diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 7519393454..ee3f79d921 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -375,7 +375,7 @@ 48dp 32dp 6dp - 5.5dp + 0dp 64dp 64dp 48dp @@ -397,7 +397,6 @@ 10dp 32dp 8dp - 8dp 400dp 8dp 16dp diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index ea49c035f2..f743a4212a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -593,6 +593,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { && !mDeviceProfile.isTaskbarPresent; } + public boolean isTaskbarInMinimalState() { + return mControllers.taskbarViewController.isTaskbarInMinimalState(); + } + /** * @return {@code true} if {@link #isPhoneMode()} is true and we're using 3 button-nav */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index e334a49e31..e4d44c1a84 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -404,6 +404,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } else { updateItemsWithoutLayoutTransition(hotseatItemInfos, recentTasks); } + mAllAppsButtonContainer.updateTaskbarMinimalState(isTaskbarInMinimalState()); + } + + public boolean isTaskbarInMinimalState() { + return getIconViews().length <= 1; } private void updateItemsWithoutLayoutTransition( diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 99674fd35c..98710863dc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -1355,6 +1355,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar return layoutTransition; } + public boolean isTaskbarInMinimalState() { + return mTaskbarView.isTaskbarInMinimalState(); + } + /** * To be called when the given Task is updated, so that we can tell TaskbarView to also update. * @param task The Task whose e.g. icon changed. diff --git a/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarAllAppsButtonContainer.kt b/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarAllAppsButtonContainer.kt index 527c00dba3..b54e016511 100644 --- a/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarAllAppsButtonContainer.kt +++ b/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarAllAppsButtonContainer.kt @@ -49,6 +49,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 private var allAppsTouchTriggered = false private var allAppsTouchRunnable: Runnable? = null private var allAppsButtonTouchDelayMs: Long = ViewConfiguration.getLongPressTimeout().toLong() + private var isTaskbarInMinimalState = false private lateinit var taskbarViewCallbacks: TaskbarViewCallbacks override val spaceNeeded: Int @@ -117,22 +118,17 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 @DrawableRes private fun getAllAppsButtonForExpressiveTheme(): Int { - return R.drawable.ic_taskbar_all_apps_search_button_expressive_theme - } - - @DimenRes - fun getAllAppsButtonTranslationXOffsetForExpressiveTheme(isTransientTaskbar: Boolean): Int { - return if (isTransientTaskbar) { - R.dimen.transient_taskbar_all_apps_button_translation_x_offset_for_expressive_theme + return if (isTaskbarInMinimalState) { + R.drawable.ic_taskbar_minimal_state_all_apps_search_button_expressive_theme } else { - R.dimen.taskbar_all_apps_search_button_translation_x_offset_for_expressive_theme + R.drawable.ic_taskbar_all_apps_search_button_expressive_theme } } @DimenRes fun getAllAppsButtonTranslationXOffset(isTransientTaskbar: Boolean): Int { if (Flags.enableGsf()) { - return getAllAppsButtonTranslationXOffsetForExpressiveTheme(isTransientTaskbar) + return R.dimen.taskbar_all_apps_search_button_translation_x_offset_for_expressive_theme } return if (isTransientTaskbar) { R.dimen.transient_taskbar_all_apps_button_translation_x_offset @@ -141,6 +137,14 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 } } + /** Taskbar minimal state is that taskbar does not host anything other than all apps button. */ + fun updateTaskbarMinimalState(isInMinimalState: Boolean) { + if (isTaskbarInMinimalState != isInMinimalState) { + isTaskbarInMinimalState = isInMinimalState + setUpIcon() + } + } + private fun onAllAppsButtonTouch(view: View, ev: MotionEvent): Boolean { when (ev.action) { MotionEvent.ACTION_DOWN -> { diff --git a/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarFeatureEvaluator.kt b/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarFeatureEvaluator.kt index 81a4a1b35d..3245c3db27 100644 --- a/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarFeatureEvaluator.kt +++ b/quickstep/src/com/android/launcher3/taskbar/customization/TaskbarFeatureEvaluator.kt @@ -40,6 +40,9 @@ private constructor(private val taskbarActivityContext: TaskbarActivityContext) val isLandscape: Boolean get() = taskbarActivityContext.deviceProfile.isLandscape + val isTnMinimalState: Boolean + get() = taskbarActivityContext.isTaskbarInMinimalState + val supportsPinningPopup: Boolean // TODO(b/381535785): Allow pinning for desktop taskbar when desktop mode transient behavior // gets updated to retain pinned UI, but translate the taskbar offscreen. diff --git a/res/drawable/ic_taskbar_all_apps_search_button_expressive_theme.xml b/res/drawable/ic_taskbar_all_apps_search_button_expressive_theme.xml index ed4a821c79..852a077221 100644 --- a/res/drawable/ic_taskbar_all_apps_search_button_expressive_theme.xml +++ b/res/drawable/ic_taskbar_all_apps_search_button_expressive_theme.xml @@ -20,6 +20,6 @@ android:viewportWidth="52" android:viewportHeight="52"> \ No newline at end of file diff --git a/res/drawable/ic_taskbar_minimal_state_all_apps_search_button_expressive_theme.xml b/res/drawable/ic_taskbar_minimal_state_all_apps_search_button_expressive_theme.xml new file mode 100644 index 0000000000..ed4a821c79 --- /dev/null +++ b/res/drawable/ic_taskbar_minimal_state_all_apps_search_button_expressive_theme.xml @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file