Update activity titles for fragments without preference screen.
1. Move getPreferenceScreenResId() from individual subclass to InstrumentedPreferenceFragment. 2. Removed InstrumentedPreferenceFragment.getTitle() and let the preference fragments that do not have preference screen set the activity title directly instead. 3. Removed OptionsMenuFragment as all it does is call setHasOptionMenu(). - changed subclasses of OptionsMenuFragment to extend from InstrumentedPreferenceFragment directly. - none of the exisitng subclasses actually implements the option menu related methods to provide any option menu. So, the setHasOptionMenu() call is not added to the subclasses. 4. Update Languages preference title. - launch the fragment from the preference controller instead of from the default handling, as we need the title res id at launch time to get it work properly when retrieving the title from back stack. Bug: 64564191 Test: blaze-bin/screenshots/android/i18nscreenshots/i18nscreenshots Change-Id: Ibecdcab32cbaed8bf604ec5ebe0a926b4e489a7d
This commit is contained in:
@@ -31,17 +31,6 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
|
||||
|
||||
private TextView mEmpty;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey);
|
||||
if (usePreferenceScreenTitle()) {
|
||||
final int resId = getPreferenceScreenResId();
|
||||
if (resId > 0) {
|
||||
addPreferencesFromResource(resId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
@@ -58,9 +47,4 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
|
||||
protected void setEmptyText(int text) {
|
||||
mEmpty.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the res id for static preference xml for this fragment.
|
||||
*/
|
||||
protected abstract int getPreferenceScreenResId();
|
||||
}
|
||||
|
Reference in New Issue
Block a user