Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7eb77bbf authored by Santiago Etchebehere's avatar Santiago Etchebehere
Browse files

Properly handle default custom theme options

Bug: 134186220
Change-Id: Ib1c6b643275d35a35cf0e5b0a27890f80a8a57ac
parent feb02d4b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
+6 −1
Original line number Diff line number Diff line
@@ -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);
    }

+1 −7
Original line number Diff line number Diff line
@@ -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;
    }