Merge "Update Task Bar and Split-Screen with new font type." into main

This commit is contained in:
Simon (Qiong) Sun
2025-03-10 11:09:58 -07:00
committed by Android (Google) Code Review
7 changed files with 30 additions and 72 deletions
@@ -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();
@@ -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() {
@@ -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<LottieAnimationView>(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<BaseDragLayer.LayoutParams> {
@@ -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)
}
}
}
@@ -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
);
}
@@ -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<T extends OverlayUICallbacks> 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] =
@@ -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(() -> {