Merge "DO NOT MERGE: Fix paddings for user switch and status bar icons." into lmp-preview-dev
This commit is contained in:
@@ -77,8 +77,9 @@
|
||||
<ImageButton android:id="@+id/settings_button"
|
||||
style="@android:style/Widget.Material.Button.Borderless"
|
||||
android:layout_toStartOf="@id/multi_user_switch"
|
||||
android:layout_width="56dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="@dimen/status_bar_header_height"
|
||||
android:layout_marginStart="8dp"
|
||||
android:src="@drawable/ic_settings_24dp"
|
||||
android:contentDescription="@string/accessibility_desc_quick_settings"/>
|
||||
|
||||
@@ -86,14 +87,14 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/status_bar_header_height"
|
||||
android:layout_toStartOf="@id/multi_user_switch"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
/>
|
||||
|
||||
<com.android.keyguard.CarrierText
|
||||
android:id="@+id/keyguard_carrier_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/status_bar_header_height_keyguard"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toStartOf="@id/system_icons_container"
|
||||
android:gravity="center_vertical"
|
||||
android:ellipsize="marquee"
|
||||
|
||||
@@ -338,4 +338,7 @@
|
||||
<!-- The width of the region on the left/right edge of the screen for performing the camera/
|
||||
phone hints. -->
|
||||
<dimen name="edge_tap_area_width">48dp</dimen>
|
||||
|
||||
<!-- end margin for multi user switch in expanded quick settings -->
|
||||
<dimen name="multi_user_switch_expanded_margin">8dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -64,6 +64,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
|
||||
private int mKeyguardWidth = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
private int mNormalWidth;
|
||||
private int mPadding;
|
||||
private int mMultiUserExpandedMargin;
|
||||
|
||||
private ActivityStarter mActivityStarter;
|
||||
private BrightnessController mBrightnessController;
|
||||
@@ -112,6 +114,10 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
mKeyguardHeight = getResources().getDimensionPixelSize(
|
||||
R.dimen.status_bar_header_height_keyguard);
|
||||
mNormalWidth = getLayoutParams().width;
|
||||
mPadding = getResources().getDimensionPixelSize(R.dimen.notification_side_padding);
|
||||
mMultiUserExpandedMargin =
|
||||
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_expanded_margin);
|
||||
|
||||
}
|
||||
|
||||
public void setActivityStarter(ActivityStarter activityStarter) {
|
||||
@@ -139,6 +145,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
updateZTranslation();
|
||||
updateClickTargets();
|
||||
updateWidth();
|
||||
updatePadding();
|
||||
updateMultiUserSwitch();
|
||||
if (mQSPanel != null) {
|
||||
mQSPanel.setExpanded(expanded && !overscrolled);
|
||||
}
|
||||
@@ -229,6 +237,21 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePadding() {
|
||||
boolean padded = !mKeyguardShowing || mExpanded;
|
||||
int padding = padded ? mPadding : 0;
|
||||
setPaddingRelative(padding, 0, padding, 0);
|
||||
}
|
||||
|
||||
private void updateMultiUserSwitch() {
|
||||
int marginEnd = !mKeyguardShowing || mExpanded ? mMultiUserExpandedMargin : 0;
|
||||
MarginLayoutParams lp = (MarginLayoutParams) mMultiUserSwitch.getLayoutParams();
|
||||
if (marginEnd != lp.getMarginEnd()) {
|
||||
lp.setMarginEnd(marginEnd);
|
||||
mMultiUserSwitch.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
|
||||
public void setExpansion(float height) {
|
||||
height = (height - mCollapsedHeight) * EXPANSION_RUBBERBAND_FACTOR + mCollapsedHeight;
|
||||
if (height < mCollapsedHeight) {
|
||||
@@ -274,6 +297,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
updateWidth();
|
||||
updateVisibilities();
|
||||
updateZTranslation();
|
||||
updatePadding();
|
||||
updateMultiUserSwitch();
|
||||
}
|
||||
|
||||
public void setUserInfoController(UserInfoController userInfoController) {
|
||||
|
||||
Reference in New Issue
Block a user