From 44950791f3ebebbb63401c1a3478de5bbcbd6a34 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 20 Aug 2026 21:13:08 +0700 Subject: [PATCH] fix: Inconsistent L3 theming around work pfp and widget selector (#7185) --- .../theme/drawable/DrawableTokens.kt | 23 +++++++++++++++++++ .../launcher3/allapps/WorkPausedCard.java | 21 ++++++++++++++--- .../launcher3/allapps/WorkUtilityView.java | 16 +++++++++++++ .../android/launcher3/widget/WidgetCell.java | 5 ++++ 4 files changed, 62 insertions(+), 3 deletions(-) diff --git a/lawnchair/src/app/lawnchair/theme/drawable/DrawableTokens.kt b/lawnchair/src/app/lawnchair/theme/drawable/DrawableTokens.kt index e0f0127789..fbd9065aab 100644 --- a/lawnchair/src/app/lawnchair/theme/drawable/DrawableTokens.kt +++ b/lawnchair/src/app/lawnchair/theme/drawable/DrawableTokens.kt @@ -186,6 +186,29 @@ object DrawableTokens { val WorkCard = ResourceDrawableToken(R.drawable.work_card) .setColor(ColorTokens.SurfaceContainerHighest) + @JvmField + val WorkFabBackground = ResourceDrawableToken(R.drawable.work_mode_fab_background) + .mutate { context, scheme, uiColorMode -> + val background = getDrawable(0) as? GradientDrawable + background?.setColor(ColorTokens.PrimaryButton.resolveColor(context, scheme, uiColorMode)) + } + + @JvmField + val WorkSchedulerBackground = ResourceDrawableToken(R.drawable.work_scheduler_background) + .mutate { context, scheme, uiColorMode -> + val background = getDrawable(0) as? GradientDrawable + background?.setColor(ColorTokens.PrimaryButton.resolveColor(context, scheme, uiColorMode)) + } + + @JvmField + val WorkAppsPausedActionButton = ResourceDrawableToken(R.drawable.bg_work_apps_paused_action_button) + .mutate { context, scheme, uiColorMode -> + val strokeWidth = context.resources.getDimensionPixelSize(R.dimen.work_apps_paused_button_stroke) + val strokeColor = ColorTokens.PrimaryButton.resolveColor(context, scheme, uiColorMode) + val background = findDrawableByLayerId(android.R.id.background) as? GradientDrawable + background?.setStroke(strokeWidth, strokeColor) + } + @JvmField val WidgetAddButtonBackground = ResourceDrawableToken(R.drawable.widget_cell_add_button_background) .setTint(ColorTokens.WidgetAddButtonBackgroundColor) diff --git a/src/com/android/launcher3/allapps/WorkPausedCard.java b/src/com/android/launcher3/allapps/WorkPausedCard.java index 15040f4dbd..7a0c6a8650 100644 --- a/src/com/android/launcher3/allapps/WorkPausedCard.java +++ b/src/com/android/launcher3/allapps/WorkPausedCard.java @@ -33,6 +33,7 @@ import com.android.launcher3.views.ActivityContext; import app.lawnchair.font.FontManager; import app.lawnchair.theme.color.tokens.ColorTokens; +import app.lawnchair.theme.drawable.DrawableTokens; /** * Work profile toggle switch shown at the bottom of AllApps work tab @@ -62,13 +63,25 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener mBtn = findViewById(R.id.enable_work_apps); mBtn.setOnClickListener(this); + setWorkProfilePausedResources(); updateStringFromCache(); } public void updateStringFromCache() { StringCache cache = mActivityContext.getStringCache(); if (cache != null) { - setWorkProfilePausedResources(); + if (cache.workProfilePausedTitle != null) { + TextView title = findViewById(R.id.work_apps_paused_title); + title.setText(cache.workProfilePausedTitle); + } + if (cache.workProfilePausedDescription != null) { + TextView body = findViewById(R.id.work_apps_paused_content); + body.setText(cache.workProfilePausedDescription); + } + if (cache.workProfileEnableButton != null) { + Button button = findViewById(R.id.enable_work_apps); + button.setText(cache.workProfileEnableButton); + } } } @@ -81,11 +94,13 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener TextView body = findViewById(R.id.work_apps_paused_content); body.setText(R.string.work_apps_paused_body); body.setTextColor(ColorTokens.TextColorPrimary.resolveColor(getContext())); - FontManager.INSTANCE.get(getContext()).setCustomFont(title, R.id.font_body_medium); + FontManager.INSTANCE.get(getContext()).setCustomFont(body, R.id.font_body_medium); Button button = findViewById(R.id.enable_work_apps); button.setText(R.string.work_apps_enable_btn_text); - FontManager.INSTANCE.get(getContext()).setCustomFont(title, R.id.font_button); + button.setBackground(DrawableTokens.WorkAppsPausedActionButton.resolve(getContext())); + button.setTextColor(ColorTokens.TextColorPrimary.resolveColor(getContext())); + FontManager.INSTANCE.get(getContext()).setCustomFont(button, R.id.font_button); button.setOnClickListener(this); } diff --git a/src/com/android/launcher3/allapps/WorkUtilityView.java b/src/com/android/launcher3/allapps/WorkUtilityView.java index 251c2b1059..6aef8de4a3 100644 --- a/src/com/android/launcher3/allapps/WorkUtilityView.java +++ b/src/com/android/launcher3/allapps/WorkUtilityView.java @@ -27,6 +27,7 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.content.Intent; +import android.content.res.ColorStateList; import android.graphics.Rect; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; @@ -58,6 +59,10 @@ import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.StringCache; import com.android.launcher3.views.ActivityContext; +import app.lawnchair.font.FontManager; +import app.lawnchair.theme.color.tokens.ColorTokens; +import app.lawnchair.theme.drawable.DrawableTokens; + import java.util.ArrayList; /** @@ -136,6 +141,17 @@ public class WorkUtilityView extends LinearLayout implements Insettable, mSchedulerButton = findViewById(R.id.work_scheduler); mWorkUtilityView = findViewById(R.id.work_utility_view); setSelected(true); + + // LC-Note: Theme work FAB and scheduler button with Lawnchair tokens + mWorkFAB.setBackground(DrawableTokens.WorkFabBackground.resolve(getContext())); + int onPrimaryColor = ColorTokens.TextColorPrimaryInverse.resolveColor(getContext()); + mPauseText.setTextColor(onPrimaryColor); + mWorkIcon.setImageTintList(ColorStateList.valueOf(onPrimaryColor)); + FontManager.INSTANCE.get(getContext()).setCustomFont(mPauseText, R.id.font_body_medium); + + mSchedulerButton.setBackground(DrawableTokens.WorkSchedulerBackground.resolve(getContext())); + mSchedulerButton.setImageTintList(ColorStateList.valueOf(onPrimaryColor)); + KeyboardInsetAnimationCallback keyboardInsetAnimationCallback = null; if (Utilities.ATLEAST_R) { diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index dbafb6e068..4d9bafd08d 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -67,8 +67,10 @@ import com.android.launcher3.widget.util.WidgetSizes; import java.util.function.Consumer; +import android.content.res.ColorStateList; import app.lawnchair.LawnchairAppWidgetHostView; import app.lawnchair.font.FontManager; +import app.lawnchair.theme.color.tokens.ColorTokens; import app.lawnchair.theme.drawable.DrawableTokens; /** @@ -165,6 +167,9 @@ public class WidgetCell extends LinearLayout { // LC: Allow customisability to the Add Button, Test: Press on any Widget on the Widget sheet. mWidgetAddButton.setBackground(DrawableTokens.WidgetAddButtonBackground.resolve(getContext())); + int widgetAddButtonTextColor = ColorTokens.TextColorPrimaryInverse.resolveColor(getContext()); + mWidgetAddButton.setTextColor(widgetAddButtonTextColor); + mWidgetAddButton.setCompoundDrawableTintList(ColorStateList.valueOf(widgetAddButtonTextColor)); fontManager.setCustomFont(mWidgetAddButton, R.id.font_body_medium); setAccessibilityDelegate(new AccessibilityDelegate() {