From c77791ba2e17310d565f2b162db01bb8ef276229 Mon Sep 17 00:00:00 2001 From: Charlie Anderson Date: Fri, 28 Jun 2024 16:16:23 -0400 Subject: [PATCH] Update system shortcut icons to filled GM3 versions Flag: com.android.launcher3.enable_launcher_visual_refresh Bug: 364950287 Test: manually and popup screenshot tests Change-Id: I5e4c964b60a4254f9f67c8128e23f5b04b621541 --- .../HotseatPredictionController.java | 10 +++++- res/drawable/hourglass_24px.xml | 10 ++++++ res/drawable/info_24px.xml | 10 ++++++ res/drawable/keep_24px.xml | 10 ++++++ res/drawable/splitscreen_24px.xml | 10 ++++++ res/drawable/widgets_24px.xml | 10 ++++++ src/com/android/launcher3/Utilities.java | 9 ++++-- src/com/android/launcher3/folder/Folder.java | 4 +++ .../launcher3/popup/RemoteActionShortcut.java | 24 ++++++++++---- .../launcher3/popup/SystemShortcut.java | 31 +++++++++++++++---- 10 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 res/drawable/hourglass_24px.xml create mode 100644 res/drawable/info_24px.xml create mode 100644 res/drawable/keep_24px.xml create mode 100644 res/drawable/splitscreen_24px.xml create mode 100644 res/drawable/widgets_24px.xml diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java index 44aa764900..71a45d5472 100644 --- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java @@ -509,10 +509,18 @@ public class HotseatPredictionController implements DragController.DragListener, private class PinPrediction extends SystemShortcut { private PinPrediction(QuickstepLauncher target, ItemInfo itemInfo, View originalView) { - super(R.drawable.ic_pin, R.string.pin_prediction, target, + super(getDrawableId(), R.string.pin_prediction, target, itemInfo, originalView); } + public static int getDrawableId() { + if (Flags.enableLauncherVisualRefresh()) { + return R.drawable.keep_24px; + } else { + return R.drawable.ic_pin; + } + } + @Override public void onClick(View view) { dismissTaskMenuView(); diff --git a/res/drawable/hourglass_24px.xml b/res/drawable/hourglass_24px.xml new file mode 100644 index 0000000000..302231ec71 --- /dev/null +++ b/res/drawable/hourglass_24px.xml @@ -0,0 +1,10 @@ + + + diff --git a/res/drawable/info_24px.xml b/res/drawable/info_24px.xml new file mode 100644 index 0000000000..734cadf9ef --- /dev/null +++ b/res/drawable/info_24px.xml @@ -0,0 +1,10 @@ + + + diff --git a/res/drawable/keep_24px.xml b/res/drawable/keep_24px.xml new file mode 100644 index 0000000000..ff9bff64bf --- /dev/null +++ b/res/drawable/keep_24px.xml @@ -0,0 +1,10 @@ + + + diff --git a/res/drawable/splitscreen_24px.xml b/res/drawable/splitscreen_24px.xml new file mode 100644 index 0000000000..3485251abf --- /dev/null +++ b/res/drawable/splitscreen_24px.xml @@ -0,0 +1,10 @@ + + + diff --git a/res/drawable/widgets_24px.xml b/res/drawable/widgets_24px.xml new file mode 100644 index 0000000000..d849fb45af --- /dev/null +++ b/res/drawable/widgets_24px.xml @@ -0,0 +1,10 @@ + + + diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 648367b665..c392772da9 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -843,9 +843,12 @@ public final class Utilities { */ public static List getSplitPositionOptions( DeviceProfile dp) { - int splitIconRes = dp.isLeftRightSplit - ? R.drawable.ic_split_horizontal - : R.drawable.ic_split_vertical; + int splitIconRes; + if (dp.isLeftRightSplit) { + splitIconRes = R.drawable.ic_split_horizontal; + } else { + splitIconRes = R.drawable.ic_split_vertical; + } int stagePosition = dp.isLeftRightSplit ? STAGE_POSITION_BOTTOM_OR_RIGHT : STAGE_POSITION_TOP_OR_LEFT; diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 329e1ee044..9be30bfbfb 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -43,6 +43,7 @@ import android.graphics.Canvas; import android.graphics.Insets; import android.graphics.Path; import android.graphics.Rect; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.os.Looper; @@ -310,6 +311,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo mFooter = findViewById(R.id.folder_footer); mFooterHeight = dp.folderFooterHeightPx; mFolderName = findViewById(R.id.folder_name); + if (Flags.enableLauncherVisualRefresh()) { + mFolderName.setTypeface(Typeface.create("google-sans-flex", Typeface.NORMAL)); + } mFolderName.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp.folderLabelTextSizePx); mFolderName.setOnBackKeyListener(this); mFolderName.setOnEditorActionListener(this); diff --git a/src/com/android/launcher3/popup/RemoteActionShortcut.java b/src/com/android/launcher3/popup/RemoteActionShortcut.java index 0860ae5743..f23c7f6274 100644 --- a/src/com/android/launcher3/popup/RemoteActionShortcut.java +++ b/src/com/android/launcher3/popup/RemoteActionShortcut.java @@ -33,6 +33,7 @@ import android.widget.TextView; import android.widget.Toast; import com.android.launcher3.AbstractFloatingView; +import com.android.launcher3.Flags; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.model.data.ItemInfo; @@ -54,17 +55,28 @@ public class RemoteActionShortcut extends S @Override public void setIconAndLabelFor(View iconView, TextView labelView) { - mAction.getIcon().loadDrawableAsync(iconView.getContext(), - iconView::setBackground, - MAIN_EXECUTOR.getHandler()); + if (Flags.enableLauncherVisualRefresh()) { + // temporarily force icon update until b/402211847 + iconView.setBackground(iconView.getContext().getDrawable(R.drawable.hourglass_24px)); + } else { + mAction.getIcon().loadDrawableAsync(iconView.getContext(), + iconView::setBackground, + MAIN_EXECUTOR.getHandler()); + } + labelView.setText(mAction.getTitle()); } @Override public void setIconAndContentDescriptionFor(ImageView view) { - mAction.getIcon().loadDrawableAsync(view.getContext(), - view::setImageDrawable, - MAIN_EXECUTOR.getHandler()); + if (Flags.enableLauncherVisualRefresh()) { + // temporarily force icon update until b/402211847 + view.setImageDrawable(view.getContext().getDrawable(R.drawable.hourglass_24px)); + } else { + mAction.getIcon().loadDrawableAsync(view.getContext(), + view::setImageDrawable, + MAIN_EXECUTOR.getHandler()); + } view.setContentDescription(mAction.getContentDescription()); } diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index b7efdecb8d..2c5b510b0f 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -125,9 +125,20 @@ public abstract class SystemShortcut extends ItemInfo }; public static class Widgets extends SystemShortcut { + public Widgets(T target, ItemInfo itemInfo, @NonNull View originalView) { - super(R.drawable.ic_widget, R.string.widget_button_text, target, itemInfo, - originalView); + super(getDrawableId(), R.string.widget_button_text, target, itemInfo, originalView); + } + + /** + * @return drawable for Widget shortcut icon + */ + public static int getDrawableId() { + if (Flags.enableLauncherVisualRefresh()) { + return R.drawable.widgets_24px; + } else { + return R.drawable.ic_widget; + } } @Override @@ -150,10 +161,20 @@ public abstract class SystemShortcut extends ItemInfo private SplitAccessibilityInfo mSplitA11yInfo; public AppInfo(T target, ItemInfo itemInfo, @NonNull View originalView) { - super(R.drawable.ic_info_no_shadow, R.string.app_info_drop_target_label, target, + super(getDrawableId(), R.string.app_info_drop_target_label, target, itemInfo, originalView); } + /** + * @return drawable for App Info shortcut icon + */ + public static int getDrawableId() { + if (Flags.enableLauncherVisualRefresh()) { + return R.drawable.info_24px; + } else { + return R.drawable.ic_info_no_shadow; + } + } /** * Constructor used by overview for staged split to provide custom A11y information. * @@ -289,9 +310,7 @@ public abstract class SystemShortcut extends ItemInfo && ((WorkspaceItemInfo) itemInfo).hasStatusFlag( WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI); boolean isInstantApp = false; - if (itemInfo instanceof com.android.launcher3.model.data.AppInfo) { - com.android.launcher3.model.data.AppInfo - appInfo = (com.android.launcher3.model.data.AppInfo) itemInfo; + if (itemInfo instanceof com.android.launcher3.model.data.AppInfo appInfo) { isInstantApp = InstantAppResolver.newInstance( originalView.getContext()).isInstantApp(appInfo); }