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

Commit 3fb35d3f authored by Saumya Prakash's avatar Saumya Prakash Committed by Android (Google) Code Review
Browse files

Merge "Remove the tint from taskbar themed icons for dark mode." into main

parents 164d162e ba04c0c1
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -206,17 +206,10 @@ public class TaskbarModelCallbacks implements

        if (mDeferUpdatesForSUW) {
            ItemInfo[] finalHotseatItemInfos = hotseatItemInfos;
            mDeferredUpdates = () -> {
                updateHotseatItemsAndBackground(finalHotseatItemInfos);
            };
            mDeferredUpdates = () -> mContainer.updateHotseatItems(finalHotseatItemInfos);
        } else {
            updateHotseatItemsAndBackground(hotseatItemInfos);
        }
    }

    private void updateHotseatItemsAndBackground(ItemInfo[] hotseatItemInfos) {
            mContainer.updateHotseatItems(hotseatItemInfos);
        mControllers.taskbarViewController.updateIconsBackground();
        }
    }

    /**
+0 −17
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.apppairs.AppPairIcon;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.folder.PreviewBackground;
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;
@@ -60,7 +59,6 @@ import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.LauncherBindableItemsContainer;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.DoubleShadowBubbleTextView;
import com.android.launcher3.views.IconButtonView;

import java.util.function.Predicate;
@@ -409,21 +407,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
        }
    }

    /**
     * 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);
                }
            }
        }
    }

    /**
     * Sets OnClickListener and OnLongClickListener for the given view.
     */
+1 −36
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import android.view.View;
import android.view.animation.Interpolator;

import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;
import androidx.core.view.OneShotPreDrawListener;

import com.android.app.animation.Interpolators;
@@ -62,7 +61,6 @@ import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.RevealOutlineAnimation;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.ThemedIconDrawable;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -93,8 +91,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
    public static final int ALPHA_INDEX_SMALL_SCREEN = 6;
    private static final int NUM_ALPHA_CHANNELS = 7;

    private static final float TASKBAR_DARK_THEME_ICONS_BACKGROUND_LUMINANCE = 0.30f;

    private final TaskbarActivityContext mActivity;
    private final TaskbarView mTaskbarView;
    private final MultiValueAlpha mTaskbarIconAlpha;
@@ -125,12 +121,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar

    private int mTaskbarBottomMargin;
    private final int mStashedHandleHeight;
    private final int mLauncherThemedIconsBackgroundColor;
    private final int mTaskbarThemedIconsBackgroundColor;

    /** Progress from {@code 0} for Launcher's color to {@code 1} for Taskbar's color. */
    private final AnimatedFloat mThemedIconsBackgroundProgress = new AnimatedFloat(
            this::updateIconsBackground);

    private final TaskbarModelCallbacks mModelCallbacks;

@@ -173,16 +163,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        mTaskbarBottomMargin = activity.getDeviceProfile().taskbarBottomMargin;
        mStashedHandleHeight = activity.getResources()
                .getDimensionPixelSize(R.dimen.taskbar_stashed_handle_height);
        mLauncherThemedIconsBackgroundColor = ThemedIconDrawable.getColors(mActivity)[0];
        if (!Utilities.isDarkTheme(mActivity)) {
            mTaskbarThemedIconsBackgroundColor = mLauncherThemedIconsBackgroundColor;
        } else {
            // Increase luminance for dark themed icons given they are on a dark Taskbar background.
            float[] colorHSL = new float[3];
            ColorUtils.colorToHSL(mLauncherThemedIconsBackgroundColor, colorHSL);
            colorHSL[2] = TASKBAR_DARK_THEME_ICONS_BACKGROUND_LUMINANCE;
            mTaskbarThemedIconsBackgroundColor = ColorUtils.HSLToColor(colorHSL);
        }

        mIsRtl = Utilities.isRtl(mTaskbarView.getResources());
        mTaskbarLeftRightMargin = mActivity.getResources().getDimensionPixelSize(
                R.dimen.transient_taskbar_padding);
@@ -470,18 +451,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        return taskbarIconTranslationYForPinningValue;
    }

    /**
     * Updates the Taskbar's themed icons background according to the progress between in-app/home.
     */
    protected void updateIconsBackground() {
        mTaskbarView.setThemedIconsBackgroundColor(
                ColorUtils.blendARGB(
                        mLauncherThemedIconsBackgroundColor,
                        mTaskbarThemedIconsBackgroundColor,
                        mThemedIconsBackgroundProgress.value
                ));
    }

    private ValueAnimator createRevealAnimForView(View view, boolean isStashed, float newWidth,
            boolean isQsb, boolean dispatchOnAnimationStart) {
        Rect viewBounds = new Rect(0, 0, view.getWidth(), view.getHeight());
@@ -679,10 +648,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        setter.setFloat(mTaskbarNavButtonTranslationY, VALUE, -offsetY, interpolator);
        setter.setFloat(mTaskbarNavButtonTranslationYForInAppDisplay, VALUE, offsetY, interpolator);

        if (Utilities.isDarkTheme(mTaskbarView.getContext())) {
            setter.addFloat(mThemedIconsBackgroundProgress, VALUE, 1f, 0f, LINEAR);
        }

        int collapsedHeight = mActivity.getDefaultTaskbarWindowSize();
        int expandedHeight = Math.max(collapsedHeight, taskbarDp.taskbarHeight + offsetY);
        setter.addOnFrameListener(anim -> mActivity.setTaskbarWindowSize(