mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Brighten theme-icons when in Dark mode and add dark color for taskbar
Bug: 217247494 Test: change between dark and light mode and transition in and out of apps Change-Id: Ia5e38d674a56eb95a48cb1e8c2688586594a69f9
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user