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

Commit 9f68c230 authored by Daniel Nishi's avatar Daniel Nishi Committed by android-build-merger
Browse files

Merge \\"Add margins to the system icons when the user avatar is gone.\\" into...

Merge \\"Add margins to the system icons when the user avatar is gone.\\" into nyc-mr1-dev am: 3c75a038
am: c0c4affe

Change-Id: I4738a03ea901be7df95a953b887b0660f20d7d5b
parents d7e947c8 c0c4affe
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -147,6 +147,9 @@
    <!-- Margin start of the system icons super container -->
    <dimen name="system_icons_super_container_margin_start">16dp</dimen>

    <!-- Margin end of the system icons super container when the avatar is missing. -->
    <dimen name="system_icons_super_container_avatarless_margin_end">6dp</dimen>

    <!-- Width for the notification panel and related windows -->
    <dimen name="match_parent">-1px</dimen>
    <dimen name="standard_notification_panel_width">416dp</dimen>
+14 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.TypedValue;
@@ -59,6 +60,7 @@ public class KeyguardStatusBarView extends RelativeLayout
    private UserSwitcherController mUserSwitcherController;

    private int mSystemIconsSwitcherHiddenExpandedMargin;
    private int mSystemIconsBaseMargin;
    private View mSystemIconsContainer;

    public KeyguardStatusBarView(Context context, AttributeSet attrs) {
@@ -137,8 +139,11 @@ public class KeyguardStatusBarView extends RelativeLayout
    }

    private void loadDimens() {
        mSystemIconsSwitcherHiddenExpandedMargin = getResources().getDimensionPixelSize(
        Resources res = getResources();
        mSystemIconsSwitcherHiddenExpandedMargin = res.getDimensionPixelSize(
                R.dimen.system_icons_switcher_hidden_expanded_margin);
        mSystemIconsBaseMargin = res.getDimensionPixelSize(
                R.dimen.system_icons_super_container_avatarless_margin_end);
    }

    private void updateVisibilities() {
@@ -166,7 +171,13 @@ public class KeyguardStatusBarView extends RelativeLayout
    private void updateSystemIconsLayoutParams() {
        RelativeLayout.LayoutParams lp =
                (LayoutParams) mSystemIconsSuperContainer.getLayoutParams();
        int marginEnd = mKeyguardUserSwitcherShowing ? mSystemIconsSwitcherHiddenExpandedMargin : 0;
        // If the avatar icon is gone, we need to have some end margin to display the system icons
        // correctly.
        int baseMarginEnd = mMultiUserSwitch.getVisibility() == View.GONE
                ? mSystemIconsBaseMargin
                : 0;
        int marginEnd = mKeyguardUserSwitcherShowing ? mSystemIconsSwitcherHiddenExpandedMargin :
                baseMarginEnd;
        if (marginEnd != lp.getMarginEnd()) {
            lp.setMarginEnd(marginEnd);
            mSystemIconsSuperContainer.setLayoutParams(lp);
@@ -301,6 +312,7 @@ public class KeyguardStatusBarView extends RelativeLayout
            mMultiUserSwitch.setAlpha(1f);
        } else {
            updateVisibilities();
            updateSystemIconsLayoutParams();
        }
    }