Fix accessibility button footer preference did not announced correct by TalkBack
Root Cause: Description would be altered after displayPreference(), but getSummary() would be called after it. Solution: Update title before displayPreference(), then it could be set correctly. Fix: 192738520 Test: atest AccessibilityButtonFooterPreferenceControllerTest Change-Id: I068994fca8202b166fedf43f9d9657b0c1a64c4e
This commit is contained in:
@@ -18,6 +18,8 @@ package com.android.settings.accessibility;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
/**
|
||||
@@ -36,9 +38,16 @@ public class AccessibilityButtonFooterPreferenceController extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
return AccessibilityUtil.isGestureNavigateEnabled(mContext)
|
||||
? mContext.getString(R.string.accessibility_button_gesture_description)
|
||||
: mContext.getString(R.string.accessibility_button_description);
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
// Need to update footerPreference's data before super.displayPreference(), then it will use
|
||||
// data to update related property of footerPreference.
|
||||
if (AccessibilityUtil.isGestureNavigateEnabled(mContext)) {
|
||||
final AccessibilityFooterPreference footerPreference =
|
||||
screen.findPreference(getPreferenceKey());
|
||||
footerPreference.setTitle(
|
||||
mContext.getString(R.string.accessibility_button_gesture_description));
|
||||
}
|
||||
|
||||
super.displayPreference(screen);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user