To hide the soft input window when press skip button on Skip setup for

PIN and face dialog of Set a PIN screen to avoid flash during transition.

bug:191181054
Test: SUW
Test: make -j RunSettingsRoboTests

Change-Id: I229b190de5e6dc714bbb8408e91c363e90b18f30
This commit is contained in:
prochinwang
2021-06-23 18:08:12 +08:00
committed by Prochin Wang
parent 416a24d821
commit b6b2485796
3 changed files with 24 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import androidx.annotation.Nullable;
@@ -112,7 +113,6 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
final boolean forBiometrics = intent
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
final SetupSkipDialog dialog = SetupSkipDialog.newInstance(
frpSupported,
/* isPatternMode= */ false,
@@ -120,6 +120,11 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
forFingerprint,
forFace,
forBiometrics);
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
dialog.show(getFragmentManager());
return;
}

View File

@@ -21,6 +21,8 @@ import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
@@ -190,12 +192,21 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
@Override
public void onClick(DialogInterface dialog, int button) {
Activity activity = getActivity();
switch (button) {
case DialogInterface.BUTTON_POSITIVE:
Activity activity = getActivity();
activity.setResult(RESULT_SKIP);
activity.finish();
break;
case DialogInterface.BUTTON_NEGATIVE:
View view = activity.getCurrentFocus();
if(view != null) {
view.requestFocus();
InputMethodManager imm = (InputMethodManager) activity
.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
break;
}
}