Fix in the scrollable Glif header design, the sub-title can not
be read out automatically in the Udfps enrolling page 1. To set focus on description view when turned on A11y & description view invisible. 2. Get back the hiding description snippet and wrap it by aconfig flag condition. Flag: com.android.settings.flags.enroll_layout_truncate_improvement Bug: 379090673 Test: atest UdfpsEnrollEnrollingView Test: Build Forrest ROM then check the UI in different scenarios Change-Id: Ic76c15ccb82998781102492ef9894190aa824218
This commit is contained in:
@@ -270,7 +270,8 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
R.integer.config_biometrics_header_scroll_duration);
|
||||
layoutView.adjustScrollableHeaderHeight(
|
||||
headerScrollView, mShouldShowLottie);
|
||||
layoutView.headerVerticalScrolling(headerScrollView, headerScrollDuration);
|
||||
layoutView.headerVerticalScrolling(headerScrollView, headerScrollDuration,
|
||||
mIsAccessibilityEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -547,6 +548,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
}
|
||||
|
||||
private void updateTitleAndDescriptionForUdfps() {
|
||||
final UdfpsEnrollEnrollingView layoutView = (UdfpsEnrollEnrollingView) getLayout();
|
||||
final boolean shouldSetFocusOnDescription = Flags.enrollLayoutTruncateImprovement()
|
||||
&& mIsAccessibilityEnabled;
|
||||
switch (getCurrentStage()) {
|
||||
case STAGE_CENTER:
|
||||
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
|
||||
@@ -560,6 +564,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
);
|
||||
configureEnrollmentStage(R.raw.udfps_center_hint_lottie);
|
||||
}
|
||||
|
||||
if (shouldSetFocusOnDescription) {
|
||||
layoutView.setFocusOnDescription();
|
||||
}
|
||||
break;
|
||||
|
||||
case STAGE_GUIDED:
|
||||
@@ -574,6 +582,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
// TODO(b/228100413) Could customize guided lottie animation
|
||||
configureEnrollmentStage(R.raw.udfps_center_hint_lottie);
|
||||
}
|
||||
|
||||
if (shouldSetFocusOnDescription) {
|
||||
layoutView.setFocusOnDescription();
|
||||
}
|
||||
break;
|
||||
case STAGE_FINGERTIP:
|
||||
setHeaderText(R.string.security_settings_udfps_enroll_fingertip_title);
|
||||
@@ -584,6 +596,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
);
|
||||
configureEnrollmentStage(R.raw.udfps_tip_hint_lottie);
|
||||
}
|
||||
|
||||
if (shouldSetFocusOnDescription) {
|
||||
layoutView.setFocusOnDescription();
|
||||
}
|
||||
break;
|
||||
case STAGE_LEFT_EDGE:
|
||||
setHeaderText(R.string.security_settings_udfps_enroll_left_edge_title);
|
||||
@@ -601,6 +617,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSetFocusOnDescription) {
|
||||
layoutView.setFocusOnDescription();
|
||||
}
|
||||
break;
|
||||
case STAGE_RIGHT_EDGE:
|
||||
setHeaderText(R.string.security_settings_udfps_enroll_right_edge_title);
|
||||
@@ -619,6 +639,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSetFocusOnDescription) {
|
||||
layoutView.setFocusOnDescription();
|
||||
}
|
||||
break;
|
||||
|
||||
case STAGE_UNKNOWN:
|
||||
|
@@ -25,6 +25,7 @@ import android.graphics.Insets;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -44,6 +45,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.LayoutRes;
|
||||
@@ -200,7 +202,26 @@ public class UdfpsEnrollEnrollingView extends GlifLayout {
|
||||
return footerBarMinHeight;
|
||||
}
|
||||
|
||||
void headerVerticalScrolling(ScrollView headerScrollView, long duration) {
|
||||
void setFocusOnDescription() {
|
||||
final ScrollView headerScrollView = findViewById(R.id.sud_header_scroll_view);
|
||||
final TextView descriptionView = getDescriptionTextView();
|
||||
if (descriptionView != null && !descriptionView.getText().isEmpty()) {
|
||||
descriptionView.post(
|
||||
() -> {
|
||||
Rect scrollBounds = new Rect();
|
||||
headerScrollView.getHitRect(scrollBounds);
|
||||
boolean isVisible = descriptionView.getLocalVisibleRect(scrollBounds);
|
||||
if (!isVisible) {
|
||||
descriptionView.setFocusable(true);
|
||||
descriptionView.setFocusableInTouchMode(true);
|
||||
descriptionView.requestFocus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void headerVerticalScrolling(ScrollView headerScrollView, long duration,
|
||||
boolean isAccessibilityEnabled) {
|
||||
headerScrollView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -216,13 +237,23 @@ public class UdfpsEnrollEnrollingView extends GlifLayout {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(@NonNull Animator animation) {
|
||||
mHeaderScrollAnimator.removeAllListeners();
|
||||
headerScrollView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mHeaderScrollAnimator.reverse();
|
||||
}
|
||||
});
|
||||
headerScrollView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mHeaderScrollAnimator.removeAllListeners();
|
||||
mHeaderScrollAnimator.reverse();
|
||||
if (isAccessibilityEnabled) {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!mHeaderScrollAnimator.isRunning()) {
|
||||
setFocusOnDescription();
|
||||
}
|
||||
}
|
||||
}, duration + 200);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -320,6 +351,19 @@ public class UdfpsEnrollEnrollingView extends GlifLayout {
|
||||
R.id.udfps_enroll_animation_fp_view);
|
||||
fingerprintView.setPadding(0, -layoutLottieAnimationPadding,
|
||||
0, layoutLottieAnimationPadding);
|
||||
|
||||
// TODO(b/260970216) Instead of hiding the description text view, we should
|
||||
// make the header view scrollable if the text is too long.
|
||||
// If description text view has overlap with udfps progress view, hide it.
|
||||
if (!Flags.enrollLayoutTruncateImprovement()) {
|
||||
final View descView = getDescriptionTextView();
|
||||
getViewTreeObserver().addOnDrawListener(() -> {
|
||||
if (descView.getVisibility() == View.VISIBLE
|
||||
&& hasOverlap(descView, mUdfpsEnrollView)) {
|
||||
descView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setOnHoverListener() {
|
||||
|
Reference in New Issue
Block a user