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

Unverified Commit 73dc8719 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 84a0dddc
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>

    <SwitchPreference
        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" />

    <SwitchPreference
        android:key="pref_desktop_show_labels"
        android:title="@string/desktop_show_labels"
+5 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.launcher3;

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.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES;
@@ -188,6 +189,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
    private boolean mDisableRelayout = false;

    private boolean mShouldShowLabel;
    private boolean mThemeAllAppsIcons;

    private HandlerRunnable mIconLoadRequest;

@@ -229,6 +231,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
            setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
            defaultIconSize = grid.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, grid.folderChildTextSizePx);
            setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx);
@@ -413,7 +416,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,

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

    /**
+7 −2
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener

    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";
@@ -339,8 +340,12 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener

    @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;
        }
    }