diff --git a/quickstep/res/layout/taskbar_all_apps_button.xml b/quickstep/res/layout/taskbar_all_apps_button.xml index 6b665e5623..c50db2e24b 100644 --- a/quickstep/res/layout/taskbar_all_apps_button.xml +++ b/quickstep/res/layout/taskbar_all_apps_button.xml @@ -21,5 +21,4 @@ android:layout_height="@dimen/taskbar_icon_min_touch_size" android:contentDescription="@string/all_apps_button_label" android:backgroundTint="@android:color/transparent" - android:icon="@drawable/ic_all_apps_button" /> diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index bd71a9feb6..126ab7c442 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -286,6 +286,8 @@ 48dp 48dp 32dp + 6dp + 72dp @@ -295,6 +297,7 @@ 40dp 10dp 32dp + 4dp 16dp diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index c1e85aac2a..0b275a85ce 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -89,6 +89,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private float mTransientTaskbarMinWidth; + private float mTransientTaskbarAllAppsButtonTranslationXOffset; + public TaskbarView(@NonNull Context context) { this(context, null); } @@ -108,9 +110,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mActivityContext = ActivityContext.lookupContext(context); mIconLayoutBounds = mActivityContext.getTransientTaskbarBounds(); Resources resources = getResources(); + boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivityContext); mIsRtl = Utilities.isRtl(resources); mTransientTaskbarMinWidth = mContext.getResources().getDimension( R.dimen.transient_taskbar_min_width); + mTransientTaskbarAllAppsButtonTranslationXOffset = + resources.getDimension(isTransientTaskbar + ? R.dimen.transient_taskbar_all_apps_button_translation_x_offset + : R.dimen.taskbar_all_apps_button_translation_x_offset); int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing); int actualIconSize = mActivityContext.getDeviceProfile().iconSizePx; @@ -130,9 +137,12 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar if (!mActivityContext.getPackageManager().hasSystemFeature(FEATURE_PC)) { mAllAppsButton = (IconButtonView) LayoutInflater.from(context) .inflate(R.layout.taskbar_all_apps_button, this, false); + mAllAppsButton.setIconDrawable(resources.getDrawable(isTransientTaskbar + ? R.drawable.ic_transient_taskbar_all_apps_button + : R.drawable.ic_taskbar_all_apps_button)); mAllAppsButton.setScaleX(mIsRtl ? -1 : 1); - mAllAppsButton.setForegroundTint(mActivityContext.getColor( - DisplayController.isTransientTaskbar(mActivityContext) + mAllAppsButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); + mAllAppsButton.setForegroundTint(mActivityContext.getColor(isTransientTaskbar ? R.color.all_apps_button_color : R.color.all_apps_button_color_dark)); @@ -276,6 +286,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } if (mAllAppsButton != null) { + mAllAppsButton.setTranslationXForTaskbarAllAppsIcon(getChildCount() > 0 + ? mTransientTaskbarAllAppsButtonTranslationXOffset : 0f); addView(mAllAppsButton, mIsRtl ? getChildCount() : 0); // if only all apps button present, don't include divider view. diff --git a/res/drawable-sw600dp/ic_transient_taskbar_all_apps_button.xml b/res/drawable-sw600dp/ic_transient_taskbar_all_apps_button.xml new file mode 100644 index 0000000000..6e740aed4f --- /dev/null +++ b/res/drawable-sw600dp/ic_transient_taskbar_all_apps_button.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + diff --git a/res/drawable/ic_all_apps_button.xml b/res/drawable-sw720dp/ic_transient_taskbar_all_apps_button.xml similarity index 100% rename from res/drawable/ic_all_apps_button.xml rename to res/drawable-sw720dp/ic_transient_taskbar_all_apps_button.xml diff --git a/res/drawable/ic_taskbar_all_apps_button.xml b/res/drawable/ic_taskbar_all_apps_button.xml new file mode 100644 index 0000000000..82fbbea617 --- /dev/null +++ b/res/drawable/ic_taskbar_all_apps_button.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index b109e8ab1c..bd5c863283 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -113,6 +113,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private float mScaleForReorderBounce = 1f; + private float mTranslationXForTaskbarAllAppsIcon = 0f; + private static final Property DOT_SCALE_PROPERTY = new Property(Float.TYPE, "dotScale") { @Override @@ -958,6 +960,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private void updateTranslation() { super.setTranslationX(mTranslationForReorderBounce.x + mTranslationForReorderPreview.x + + mTranslationXForTaskbarAllAppsIcon + mTranslationForMoveFromCenterAnimation.x + mTranslationXForTaskbarAlignmentAnimation + mTranslationXForTaskbarRevealAnimation @@ -969,6 +972,14 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, + mTranslationYForTaskbarRevealAnimation); } + /** + * Sets translationX for taskbar all apps icon + */ + public void setTranslationXForTaskbarAllAppsIcon(float translationX) { + mTranslationXForTaskbarAllAppsIcon = translationX; + updateTranslation(); + } + public void setReorderBounceOffset(float x, float y) { mTranslationForReorderBounce.set(x, y); updateTranslation(); diff --git a/src/com/android/launcher3/views/IconButtonView.java b/src/com/android/launcher3/views/IconButtonView.java index 64e9327dfa..9969eebe06 100644 --- a/src/com/android/launcher3/views/IconButtonView.java +++ b/src/com/android/launcher3/views/IconButtonView.java @@ -31,6 +31,7 @@ import android.os.Build; import android.util.AttributeSet; import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; import com.android.launcher3.BubbleTextView; import com.android.launcher3.icons.BaseIconFactory; @@ -70,6 +71,15 @@ public class IconButtonView extends BubbleTextView { } } + /** Sets given Drawable as icon */ + public void setIconDrawable(@NonNull Drawable drawable) { + ColorStateList tintList = getBackgroundTintList(); + int tint = tintList == null ? Color.WHITE : tintList.getDefaultColor(); + try (BaseIconFactory factory = LauncherIcons.obtain(getContext())) { + setIcon(new IconDrawable(factory.getWhiteShadowLayer(), tint, drawable)); + } + } + /** Updates the color of the icon's foreground layer. */ public void setForegroundTint(@ColorInt int tintColor) { FastBitmapDrawable icon = getIcon();