Taskbar Icon changes
Test: Manual Bug: 379158656 Flag: com.android.wm.shell.enable_gsf Change-Id: Ic4ec9a7c634231c2592cfcd6ba6c8f8252c2dd98
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2025 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.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="52dp"
|
||||
android:height="52dp"
|
||||
android:viewportHeight="52"
|
||||
android:viewportWidth="52">
|
||||
<group>
|
||||
<path
|
||||
android:fillColor="@color/taskbar_divider_background"
|
||||
android:pathData="M26,14L26,38"
|
||||
android:strokeColor="@color/taskbar_divider_background"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="3" />
|
||||
</group>
|
||||
</vector>
|
||||
@@ -363,6 +363,7 @@
|
||||
<dimen name="taskbar_home_button_left_margin_kids">48dp</dimen>
|
||||
<dimen name="taskbar_icon_size_kids">32dp</dimen>
|
||||
<dimen name="taskbar_all_apps_search_button_translation_x_offset">6dp</dimen>
|
||||
<dimen name="taskbar_all_apps_search_button_translation_x_offset_for_expressive_theme">5.5dp</dimen>
|
||||
<dimen name="taskbar_contextual_button_suw_margin">64dp</dimen>
|
||||
<dimen name="taskbar_contextual_button_suw_height">64dp</dimen>
|
||||
<dimen name="taskbar_back_button_suw_start_margin">48dp</dimen>
|
||||
@@ -381,6 +382,7 @@
|
||||
<dimen name="transient_taskbar_key_shadow_distance">10dp</dimen>
|
||||
<dimen name="transient_taskbar_stashed_height">32dp</dimen>
|
||||
<dimen name="transient_taskbar_all_apps_button_translation_x_offset">8dp</dimen>
|
||||
<dimen name="transient_taskbar_all_apps_button_translation_x_offset_for_expressive_theme">8dp</dimen>
|
||||
<dimen name="transient_taskbar_stash_spring_velocity_dp_per_s">400dp</dimen>
|
||||
<dimen name="taskbar_tooltip_vertical_padding">8dp</dimen>
|
||||
<dimen name="taskbar_tooltip_horizontal_padding">16dp</dimen>
|
||||
|
||||
+21
@@ -37,6 +37,7 @@ import com.android.launcher3.views.ActivityContext
|
||||
import com.android.launcher3.views.IconButtonView
|
||||
import com.android.quickstep.DeviceConfigWrapper
|
||||
import com.android.quickstep.util.ContextualSearchStateManager
|
||||
import com.android.wm.shell.Flags
|
||||
|
||||
/** Taskbar all apps button container for customizable taskbar. */
|
||||
class TaskbarAllAppsButtonContainer
|
||||
@@ -97,14 +98,34 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
|
||||
@DrawableRes
|
||||
private fun getAllAppsButton(isTransientTaskbar: Boolean): Int {
|
||||
if (Flags.enableGsf()) {
|
||||
return getAllAppsButtonForExpressiveTheme()
|
||||
}
|
||||
val shouldSelectTransientIcon =
|
||||
isTransientTaskbar || (enableTaskbarPinning() && !activityContext.isThreeButtonNav)
|
||||
return if (shouldSelectTransientIcon) R.drawable.ic_transient_taskbar_all_apps_search_button
|
||||
else R.drawable.ic_taskbar_all_apps_search_button
|
||||
}
|
||||
|
||||
@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
|
||||
} else {
|
||||
R.dimen.taskbar_all_apps_search_button_translation_x_offset_for_expressive_theme
|
||||
}
|
||||
}
|
||||
|
||||
@DimenRes
|
||||
fun getAllAppsButtonTranslationXOffset(isTransientTaskbar: Boolean): Int {
|
||||
if (Flags.enableGsf()) {
|
||||
return getAllAppsButtonTranslationXOffsetForExpressiveTheme(isTransientTaskbar)
|
||||
}
|
||||
return if (isTransientTaskbar) {
|
||||
R.dimen.transient_taskbar_all_apps_button_translation_x_offset
|
||||
} else {
|
||||
|
||||
+12
-2
@@ -20,6 +20,7 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color.TRANSPARENT
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.view.setPadding
|
||||
import com.android.launcher3.R
|
||||
@@ -28,6 +29,7 @@ import com.android.launcher3.taskbar.TaskbarActivityContext
|
||||
import com.android.launcher3.taskbar.TaskbarViewCallbacks
|
||||
import com.android.launcher3.views.ActivityContext
|
||||
import com.android.launcher3.views.IconButtonView
|
||||
import com.android.wm.shell.Flags
|
||||
|
||||
/** Taskbar divider view container for customizable taskbar. */
|
||||
class TaskbarDividerContainer
|
||||
@@ -46,16 +48,24 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
setUpIcon()
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
fun setUpIcon() {
|
||||
backgroundTintList = ColorStateList.valueOf(TRANSPARENT)
|
||||
val drawable = resources.getDrawable(R.drawable.taskbar_divider_button)
|
||||
val drawable = getTaskbarDividerIcon()
|
||||
setIconDrawable(drawable)
|
||||
if (!activityContext.isTransientTaskbar) {
|
||||
setPadding(dpToPx(activityContext.taskbarSpecsEvaluator.taskbarIconPadding.toFloat()))
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
fun getTaskbarDividerIcon(): Drawable {
|
||||
return if (Flags.enableGsf()) {
|
||||
resources.getDrawable(R.drawable.taskbar_divider_button_expressive_theme)
|
||||
} else {
|
||||
resources.getDrawable(R.drawable.taskbar_divider_button)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
fun setUpCallbacks(callbacks: TaskbarViewCallbacks) {
|
||||
setOnLongClickListener(callbacks.taskbarDividerLongClickListener)
|
||||
|
||||
Reference in New Issue
Block a user