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

Commit f8f4c825 authored by Santiago Etchebehere's avatar Santiago Etchebehere
Browse files

Use enabled flashlight icon for color QS preview

Fixes: 132808298
Change-Id: I0efe9f6b9a9291f879f94ed9305f5a83480f8bfe
parent 60c3f2f9
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -75,14 +75,13 @@
                android:layout_width="@dimen/preview_theme_icon_size"
                android:layout_height="@dimen/preview_theme_icon_size"
                android:layout_gravity="center"
                android:id="@+id/preview_color_qs_2_bg"
                android:tint="@color/tile_disabled_background_color"/>
                android:id="@+id/preview_color_qs_2_bg"/>
            <ImageView
                android:layout_width="@dimen/preview_theme_tile_size"
                android:layout_height="@dimen/preview_theme_tile_size"
                android:layout_gravity="center"
                android:id="@+id/preview_color_qs_2_icon"
                android:color="@color/tile_disabled_icon_color"/>
                android:color="@color/tile_enabled_icon_color"/>
        </FrameLayout>
    </LinearLayout>
    <Space
+2 −3
Original line number Diff line number Diff line
@@ -67,13 +67,12 @@
        <ImageView
            android:layout_width="@dimen/preview_theme_icon_size"
            android:layout_height="@dimen/preview_theme_icon_size"
            android:id="@+id/preview_color_qs_2_bg"
            android:tint="@color/tile_disabled_background_color"/>
            android:id="@+id/preview_color_qs_2_bg"/>
        <ImageView
            android:layout_width="@dimen/preview_theme_tile_size"
            android:layout_height="@dimen/preview_theme_tile_size"
            android:id="@+id/preview_color_qs_2_icon"
            android:color="@color/tile_disabled_icon_color"
            android:tint="@color/tile_enabled_icon_color"
            android:layout_gravity="center"/>
    </FrameLayout>

+0 −3
Original line number Diff line number Diff line
@@ -81,9 +81,6 @@ public class ColorOptionsProvider extends ThemeComponentOptionProvider<ColorOpti
        }
        for (String iconName : ICONS_FOR_PREVIEW) {
            try {
                if (previewIcons.size() == COLOR_TILES_ICON_IDS.length) {
                    break;
                }
                previewIcons.add(loadIconPreviewDrawable(iconName, iconPackage));
            } catch (NameNotFoundException | NotFoundException e) {
                Log.w(TAG, String.format("Couldn't load icon in %s for color preview, will skip it",
+12 −5
Original line number Diff line number Diff line
@@ -265,9 +265,15 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC
        private static int[] COLOR_TILE_IDS = {
                R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg
        };
        static int[] COLOR_TILES_ICON_IDS = {
                R.id.preview_color_qs_0_icon, R.id.preview_color_qs_1_icon,
                R.id.preview_color_qs_2_icon

        /**
         * Ids of the views for the foreground of the icon, mapping to the corresponding index of
         * the actual icon drawable.
         */
        static int[][] COLOR_TILES_ICON_IDS = {
                new int[]{ R.id.preview_color_qs_0_icon, 0},
                new int[]{ R.id.preview_color_qs_1_icon, 1},
                new int[] { R.id.preview_color_qs_2_icon, 3}
        };

        /**
@@ -371,14 +377,15 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC
            seekbar.setOnTouchListener((view, motionEvent) -> true);
            if (!mIcons.isEmpty() && mShapeDrawable != null) {
                for (int i = 0; i < COLOR_TILE_IDS.length; i++) {
                    Drawable icon = mIcons.get(i).getConstantState().newDrawable();
                    Drawable icon = mIcons.get(COLOR_TILES_ICON_IDS[i][1]).getConstantState()
                            .newDrawable();
                    //TODO: load and set the shape.
                    Drawable bgShape = mShapeDrawable.getConstantState().newDrawable();
                    bgShape.setTint(accentColor);

                    ImageView bg = container.findViewById(COLOR_TILE_IDS[i]);
                    bg.setImageDrawable(bgShape);
                    ImageView fg = container.findViewById(COLOR_TILES_ICON_IDS[i]);
                    ImageView fg = container.findViewById(COLOR_TILES_ICON_IDS[i][0]);
                    fg.setImageDrawable(icon);
                }
            }
+4 −2
Original line number Diff line number Diff line
@@ -63,8 +63,10 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment {
    private int[] mColorTileIds = {
            R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg
    };
    private int[] mColorTileIconIds = {
            R.id.preview_color_qs_0_icon, R.id.preview_color_qs_1_icon, R.id.preview_color_qs_2_icon
    private int[][] mColorTileIconIds = {
            new int[]{ R.id.preview_color_qs_0_icon, 0},
            new int[]{ R.id.preview_color_qs_1_icon, 1},
            new int[] { R.id.preview_color_qs_2_icon, 3}
    };

    private int[] mShapeIconIds = {
Loading