mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
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
This commit is contained in:
@@ -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"/>
|
||||
|
||||
<TextView
|
||||
style="@style/KeyboardQuickSwitchText.OnTaskView"
|
||||
android:id="@+id/text"
|
||||
android:id="@+id/small_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
|
||||
@@ -104,9 +104,18 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
|
||||
mIcon2 = findViewById(R.id.icon_2);
|
||||
mContent = findViewById(R.id.content);
|
||||
|
||||
Resources resources = mContext.getResources();
|
||||
|
||||
Preconditions.assertNotNull(mContent);
|
||||
|
||||
TypefaceUtils.setTypeface(
|
||||
mContent.findViewById(R.id.large_text),
|
||||
TypefaceUtils.FONT_FAMILY_HEADLINE_LARGE_EMPHASIZED
|
||||
);
|
||||
TypefaceUtils.setTypeface(
|
||||
mContent.findViewById(R.id.small_text),
|
||||
TypefaceUtils.FONT_FAMILY_LABEL_LARGE_BASELINE
|
||||
);
|
||||
|
||||
Resources resources = mContext.getResources();
|
||||
mBorderAnimator = BorderAnimator.createScalingBorderAnimator(
|
||||
/* borderRadiusPx= */ mBorderRadius != INVALID_BORDER_RADIUS
|
||||
? mBorderRadius
|
||||
|
||||
@@ -163,6 +163,10 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
R.dimen.keyboard_quick_switch_view_small_spacing);
|
||||
mOutlineRadius = resources.getDimensionPixelSize(R.dimen.keyboard_quick_switch_view_radius);
|
||||
mIsRtl = Utilities.isRtl(resources);
|
||||
|
||||
TypefaceUtils.setTypeface(
|
||||
mNoRecentItemsPane.findViewById(R.id.no_recent_items_text),
|
||||
TypefaceUtils.FONT_FAMILY_LABEL_LARGE_BASELINE);
|
||||
}
|
||||
|
||||
private void registerOnBackInvokedCallback() {
|
||||
@@ -310,7 +314,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
layoutInflater,
|
||||
previousTaskView);
|
||||
|
||||
desktopButton.<TextView>findViewById(R.id.text).setText(
|
||||
desktopButton.<TextView>findViewById(R.id.small_text).setText(
|
||||
resources.getString(R.string.quick_switch_desktop));
|
||||
}
|
||||
mDisplayingRecentTasks = !groupTasks.isEmpty() || useDesktopTaskView;
|
||||
|
||||
47
quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt
Normal file
47
quickstep/src/com/android/launcher3/taskbar/TypefaceUtils.kt
Normal file
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user