Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53d74951 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use title area for enrollment error messages" into sc-dev

parents 5c11109f a01f882e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -183,10 +183,18 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
        setHeaderText(resId, false /* force */);
    }

    protected void setHeaderText(CharSequence title) {
        getLayout().setHeaderText(title);
    }

    protected void setDescriptionText(int resId) {
        getLayout().setDescriptionText(resId);
    }

    protected void setDescriptionText(CharSequence descriptionText) {
        getLayout().setDescriptionText(descriptionText);
    }

    protected FooterButton getNextButton() {
        if (mFooterBarMixin != null) {
            return mFooterBarMixin.getPrimaryButton();
+32 −20
Original line number Diff line number Diff line
@@ -324,7 +324,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
    @Override
    public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) {
        if (!TextUtils.isEmpty(helpString)) {
            if (!mCanAssumeUdfps) {
                mErrorText.removeCallbacks(mTouchAgainRunnable);
            }
            showError(helpString);
        }
    }
@@ -345,8 +347,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
        }
        showErrorDialog(getText(msgId), errMsgId);
        stopIconAnimation();
        if (!mCanAssumeUdfps) {
            mErrorText.removeCallbacks(mTouchAgainRunnable);
        }
    }

    @Override
    public void onEnrollmentProgressChange(int steps, int remaining) {
@@ -354,9 +358,11 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
        updateTitleAndDescription();
        clearError();
        animateFlash();
        if (!mCanAssumeUdfps) {
            mErrorText.removeCallbacks(mTouchAgainRunnable);
            mErrorText.postDelayed(mTouchAgainRunnable, HINT_TIMEOUT_DURATION);
        }
    }

    private void updateProgress(boolean animate) {
        if (mSidecar == null || !mSidecar.isEnrolling()) {
@@ -397,6 +403,11 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
    }

    private void showError(CharSequence error) {
        if (mCanAssumeUdfps) {
            setHeaderText(error);
            // Show nothing for subtitle when getting an error message.
            setDescriptionText("");
        } else {
            mErrorText.setText(error);
            if (mErrorText.getVisibility() == View.INVISIBLE) {
                mErrorText.setVisibility(View.VISIBLE);
@@ -414,13 +425,14 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
                mErrorText.setAlpha(1f);
                mErrorText.setTranslationY(0f);
            }
        }
        if (isResumed()) {
            mVibrator.vibrate(VIBRATE_EFFECT_ERROR, FINGERPRINT_ENROLLING_SONFICATION_ATTRIBUTES);
        }
    }

    private void clearError() {
        if (mErrorText.getVisibility() == View.VISIBLE) {
        if (!mCanAssumeUdfps && mErrorText.getVisibility() == View.VISIBLE) {
            mErrorText.animate()
                    .alpha(0f)
                    .translationY(getResources().getDimensionPixelSize(