Remove KeyboardView in ChooseLockPassword

1. We actually use user installed keyboard
2. Request focus on the edittext instead of the keyboard

Bug: 24900754

Change-Id: I6257a592ad34875d46c5c05349098b891ef37d98
This commit is contained in:
Tony Mak
2016-07-01 13:55:47 +01:00
parent 0bbcdccdbf
commit 9c26c9dba6
2 changed files with 2 additions and 30 deletions

View File

@@ -89,21 +89,6 @@
android:text="@string/lockpassword_continue_label" /> android:text="@string/lockpassword_continue_label" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<!-- Spacer between password entry and keyboard -->
<View
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
<!-- Alphanumeric keyboard -->
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
android:visibility="gone"/>
</LinearLayout> </LinearLayout>
</com.android.setupwizardlib.GlifLayout> </com.android.setupwizardlib.GlifLayout>

View File

@@ -150,10 +150,6 @@ public class ChooseLockPassword extends SettingsActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
// TODO: Fix on phones
// Disable IME on our window since we provide our own keyboard
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
//WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
CharSequence msg = getText(R.string.lockpassword_choose_your_password_header); CharSequence msg = getText(R.string.lockpassword_choose_your_password_header);
setTitle(msg); setTitle(msg);
@@ -200,8 +196,6 @@ public class ChooseLockPassword extends SettingsActivity {
private TextView mHeaderText; private TextView mHeaderText;
private String mFirstPin; private String mFirstPin;
private RecyclerView mPasswordRestrictionView; private RecyclerView mPasswordRestrictionView;
private KeyboardView mKeyboardView;
private PasswordEntryKeyboardHelper mKeyboardHelper;
private boolean mIsAlphaMode; private boolean mIsAlphaMode;
private Button mCancelButton; private Button mCancelButton;
private Button mNextButton; private Button mNextButton;
@@ -313,22 +307,15 @@ public class ChooseLockPassword extends SettingsActivity {
setupPasswordRequirementsView(view); setupPasswordRequirementsView(view);
mKeyboardView = (PasswordEntryKeyboardView) view.findViewById(R.id.keyboard);
mPasswordRestrictionView.setLayoutManager(new LinearLayoutManager(getActivity())); mPasswordRestrictionView.setLayoutManager(new LinearLayoutManager(getActivity()));
mPasswordEntry = (EditText) view.findViewById(R.id.password_entry); mPasswordEntry = (EditText) view.findViewById(R.id.password_entry);
mPasswordEntry.setOnEditorActionListener(this); mPasswordEntry.setOnEditorActionListener(this);
mPasswordEntry.addTextChangedListener(this); mPasswordEntry.addTextChangedListener(this);
mPasswordEntry.requestFocus();
mPasswordEntryInputDisabler = new TextViewInputDisabler(mPasswordEntry); mPasswordEntryInputDisabler = new TextViewInputDisabler(mPasswordEntry);
final Activity activity = getActivity(); final Activity activity = getActivity();
mKeyboardHelper = new PasswordEntryKeyboardHelper(activity,
mKeyboardView, mPasswordEntry);
mKeyboardHelper.setKeyboardMode(mIsAlphaMode ?
PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA
: PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
mHeaderText = (TextView) view.findViewById(R.id.headerText); mHeaderText = (TextView) view.findViewById(R.id.headerText);
mKeyboardView.requestFocus();
int currentType = mPasswordEntry.getInputType(); int currentType = mPasswordEntry.getInputType();
mPasswordEntry.setInputType(mIsAlphaMode ? currentType mPasswordEntry.setInputType(mIsAlphaMode ? currentType
@@ -454,7 +441,7 @@ public class ChooseLockPassword extends SettingsActivity {
if (mSaveAndFinishWorker != null) { if (mSaveAndFinishWorker != null) {
mSaveAndFinishWorker.setListener(this); mSaveAndFinishWorker.setListener(this);
} else { } else {
mKeyboardView.requestFocus(); mPasswordEntry.requestFocus();
} }
} }