Do not set positive button visibility if dialog is from restored state

am: 30c76081f5

Change-Id: If0d25995069aeeaff9e50fbfac9c492a684493a2
This commit is contained in:
Kevin Chyn
2019-05-08 00:29:13 -07:00
committed by android-build-merger
2 changed files with 4 additions and 3 deletions

View File

@@ -92,6 +92,7 @@ public abstract class BiometricDialogView extends LinearLayout {
protected final int mTextColor;
private Bundle mBundle;
private Bundle mRestoredState;
private int mState;
private boolean mAnimatingAway;
@@ -286,7 +287,7 @@ public abstract class BiometricDialogView extends LinearLayout {
mNegativeButton.setText(mBundle.getCharSequence(BiometricPrompt.KEY_NEGATIVE_TEXT));
if (requiresConfirmation()) {
if (requiresConfirmation() && mRestoredState == null) {
mPositiveButton.setVisibility(View.VISIBLE);
mPositiveButton.setEnabled(false);
}
@@ -443,6 +444,7 @@ public abstract class BiometricDialogView extends LinearLayout {
if (newState == STATE_PENDING_CONFIRMATION) {
mHandler.removeMessages(MSG_CLEAR_MESSAGE);
mErrorText.setVisibility(View.INVISIBLE);
mPositiveButton.setVisibility(View.VISIBLE);
mPositiveButton.setEnabled(true);
} else if (newState == STATE_AUTHENTICATED) {
mPositiveButton.setVisibility(View.GONE);
@@ -465,6 +467,7 @@ public abstract class BiometricDialogView extends LinearLayout {
}
public void restoreState(Bundle bundle) {
mRestoredState = bundle;
mTryAgainButton.setVisibility(bundle.getInt(KEY_TRY_AGAIN_VISIBILITY));
mPositiveButton.setVisibility(bundle.getInt(KEY_CONFIRM_VISIBILITY));
}

View File

@@ -360,8 +360,6 @@ public class FaceDialogView extends BiometricDialogView {
if (show) {
mPositiveButton.setVisibility(View.GONE);
} else if (!show && requiresConfirmation()) {
mPositiveButton.setVisibility(View.VISIBLE);
}
}