Merge "Fix accessibility button footer preference did not announced correct by TalkBack" into sc-dev

This commit is contained in:
Jason Hsu
2021-07-06 06:57:30 +00:00
committed by Android (Google) Code Review
3 changed files with 29 additions and 19 deletions

View File

@@ -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);
}
}