summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Martinz <amartinz@shiftphones.com>2018-04-09 19:43:05 +0200
committerAlexander Martinz <amartinz@shiftphones.com>2018-04-09 19:52:49 +0200
commita461fa3c02eecc2a423dd9d5500df424628f3fdb (patch)
tree07bfe9d04b0e89592befcf118c0c4ea3c7e8e3f2 /src
parent1b3e3716616cf5f629d83facb87934d9380ab613 (diff)
downloadandroid_packages_apps_Trebuchet-a461fa3c02eecc2a423dd9d5500df424628f3fdb.tar.gz
android_packages_apps_Trebuchet-a461fa3c02eecc2a423dd9d5500df424628f3fdb.tar.bz2
android_packages_apps_Trebuchet-a461fa3c02eecc2a423dd9d5500df424628f3fdb.zip
Utilities: fix checking whether non-default icon pack is applied
The current check returns the opposite of what the method is called. Printing the following values: - defaultPack, defaultLocalizedPack, currentPack, isNotUsingIconPack without icon pack applied: - Default | System (Standard) | System (Standard) | false with "Frost" (com.dkanada.icecons) icon pack applied: - Default | System (Standard) | com.dkanada.icecons | true with "Pixel Icon Pack" (com.themezilla.pixelui) icon pack applied: - Default | System (Standard) | com.themezilla.pixelui | true To correct this behavior: *) rename "isNotUsingIconPack" to "isUsingIconPack" *) fix all the users of the method *) add comments to document the thoughts behind the logic Change-Id: I8a5339fae536a3f3803637353737994670d8ee92 Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Utilities.java8
-rw-r--r--src/com/android/launcher3/graphics/LauncherIcons.java2
-rw-r--r--src/com/android/launcher3/icons/CustomIconsProvider.java5
3 files changed, 9 insertions, 6 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index bbfc06dbe..e0ef90c3f 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -690,13 +690,15 @@ public final class Utilities {
GRID_VALUE_SEPARATOR, rows);
}
- public static boolean isNotUsingIconPack(Context context) {
+ public static boolean isUsingIconPack(Context context) {
SharedPreferences prefs = Utilities.getPrefs(context.getApplicationContext());
String defaultPack = context.getString(R.string.icon_pack_default);
- String defaultLocalziedPack = context.getString(R.string.icon_pack_system);
+ String defaultLocalizedPack = context.getString(R.string.icon_pack_system);
String currentPack = prefs.getString(QuickSettingsActivity.KEY_ICON_PACK, defaultPack);
- return !currentPack.equals(defaultPack) && !currentPack.equals(defaultLocalziedPack);
+ // if our current icon pack does not equal to the default or localized default icon pack,
+ // assume we are using an icon pack
+ return !(currentPack.equals(defaultPack) || currentPack.equals(defaultLocalizedPack));
}
static boolean hasFeedIntegration(Context context) {
diff --git a/src/com/android/launcher3/graphics/LauncherIcons.java b/src/com/android/launcher3/graphics/LauncherIcons.java
index 7ec53f0be..45b64ddc6 100644
--- a/src/com/android/launcher3/graphics/LauncherIcons.java
+++ b/src/com/android/launcher3/graphics/LauncherIcons.java
@@ -107,7 +107,7 @@ public class LauncherIcons {
if (!FeatureFlags.LAUNCHER3_DISABLE_ICON_NORMALIZATION) {
normalizer = IconNormalizer.getInstance(context);
if (Utilities.ATLEAST_OREO && iconAppTargetSdk >= Build.VERSION_CODES.O &&
- Utilities.isNotUsingIconPack(context)) {
+ !Utilities.isUsingIconPack(context)) {
boolean[] outShape = new boolean[1];
AdaptiveIconDrawable dr = (AdaptiveIconDrawable)
context.getDrawable(R.drawable.adaptive_icon_drawable_wrapper).mutate();
diff --git a/src/com/android/launcher3/icons/CustomIconsProvider.java b/src/com/android/launcher3/icons/CustomIconsProvider.java
index 1cdb208ad..ed63c076e 100644
--- a/src/com/android/launcher3/icons/CustomIconsProvider.java
+++ b/src/com/android/launcher3/icons/CustomIconsProvider.java
@@ -38,7 +38,8 @@ public class CustomIconsProvider extends IconProvider {
@Override
public Drawable getIcon(LauncherActivityInfo info, int iconDpi, boolean flattenDrawable) {
- if (Utilities.ATLEAST_OREO && !Utilities.isNotUsingIconPack(mContext)) {
+ // if we are not using any icon pack, load application icon directly
+ if (Utilities.ATLEAST_OREO && !Utilities.isUsingIconPack(mContext)) {
return mContext.getPackageManager().getApplicationIcon(info.getApplicationInfo());
}
@@ -49,4 +50,4 @@ public class CustomIconsProvider extends IconProvider {
return new BitmapDrawable(mContext.getResources(), bm);
}
-} \ No newline at end of file
+}