diff options
5 files changed, 40 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/FontStyles.kt b/packages/SystemUI/src/com/android/systemui/FontStyles.kt new file mode 100644 index 000000000000..d8cd6c87a1ac --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/FontStyles.kt @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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.systemui + +/** String tokens for the different GSF font families. */ +object FontStyles { + +    const val GSF_LABEL_MEDIUM = "gsf-label-medium" +    const val GSF_LABEL_LARGE = "gsf-label-large" + +    const val GSF_BODY_MEDIUM = "gsf-body-medium" + +    const val GSF_TITLE_SMALL_EMPHASIZED = "gsf-title-small-emphasized" +} diff --git a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java index 1176cb0523c1..c17055740166 100644 --- a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java @@ -52,6 +52,7 @@ import androidx.annotation.VisibleForTesting;  import com.android.app.animation.Interpolators;  import com.android.systemui.DualToneHandler; +import com.android.systemui.FontStyles;  import com.android.systemui.battery.unified.BatteryColors;  import com.android.systemui.battery.unified.BatteryDrawableState;  import com.android.systemui.battery.unified.BatteryLayersDrawable; @@ -387,7 +388,8 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver {          float fontHeight = mBatteryPercentView.getPaint().getFontMetricsInt(null);          mBatteryPercentView.setLineHeight(TypedValue.COMPLEX_UNIT_PX, fontHeight);          if (gsfQuickSettings()) { -            mBatteryPercentView.setTypeface(Typeface.create("gsf-label-large", Typeface.NORMAL)); +            mBatteryPercentView.setTypeface( +                    Typeface.create(FontStyles.GSF_LABEL_LARGE, Typeface.NORMAL));          }          if (mTextColor != 0) mBatteryPercentView.setTextColor(mTextColor);          addView(mBatteryPercentView, new LayoutParams( diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java index dc188c24e02b..e8ee4dd8ebce 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java @@ -26,6 +26,7 @@ import android.view.View;  import android.widget.TextView;  import android.widget.Toast; +import com.android.systemui.FontStyles;  import com.android.systemui.plugins.ActivityStarter;  import com.android.systemui.plugins.FalsingManager;  import com.android.systemui.qs.dagger.QSScope; @@ -68,7 +69,7 @@ public class QSFooterViewController extends ViewController<QSFooterView> impleme          mBuildText = mView.findViewById(R.id.build);          if (gsfQuickSettings()) { -            mBuildText.setTypeface(Typeface.create("gsf-body-medium", Typeface.NORMAL)); +            mBuildText.setTypeface(Typeface.create(FontStyles.GSF_BODY_MEDIUM, Typeface.NORMAL));          }          mPageIndicator = mView.findViewById(R.id.footer_page_indicator);          mEditButton = mView.findViewById(android.R.id.edit); diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java index db778a208b1e..873059ee08db 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java @@ -47,6 +47,7 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;  import com.android.internal.logging.UiEventLogger;  import com.android.systemui.FontSizeUtils; +import com.android.systemui.FontStyles;  import com.android.systemui.flags.FeatureFlags;  import com.android.systemui.flags.Flags;  import com.android.systemui.qs.QSEditEvent; @@ -314,7 +315,7 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta              v.setMinimumHeight(calculateHeaderMinHeight(context));              if (gsfQuickSettings()) {                  ((TextView) v.findViewById(android.R.id.title)).setTypeface( -                        Typeface.create("gsf-label-large", Typeface.NORMAL)); +                        Typeface.create(FontStyles.GSF_LABEL_LARGE, Typeface.NORMAL));              }              return new Holder(v);          } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt index b7ebce247ec9..879e01f0ae9a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt @@ -60,6 +60,7 @@ import com.android.app.tracing.traceSection  import com.android.settingslib.Utils  import com.android.systemui.Flags  import com.android.systemui.FontSizeUtils +import com.android.systemui.FontStyles  import com.android.systemui.animation.Expandable  import com.android.systemui.animation.LaunchableView  import com.android.systemui.animation.LaunchableViewDelegate @@ -312,9 +313,11 @@ constructor(          if (Flags.gsfQuickSettings()) {              label.apply { -                typeface = Typeface.create("gsf-title-small-emphasized", Typeface.NORMAL) +                typeface = Typeface.create(FontStyles.GSF_TITLE_SMALL_EMPHASIZED, Typeface.NORMAL) +            } +            secondaryLabel.apply { +                typeface = Typeface.create(FontStyles.GSF_LABEL_MEDIUM, Typeface.NORMAL)              } -            secondaryLabel.apply { typeface = Typeface.create("gsf-label-medium", Typeface.NORMAL) }          }          addView(labelContainer)  |