Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-Launcher3: Commit

packages/apps/Launcher3


Commit MetaInfo

Revisión7e0801eafb1163f1f3b8416739a36dcf26610215 (tree)
Tiempo2017-06-10 02:04:05
AutorTony <twickham@goog...>
CommiterAdam Cohen

Log Message

Merge branch 'ub-launcher3-dorval' into launcher3merge

Test: testing done on ub-launcher3-dorval branch
Change-Id: I3e5167b7e1944ca259747caa8fd56a0507742dfc

issue 62484015

Cambiar Resumen

Diferencia

--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -82,7 +82,8 @@
8282
8383 <service android:name="com.android.launcher3.dynamicui.ColorExtractionService"
8484 android:exported="false"
85- android:process=":wallpaper_chooser">
85+ android:process=":wallpaper_chooser"
86+ android:permission="android.permission.BIND_JOB_SERVICE">
8687 </service>
8788
8889 <service android:name="com.android.launcher3.notification.NotificationListener"
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -120,7 +120,7 @@
120120 <string name="widget_resized" msgid="9130327887929620">"ウィジェットのサイズを幅<xliff:g id="NUMBER_0">%1$s</xliff:g>、高さ<xliff:g id="NUMBER_1">%2$s</xliff:g>に変更しました"</string>
121121 <string name="action_deep_shortcut" msgid="2864038805849372848">"ショートカット"</string>
122122 <string name="shortcuts_menu_description" msgid="406159963824238648">"<xliff:g id="APP_NAME">%2$s</xliff:g>用の <xliff:g id="NUMBER_OF_SHORTCUTS">%1$d</xliff:g> 件のショートカット"</string>
123- <string name="shortcuts_menu_with_notifications_description" msgid="8985659504915468840">"<xliff:g id="APP_NAME">%3$s</xliff:g>: <xliff:g id="NUMBER_OF_SHORTCUTS">%1$d</xliff:g> 件のショートカットと <xliff:g id="NUMBER_OF_NOTIFICATIONS">%2$d</xliff:g> 件の通知"</string>
123+ <string name="shortcuts_menu_with_notifications_description" msgid="8985659504915468840">"<xliff:g id="APP_NAME">%3$s</xliff:g>: <xliff:g id="NUMBER_OF_SHORTCUTS">%1$d</xliff:g> 個のショートカットと <xliff:g id="NUMBER_OF_NOTIFICATIONS">%2$d</xliff:g> 件の通知"</string>
124124 <string name="action_dismiss_notification" msgid="5909461085055959187">"表示しない"</string>
125125 <string name="notification_dismissed" msgid="6002233469409822874">"通知を非表示にしました"</string>
126126 </resources>
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -42,6 +42,7 @@
4242 <color name="notification_color_beneath">#E0E0E0</color> <!-- Gray 300 -->
4343
4444 <color name="badge_color">#1DE9B6</color> <!-- Teal A400 -->
45+ <color name="folder_badge_color">#1DE9B6</color> <!-- Teal A400 -->
4546
4647 <!-- System shortcuts -->
4748 <color name="system_shortcuts_icon_color">@android:color/tertiary_text_light</color>
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -172,12 +172,12 @@
172172 <string name="allow_rotation_desc">When phone is rotated</string>
173173 <!-- Text explaining that rotation is disabled in Display settings. 'Display' refers to the Display section in system settings [CHAR LIMIT=100] -->
174174 <string name="allow_rotation_blocked_desc">Current Display setting doesn\'t permit rotation</string>
175- <!-- Title for Icon Badging setting. Tapping this will link to the system Notifications Settings screen where the user can turn off badging globally. [CHAR LIMIT=50] -->
176- <string name="icon_badging_title">Icon badging</string>
175+ <!-- Title for Notification dots setting. Tapping this will link to the system Notifications settings screen where the user can turn off notification dots globally. [CHAR LIMIT=50] -->
176+ <string name="icon_badging_title">Notification dots</string>
177177 <!-- Text to indicate that the system icon badging setting is on [CHAR LIMIT=100] -->
178- <string name="icon_badging_desc_on">On for all apps</string>
178+ <string name="icon_badging_desc_on">On</string>
179179 <!-- Text to indicate that the system icon badging setting is off [CHAR LIMIT=100] -->
180- <string name="icon_badging_desc_off">Off for all apps</string>
180+ <string name="icon_badging_desc_off">Off</string>
181181
182182 <!-- Label for the setting that allows the automatic placement of launcher shortcuts for applications and games installed on the device [CHAR LIMIT=40] -->
183183 <string name="auto_add_shortcuts_label">Add icon to Home screen</string>
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -96,7 +96,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
9696
9797 private BadgeInfo mBadgeInfo;
9898 private BadgeRenderer mBadgeRenderer;
99- private IconPalette mIconPalette;
99+ private IconPalette mBadgePalette;
100100 private float mBadgeScale;
101101 private boolean mForceHideBadge;
102102 private Point mTempSpaceForBadgeOffset = new Point();
@@ -453,7 +453,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
453453 final int scrollX = getScrollX();
454454 final int scrollY = getScrollY();
455455 canvas.translate(scrollX, scrollY);
456- mBadgeRenderer.draw(canvas, mBadgeInfo, mTempIconBounds, mBadgeScale,
456+ mBadgeRenderer.draw(canvas, mBadgePalette, mBadgeInfo, mTempIconBounds, mBadgeScale,
457457 mTempSpaceForBadgeOffset);
458458 canvas.translate(-scrollX, -scrollY);
459459 }
@@ -578,7 +578,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
578578 float newBadgeScale = isBadged ? 1f : 0;
579579 mBadgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer;
580580 if (wasBadged || isBadged) {
581- mIconPalette = ((FastBitmapDrawable) mIcon).getIconPalette();
581+ mBadgePalette = IconPalette.getBadgePalette(getResources());
582+ if (mBadgePalette == null) {
583+ mBadgePalette = ((FastBitmapDrawable) mIcon).getIconPalette();
584+ }
582585 // Animate when a badge is first added or when it is removed.
583586 if (animate && (wasBadged ^ isBadged) && isShown()) {
584587 ObjectAnimator.ofFloat(this, BADGE_SCALE_PROPERTY, newBadgeScale).start();
@@ -590,6 +593,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
590593 }
591594 }
592595
596+ public IconPalette getBadgePalette() {
597+ return mBadgePalette;
598+ }
599+
593600 /**
594601 * Sets the icon for this view based on the layout direction.
595602 */
--- a/src/com/android/launcher3/FastBitmapDrawable.java
+++ b/src/com/android/launcher3/FastBitmapDrawable.java
@@ -124,7 +124,7 @@ public class FastBitmapDrawable extends Drawable {
124124 public IconPalette getIconPalette() {
125125 if (mIconPalette == null) {
126126 mIconPalette = IconPalette.fromDominantColor(Utilities
127- .findDominantColorByHue(mBitmap, 20));
127+ .findDominantColorByHue(mBitmap, 20), true /* desaturateBackground */);
128128 }
129129 return mIconPalette;
130130 }
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -61,7 +61,6 @@ import java.lang.reflect.Method;
6161 import java.util.Collection;
6262 import java.util.HashSet;
6363 import java.util.Locale;
64-import java.util.Set;
6564 import java.util.concurrent.Executor;
6665 import java.util.concurrent.LinkedBlockingQueue;
6766 import java.util.concurrent.ThreadPoolExecutor;
@@ -110,6 +109,8 @@ public final class Utilities {
110109 // An intent extra to indicate the horizontal scroll of the wallpaper.
111110 public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
112111
112+ public static final int COLOR_EXTRACTION_JOB_ID = 1;
113+
113114 // These values are same as that in {@link AsyncTask}.
114115 private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
115116 private static final int CORE_POOL_SIZE = CPU_COUNT + 1;
--- a/src/com/android/launcher3/badge/BadgeRenderer.java
+++ b/src/com/android/launcher3/badge/BadgeRenderer.java
@@ -63,7 +63,6 @@ public class BadgeRenderer {
6363 private final Paint mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG
6464 | Paint.FILTER_BITMAP_FLAG);
6565 private final SparseArray<Bitmap> mBackgroundsWithShadow;
66- private final IconPalette mIconPalette;
6766
6867 public BadgeRenderer(Context context, int iconSizePx) {
6968 mContext = context;
@@ -83,25 +82,24 @@ public class BadgeRenderer {
8382 mTextHeight = tempTextHeight.height();
8483
8584 mBackgroundsWithShadow = new SparseArray<>(3);
86-
87- mIconPalette = IconPalette.fromDominantColor(context.getColor(R.color.badge_color));
8885 }
8986
9087 /**
9188 * Draw a circle in the top right corner of the given bounds, and draw
9289 * {@link BadgeInfo#getNotificationCount()} on top of the circle.
90+ * @param palette The colors (based on the icon) to use for the badge.
9391 * @param badgeInfo Contains data to draw on the badge. Could be null if we are animating out.
9492 * @param iconBounds The bounds of the icon being badged.
9593 * @param badgeScale The progress of the animation, from 0 to 1.
9694 * @param spaceForOffset How much space is available to offset the badge up and to the right.
9795 */
98- public void draw(Canvas canvas, @Nullable BadgeInfo badgeInfo,
96+ public void draw(Canvas canvas, IconPalette palette, @Nullable BadgeInfo badgeInfo,
9997 Rect iconBounds, float badgeScale, Point spaceForOffset) {
100- mTextPaint.setColor(mIconPalette.textColor);
98+ mTextPaint.setColor(palette.textColor);
10199 IconDrawer iconDrawer = badgeInfo != null && badgeInfo.isIconLarge()
102100 ? mLargeIconDrawer : mSmallIconDrawer;
103101 Shader icon = badgeInfo == null ? null : badgeInfo.getNotificationIconForBadge(
104- mContext, mIconPalette.backgroundColor, mSize, iconDrawer.mPadding);
102+ mContext, palette.backgroundColor, mSize, iconDrawer.mPadding);
105103 String notificationCount = badgeInfo == null ? "0"
106104 : String.valueOf(badgeInfo.getNotificationCount());
107105 int numChars = notificationCount.length();
@@ -127,7 +125,7 @@ public class BadgeRenderer {
127125 canvas.translate(badgeCenterX + offsetX, badgeCenterY - offsetY);
128126 canvas.scale(badgeScale, badgeScale);
129127 // Prepare the background and shadow and possible stacking effect.
130- mBackgroundPaint.setColorFilter(mIconPalette.backgroundColorMatrixFilter);
128+ mBackgroundPaint.setColorFilter(palette.backgroundColorMatrixFilter);
131129 int backgroundWithShadowSize = backgroundWithShadow.getHeight(); // Same as width.
132130 boolean shouldStack = !isDot && badgeInfo != null
133131 && badgeInfo.getNotificationKeys().size() > 1;
@@ -149,7 +147,7 @@ public class BadgeRenderer {
149147 -backgroundWithShadowSize / 2, mBackgroundPaint);
150148 iconDrawer.drawIcon(icon, canvas);
151149 } else if (isDot) {
152- mBackgroundPaint.setColorFilter(mIconPalette.saturatedBackgroundColorMatrixFilter);
150+ mBackgroundPaint.setColorFilter(palette.saturatedBackgroundColorMatrixFilter);
153151 canvas.drawBitmap(backgroundWithShadow, -backgroundWithShadowSize / 2,
154152 -backgroundWithShadowSize / 2, mBackgroundPaint);
155153 }
--- a/src/com/android/launcher3/dynamicui/ColorExtractionService.java
+++ b/src/com/android/launcher3/dynamicui/ColorExtractionService.java
@@ -17,15 +17,17 @@
1717 package com.android.launcher3.dynamicui;
1818
1919 import android.annotation.TargetApi;
20-import android.app.IntentService;
2120 import android.app.WallpaperManager;
22-import android.content.Intent;
21+import android.app.job.JobParameters;
22+import android.app.job.JobService;
2323 import android.graphics.Bitmap;
2424 import android.graphics.BitmapRegionDecoder;
2525 import android.graphics.Rect;
2626 import android.graphics.drawable.BitmapDrawable;
2727 import android.os.Build;
2828 import android.os.Bundle;
29+import android.os.Handler;
30+import android.os.HandlerThread;
2931 import android.os.ParcelFileDescriptor;
3032 import android.support.v7.graphics.Palette;
3133 import android.util.Log;
@@ -41,45 +43,76 @@ import java.io.IOException;
4143 /**
4244 * Extracts colors from the wallpaper, and saves results to {@link LauncherProvider}.
4345 */
44-public class ColorExtractionService extends IntentService {
46+public class ColorExtractionService extends JobService {
4547
4648 private static final String TAG = "ColorExtractionService";
49+ private static final boolean DEBUG = false;
4750
4851 /** The fraction of the wallpaper to extract colors for use on the hotseat. */
4952 private static final float HOTSEAT_FRACTION = 1f / 4;
5053
51- public ColorExtractionService() {
52- super("ColorExtractionService");
54+ private HandlerThread mWorkerThread;
55+ private Handler mWorkerHandler;
56+
57+ @Override
58+ public void onCreate() {
59+ super.onCreate();
60+ mWorkerThread = new HandlerThread("ColorExtractionService");
61+ mWorkerThread.start();
62+ mWorkerHandler = new Handler(mWorkerThread.getLooper());
5363 }
5464
5565 @Override
56- protected void onHandleIntent(Intent intent) {
57- WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
58- int wallpaperId = ExtractionUtils.getWallpaperId(wallpaperManager);
59-
60- ExtractedColors extractedColors = new ExtractedColors();
61- if (wallpaperManager.getWallpaperInfo() != null) {
62- // We can't extract colors from live wallpapers, so just use the default color always.
63- extractedColors.updateHotseatPalette(null);
64- } else {
65- // We extract colors for the hotseat and status bar separately,
66- // since they only consider part of the wallpaper.
67- extractedColors.updateHotseatPalette(getHotseatPalette());
68-
69- if (FeatureFlags.LIGHT_STATUS_BAR) {
70- extractedColors.updateStatusBarPalette(getStatusBarPalette());
66+ public void onDestroy() {
67+ super.onDestroy();
68+ mWorkerThread.quit();
69+ }
70+
71+ @Override
72+ public boolean onStartJob(final JobParameters jobParameters) {
73+ if (DEBUG) Log.d(TAG, "onStartJob");
74+ mWorkerHandler.post(new Runnable() {
75+ @Override
76+ public void run() {
77+ WallpaperManager wallpaperManager = WallpaperManager.getInstance(
78+ ColorExtractionService.this);
79+ int wallpaperId = ExtractionUtils.getWallpaperId(wallpaperManager);
80+
81+ ExtractedColors extractedColors = new ExtractedColors();
82+ if (wallpaperManager.getWallpaperInfo() != null) {
83+ // We can't extract colors from live wallpapers; always use the default color.
84+ extractedColors.updateHotseatPalette(null);
85+ } else {
86+ // We extract colors for the hotseat and status bar separately,
87+ // since they only consider part of the wallpaper.
88+ extractedColors.updateHotseatPalette(getHotseatPalette());
89+
90+ if (FeatureFlags.LIGHT_STATUS_BAR) {
91+ extractedColors.updateStatusBarPalette(getStatusBarPalette());
92+ }
93+ }
94+
95+ // Save the extracted colors and wallpaper id to LauncherProvider.
96+ String colorsString = extractedColors.encodeAsString();
97+ Bundle extras = new Bundle();
98+ extras.putInt(LauncherSettings.Settings.EXTRA_WALLPAPER_ID, wallpaperId);
99+ extras.putString(LauncherSettings.Settings.EXTRA_EXTRACTED_COLORS, colorsString);
100+ getContentResolver().call(
101+ LauncherSettings.Settings.CONTENT_URI,
102+ LauncherSettings.Settings.METHOD_SET_EXTRACTED_COLORS_AND_WALLPAPER_ID,
103+ null, extras);
104+ jobFinished(jobParameters, false /* needsReschedule */);
105+ if (DEBUG) Log.d(TAG, "job finished!");
71106 }
72- }
107+ });
108+ return true;
109+ }
73110
74- // Save the extracted colors and wallpaper id to LauncherProvider.
75- String colorsString = extractedColors.encodeAsString();
76- Bundle extras = new Bundle();
77- extras.putInt(LauncherSettings.Settings.EXTRA_WALLPAPER_ID, wallpaperId);
78- extras.putString(LauncherSettings.Settings.EXTRA_EXTRACTED_COLORS, colorsString);
79- getContentResolver().call(
80- LauncherSettings.Settings.CONTENT_URI,
81- LauncherSettings.Settings.METHOD_SET_EXTRACTED_COLORS_AND_WALLPAPER_ID,
82- null, extras);
111+ @Override
112+ public boolean onStopJob(JobParameters jobParameters) {
113+ if (DEBUG) Log.d(TAG, "onStopJob");
114+ mWorkerHandler.removeCallbacksAndMessages(null);
115+ return true;
83116 }
84117
85118 @TargetApi(Build.VERSION_CODES.N)
--- a/src/com/android/launcher3/dynamicui/ExtractionUtils.java
+++ b/src/com/android/launcher3/dynamicui/ExtractionUtils.java
@@ -18,8 +18,10 @@ package com.android.launcher3.dynamicui;
1818
1919 import android.annotation.TargetApi;
2020 import android.app.WallpaperManager;
21+import android.app.job.JobInfo;
22+import android.app.job.JobScheduler;
23+import android.content.ComponentName;
2124 import android.content.Context;
22-import android.content.Intent;
2325 import android.content.SharedPreferences;
2426 import android.graphics.Color;
2527 import android.os.Build;
@@ -58,7 +60,11 @@ public class ExtractionUtils {
5860
5961 /** Starts the {@link ColorExtractionService} without checking the wallpaper id */
6062 public static void startColorExtractionService(Context context) {
61- context.startService(new Intent(context, ColorExtractionService.class));
63+ JobScheduler jobScheduler = (JobScheduler) context.getSystemService(
64+ Context.JOB_SCHEDULER_SERVICE);
65+ jobScheduler.schedule(new JobInfo.Builder(Utilities.COLOR_EXTRACTION_JOB_ID,
66+ new ComponentName(context, ColorExtractionService.class))
67+ .setMinimumLatency(0).build());
6268 }
6369
6470 private static boolean hasWallpaperIdChanged(Context context) {
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -75,6 +75,7 @@ import com.android.launcher3.badge.FolderBadgeInfo;
7575 import com.android.launcher3.config.FeatureFlags;
7676 import com.android.launcher3.dragndrop.DragLayer;
7777 import com.android.launcher3.dragndrop.DragView;
78+import com.android.launcher3.graphics.IconPalette;
7879 import com.android.launcher3.util.Thunk;
7980
8081 import java.util.ArrayList;
@@ -885,7 +886,8 @@ public class FolderIcon extends FrameLayout implements FolderListener {
885886 // If we are animating to the accepting state, animate the badge out.
886887 float badgeScale = Math.max(0, mBadgeScale - mBackground.getScaleProgress());
887888 mTempSpaceForBadgeOffset.set(getWidth() - mTempBounds.right, mTempBounds.top);
888- mBadgeRenderer.draw(canvas, mBadgeInfo, mTempBounds,
889+ IconPalette badgePalette = IconPalette.getFolderBadgePalette(getResources());
890+ mBadgeRenderer.draw(canvas, badgePalette, mBadgeInfo, mTempBounds,
889891 badgeScale, mTempSpaceForBadgeOffset);
890892 }
891893 }
--- a/src/com/android/launcher3/graphics/IconPalette.java
+++ b/src/com/android/launcher3/graphics/IconPalette.java
@@ -18,9 +18,12 @@ package com.android.launcher3.graphics;
1818
1919 import android.app.Notification;
2020 import android.content.Context;
21+import android.content.res.Resources;
2122 import android.graphics.Color;
2223 import android.graphics.ColorMatrix;
2324 import android.graphics.ColorMatrixColorFilter;
25+import android.support.annotation.NonNull;
26+import android.support.annotation.Nullable;
2427 import android.support.v4.graphics.ColorUtils;
2528 import android.util.Log;
2629
@@ -35,11 +38,12 @@ public class IconPalette {
3538 private static final boolean DEBUG = false;
3639 private static final String TAG = "IconPalette";
3740
38- public static final IconPalette FOLDER_ICON_PALETTE = new IconPalette(Color.parseColor("#BDC1C6"));
39-
4041 private static final float MIN_PRELOAD_COLOR_SATURATION = 0.2f;
4142 private static final float MIN_PRELOAD_COLOR_LIGHTNESS = 0.6f;
4243
44+ private static IconPalette sBadgePalette;
45+ private static IconPalette sFolderBadgePalette;
46+
4347 public final int dominantColor;
4448 public final int backgroundColor;
4549 public final ColorMatrixColorFilter backgroundColorMatrixFilter;
@@ -47,15 +51,19 @@ public class IconPalette {
4751 public final int textColor;
4852 public final int secondaryColor;
4953
50- private IconPalette(int color) {
54+ private IconPalette(int color, boolean desaturateBackground) {
5155 dominantColor = color;
52- backgroundColor = dominantColor;
56+ backgroundColor = desaturateBackground ? getMutedColor(dominantColor, 0.87f) : dominantColor;
5357 ColorMatrix backgroundColorMatrix = new ColorMatrix();
5458 Themes.setColorScaleOnMatrix(backgroundColor, backgroundColorMatrix);
5559 backgroundColorMatrixFilter = new ColorMatrixColorFilter(backgroundColorMatrix);
56- // Get slightly more saturated background color.
57- Themes.setColorScaleOnMatrix(getMutedColor(dominantColor, 0.54f), backgroundColorMatrix);
58- saturatedBackgroundColorMatrixFilter = new ColorMatrixColorFilter(backgroundColorMatrix);
60+ if (!desaturateBackground) {
61+ saturatedBackgroundColorMatrixFilter = backgroundColorMatrixFilter;
62+ } else {
63+ // Get slightly more saturated background color.
64+ Themes.setColorScaleOnMatrix(getMutedColor(dominantColor, 0.54f), backgroundColorMatrix);
65+ saturatedBackgroundColorMatrixFilter = new ColorMatrixColorFilter(backgroundColorMatrix);
66+ }
5967 textColor = getTextColorForBackground(backgroundColor);
6068 secondaryColor = getLowContrastColor(backgroundColor);
6169 }
@@ -78,8 +86,35 @@ public class IconPalette {
7886 return result;
7987 }
8088
81- public static IconPalette fromDominantColor(int dominantColor) {
82- return new IconPalette(dominantColor);
89+ public static IconPalette fromDominantColor(int dominantColor, boolean desaturateBackground) {
90+ return new IconPalette(dominantColor, desaturateBackground);
91+ }
92+
93+ /**
94+ * Returns an IconPalette based on the badge_color in colors.xml.
95+ * If that color is Color.TRANSPARENT, then returns null instead.
96+ */
97+ public static @Nullable IconPalette getBadgePalette(Resources resources) {
98+ int badgeColor = resources.getColor(R.color.badge_color);
99+ if (badgeColor == Color.TRANSPARENT) {
100+ // Colors will be extracted per app icon, so a static palette won't work.
101+ return null;
102+ }
103+ if (sBadgePalette == null) {
104+ sBadgePalette = fromDominantColor(badgeColor, false);
105+ }
106+ return sBadgePalette;
107+ }
108+
109+ /**
110+ * Returns an IconPalette based on the folder_badge_color in colors.xml.
111+ */
112+ public static @NonNull IconPalette getFolderBadgePalette(Resources resources) {
113+ if (sFolderBadgePalette == null) {
114+ int badgeColor = resources.getColor(R.color.folder_badge_color);
115+ sFolderBadgePalette = fromDominantColor(badgeColor, false);
116+ }
117+ return sFolderBadgePalette;
83118 }
84119
85120 /**
--- a/src/com/android/launcher3/graphics/LauncherIcons.java
+++ b/src/com/android/launcher3/graphics/LauncherIcons.java
@@ -266,9 +266,10 @@ public class LauncherIcons {
266266
267267 sOldBounds.set(icon.getBounds());
268268 if (Utilities.isAtLeastO() && icon instanceof AdaptiveIconDrawable) {
269- int offset = Math.min(left, top);
269+ int offset = Math.max((int)(ShadowGenerator.BLUR_FACTOR * iconBitmapSize),
270+ Math.min(left, top));
270271 int size = Math.max(width, height);
271- icon.setBounds(offset, offset, offset + size, offset + size);
272+ icon.setBounds(offset, offset, size, size);
272273 } else {
273274 icon.setBounds(left, top, left+width, top+height);
274275 }
--- a/src/com/android/launcher3/graphics/ShadowGenerator.java
+++ b/src/com/android/launcher3/graphics/ShadowGenerator.java
@@ -35,7 +35,7 @@ public class ShadowGenerator {
3535
3636 // Percent of actual icon size
3737 private static final float HALF_DISTANCE = 0.5f;
38- private static final float BLUR_FACTOR = 0.5f/48;
38+ public static final float BLUR_FACTOR = 0.5f/48;
3939
4040 // Percent of actual icon size
4141 private static final float KEY_SHADOW_DISTANCE = 1f/48;
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -47,7 +47,6 @@ import com.android.launcher3.AbstractFloatingView;
4747 import com.android.launcher3.BubbleTextView;
4848 import com.android.launcher3.DragSource;
4949 import com.android.launcher3.DropTarget;
50-import com.android.launcher3.FastBitmapDrawable;
5150 import com.android.launcher3.ItemInfo;
5251 import com.android.launcher3.Launcher;
5352 import com.android.launcher3.LauncherAnimUtils;
@@ -579,9 +578,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
579578 ItemInfo itemInfo = (ItemInfo) mOriginalIcon.getTag();
580579 BadgeInfo badgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo);
581580 if (mNotificationItemView != null && badgeInfo != null) {
582- IconPalette palette = mOriginalIcon.getIcon() instanceof FastBitmapDrawable
583- ? ((FastBitmapDrawable) mOriginalIcon.getIcon()).getIconPalette()
584- : null;
581+ IconPalette palette = mOriginalIcon.getBadgePalette();
585582 mNotificationItemView.updateHeader(badgeInfo.getNotificationCount(), palette);
586583 }
587584 }
Show on old repository browser