Merge \"Add margins to the system icons when the user avatar is gone.\" into nyc-mr1-dev
am: 3c75a0380d
Change-Id: I9a92b0501fe6cbd3a910f21ff89e893ee5d77c67
This commit is contained in:
@@ -141,6 +141,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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user