mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Use custom accent colour for App Drawer empty state illustration
This commit is contained in:
12
res/drawable/ic_all_apps_bg_bag.xml
Normal file
12
res/drawable/ic_all_apps_bg_bag.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:name="vector"
|
||||
android:width="52dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="52"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:name="path"
|
||||
android:fillColor="#4285f4"
|
||||
android:pathData="M 33.6 5.7 L 33.3 3.6 L 28.4 0 L 15.8 1.9 L 12.2 6.8 L 12.5 8.9 L 0 10.8 L 5.2 44.5 C 5.5 46.2 7.1 47.4 8.8 47.2 L 48.8 41.1 C 50.5 40.8 51.7 39.2 51.5 37.5 L 46.3 3.7 L 33.6 5.7 Z M 29.4 6.3 L 16.8 8.2 L 16.5 6.1 L 29.1 4.2 L 29.4 6.3 Z"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
@@ -25,22 +25,6 @@
|
||||
android:pathData="M89.4,61.8H85l-1.6-1.5c5.5-6.4,8.8-14.7,8.8-23.7C92.2,16.6,76,0.3,55.9,0.3
|
||||
S19.5,16.6,19.5,36.6S35.8,73,55.9,73c9,0,17.3-3.3,23.7-8.8l1.5,1.6v4.4l40.5,40.4l8.3-8.3L89.4,61.8z M54,66.6
|
||||
c-13.9,0-28.8-16-28.8-30S41.5,8.9,55.4,8.9S81,22.7,81,36.6S67.9,66.6,54,66.6z"/>
|
||||
<path
|
||||
android:fillColor="#1A000000"
|
||||
android:pathData="M33.4,29.2l-0.3-1.8l-4.2-3.1L18.1,26l-3.1,4.2l0.3,1.8L4.5,33.7L9,62.5
|
||||
c0.2,1.5,1.6,2.5,3.1,2.3l34.2-5.3c1.5-0.2,2.5-1.6,2.3-3.1l-4.4-28.8L33.4,29.2z"/>
|
||||
<path
|
||||
android:fillColor="#3367D6"
|
||||
android:pathData="M30.2,27.9l-0.3-1.8l-4.1-3L15,24.7l-3,4.1l0.3,1.8L1.6,32.3L6,60.9
|
||||
c0.2,1.5,1.6,2.5,3.1,2.3L43,57.9c1.5-0.2,2.5-1.6,2.3-3.1l-4.4-28.6L30.2,27.9z M26.6,28.4l-10.7,1.6l-0.3-1.8l10.7-1.6L26.6,28.4z"/>
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M25.1,37.7a28.9,28.9 0 1,0 57.8,0a28.9,28.9 0 1,0 -57.8,0"/>
|
||||
<path
|
||||
android:fillColor="#4285F4"
|
||||
android:pathData="M41.7,23l-0.3-2.1l-4.9-3.6l-12.6,1.9l-3.6,4.9l0.3,2.1L8.1,28.1l5.2,33.7
|
||||
c0.3,1.7,1.9,2.9,3.6,2.7l40-6.1c1.7-0.3,2.9-1.9,2.7-3.6L54.4,21L41.7,23z M37.5,23.6l-12.6,1.9l-0.3-2.1l12.6-1.9L37.5,23.6z"/>
|
||||
</group>
|
||||
<path
|
||||
android:fillColor="?android:attr/colorControlHighlight"
|
||||
android:pathData="M87.5,62.9h-4.4l-1.6-1.5c5.5-6.4,8.8-14.7,8.8-23.7C90.3,17.7,74,1.4,54,1.4
|
||||
|
||||
@@ -26,6 +26,8 @@ import android.graphics.drawable.Drawable;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.android.launcher3.LauncherAnimUtils;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.Themes;
|
||||
@@ -68,6 +70,10 @@ public class AllAppsBackgroundDrawable extends Drawable {
|
||||
return mAlpha;
|
||||
}
|
||||
|
||||
public void setTint(@ColorInt int tint) {
|
||||
mImage.setTint(tint);
|
||||
}
|
||||
|
||||
public void updateBounds(Rect bounds) {
|
||||
int width = mImage.getIntrinsicWidth();
|
||||
int height = mImage.getIntrinsicHeight();
|
||||
@@ -93,6 +99,8 @@ public class AllAppsBackgroundDrawable extends Drawable {
|
||||
|
||||
protected final TransformedImageDrawable mHand;
|
||||
protected final TransformedImageDrawable[] mIcons;
|
||||
protected final TransformedImageDrawable mBag;
|
||||
protected final TransformedImageDrawable mBagShadow;
|
||||
private final int mWidth;
|
||||
private final int mHeight;
|
||||
|
||||
@@ -109,6 +117,10 @@ public class AllAppsBackgroundDrawable extends Drawable {
|
||||
: R.style.AllAppsEmptySearchBackground);
|
||||
mHand = new TransformedImageDrawable(context, R.drawable.ic_all_apps_bg_hand,
|
||||
0.575f, 0.f, Gravity.CENTER_HORIZONTAL);
|
||||
mBag = new TransformedImageDrawable(context, R.drawable.ic_all_apps_bg_bag,
|
||||
0.46f, 0.04f, Gravity.CENTER_HORIZONTAL);
|
||||
mBagShadow = new TransformedImageDrawable(context, R.drawable.ic_all_apps_bg_bag,
|
||||
0.4635f, 0.044f, Gravity.CENTER_HORIZONTAL);
|
||||
mIcons = new TransformedImageDrawable[4];
|
||||
mIcons[0] = new TransformedImageDrawable(context, R.drawable.ic_all_apps_bg_icon_1,
|
||||
0.375f, 0, Gravity.CENTER_HORIZONTAL);
|
||||
@@ -118,6 +130,10 @@ public class AllAppsBackgroundDrawable extends Drawable {
|
||||
0.475f, 0.26f, Gravity.CENTER_HORIZONTAL);
|
||||
mIcons[3] = new TransformedImageDrawable(context, R.drawable.ic_all_apps_bg_icon_4,
|
||||
0.7f, 0.125f, Gravity.CENTER_HORIZONTAL);
|
||||
|
||||
@ColorInt int accentColor = Themes.getColorAccent(context);
|
||||
mBag.setTint(accentColor);
|
||||
mBagShadow.setTint(0x1A000000);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,6 +173,8 @@ public class AllAppsBackgroundDrawable extends Drawable {
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
mBagShadow.draw(canvas);
|
||||
mBag.draw(canvas);
|
||||
mHand.draw(canvas);
|
||||
for (int i = 0; i < mIcons.length; i++) {
|
||||
mIcons[i].draw(canvas);
|
||||
@@ -166,6 +184,8 @@ public class AllAppsBackgroundDrawable extends Drawable {
|
||||
@Override
|
||||
protected void onBoundsChange(Rect bounds) {
|
||||
super.onBoundsChange(bounds);
|
||||
mBagShadow.updateBounds(bounds);
|
||||
mBag.updateBounds(bounds);
|
||||
mHand.updateBounds(bounds);
|
||||
for (int i = 0; i < mIcons.length; i++) {
|
||||
mIcons[i].updateBounds(bounds);
|
||||
@@ -175,6 +195,8 @@ public class AllAppsBackgroundDrawable extends Drawable {
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
mBagShadow.setAlpha(alpha);
|
||||
mBag.setAlpha(alpha);
|
||||
mHand.setAlpha(alpha);
|
||||
for (int i = 0; i < mIcons.length; i++) {
|
||||
mIcons[i].setAlpha(alpha);
|
||||
|
||||
Reference in New Issue
Block a user