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

Unverified Commit 0bbe5660 authored by Trishiraj's avatar Trishiraj Committed by Michael Bestas
Browse files

Launcher3: Ability to toggle themed icons for all apps



Co-authored-by: default avatarHarsh <harsh@project404.us>
Co-authored-by: default avatarPranav Vashi <neobuddy89@gmail.com>
Change-Id: Icd157a1ab211590529693d7c81e65d0214277ebc
parent dc333504
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@
    <!-- Folder titles -->
    <string name="google_folder_title" translatable="false">Google</string>

    <!-- All apps themed icons -->
    <string name="pref_themed_icons_title">Use themed icons in drawer</string>
    <string name="pref_themed_icons_summary">Follow themed icons used on home screen</string>

    <!-- Hide labels -->
    <string name="desktop_show_labels">Show icon labels on desktop</string>
    <string name="drawer_show_labels">Show icon labels in drawer</string>
+7 −0
Original line number Diff line number Diff line
@@ -77,6 +77,13 @@
        <intent android:action="android.settings.ACTION_CONTENT_SUGGESTIONS_SETTINGS" />
    </androidx.preference.PreferenceScreen>

    <SwitchPreferenceCompat
        android:key="pref_allapps_themed_icons"
        android:title="@string/pref_themed_icons_title"
        android:summary="@string/pref_themed_icons_summary"
        android:defaultValue="false"
        android:persistent="true" />

    <SwitchPreferenceCompat
        android:key="pref_desktop_show_labels"
        android:title="@string/desktop_show_labels"
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3;
import static android.text.Layout.Alignment.ALIGN_NORMAL;

import static com.android.launcher3.Flags.enableCursorHoverStates;
import static com.android.launcher3.InvariantDeviceProfile.KEY_ALLAPPS_THEMED_ICONS;
import static com.android.launcher3.InvariantDeviceProfile.KEY_SHOW_DESKTOP_LABELS;
import static com.android.launcher3.InvariantDeviceProfile.KEY_SHOW_DRAWER_LABELS;
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
@@ -212,6 +213,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
    private boolean mDisableRelayout = false;

    private boolean mShouldShowLabel;
    private boolean mThemeAllAppsIcons;

    private CancellableTask mIconLoadRequest;

@@ -254,6 +256,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
            setCompoundDrawablePadding(mDeviceProfile.allAppsIconDrawablePaddingPx);
            defaultIconSize = mDeviceProfile.allAppsIconSizePx;
            mShouldShowLabel = prefs.getBoolean(KEY_SHOW_DRAWER_LABELS, true);
            mThemeAllAppsIcons = prefs.getBoolean(KEY_ALLAPPS_THEMED_ICONS, false);
        } else if (mDisplay == DISPLAY_FOLDER) {
            setTextSize(TypedValue.COMPLEX_UNIT_PX, mDeviceProfile.folderChildTextSizePx);
            setCompoundDrawablePadding(mDeviceProfile.folderChildDrawablePaddingPx);
@@ -473,7 +476,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,

    protected boolean shouldUseTheme() {
        return (mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER
                || mDisplay == DISPLAY_TASKBAR) && Themes.isThemedIconEnabled(getContext());
                || mDisplay == DISPLAY_TASKBAR
                || (mThemeAllAppsIcons && mDisplay == DISPLAY_ALL_APPS))
                && Themes.isThemedIconEnabled(getContext());
    }

    /**
+7 −2
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ public class InvariantDeviceProfile implements SafeCloseable, OnSharedPreference

    private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48;

    public static final String KEY_ALLAPPS_THEMED_ICONS = "pref_allapps_themed_icons";
    public static final String KEY_SHOW_DESKTOP_LABELS = "pref_desktop_show_labels";
    public static final String KEY_SHOW_DRAWER_LABELS = "pref_drawer_show_labels";
    public static final String KEY_WORKSPACE_LOCK = "pref_workspace_lock";
@@ -345,8 +346,12 @@ public class InvariantDeviceProfile implements SafeCloseable, OnSharedPreference

    @Override
    public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
        if (KEY_SHOW_DESKTOP_LABELS.equals(key) || KEY_SHOW_DRAWER_LABELS.equals(key)) {
        switch (key) {
            case KEY_ALLAPPS_THEMED_ICONS:
            case KEY_SHOW_DESKTOP_LABELS:
            case KEY_SHOW_DRAWER_LABELS:
                onConfigChanged(mContext);
                break;
        }
    }