private void updateStage(@Nullable MaterialDialog dialog) { if (mLastStage == null || (mLastStage != mStage && mCallback != null)) { mLastStage = mStage; mCallback.onFingerprintDialogStageUpdated(this, mStage); } if (dialog == null) dialog = (MaterialDialog) getDialog(); if (dialog == null) return; switch (mStage) { case FINGERPRINT: dialog.setActionButton(DialogAction.POSITIVE, android.R.string.cancel); dialog.setActionButton(DialogAction.NEGATIVE, R.string.use_password); mFingerprintContent.setVisibility(View.VISIBLE); mBackupContent.setVisibility(View.GONE); break; case NEW_FINGERPRINT_ENROLLED: // Intentional fall through case PASSWORD: dialog.setActionButton(DialogAction.POSITIVE, android.R.string.cancel); dialog.setActionButton(DialogAction.NEGATIVE, android.R.string.ok); mFingerprintContent.setVisibility(View.GONE); mBackupContent.setVisibility(View.VISIBLE); if (mStage == Stage.NEW_FINGERPRINT_ENROLLED) { mPasswordDescriptionTextView.setVisibility(View.GONE); mNewFingerprintEnrolledTextView.setVisibility(View.VISIBLE); mUseFingerprintFutureCheckBox.setVisibility(View.VISIBLE); } break; } }
@Override public void onClick(View v) { if (v.getTag() != null) { final int index = (Integer) v.getTag(); final MaterialDialog dialog = (MaterialDialog) getDialog(); final Builder builder = getBuilder(); if (isInSub()) { subIndex(index); } else { topIndex(index); if (mColorsSub != null && index < mColorsSub.length) { dialog.setActionButton(DialogAction.NEUTRAL, builder.mBackBtn); isInSub(true); } } invalidateDynamicButtonColors(); invalidate(); } }