diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java index f80dc909f8..5f867cd080 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java @@ -40,6 +40,8 @@ import com.android.launcher3.util.SplitConfigurationOptions.SplitBounds; import com.android.quickstep.util.BorderAnimator; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; +import com.android.wm.shell.shared.TypefaceUtils; +import com.android.wm.shell.shared.TypefaceUtils.FontFamily; import kotlin.Unit; @@ -108,11 +110,11 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { TypefaceUtils.setTypeface( mContent.findViewById(R.id.large_text), - TypefaceUtils.FONT_FAMILY_HEADLINE_LARGE_EMPHASIZED + FontFamily.GSF_HEADLINE_LARGE_EMPHASIZED ); TypefaceUtils.setTypeface( mContent.findViewById(R.id.small_text), - TypefaceUtils.FONT_FAMILY_LABEL_LARGE_BASELINE + FontFamily.GSF_LABEL_LARGE ); Resources resources = mContext.getResources(); diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java index 336ef48c64..845e19f0c2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java @@ -58,6 +58,8 @@ import com.android.quickstep.util.SingleTask; import com.android.quickstep.util.SplitTask; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; +import com.android.wm.shell.shared.TypefaceUtils; +import com.android.wm.shell.shared.TypefaceUtils.FontFamily; import java.util.HashMap; import java.util.List; @@ -189,10 +191,9 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { } } - TypefaceUtils.setTypeface( mNoRecentItemsPane.findViewById(R.id.no_recent_items_text), - TypefaceUtils.FONT_FAMILY_LABEL_LARGE_BASELINE); + FontFamily.GSF_LABEL_LARGE); } private void registerOnBackInvokedCallback() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index 5d1288c106..d624413d60 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -52,6 +52,8 @@ import com.android.launcher3.views.ActivityContext import com.android.launcher3.views.BaseDragLayer import com.android.quickstep.util.ContextualSearchInvoker import com.android.quickstep.util.LottieAnimationColorUtils +import com.android.wm.shell.shared.TypefaceUtils +import com.android.wm.shell.shared.TypefaceUtils.FontFamily import java.io.PrintWriter /** First EDU step for swiping up to show transient Taskbar. */ @@ -164,7 +166,7 @@ open class TaskbarEduTooltipController(context: Context) : tooltip?.run { TypefaceUtils.setTypeface( requireViewById(R.id.taskbar_edu_title), - TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED, + FontFamily.GSF_HEADLINE_SMALL_EMPHASIZED, ) val swipeAnimation = requireViewById(R.id.swipe_animation) swipeAnimation.supportLightTheme() @@ -210,19 +212,19 @@ open class TaskbarEduTooltipController(context: Context) : TypefaceUtils.setTypeface( requireViewById(R.id.taskbar_edu_title), - TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED, + FontFamily.GSF_HEADLINE_SMALL_EMPHASIZED, ) TypefaceUtils.setTypeface( requireViewById(R.id.splitscreen_text), - TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE, + FontFamily.GSF_BODY_MEDIUM, ) TypefaceUtils.setTypeface( requireViewById(R.id.suggestions_text), - TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE, + FontFamily.GSF_BODY_MEDIUM, ) TypefaceUtils.setTypeface( requireViewById(R.id.pinning_text), - TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE, + FontFamily.GSF_BODY_MEDIUM, ) // Set up layout parameters. @@ -275,11 +277,11 @@ open class TaskbarEduTooltipController(context: Context) : allowTouchDismissal = true TypefaceUtils.setTypeface( requireViewById(R.id.taskbar_edu_title), - TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED, + FontFamily.GSF_HEADLINE_SMALL_EMPHASIZED, ) TypefaceUtils.setTypeface( requireViewById(R.id.pinning_text), - TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE, + FontFamily.GSF_BODY_MEDIUM, ) val pinningAnim = @@ -336,9 +338,9 @@ open class TaskbarEduTooltipController(context: Context) : TypefaceUtils.setTypeface( requireViewById(R.id.taskbar_edu_title), - TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED, + FontFamily.GSF_HEADLINE_SMALL_EMPHASIZED, ) - TypefaceUtils.setTypeface(eduSubtitle, TypefaceUtils.FONT_FAMILY_BODY_SMALL_BASELINE) + TypefaceUtils.setTypeface(eduSubtitle, FontFamily.GSF_BODY_SMALL) showDisclosureText(eduSubtitle) updateLayoutParams { diff --git a/quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt b/quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt deleted file mode 100644 index e9c62d19c9..0000000000 --- a/quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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_BODY_SMALL_BASELINE = "variable-body-small" - const val FONT_FAMILY_BODY_MEDIUM_BASELINE = "variable-body-medium" - const val FONT_FAMILY_BODY_LARGE_BASELINE = "variable-body-large" - const val FONT_FAMILY_LABEL_LARGE_BASELINE = "variable-label-large" - const val FONT_FAMILY_DISPLAY_SMALL_EMPHASIZED = "variable-display-small-emphasized" - const val FONT_FAMILY_DISPLAY_MEDIUM_EMPHASIZED = "variable-display-medium-emphasized" - const val FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED = "variable-headline-small-emphasized" - const val FONT_FAMILY_HEADLINE_LARGE_EMPHASIZED = "variable-headline-large-emphasized" - - @JvmStatic - @JvmOverloads - fun setTypeface( - textView: TextView?, - fontFamilyName: String, - fontStyle: Int = Typeface.NORMAL, - ) { - if (!Flags.expressiveThemeInTaskbarAndNavigation()) return - textView?.typeface = Typeface.create(fontFamilyName, fontStyle) - } - } -} diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java index 1e61967529..5995ca25df 100644 --- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java @@ -56,11 +56,12 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorListeners; -import com.android.launcher3.taskbar.TypefaceUtils; import com.android.launcher3.views.ClipIconView; import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureAttemptCallback; import com.android.quickstep.interaction.NavBarGestureHandler.NavBarGestureAttemptCallback; import com.android.systemui.shared.system.QuickStepContract; +import com.android.wm.shell.shared.TypefaceUtils; +import com.android.wm.shell.shared.TypefaceUtils.FontFamily; import com.airbnb.lottie.LottieAnimationView; import com.airbnb.lottie.LottieComposition; @@ -409,7 +410,7 @@ abstract class TutorialController implements BackGestureAttemptCallback, if (mTutorialFragment.isAtFinalStep()) { TypefaceUtils.setTypeface( mDoneButton, - TypefaceUtils.FONT_FAMILY_LABEL_LARGE_BASELINE + FontFamily.GSF_LABEL_LARGE ); showActionButton(); } @@ -517,11 +518,11 @@ abstract class TutorialController implements BackGestureAttemptCallback, TypefaceUtils.setTypeface( mFeedbackTitleView, mTutorialFragment.isLargeScreen() - ? TypefaceUtils.FONT_FAMILY_DISPLAY_MEDIUM_EMPHASIZED - : TypefaceUtils.FONT_FAMILY_DISPLAY_SMALL_EMPHASIZED); + ? FontFamily.GSF_DISPLAY_MEDIUM_EMPHASIZED + : FontFamily.GSF_DISPLAY_SMALL_EMPHASIZED); TypefaceUtils.setTypeface( mFeedbackSubtitleView, - TypefaceUtils.FONT_FAMILY_BODY_LARGE_BASELINE + FontFamily.GSF_BODY_LARGE ); } diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java index 4a2be2adf7..5f08209fbb 100644 --- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java @@ -40,6 +40,8 @@ import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.NavigationMode; import com.android.quickstep.TaskOverlayFactory.OverlayUICallbacks; import com.android.quickstep.util.LayoutUtils; +import com.android.wm.shell.shared.TypefaceUtils; +import com.android.wm.shell.shared.TypefaceUtils.FontFamily; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -157,6 +159,7 @@ public class OverviewActionsView extends FrameLayo // Currently, the only grouped task action is "save app pairs". mActionButtons = findViewById(R.id.action_buttons); mSaveAppPairButton = findViewById(R.id.action_save_app_pair); + TypefaceUtils.setTypeface(mSaveAppPairButton, FontFamily.GSF_LABEL_LARGE); // Initialize a list to hold alphas for mActionButtons and any group action buttons. mMultiValueAlphas[ACTIONS_ALPHAS] = new MultiValueAlpha(mActionButtons, NUM_ALPHAS); mMultiValueAlphas[GROUP_ACTIONS_ALPHAS] = diff --git a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java index 0d80f6ad76..4cf1eaecf2 100644 --- a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java +++ b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java @@ -39,10 +39,11 @@ import com.android.app.animation.Interpolators; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StateManager; import com.android.quickstep.util.AnimUtils; import com.android.quickstep.util.SplitSelectStateController; +import com.android.wm.shell.shared.TypefaceUtils; +import com.android.wm.shell.shared.TypefaceUtils.FontFamily; /** * A rounded rectangular component containing a single TextView. @@ -129,6 +130,7 @@ public class SplitInstructionsView extends LinearLayout { cancelTextView.setVisibility(VISIBLE); cancelTextView.setOnClickListener((v) -> exitSplitSelection()); instructionTextView.setText(R.string.toast_contextual_split_select_app); + TypefaceUtils.setTypeface(instructionTextView, FontFamily.GSF_BODY_MEDIUM); // After layout, expand touch target of cancel button to meet minimum a11y measurements. post(() -> {