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

Commit 840be1bd authored by Ben Murdoch's avatar Ben Murdoch
Browse files

Decouple Keyguard user switch font size from QS user switcher.

Fix an issue where the text size of the keyguard user switcher
was being forced to that of the quick settings user switcher.

Test: Manual inspection of styles
Bug: 136122305

Change-Id: I2d62f374d74663a86338ffdfcf0412b12390690a
parent 663a13b1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
  -->

<!-- LinearLayout -->
<com.android.systemui.qs.tiles.UserDetailItemView
<com.android.systemui.statusbar.policy.KeyguardUserDetailItemView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:sysui="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
@@ -34,7 +34,7 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="13dp"
            android:textAppearance="@style/TextAppearance.StatusBar.Expanded.UserSwitcher.UserName"
            android:textAppearance="@style/TextAppearance.StatusBar.Expanded.UserSwitcher"
            />
    <com.android.systemui.statusbar.phone.UserAvatarView android:id="@+id/user_picture"
            android:layout_width="@dimen/framed_avatar_size"
@@ -47,4 +47,4 @@
            sysui:badgeDiameter="18dp"
            sysui:badgeMargin="1dp"
            sysui:frameColor="@color/qs_user_detail_avatar_frame" />
</com.android.systemui.qs.tiles.UserDetailItemView>
</com.android.systemui.statusbar.policy.KeyguardUserDetailItemView>
+2 −0
Original line number Diff line number Diff line
@@ -1228,4 +1228,6 @@
    <!-- Screen Record -->
    <dimen name="screenrecord_dialog_padding">18dp</dimen>
    <dimen name="screenrecord_logo_size">24dp</dimen>

    <dimen name="kg_user_switcher_text_size">16sp</dimen>
</resources>
+1 −2
Original line number Diff line number Diff line
@@ -129,11 +129,10 @@
            parent="TextAppearance.StatusBar.Expanded.AboveDateTime" />

    <style name="TextAppearance.StatusBar.Expanded.UserSwitcher">
        <item name="android:textSize">16sp</item>
        <item name="android:textSize">@dimen/kg_user_switcher_text_size</item>
        <item name="android:textStyle">normal</item>
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>
    <style name="TextAppearance.StatusBar.Expanded.UserSwitcher.UserName" />

    <style name="TextAppearance" />

+5 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public class UserDetailItemView extends LinearLayout {
    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        FontSizeUtils.updateFontSize(mName, R.dimen.qs_detail_item_secondary_text_size);
        FontSizeUtils.updateFontSize(mName, getFontSizeDimen());
    }

    @Override
@@ -146,4 +146,8 @@ public class UserDetailItemView extends LinearLayout {
    public boolean hasOverlappingRendering() {
        return false;
    }

    protected int getFontSizeDimen() {
        return R.dimen.qs_detail_item_secondary_text_size;
    }
}
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.statusbar.policy;

import android.content.Context;
import android.util.AttributeSet;

import com.android.systemui.R;
import com.android.systemui.qs.tiles.UserDetailItemView;

/**
 * Displays a user on the keyguard user switcher.
 */
public class KeyguardUserDetailItemView extends UserDetailItemView {

    public KeyguardUserDetailItemView(Context context) {
        this(context, null);
    }

    public KeyguardUserDetailItemView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public KeyguardUserDetailItemView(Context context, AttributeSet attrs, int defStyleAttr) {
        this(context, attrs, defStyleAttr, 0);
    }

    public KeyguardUserDetailItemView(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected int getFontSizeDimen() {
        return R.dimen.kg_user_switcher_text_size;
    }
}