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

Commit ca187461 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding support for dynamically change icon shape for AdaptiveIcons

> This would allow developers to verify their icon designs on different
device configurations
> This settings is only visible when developer settings is enabled

Change-Id: I7e32abfede001c134f23390734dcd39c93b68b9a
parent 2f54a162
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -13,6 +13,26 @@
     easily override the app name without providing all translations -->
    <string name="derived_app_name" translatable="false">@string/app_name</string>

    <!-- Values for icon shape overrides. These should correspond to entries defined
     in icon_shape_override_paths_names -->
    <string-array name="icon_shape_override_paths_values">
        <item></item>
        <item>M50,0L100,0 100,100 0,100 0,0z</item>
        <item>M50,0L80,0 A20,20,0,0 1 100,20 L100,80 A20,20,0,0 1 80,100 L20,100 A20,20,0,0 1 0,80 L 0,20 A20,20,0,0 1 20,0z</item>
        <item>M50,0 C10,0 0,10 0,50 0,90 10,100 50,100 90,100 100,90 100,50 100,10 90,0 50,0 Z</item>
        <item>M50 0A50 50,0,1,1,50 100A50 50,0,1,1,50 0</item>
        <item>M50,0A50,30 0,0,1 100,30V70A50,30 0,0,1 0,70V30A50,30 0,0,1 50,0z</item>
    </string-array>

    <string-array name="icon_shape_override_paths_names">
        <!-- Option to not change the icon shape on home screen. [CHAR LIMIT=50] -->
        <item>@string/icon_shape_no_override</item>
        <item translatable="false">Square</item>
        <item translatable="false">Rounded corner rect</item>
        <item translatable="false">Squircle</item>
        <item translatable="false">Circle</item>
        <item translatable="false">Cylinder</item>
    </string-array>
<!-- DragController -->
    <item type="id" name="drag_event_parity" />

+7 −0
Original line number Diff line number Diff line
@@ -184,6 +184,13 @@
    <!-- Text description of the setting that allows the automatic placement of launcher shortcuts for applications and games installed on the device [CHAR LIMIT=NONE] -->
    <string name="auto_add_shortcuts_description">For new apps</string>

    <!-- Developer setting to change the shape of icons on home screen. [CHAR LIMIT=50] -->
    <string name="icon_shape_override_label">Change icon shape</string>
    <!-- Option to not change the icon shape on home screen. [CHAR LIMIT=50] -->
    <string name="icon_shape_no_override">Do not change</string>
    <!-- Message shown in the progress dialog when the icon shape override is being applied [CHAR LIMIT=100]-->
    <string name="icon_shape_override_progress">Applying icon shape changes</string>

    <!-- Label on an icon that references an uninstalled package, for which we have no information about when it might be installed. [CHAR_LIMIT=15] -->
    <string name="package_state_unknown">Unknown</string>

+10 −0
Original line number Diff line number Diff line
@@ -30,4 +30,14 @@
        android:defaultValue="true"
        android:persistent="true"
        />

    <ListPreference
        android:key="pref_override_icon_shape"
        android:title="@string/icon_shape_override_label"
        android:summary="%s"
        android:entries="@array/icon_shape_override_paths_names"
        android:entryValues="@array/icon_shape_override_paths_values"
        android:defaultValue=""
        android:persistent="false" />

</PreferenceScreen>
+5 −0
Original line number Diff line number Diff line
@@ -572,6 +572,11 @@ public class IconCache {
        return entry;
    }

    public synchronized void clear() {
        Preconditions.assertWorkerThread();
        mIconDb.clear();
    }

    /**
     * Adds a default package entry in the cache. This entry is not persisted and will be removed
     * when the cache is flushed.
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dynamicui.ExtractionUtils;
import com.android.launcher3.graphics.IconShapeOverride;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.provider.LauncherDbUtils;
import com.android.launcher3.provider.RestoreDbTask;
@@ -96,6 +97,7 @@ public class LauncherProvider extends ContentProvider {
        // is the first component to get created. Initializing FileLog here ensures that it's
        // always available in the main process.
        FileLog.setDir(getContext().getApplicationContext().getFilesDir());
        IconShapeOverride.apply(getContext());
        return true;
    }

Loading