Disable non-ASCII symbol keys in password input
Bug: 3384942 Change-Id: Ifa10e84f22bb6ff85dfc397fac95a0294b2a6beamain
parent
a9f2fe2d59
commit
4adf5d9ae5
|
@ -165,4 +165,19 @@
|
||||||
latin:keyOutputText="@string/keylabel_for_popular_domain"
|
latin:keyOutputText="@string/keylabel_for_popular_domain"
|
||||||
latin:keyHintIcon="@drawable/hint_popup_holo"
|
latin:keyHintIcon="@drawable/hint_popup_holo"
|
||||||
latin:popupCharacters="@string/alternates_for_popular_domain" />
|
latin:popupCharacters="@string/alternates_for_popular_domain" />
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:passwordInput="true"
|
||||||
|
>
|
||||||
|
<key-style
|
||||||
|
latin:styleName="nonPasswordSymbolKeyStyle"
|
||||||
|
latin:enabled="false" />
|
||||||
|
</case>
|
||||||
|
<!-- latin:passwordInput="false" -->
|
||||||
|
<default>
|
||||||
|
<key-style
|
||||||
|
latin:styleName="nonPasswordSymbolKeyStyle"
|
||||||
|
latin:enabled="true" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
</merge>
|
</merge>
|
||||||
|
|
|
@ -46,21 +46,28 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="|" />
|
latin:keyLabel="|" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="•"
|
latin:keyLabel="•"
|
||||||
latin:popupCharacters="♪,♥,♠,♦,♣" />
|
latin:popupCharacters="♪,♥,♠,♦,♣" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="√" />
|
latin:keyLabel="√" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="π"
|
latin:keyLabel="π"
|
||||||
latin:popupCharacters="Π" />
|
latin:popupCharacters="Π" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="÷" />
|
latin:keyLabel="÷" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="×" />
|
latin:keyLabel="×" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="§"
|
latin:keyLabel="§"
|
||||||
latin:popupCharacters="¶" />
|
latin:popupCharacters="¶" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="Δ" />
|
latin:keyLabel="Δ" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="deleteKeyStyle"
|
latin:keyStyle="deleteKeyStyle"
|
||||||
|
@ -76,19 +83,25 @@
|
||||||
latin:keyWidth="11.167%p"
|
latin:keyWidth="11.167%p"
|
||||||
latin:keyEdgeFlags="left" />
|
latin:keyEdgeFlags="left" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="£" />
|
latin:keyLabel="£" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="¢" />
|
latin:keyLabel="¢" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="€" />
|
latin:keyLabel="€" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="¥" />
|
latin:keyLabel="¥" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="^"
|
latin:keyLabel="^"
|
||||||
latin:popupCharacters="↑,↓,←,→" />
|
latin:popupCharacters="↑,↓,←,→" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="°" />
|
latin:keyLabel="°" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="±"
|
latin:keyLabel="±"
|
||||||
latin:popupCharacters="∞" />
|
latin:popupCharacters="∞" />
|
||||||
<Key
|
<Key
|
||||||
|
@ -110,20 +123,26 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="\\" />
|
latin:keyLabel="\\" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="©" />
|
latin:keyLabel="©" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="®" />
|
latin:keyLabel="®" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="™" />
|
latin:keyLabel="™" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="℅" />
|
latin:keyLabel="℅" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="[" />
|
latin:keyLabel="[" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="]" />
|
latin:keyLabel="]" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="¡" />
|
latin:keyLabel="¡" />
|
||||||
<Key
|
<Key
|
||||||
|
latin:keyStyle="nonPasswordSymbolKeyStyle"
|
||||||
latin:keyLabel="¿" />
|
latin:keyLabel="¿" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="moreKeyStyle"
|
latin:keyStyle="moreKeyStyle"
|
||||||
|
|
|
@ -103,7 +103,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class KeyboardParser {
|
public class KeyboardParser {
|
||||||
private static final String TAG = "KeyboardParser";
|
private static final String TAG = KeyboardParser.class.getSimpleName();
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
// Keyboard XML Tags
|
// Keyboard XML Tags
|
||||||
|
@ -279,8 +279,8 @@ public class KeyboardParser {
|
||||||
checkEndTag(TAG_KEY, parser);
|
checkEndTag(TAG_KEY, parser);
|
||||||
} else {
|
} else {
|
||||||
Key key = new Key(mResources, row, mCurrentX, mCurrentY, parser, mKeyStyles);
|
Key key = new Key(mResources, row, mCurrentX, mCurrentY, parser, mKeyStyles);
|
||||||
if (DEBUG) Log.d(TAG, String.format("<%s keyLabel=%s code=%d popupCharacters=%s />",
|
if (DEBUG) Log.d(TAG, String.format("<%s%s keyLabel=%s code=%d popupCharacters=%s />",
|
||||||
TAG_KEY, key.mLabel, key.mCode,
|
TAG_KEY, (key.mEnabled ? "" : " disabled"), key.mLabel, key.mCode,
|
||||||
Arrays.toString(key.mPopupCharacters)));
|
Arrays.toString(key.mPopupCharacters)));
|
||||||
checkEndTag(TAG_KEY, parser);
|
checkEndTag(TAG_KEY, parser);
|
||||||
keys.add(key);
|
keys.add(key);
|
||||||
|
|
|
@ -26,6 +26,7 @@ import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Align;
|
import android.graphics.Paint.Align;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
@ -705,8 +706,13 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
} else {
|
} else {
|
||||||
paint.setColor(mKeyTextColor);
|
paint.setColor(mKeyTextColor);
|
||||||
}
|
}
|
||||||
// Set a drop shadow for the text
|
if (key.mEnabled) {
|
||||||
paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor);
|
// Set a drop shadow for the text
|
||||||
|
paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor);
|
||||||
|
} else {
|
||||||
|
// Make label invisible
|
||||||
|
paint.setColor(Color.TRANSPARENT);
|
||||||
|
}
|
||||||
canvas.drawText(label, positionX, baseline, paint);
|
canvas.drawText(label, positionX, baseline, paint);
|
||||||
// Turn off drop shadow
|
// Turn off drop shadow
|
||||||
paint.setShadowLayer(0, 0, 0, 0);
|
paint.setShadowLayer(0, 0, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue