Merge "Update widget manipulation colors." into sc-dev

This commit is contained in:
TreeHugger Robot
2021-06-25 15:18:45 +00:00
committed by Android (Google) Code Review
11 changed files with 41 additions and 39 deletions

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?workspaceAccentColor" android:state_selected="false" />
<item android:color="?dropTargetHoverTextColor" android:state_selected="true" />
</selector>

View File

@@ -18,5 +18,5 @@
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:radius="28dp" />
<stroke android:width="2dp" android:color="?android:attr/colorAccent" />
<stroke android:width="2dp" android:color="?attr/workspaceAccentColor" />
</shape>

View File

@@ -16,6 +16,6 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?android:attr/colorAccent" />
<solid android:color="?attr/workspaceAccentColor" />
<corners android:radius="28dp" />
</shape>

View File

@@ -18,5 +18,5 @@
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:radius="@android:dimen/system_app_widget_background_radius" />
<stroke android:width="2dp" android:color="?android:attr/colorAccent" />
<stroke android:width="2dp" android:color="?attr/workspaceAccentColor" />
</shape>

View File

@@ -41,7 +41,7 @@
android:layout_gravity="left|center_vertical"
android:layout_marginLeft="@dimen/widget_handle_margin"
android:src="@drawable/ic_widget_resize_handle"
android:tint="?android:attr/colorAccent" />
android:tint="?attr/workspaceAccentColor" />
<!-- Top -->
<ImageView
@@ -51,7 +51,7 @@
android:layout_gravity="top|center_horizontal"
android:layout_marginTop="@dimen/widget_handle_margin"
android:src="@drawable/ic_widget_resize_handle"
android:tint="?android:attr/colorAccent" />
android:tint="?attr/workspaceAccentColor" />
<!-- Right -->
<ImageView
@@ -61,7 +61,7 @@
android:layout_gravity="right|center_vertical"
android:layout_marginRight="@dimen/widget_handle_margin"
android:src="@drawable/ic_widget_resize_handle"
android:tint="?android:attr/colorAccent" />
android:tint="?attr/workspaceAccentColor" />
<!-- Bottom -->
<ImageView
@@ -71,7 +71,7 @@
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="@dimen/widget_handle_margin"
android:src="@drawable/ic_widget_resize_handle"
android:tint="?android:attr/colorAccent" />
android:tint="?attr/workspaceAccentColor" />
<ImageButton
android:id="@+id/widget_reconfigure_button"

View File

@@ -41,4 +41,7 @@
<color name="wallpaper_popup_scrim">@android:color/system_neutral1_900</color>
<color name="folder_dot_color">@android:color/system_accent2_50</color>
<color name="workspace_accent_color_light">@android:color/system_accent2_700</color>
<color name="workspace_accent_color_dark">@android:color/system_accent1_50</color>
</resources>

View File

@@ -46,7 +46,8 @@
<attr name="folderHintColor" format="color" />
<attr name="isFolderDarkText" format="boolean" />
<attr name="workProfileOverlayTextColor" format="color" />
<attr name="gridColor" format="color" />
<attr name="workspaceAccentColor" format="color" />
<attr name="dropTargetHoverTextColor" format="color" />
<!-- BubbleTextView specific attributes. -->
<declare-styleable name="BubbleTextView">

View File

@@ -73,4 +73,7 @@
<color name="wallpaper_popup_scrim">?android:attr/colorAccent</color>
<color name="wallpaper_scrim_color">#0D878787</color>
<color name="workspace_accent_color_light">#ff254e47</color>
<color name="workspace_accent_color_dark">#ff9cfff2</color>
</resources>

View File

