Use non-breaking spaces for backup code MaskedEditText

This commit is contained in:
Dominik Schürmann
2016-02-10 18:14:36 +01:00
parent a2ea509f06
commit 0feb4d074c
3 changed files with 11 additions and 2 deletions

View File

@@ -170,7 +170,11 @@ public class BackupCodeFragment extends CryptoOperationFragment<BackupKeyringPar
mTitleAnimator.setDisplayedChild(1, animate);
mStatusAnimator.setDisplayedChild(1, animate);
mCodeFieldsAnimator.setDisplayedChild(1, animate);
mCodeEditText.setText(" - - - - - ");
// use non-breaking spaces to enlarge the empty EditText appropriately
String empty = "\u00a0\u00a0\u00a0\u00a0-\u00a0\u00a0\u00a0\u00a0" +
"-\u00a0\u00a0\u00a0\u00a0-\u00a0\u00a0\u00a0\u00a0" +
"-\u00a0\u00a0\u00a0\u00a0-\u00a0\u00a0\u00a0\u00a0";
mCodeEditText.setText(empty);
pushBackStackEntry();
@@ -349,7 +353,8 @@ public class BackupCodeFragment extends CryptoOperationFragment<BackupKeyringPar
public void afterTextChanged(Editable s) {
boolean inInputState = mCurrentState == BackupCodeState.STATE_INPUT
|| mCurrentState == BackupCodeState.STATE_INPUT_ERROR;
boolean partIsComplete = (backupCode.getText().toString().indexOf(' ') == -1);
boolean partIsComplete = (backupCode.getText().toString().indexOf(' ') == -1)
&& (backupCode.getText().toString().indexOf('\u00a0') == -1);
if (!inInputState || !partIsComplete) {
return;
}

View File

@@ -84,9 +84,11 @@
android:textSize="18dp"
android:textStyle="bold"
android:typeface="monospace"
app:deleteChar="\u00a0"
app:mask="****-****-****-****-****-****"
app:maskIconColor="@color/colorPrimary"
app:notMaskedSymbol="*"
app:replacementChar="\u00a0"
tools:ignore="SpUsage" />
</org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator>

View File

@@ -38,9 +38,11 @@
android:textSize="18dp"
android:textStyle="bold"
android:typeface="monospace"
app:deleteChar="\u00a0"
app:mask="****-****-****-****-****-****"
app:maskIconColor="@color/colorPrimary"
app:notMaskedSymbol="*"
app:replacementChar="\u00a0"
tools:ignore="SpUsage" />
</LinearLayout>