diff --git a/lawnchair/src/app/lawnchair/allapps/AllAppsSearchInput.kt b/lawnchair/src/app/lawnchair/allapps/AllAppsSearchInput.kt index c7ae7ca319..04788befc9 100644 --- a/lawnchair/src/app/lawnchair/allapps/AllAppsSearchInput.kt +++ b/lawnchair/src/app/lawnchair/allapps/AllAppsSearchInput.kt @@ -27,6 +27,7 @@ import app.lawnchair.preferences.PreferenceManager import app.lawnchair.preferences2.PreferenceManager2 import app.lawnchair.search.LawnchairRecentSuggestionProvider import app.lawnchair.search.algorithms.LawnchairSearchAlgorithm +import app.lawnchair.theme.color.tokens.ColorTokens import app.lawnchair.theme.drawable.DrawableTokens import com.android.launcher3.Insettable import com.android.launcher3.LauncherState @@ -162,7 +163,7 @@ class AllAppsSearchInput(context: Context, attrs: AttributeSet?) : focusedLowerCase.matches(Regex("^[\\x00-\\x7F]*$")) && focusedLowerCase.startsWith(inputLowerCase) ) { - val hintColor = Themes.getAttrColor(context, android.R.attr.textColorTertiary) + val hintColor = ColorTokens.TextColorTertiary.resolveColor(context) val hintText = SpannableStringBuilder(inputString) .append(focusedLowerCase.substring(inputLowerCase.length)) hintText.setSpan(ForegroundColorSpan(Color.TRANSPARENT), 0, inputLowerCase.length, SPAN_POINT_MARK) diff --git a/lawnchair/src/app/lawnchair/theme/color/tokens/ColorTokens.kt b/lawnchair/src/app/lawnchair/theme/color/tokens/ColorTokens.kt index 921557cb18..e2593450a8 100644 --- a/lawnchair/src/app/lawnchair/theme/color/tokens/ColorTokens.kt +++ b/lawnchair/src/app/lawnchair/theme/color/tokens/ColorTokens.kt @@ -22,6 +22,7 @@ object ColorTokens { val Neutral2_200 = SwatchColorToken(Swatch.Neutral2, Shade.S200) val Neutral2_300 = SwatchColorToken(Swatch.Neutral2, Shade.S300) val Neutral2_500 = SwatchColorToken(Swatch.Neutral2, Shade.S500) + val Neutral2_600 = SwatchColorToken(Swatch.Neutral2, Shade.S600) val Neutral2_700 = SwatchColorToken(Swatch.Neutral2, Shade.S700) val Neutral2_800 = SwatchColorToken(Swatch.Neutral2, Shade.S800) val Neutral2_900 = SwatchColorToken(Swatch.Neutral2, Shade.S900) @@ -35,6 +36,8 @@ object ColorTokens { val Accent1_500 = SwatchColorToken(Swatch.Accent1, Shade.S500) val Accent1_600 = SwatchColorToken(Swatch.Accent1, Shade.S600) val Accent1_700 = SwatchColorToken(Swatch.Accent1, Shade.S700) + val Accent1_900 = SwatchColorToken(Swatch.Accent1, Shade.S900) + val Accent2_50 = SwatchColorToken(Swatch.Accent2, Shade.S50) val Accent2_100 = SwatchColorToken(Swatch.Accent2, Shade.S100) val Accent2_300 = SwatchColorToken(Swatch.Accent2, Shade.S300) @@ -42,15 +45,20 @@ object ColorTokens { val Accent2_600 = SwatchColorToken(Swatch.Accent2, Shade.S600) val Accent2_800 = SwatchColorToken(Swatch.Accent2, Shade.S800) + + val Accent3_10 = SwatchColorToken(Swatch.Accent3, Shade.S10) val Accent3_50 = SwatchColorToken(Swatch.Accent3, Shade.S50) val Accent3_100 = SwatchColorToken(Swatch.Accent3, Shade.S100) val Accent3_200 = SwatchColorToken(Swatch.Accent3, Shade.S200) val Accent3_400 = SwatchColorToken(Swatch.Accent3, Shade.S400) val Accent3_600 = SwatchColorToken(Swatch.Accent3, Shade.S600) + val Accent3_800 = SwatchColorToken(Swatch.Accent3, Shade.S800) val SurfaceLight = Neutral1_500.setLStar(98.0) val SurfaceDark = Neutral1_800 + + @JvmField val Surface = DayNightColorToken(SurfaceLight, SurfaceDark) val SurfaceVariantLight = Neutral2_100 @@ -70,6 +78,8 @@ object ColorTokens { @JvmField val TextColorSecondary = DayNightColorToken(StaticColorToken(0xde000000), Neutral2_200) + @JvmField val TextColorTertiary = DayNightColorToken(Accent3_800, Accent3_10) + @JvmField val AllAppsHeaderProtectionColor = DayNightColorToken(Neutral1_100, Neutral1_700) @JvmField val AllAppsScrimColor = ColorBackground @@ -80,6 +90,8 @@ object ColorTokens { @JvmField val GroupHighlight = Surface + @JvmField val OverviewScrimColor = DayNightColorToken(Neutral2_500.setLStar(87.0), Neutral1_800) + @JvmField val OverviewScrim = DayNightColorToken(Neutral2_500.setLStar(87.0), Neutral1_800) .withPreferences { prefs -> val translucent = prefs.recentsTranslucentBackground.get() @@ -127,8 +139,14 @@ object ColorTokens { @JvmField val WorkspaceAccentColor = DarkTextColorToken(Accent1_100, Accent2_600) + @JvmField val DropTargetHoverTextColor = DarkTextColorToken(Accent1_900, Accent1_100) + @JvmField val WidgetListRowColor = DayNightColorToken(Neutral1_10, Neutral2_800) + @JvmField val SurfaceDimColor = DayNightColorToken(Neutral2_600.setLStar(87.0), Neutral2_600.setLStar(6.0)) + + @JvmField val SurfaceBrightColor = DayNightColorToken(Neutral2_600.setLStar(98.0), Neutral2_600.setLStar(24.0)) + val SwitchThumbOn = Accent1_100 val SwitchThumbOff = DayNightColorToken(Neutral2_300, Neutral1_400) val SwitchThumbDisabled = DayNightColorToken(Neutral2_100, Neutral1_700) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt index c45c66741d..efdfb6c2bc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt @@ -28,6 +28,7 @@ import android.view.ViewGroup import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.view.animation.Interpolator import androidx.core.view.updateLayoutParams +import app.lawnchair.theme.color.tokens.ColorTokens import com.android.app.animation.Interpolators.EMPHASIZED_ACCELERATE import com.android.app.animation.Interpolators.EMPHASIZED_DECELERATE import com.android.app.animation.Interpolators.STANDARD @@ -53,7 +54,7 @@ constructor( private val activityContext: ActivityContext = ActivityContext.lookupContext(context) private val backgroundColor = - Themes.getAttrColor(context, com.android.internal.R.attr.materialColorSurfaceBright) + ColorTokens.SurfaceBrightColor.resolveColor(getContext()) private val tooltipCornerRadius = Themes.getDialogCornerRadius(context) private val arrowWidth = resources.getDimension(R.dimen.popup_arrow_width) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 00ba5180ac..190b63876b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -60,6 +60,7 @@ import java.util.function.Predicate; import app.lawnchair.hotseat.HotseatMode; import app.lawnchair.preferences2.PreferenceManager2; +import app.lawnchair.theme.color.tokens.ColorTokens; /** * Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of @@ -146,8 +147,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mItemMarginLeftRight = actualMargin - (mIconTouchSize - visualIconSize) / 2; mItemPadding = (mIconTouchSize - actualIconSize) / 2; - mFolderLeaveBehindColor = Themes.getAttrColor(mActivityContext, - android.R.attr.textColorTertiary); + mFolderLeaveBehindColor = ColorTokens.TextColorTertiary.resolveColor(getContext()); // Needed to draw folder leave-behind when opening one. setWillNotDraw(false); diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt b/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt index b373911f3d..b67540bcae 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt +++ b/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt @@ -29,6 +29,7 @@ import android.view.View import android.view.ViewGroup import android.widget.FrameLayout import android.widget.LinearLayout +import app.lawnchair.theme.color.tokens.ColorTokens import com.android.launcher3.BaseDraggingActivity import com.android.launcher3.DeviceProfile import com.android.launcher3.InsettableFrameLayout @@ -149,7 +150,7 @@ class TaskMenuViewWithArrow : ArrowPopup { FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT ) - setBackgroundColor(Themes.getAttrColor(context, R.attr.overviewScrimColor)) + setBackgroundColor(ColorTokens.OverviewScrimColor.resolveColor(context)) alpha = 0f } popupContainer.addView(scrim) @@ -205,7 +206,7 @@ class TaskMenuViewWithArrow : ArrowPopup { override fun assignMarginsAndBackgrounds(viewGroup: ViewGroup) { assignMarginsAndBackgrounds( this, - Themes.getAttrColor(context, com.android.internal.R.attr.colorSurface) + ColorTokens.Surface.resolveColor(context) ) } diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java index 66a00b18d5..680d9cb809 100644 --- a/src/com/android/launcher3/ButtonDropTarget.java +++ b/src/com/android/launcher3/ButtonDropTarget.java @@ -121,7 +121,7 @@ public abstract class ButtonDropTarget extends TextView private void setTextColor() { int normalColor = ColorTokens.WorkspaceAccentColor.resolveColor(getContext()); - int selectedColor = Themes.getAttrColor(getContext(), R.attr.dropTargetHoverTextColor); + int selectedColor = ColorTokens.DropTargetHoverTextColor.resolveColor(getContext()); setTextColor(new ColorStateList( new int[][] { new int[] { -android.R.attr.state_selected }, new int[] { android.R.attr.state_selected } }, diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 2ec410457d..ce9885a519 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -25,6 +25,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.ScrollableLayoutManager.PREDICTIVE_BACK_MIN_SCALE; +import static com.topjohnwu.superuser.internal.Utils.context; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -306,7 +307,7 @@ public class ActivityAllAppsContainerView 0 // Bottom left }; mBottomSheetBackgroundColor = - Themes.getAttrColor(getContext(), R.attr.materialColorSurfaceDim); + ColorTokens.SurfaceDimColor.resolveColor(getContext()); updateBackgroundVisibility(mActivityContext.getDeviceProfile()); mSearchUiManager.initializeSearch(this); } diff --git a/src/com/android/launcher3/views/RecyclerViewFastScroller.java b/src/com/android/launcher3/views/RecyclerViewFastScroller.java index 6d32a79faf..20cc9da77f 100644 --- a/src/com/android/launcher3/views/RecyclerViewFastScroller.java +++ b/src/com/android/launcher3/views/RecyclerViewFastScroller.java @@ -52,6 +52,8 @@ import com.android.launcher3.util.Themes; import java.util.Collections; import java.util.List; +import app.lawnchair.theme.color.tokens.ColorTokens; + /** * The track and scrollbar that shows when you scroll the list. */ @@ -145,7 +147,7 @@ public class RecyclerViewFastScroller extends View { super(context, attrs, defStyleAttr); mTrackPaint = new Paint(); - mTrackPaint.setColor(Themes.getAttrColor(context, android.R.attr.textColorPrimary)); + mTrackPaint.setColor(ColorTokens.TextColorPrimary.resolveColor(getContext())); mTrackPaint.setAlpha(MAX_TRACK_ALPHA); mThumbPaint = new Paint(); diff --git a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java index 1c88c4a466..06e30c0f43 100644 --- a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java +++ b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java @@ -51,6 +51,8 @@ import com.android.launcher3.util.Themes; import java.util.List; +import app.lawnchair.theme.color.tokens.ColorTokens; + public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implements OnClickListener, ItemInfoUpdateReceiver { private static final float SETUP_ICON_SIZE_FACTOR = 2f / 5; @@ -79,7 +81,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView mDisabledForSafeMode = disabledForSafeMode; mPaint = new TextPaint(); - mPaint.setColor(Themes.getAttrColor(getContext(), android.R.attr.textColorPrimary)); + mPaint.setColor(ColorTokens.TextColorPrimary.resolveColor(getContext())); mPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mLauncher.getDeviceProfile().iconTextSizePx, getResources().getDisplayMetrics())); setBackgroundResource(R.drawable.pending_widget_bg);