Migrate materialColor* attributes into colors
TLDR: * This change should not break anything or change any color. * Simplifies theming and styling while improving developer experience. * With this developers can often skip styling for color entirely, while ensuring consistency and preventing accidental overrides. Bug: 374273611 Test: presubmit Flag: EXEMPT bugfix Change-Id: Id19038078e83c73847b1a7c686c3a3df1ecccac2
This commit is contained in:
1 parent
ad43c3dbc9
commit
bc02103a6a
87 files changed
+245
-314
No files matched your search
@@ -37,7 +37,6 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.allapps.FloatingHeaderRow;
|
||||
import com.android.launcher3.allapps.FloatingHeaderView;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
||||
/**
|
||||
* A view which shows a horizontal divider
|
||||
@@ -85,9 +84,9 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
|
||||
getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height)
|
||||
};
|
||||
|
||||
mStrokeColor = Themes.getAttrColor(context, R.attr.materialColorOutlineVariant);
|
||||
mStrokeColor = context.getColor(R.color.materialColorOutlineVariant);
|
||||
|
||||
mAllAppsLabelTextColor = Themes.getAttrColor(context, R.attr.materialColorOnSurfaceVariant);
|
||||
mAllAppsLabelTextColor = context.getColor(R.color.materialColorOnSurfaceVariant);
|
||||
|
||||
mAccessibilityManager = AccessibilityManager.getInstance(context);
|
||||
setShowAllAppsLabel(!ALL_APPS_VISITED_COUNT.hasReachedMax(context));
|
||||
|
||||
@@ -148,7 +148,7 @@ class ManageWindowsTaskbarShortcut<T>(
|
||||
) :
|
||||
ManageWindowsViewContainer(
|
||||
originalView.context,
|
||||
Themes.getAttrColor(originalView.context, R.attr.materialColorSurfaceBright),
|
||||
originalView.context.getColor(R.color.materialColorSurfaceBright),
|
||||
),
|
||||
TouchController {
|
||||
private val taskbarActivityContext = controllers.taskbarActivityContext
|
||||
|
||||
@@ -45,15 +45,12 @@ private const val EXIT_DURATION_MS = 150L
|
||||
/** Floating tooltip for Taskbar education. */
|
||||
class TaskbarEduTooltip
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0,
|
||||
) : AbstractFloatingView(context, attrs, defStyleAttr) {
|
||||
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
|
||||
AbstractFloatingView(context, attrs, defStyleAttr) {
|
||||
|
||||
private val activityContext: ActivityContext = ActivityContext.lookupContext(context)
|
||||
|
||||
private val backgroundColor = Themes.getAttrColor(context, R.attr.materialColorSurfaceBright)
|
||||
private val backgroundColor = context.getColor(R.color.materialColorSurfaceBright)
|
||||
|
||||
private val tooltipCornerRadius = Themes.getDialogCornerRadius(context)
|
||||
private val arrowWidth = resources.getDimension(R.dimen.popup_arrow_width)
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
@@ -217,14 +216,8 @@ public class BubbleCreator {
|
||||
private Bitmap createOverflowBitmap() {
|
||||
Drawable iconDrawable = mContext.getDrawable(R.drawable.bubble_ic_overflow_button);
|
||||
|
||||
final TypedArray ta = mContext.obtainStyledAttributes(
|
||||
new int[]{
|
||||
R.attr.materialColorOnPrimaryFixed,
|
||||
R.attr.materialColorPrimaryFixed
|
||||
});
|
||||
int overflowIconColor = ta.getColor(0, Color.WHITE);
|
||||
int overflowBackgroundColor = ta.getColor(1, Color.BLACK);
|
||||
ta.recycle();
|
||||
int overflowIconColor = mContext.getColor(R.color.materialColorOnPrimaryFixed);
|
||||
int overflowBackgroundColor = mContext.getColor(R.color.materialColorPrimaryFixed);
|
||||
|
||||
iconDrawable.setTint(overflowIconColor);
|
||||
|
||||
|
||||
@@ -402,18 +402,13 @@ class BubbleBarFlyoutView(
|
||||
val isNightModeOn = nightModeFlags == Configuration.UI_MODE_NIGHT_YES
|
||||
val defaultBackgroundColor = if (isNightModeOn) Color.BLACK else Color.WHITE
|
||||
val defaultTextColor = if (isNightModeOn) Color.WHITE else Color.BLACK
|
||||
val ta =
|
||||
context.obtainStyledAttributes(
|
||||
intArrayOf(
|
||||
com.android.internal.R.attr.materialColorSurfaceContainer,
|
||||
com.android.internal.R.attr.materialColorOnSurface,
|
||||
com.android.internal.R.attr.materialColorOnSurfaceVariant,
|
||||
)
|
||||
)
|
||||
backgroundColor = ta.getColor(0, defaultBackgroundColor)
|
||||
title.setTextColor(ta.getColor(1, defaultTextColor))
|
||||
message.setTextColor(ta.getColor(2, defaultTextColor))
|
||||
ta.recycle()
|
||||
|
||||
backgroundColor =
|
||||
context.getColor(com.android.internal.R.color.materialColorSurfaceContainer)
|
||||
title.setTextColor(context.getColor(com.android.internal.R.color.materialColorOnSurface))
|
||||
message.setTextColor(
|
||||
context.getColor(com.android.internal.R.color.materialColorOnSurfaceVariant)
|
||||
)
|
||||
backgroundPaint.color = backgroundColor
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user