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

Unverified Commit 61b152b0 authored by Michael Bestas's avatar Michael Bestas
Browse files

ThemePicker: Drop corner radius from icon shapes

Change-Id: Ia715dee7e694682839731128b4b902a62410c1f5
parent b7e8a7d2
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -51,20 +51,17 @@ public class IconShapeOption implements CustomizationOption<IconShapeOption> {
    private final String mTitle;
    private final String mOverlayPackage;
    private final Path mPath;
    private final int mCornerRadius;
    private int[] mShapeIconIds = {
            R.id.shape_preview_icon_0, R.id.shape_preview_icon_1, R.id.shape_preview_icon_2,
            R.id.shape_preview_icon_3, R.id.shape_preview_icon_4, R.id.shape_preview_icon_5
    };

    public IconShapeOption(String packageName, String title, Path path,
                           @Dimension int cornerRadius, Drawable shapeDrawable,
                           List<ShapeAppIcon> appIcons) {
                           Drawable shapeDrawable, List<ShapeAppIcon> appIcons) {
        mOverlayPackage = packageName;
        mTitle = title;
        mAppIcons = appIcons;
        mPath = path;
        mCornerRadius = cornerRadius;
        Drawable background = shapeDrawable.getConstantState().newDrawable();
        Drawable foreground = shapeDrawable.getConstantState().newDrawable();
        mShape = new LayerDrawable(new Drawable[]{background, foreground});
+1 −18
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.customization.model.iconshape;

import static com.android.customization.model.ResourceConstants.ANDROID_PACKAGE;
import static com.android.customization.model.ResourceConstants.CONFIG_CORNERRADIUS;
import static com.android.customization.model.ResourceConstants.CONFIG_ICON_MASK;
import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_SHAPE;
import static com.android.customization.model.ResourceConstants.PATH_SIZE;
@@ -84,8 +83,7 @@ public class IconShapeOptionProvider {
                PackageManager pm = mContext.getPackageManager();
                String label = pm.getApplicationInfo(overlayPackage, 0).loadLabel(pm).toString();
                mOptions.add(new IconShapeOption(overlayPackage, label, path,
                        loadCornerRadius(overlayPackage), createShapeDrawable(path),
                        getShapedAppIcons(path)));
                        createShapeDrawable(path), getShapedAppIcons(path)));
            } catch (NameNotFoundException | NotFoundException e) {
                Log.w(TAG, String.format("Couldn't load shape overlay %s, will skip it",
                        overlayPackage), e);
@@ -97,9 +95,6 @@ public class IconShapeOptionProvider {
        Resources system = Resources.getSystem();
        Path path = loadPath(system, ANDROID_PACKAGE);
        mOptions.add(new IconShapeOption(null, mContext.getString(R.string.default_theme_title), path,
                system.getDimensionPixelOffset(
                        system.getIdentifier(CONFIG_CORNERRADIUS,
                                "dimen", ResourceConstants.ANDROID_PACKAGE)),
                createShapeDrawable(path), getShapedAppIcons(path)));
    }

@@ -148,16 +143,4 @@ public class IconShapeOptionProvider {
        }
        return null;
    }

    @Dimension
    private int loadCornerRadius(String packageName)
            throws NameNotFoundException, NotFoundException {

        Resources overlayRes =
                mContext.getPackageManager().getResourcesForApplication(
                        packageName);
        return overlayRes.getDimensionPixelOffset(overlayRes.getIdentifier(
                CONFIG_CORNERRADIUS, "dimen", packageName));
    }

}