@@ -57,7 +57,8 @@
<item name="workProfileOverlayTextColor">#FF212121</item>
<item name="eduHalfSheetBGColor">?android:attr/colorAccent</item>
<item name="disabledIconAlpha">.54</item>
<item name="gridColor">?android:attr/colorAccent</item>
<item name="workspaceAccentColor">@color/workspace_accent_color_light</item>
<item name="dropTargetHoverTextColor">@color/workspace_text_color_light</item>
<item name="overviewScrimColor">@color/overview_scrim</item>
<item name="android:windowTranslucentStatus">false</item>
@@ -71,6 +72,8 @@
<style name="LauncherTheme.DarkMainColor" parent="@style/LauncherTheme">
<item name="disabledIconAlpha">.254</item>
<item name="workspaceAccentColor">@color/workspace_accent_color_dark</item>
<item name="dropTargetHoverTextColor">@color/workspace_text_color_dark</item>
</style>
@@ -250,7 +253,7 @@
<style name="DropTargetButtonBase" parent="@android:style/TextAppearance.DeviceDefault">
<item name="android:drawablePadding">8dp</item>
<item name="android:padding">16dp</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textColor">@color/drop_target_text</item>
<item name="android:textSize">@dimen/drop_target_text_size</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item>

View File

@@ -48,20 +48,6 @@ import com.android.launcher3.model.data.ItemInfo;
public abstract class ButtonDropTarget extends TextView
implements DropTarget, DragController.DragListener, OnClickListener {
private static final Property<ButtonDropTarget, Integer> TEXT_COLOR =
new Property<ButtonDropTarget, Integer>(Integer.TYPE, "textColor") {
@Override
public Integer get(ButtonDropTarget target) {
return target.getTextColor();
}
@Override
public void set(ButtonDropTarget target, Integer value) {
target.setTextColor(value);
}
};
private static final int[] sTempCords = new int[2];
private static final int DRAG_VIEW_DROP_DURATION = 285;
private static final float DRAG_VIEW_HOVER_OVER_OPACITY = 0.65f;
@@ -84,15 +70,12 @@ public abstract class ButtonDropTarget extends TextView
private final int mDrawableSize;
protected CharSequence mText;
protected ColorStateList mOriginalTextColor;
protected Drawable mDrawable;
private boolean mTextVisible = true;
private PopupWindow mToolTip;
private int mToolTipLocation;
private AnimatorSet mCurrentColorAnim;
public ButtonDropTarget(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@@ -110,7 +93,6 @@ public abstract class ButtonDropTarget extends TextView
protected void onFinishInflate() {
super.onFinishInflate();
mText = getText();
mOriginalTextColor = getTextColors();
setContentDescription(mText);
}
@@ -125,6 +107,7 @@ public abstract class ButtonDropTarget extends TextView
// drawableLeft and drawableStart.
mDrawable = getContext().getDrawable(resId).mutate();
mDrawable.setBounds(0, 0, mDrawableSize, mDrawableSize);
mDrawable.setTintList(getTextColors());
setCompoundDrawablesRelative(mDrawable, null, null, null);
}
@@ -191,12 +174,6 @@ public abstract class ButtonDropTarget extends TextView
@Override
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
mActive = !options.isKeyboardDrag && supportsDrop(dragObject.dragInfo);
mDrawable.setColorFilter(null);
if (mCurrentColorAnim != null) {
mCurrentColorAnim.cancel();
mCurrentColorAnim = null;
}
setTextColor(mOriginalTextColor);
setVisibility(mActive ? View.VISIBLE : View.GONE);
mAccessibleDrag = options.isAccessibleDrag;
@@ -317,10 +294,6 @@ public abstract class ButtonDropTarget extends TextView
mLauncher.getAccessibilityDelegate().handleAccessibleDrop(this, null, null);
}
public int getTextColor() {
return getTextColors().getDefaultColor();
}
public void setTextVisible(boolean isVisible) {
CharSequence newText = isVisible ? mText : "";
if (mTextVisible != isVisible || !TextUtils.equals(newText, getText())) {

View File

@@ -263,7 +263,7 @@ public class CellLayout extends ViewGroup {
mBackground.setCallback(this);
mBackground.setAlpha(0);
mGridColor = Themes.getAttrColor(getContext(), R.attr.gridColor);
mGridColor = Themes.getAttrColor(getContext(), R.attr.workspaceAccentColor);
mGridVisualizationPadding =
res.getDimensionPixelSize(R.dimen.grid_visualization_cell_spacing);
mGridVisualizationRoundingRadius =