From 0ae28ca5d002fd10c1dfd80ff0491d5a12e4e0b4 Mon Sep 17 00:00:00 2001 From: Schneider Victor-Tulias Date: Thu, 13 Feb 2025 11:39:51 -0500 Subject: [PATCH] Update KQS text font family to match new specs Flag: com.android.launcher3.expressive_theme_in_taskbar_and_navigation Fixes: 393615634 Test: opened KQS, be before/after in bug Change-Id: Ia953e2b927b6e69c0c150df01925436b6247d751 --- ...keyboard_quick_switch_desktop_taskview.xml | 4 +- .../taskbar/KeyboardQuickSwitchTaskView.java | 13 ++++- .../taskbar/KeyboardQuickSwitchView.java | 6 ++- .../launcher3/taskbar/TypefaceUtils.kt | 47 +++++++++++++++++++ 4 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt diff --git a/quickstep/res/layout/keyboard_quick_switch_desktop_taskview.xml b/quickstep/res/layout/keyboard_quick_switch_desktop_taskview.xml index 71c782d7e0..db47ff08ba 100644 --- a/quickstep/res/layout/keyboard_quick_switch_desktop_taskview.xml +++ b/quickstep/res/layout/keyboard_quick_switch_desktop_taskview.xml @@ -48,13 +48,13 @@ app:layout_constraintVertical_chainStyle="packed" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toTopOf="@id/text" + app:layout_constraintBottom_toTopOf="@id/small_text" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"/> findViewById(R.id.text).setText( + desktopButton.findViewById(R.id.small_text).setText( resources.getString(R.string.quick_switch_desktop)); } mDisplayingRecentTasks = !groupTasks.isEmpty() || useDesktopTaskView; diff --git a/quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt b/quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt new file mode 100644 index 0000000000..fa551b84ad --- /dev/null +++ b/quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt @@ -0,0 +1,47 @@ +/* + * 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. + */ + +package com.android.launcher3.taskbar + +import android.graphics.Typeface +import android.widget.TextView +import com.android.launcher3.Flags + +/** + * Helper util class to set pre-defined typefaces to textviews + * + * If the typeface font family is already defined here, you can just reuse it directly. Otherwise, + * please define it here for future use. You do not need to define the font style. If you need + * anything other than [Typeface.NORMAL], pass it inline when calling [setTypeface] + */ +class TypefaceUtils { + + companion object { + const val FONT_FAMILY_HEADLINE_LARGE_EMPHASIZED = "variable-headline-large-emphasized" + const val FONT_FAMILY_LABEL_LARGE_BASELINE = "variable-label-large" + + @JvmStatic + @JvmOverloads + fun setTypeface( + textView: TextView?, + fontFamilyName: String, + fontStyle: Int = Typeface.NORMAL, + ) { + if (!Flags.expressiveThemeInTaskbarAndNavigation()) return + textView?.typeface = Typeface.create(fontFamilyName, fontStyle) + } + } +}