diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-06-01 11:51:43 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-06-01 11:51:43 +0000 |
commit | 8f77b2bc3e12c2fab44f9b8bbc6ffebde732ec98 (patch) | |
tree | 09e819fff1e61429159bc68915ae07131c28ed92 /src/com/android/customization/model/theme | |
parent | 889abbb5d4f6bb0cdebd7f2b8bd00ce5d200fd18 (diff) | |
parent | 7eb77bbf12a2e62584caf505bce810e4a5e17824 (diff) | |
download | ThemePicker-8f77b2bc3e12c2fab44f9b8bbc6ffebde732ec98.tar.gz |
Merge "Properly handle default custom theme options" into ub-launcher3-qt-r1-dev
Diffstat (limited to 'src/com/android/customization/model/theme')
3 files changed, 10 insertions, 9 deletions
diff --git a/src/com/android/customization/model/theme/ThemeBundle.java b/src/com/android/customization/model/theme/ThemeBundle.java index 7c543d47..b3258deb 100644 --- a/src/com/android/customization/model/theme/ThemeBundle.java +++ b/src/com/android/customization/model/theme/ThemeBundle.java @@ -70,6 +70,7 @@ import java.util.Set; */ public class ThemeBundle implements CustomizationOption<ThemeBundle> { + private final static String EMPTY_JSON = "{}"; private final String mTitle; private final PreviewInfo mPreviewInfo; private final boolean mIsDefault; @@ -144,7 +145,8 @@ public class ThemeBundle implements CustomizationOption<ThemeBundle> { return false; } if (mIsDefault) { - return other.isDefault() || TextUtils.isEmpty(other.getSerializedPackages()); + return other.isDefault() || TextUtils.isEmpty(other.getSerializedPackages()) + || EMPTY_JSON.equals(other.getSerializedPackages()); } // Map#equals ensures keys and values are compared. return mPackagesByCategory.equals(other.mPackagesByCategory); diff --git a/src/com/android/customization/model/theme/custom/IconOptionsProvider.java b/src/com/android/customization/model/theme/custom/IconOptionsProvider.java index 73a4a22c..f7b669b1 100644 --- a/src/com/android/customization/model/theme/custom/IconOptionsProvider.java +++ b/src/com/android/customization/model/theme/custom/IconOptionsProvider.java @@ -86,7 +86,7 @@ public class IconOptionsProvider extends ThemeComponentOptionProvider<IconOption } for (String overlayPackage : mSysUiIconsOverlayPackages) { - addOrUpdateOption(optionsByPrefix, overlayPackage, OVERLAY_CATEGORY_ICON_SYSUI); + addOrUpdateOption(optionsByPrefix, overlayPackage, OVERLAY_CATEGORY_ICON_SYSUI); } for (String overlayPackage : mSettingsIconsOverlayPackages) { @@ -142,6 +142,11 @@ public class IconOptionsProvider extends ThemeComponentOptionProvider<IconOption } catch (NameNotFoundException | NotFoundException e) { Log.w(TAG, "Didn't find SystemUi package icons, will skip option", e); } + option.addOverlayPackage(OVERLAY_CATEGORY_ICON_ANDROID, null); + option.addOverlayPackage(OVERLAY_CATEGORY_ICON_SYSUI, null); + option.addOverlayPackage(OVERLAY_CATEGORY_ICON_SETTINGS, null); + option.addOverlayPackage(OVERLAY_CATEGORY_ICON_LAUNCHER, null); + option.addOverlayPackage(OVERLAY_CATEGORY_ICON_THEMEPICKER, null); mOptions.add(option); } diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java index 8966dc56..78131cc9 100644 --- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java +++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java @@ -34,7 +34,6 @@ import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.ShapeDrawable; -import android.text.TextUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -61,7 +60,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Objects; /** @@ -92,11 +90,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC public abstract void bindPreview(ViewGroup container); public Builder buildStep(Builder builder) { - getOverlayPackages().forEach((category, packageName) -> { - if (!TextUtils.isEmpty(packageName)) { - builder.addOverlayPackage(category, packageName); - } - }); + getOverlayPackages().forEach(builder::addOverlayPackage); return builder; } |