summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin F. Haggerty <haggertk@lineageos.org>2021-06-08 16:11:55 -0600
committerSemavi Ulusoy <doc.divxm@gmail.com>2021-06-10 17:27:48 +0300
commit6b54ef078a651b938269e756370fe086e1d4db7a (patch)
treed5f2c8487e383c57275d903a9545c8f2cb81293b
parent8f9d00744cad40b6761b3b91e01c80afc255c194 (diff)
[SQUASH] Merge tag 'android-11.0.0_r38' into r11.1r11.1
Android 11.0.0 Release 38 (RQ3A.210605.005) * tag 'android-11.0.0_r38': Fix can't find default theme bundle for some specific languages. https://github.com/haggertk/android_packages_apps_ThemePicker/tree/lineage-18.1_merge-android-11.0.0_r38 Change-Id: I42391693f0462a1b77ba6c4af64a746994a1dbe5
-rw-r--r--src/com/android/customization/picker/theme/ThemeFragment.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index de8aa69b..7b582747 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -287,9 +287,10 @@ public class ThemeFragment extends AppbarFragment {
mSelectedTheme = previouslySelectedTheme != null
? previouslySelectedTheme
: activeTheme;
- // 3. Select the default theme if there is no matching custom enabled theme.
+ // 3. Select the first system theme(default theme currently)
+ // if there is no matching custom enabled theme.
if (mSelectedTheme == null) {
- mSelectedTheme = findDefaultThemeBundle(options);
+ mSelectedTheme = findFirstSystemThemeBundle(options);
}
mOptionsController.setSelectedOption(mSelectedTheme);
@@ -324,8 +325,7 @@ public class ThemeFragment extends AppbarFragment {
}
}
if (mSelectedTheme == null) {
- // Select the default theme if there is no matching custom enabled theme
- mSelectedTheme = findDefaultThemeBundle(options);
+ mSelectedTheme = findFirstSystemThemeBundle(options);
}
mOptionsController.setSelectedOption(mSelectedTheme);
// Set selected option above will show BottomActionBar,
@@ -334,11 +334,9 @@ public class ThemeFragment extends AppbarFragment {
}, true);
}
- private ThemeBundle findDefaultThemeBundle(List<ThemeBundle> options) {
- String defaultThemeTitle =
- getActivity().getResources().getString(R.string.default_theme_title);
+ private ThemeBundle findFirstSystemThemeBundle(List<ThemeBundle> options) {
for (ThemeBundle bundle : options) {
- if (bundle.getTitle().equals(defaultThemeTitle)) {
+ if (!(bundle instanceof CustomTheme)) {
return bundle;
}
}