Commit 87c88bd7 authored by ColinTree's avatar ColinTree Committed by Evan W. Patton

Add PasswordVisible property to PasswordTextBox (#943)

parent 42ec861c
......@@ -3471,6 +3471,10 @@ public interface OdeMessages extends Messages {
@Description("")
String MentionsProperties();
@DefaultMessage("PasswordVisible")
@Description("")
String PasswordVisibleProperties();
@DefaultMessage("ProviderLocked")
@Description("")
String ProviderLockedProperties();
......
......@@ -606,6 +606,7 @@ LeaderProperties = 领队
LongitudeProperties = 经度
MagnitudeProperties = 力度
MentionsProperties = 提名信息
PasswordVisibleProperties = 显示密码
ProviderLockedProperties = 锁定提供者
ProviderNameProperties = 提供者名称
PublicInstancesProperties = 公共对象
......
......@@ -1155,6 +1155,10 @@ public final class YoungAndroidFormUpgrader {
// Added RequestFocus Function (via TextBoxBase)
srcCompVersion = 3;
}
if (srcCompVersion < 4) {
// Added PasswordVisible Property
srcCompVersion = 4;
}
return srcCompVersion;
}
......
......@@ -1923,7 +1923,10 @@ Blockly.Versioning.AllUpgradeMaps =
2: "ai1CantDoUpgrade", // Just indicates we couldn't do upgrade even if we wanted to
// RequestFocus was added
3: "noUpgrade"
3: "noUpgrade",
// PasswordVisible was added
4: "noUpgrade"
}, // End PasswordTextBox upgraders
......
......@@ -850,7 +850,9 @@ public class YaVersion {
// - The Alignment property was renamed to TextAlignment.
// For PASSWORDTEXTBOX_COMPONENT_VERSION 3:
// - Added RequestFocus Function (via TextBoxBase)
public static final int PASSWORDTEXTBOX_COMPONENT_VERSION = 3;
// For PASSWORDTEXTBOX_COMPONENT_VERSION 4:
// - Added PasswordVisible property
public static final int PASSWORDTEXTBOX_COMPONENT_VERSION = 4;
// For PEDOMETER_COMPONENT_VERSION 2:
// - The step sensing algorithm was updated to be more accurate.
......
......@@ -8,6 +8,7 @@ package com.google.appinventor.components.runtime;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.YaVersion;
......@@ -33,6 +34,9 @@ import android.widget.EditText;
category = ComponentCategory.USERINTERFACE)
@SimpleObject
public final class PasswordTextBox extends TextBoxBase {
private boolean passwordVisible;
/**
* Creates a new PasswordTextBox component.
*
......@@ -41,9 +45,6 @@ public final class PasswordTextBox extends TextBoxBase {
public PasswordTextBox(ComponentContainer container) {
super(container, new EditText(container.$context()));
// Disable auto-suggestion.
view.setRawInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
// make the box single line
view.setSingleLine(true);
// Add a transformation method to hide password text. This must
......@@ -53,5 +54,22 @@ public final class PasswordTextBox extends TextBoxBase {
// make sure the done action is Done and not Next. See comment in Textbox.java
view.setImeOptions(EditorInfo.IME_ACTION_DONE);
PasswordVisible(false);
}
@SimpleProperty(description = "Visibility of password.")
public void PasswordVisible(boolean visible){
passwordVisible=visible;
if(visible){
view.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
}else{
view.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);
}
}
@SimpleProperty(description = "Visibility of password.")
public boolean PasswordVisible(){
return passwordVisible;
}
}
......@@ -926,6 +926,8 @@ none
<dd> Color for text. </dd>
<dt> <code> Hint </code> </dt>
<dd> Password hint. </dd>
<dt> <code> PasswordVisible </code> </dt>
<dd> Visibility of password. </dd>
</dl>
<h3> Events </h3>
<dl>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment