diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 0b537e2176..8291475f5d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -28,6 +28,7 @@ import android.widget.FrameLayout; import androidx.annotation.LayoutRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.graphics.ColorUtils; import com.android.launcher3.BubbleTextView; import com.android.launcher3.Insettable; @@ -35,6 +36,7 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -43,14 +45,17 @@ import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.AllAppsButton; +import com.android.launcher3.views.DoubleShadowBubbleTextView; /** * Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps. */ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable { - private final int[] mTempOutLocation = new int[2]; + private static final float TASKBAR_BACKGROUND_LUMINANCE = 0.30f; + public int mThemeIconsBackground; + private final int[] mTempOutLocation = new int[2]; private final Rect mIconLayoutBounds = new Rect(); private final int mIconTouchSize; private final int mItemMarginLeftRight; @@ -103,6 +108,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // Needed to draw folder leave-behind when opening one. setWillNotDraw(false); + mThemeIconsBackground = calculateThemeIconsBackground(); + if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) { mAllAppsButton = new AllAppsButton(context); mAllAppsButton.setLayoutParams( @@ -111,6 +118,21 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } } + private int getColorWithGivenLuminance(int color, float luminance) { + float[] colorHSL = new float[3]; + ColorUtils.colorToHSL(color, colorHSL); + colorHSL[2] = luminance; + return ColorUtils.HSLToColor(colorHSL); + } + + private int calculateThemeIconsBackground() { + int color = ThemedIconDrawable.getColors(mContext)[0]; + if (Utilities.isDarkTheme(mContext)) { + return getColorWithGivenLuminance(color, TASKBAR_BACKGROUND_LUMINANCE); + } + return color; + } + protected void init(TaskbarViewController.TaskbarViewCallbacks callbacks) { mControllerCallbacks = callbacks; mIconClickListener = mControllerCallbacks.getIconOnClickListener(); @@ -219,6 +241,24 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar int index = Utilities.isRtl(getResources()) ? 0 : getChildCount(); addView(mAllAppsButton, index); } + + mThemeIconsBackground = calculateThemeIconsBackground(); + setThemedIconsBackgroundColor(mThemeIconsBackground); + } + + /** + * Traverse all the child views and change the background of themeIcons + **/ + public void setThemedIconsBackgroundColor(int color) { + for (View icon : getIconViews()) { + if (icon instanceof DoubleShadowBubbleTextView) { + DoubleShadowBubbleTextView textView = ((DoubleShadowBubbleTextView) icon); + if (textView.getIcon() != null + && textView.getIcon() instanceof ThemedIconDrawable) { + ((ThemedIconDrawable) textView.getIcon()).changeBackgroundColor(color); + } + } + } } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index a89061bf11..f5c382df42 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -27,6 +27,7 @@ import android.util.Log; import android.view.MotionEvent; import android.view.View; +import androidx.core.graphics.ColorUtils; import androidx.core.view.OneShotPreDrawListener; import com.android.launcher3.BubbleTextView; @@ -37,6 +38,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; @@ -71,6 +73,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar this::updateTranslationY); private AnimatedFloat mTaskbarNavButtonTranslationY; + private final AnimatedFloat mThemeIconsBackground = new AnimatedFloat( + this::updateIconsBackground); + private final TaskbarModelCallbacks mModelCallbacks; // Initialized in init. @@ -81,6 +86,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar private AnimatorPlaybackController mIconAlignControllerLazy = null; private Runnable mOnControllerPreCreateCallback = NO_OP; + private int mThemeIconsColor; + public TaskbarViewController(TaskbarActivityContext activity, TaskbarView taskbarView) { mActivity = activity; mTaskbarView = taskbarView; @@ -93,6 +100,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mControllers = controllers; mTaskbarView.init(new TaskbarViewCallbacks()); mTaskbarView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarSize; + mThemeIconsColor = ThemedIconDrawable.getColors(mTaskbarView.getContext())[0]; mTaskbarIconScaleForStash.updateValue(1f); @@ -182,6 +190,15 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar + mTaskbarIconTranslationYForStash.value); } + private void updateIconsBackground() { + mTaskbarView.setThemedIconsBackgroundColor( + ColorUtils.blendARGB( + mThemeIconsColor, + mTaskbarView.mThemeIconsBackground, + mThemeIconsBackground.value + )); + } + /** * Sets the taskbar icon alignment relative to Launcher hotseat icons * @param alignmentRatio [0, 1] @@ -217,6 +234,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar setter.setFloat(mTaskbarIconTranslationYForHome, VALUE, -offsetY, LINEAR); setter.setFloat(mTaskbarNavButtonTranslationY, VALUE, -offsetY, LINEAR); + if (Utilities.isDarkTheme(mTaskbarView.getContext())) { + setter.addFloat(mThemeIconsBackground, VALUE, 0f, 1f, LINEAR); + } + int collapsedHeight = mActivity.getDefaultTaskbarWindowHeight(); int expandedHeight = Math.max(collapsedHeight, mActivity.getDeviceProfile().taskbarSize + offsetY); diff --git a/res/color-v31/overview_scrim_dark.xml b/res/color-v31/overview_scrim_dark.xml index 2ab8ecdec9..487b9f8266 100644 --- a/res/color-v31/overview_scrim_dark.xml +++ b/res/color-v31/overview_scrim_dark.xml @@ -14,5 +14,5 @@ limitations under the License. --> - + diff --git a/src/com/android/launcher3/settings/NotificationDotsPreference.java b/src/com/android/launcher3/settings/NotificationDotsPreference.java index 0ee27443ef..f2a052d0ed 100644 --- a/src/com/android/launcher3/settings/NotificationDotsPreference.java +++ b/src/com/android/launcher3/settings/NotificationDotsPreference.java @@ -89,7 +89,8 @@ public class NotificationDotsPreference extends Preference // Update intent Bundle extras = new Bundle(); extras.putString(EXTRA_FRAGMENT_ARG_KEY, "notification_badging"); - setIntent(new Intent("android.settings.NOTIFICATION_SETTINGS") + + setIntent(new Intent("android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY") .putExtra(EXTRA_SHOW_FRAGMENT_ARGS, extras)); }