Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06640833 authored by Florence Yang's avatar Florence Yang Committed by Android (Google) Code Review
Browse files

Merge "Refactor font strings to constants in QS" into main

parents 32d5b84a fc9f30d7
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
/*
 * 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"
}
+3 −1
Original line number Diff line number Diff line
@@ -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(
+2 −1
Original line number Diff line number Diff line
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -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);
        }
+5 −2
Original line number Diff line number Diff line
@@ -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)