Fix AppearancePreferencesFragment title after locale changed

root cause:
the `_prefTitle` is saved in `CharSequence`

solution:
we only able to store `CharSequence` since `Preference.getTitleRes` is removed in AndroidX. As a workaround, we update the title again on Fragment.onStart()
This commit is contained in:
codeall9 2024-05-12 17:01:11 +08:00
parent dee881bc05
commit 802d449bfb
No known key found for this signature in database

View file

@ -10,6 +10,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.ui.fragments.preferences.AppearancePreferencesFragment;
import com.beemdevelopment.aegis.ui.fragments.preferences.MainPreferencesFragment;
import com.beemdevelopment.aegis.ui.fragments.preferences.PreferencesFragment;
@ -128,6 +129,9 @@ public class PreferencesActivity extends AegisActivity implements
public void onFragmentStarted(@NonNull FragmentManager fm, @NonNull Fragment f) {
if (f instanceof MainPreferencesFragment) {
setTitle(R.string.action_settings);
} else if (f instanceof AppearancePreferencesFragment) {
_prefTitle = getString(R.string.pref_section_appearance_title);
setTitle(_prefTitle);
}
}
}