mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 02:08:20 +00:00
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>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
~ 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:viewportWidth="52"
|
||||
android:viewportHeight="52">
|
||||
<path
|
||||
android:pathData="M32.862,38.75C31.263,38.75 29.888,38.175 28.737,37.025C27.587,35.875 27.013,34.487 27.013,32.862C27.013,31.237 27.587,29.85 28.737,28.7C29.888,27.55 31.263,26.975 32.862,26.975C34.487,26.975 35.875,27.55 37.025,28.7C38.175,29.85 38.75,31.237 38.75,32.862C38.75,33.438 38.662,33.987 38.487,34.513C38.338,35.037 38.125,35.525 37.85,35.975L41.45,39.612C41.6,39.737 41.7,39.875 41.75,40.025C41.825,40.175 41.862,40.338 41.862,40.513C41.862,40.688 41.825,40.85 41.75,41C41.7,41.15 41.6,41.3 41.45,41.45C41.325,41.575 41.188,41.675 41.037,41.75C40.888,41.8 40.725,41.825 40.55,41.825C40.375,41.825 40.213,41.8 40.063,41.75C39.912,41.675 39.763,41.575 39.612,41.45L35.975,37.85C35.525,38.15 35.037,38.375 34.513,38.525C33.987,38.675 33.438,38.75 32.862,38.75ZM16.1,38.75C14.5,38.75 13.125,38.175 11.975,37.025C10.825,35.875 10.25,34.5 10.25,32.9C10.25,31.25 10.825,29.85 11.975,28.7C13.125,27.55 14.5,26.975 16.1,26.975C17.75,26.975 19.15,27.55 20.3,28.7C21.45,29.85 22.025,31.25 22.025,32.9C22.025,34.5 21.45,35.875 20.3,37.025C19.15,38.175 17.75,38.75 16.1,38.75ZM32.862,36.125C33.763,36.125 34.525,35.813 35.15,35.188C35.8,34.537 36.125,33.775 36.125,32.9C36.125,31.975 35.8,31.2 35.15,30.575C34.525,29.925 33.763,29.6 32.862,29.6C31.962,29.6 31.188,29.925 30.538,30.575C29.913,31.2 29.6,31.975 29.6,32.9C29.6,33.775 29.913,34.537 30.538,35.188C31.188,35.813 31.962,36.125 32.862,36.125ZM16.1,22.025C14.5,22.025 13.125,21.45 11.975,20.3C10.825,19.15 10.25,17.763 10.25,16.138C10.25,14.512 10.825,13.125 11.975,11.975C13.125,10.825 14.5,10.25 16.1,10.25C17.75,10.25 19.15,10.825 20.3,11.975C21.45,13.125 22.025,14.512 22.025,16.138C22.025,17.763 21.45,19.15 20.3,20.3C19.15,21.45 17.75,22.025 16.1,22.025ZM32.862,22.025C31.237,22.025 29.85,21.45 28.7,20.3C27.55,19.15 26.975,17.763 26.975,16.138C26.975,14.512 27.55,13.125 28.7,11.975C29.85,10.825 31.237,10.25 32.862,10.25C34.487,10.25 35.875,10.825 37.025,11.975C38.175,13.125 38.75,14.512 38.75,16.138C38.75,17.763 38.175,19.15 37.025,20.3C35.875,21.45 34.487,22.025 32.862,22.025Z"
|
||||
android:fillColor="#FF000000"/>
|
||||
</vector>
|
||||
Reference in New Issue
Block a user