From af56a33f113478b8ff0d9a40d24440bd00e3cb5b Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Wed, 23 May 2018 19:52:34 -0400 Subject: [PATCH] Put a little space between wifi and data type Also remove it from the mobile signal group when it's not needed Test: visual; demo mode Change-Id: Iaade5144e5ad762e6a57e49c52b9c5272bac8b48 Fixes: 77822905 --- .../layout/status_bar_mobile_signal_group.xml | 1 - .../phone/StatusBarSignalPolicy.java | 53 +++++++++++++++---- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml b/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml index 7931dfe745879..8b56b6806db2e 100644 --- a/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml +++ b/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml @@ -29,7 +29,6 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" - android:paddingStart="2dp" android:orientation="horizontal" > 0) { - mIconController.setSignalIcon(mSlotWifi, mWifiIconState.copy()); + newState.visible = visible; + newState.resId = statusIcon.icon; + newState.activityIn = in; + newState.activityOut = out; + newState.slot = mSlotWifi; + newState.airplaneSpacerVisible = mIsAirplaneMode; + newState.contentDescription = statusIcon.contentDescription; + + MobileIconState first = getFirstMobileState(); + newState.signalSpacerVisible = first != null && first.typeId != 0; + + updateWifiIconWithState(newState); + mWifiIconState = newState; + } + + private void updateShowWifiSignalSpacer(WifiIconState state) { + MobileIconState first = getFirstMobileState(); + state.signalSpacerVisible = first != null && first.typeId != 0; + } + + private void updateWifiIconWithState(WifiIconState state) { + if (state.visible && state.resId > 0) { + mIconController.setSignalIcon(mSlotWifi, state); mIconController.setIconVisibility(mSlotWifi, true); } else { mIconController.setIconVisibility(mSlotWifi, false); @@ -173,6 +188,9 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba return; } + // Visibility of the data type indicator changed + boolean typeChanged = statusType != state.typeId && (statusType == 0 || state.typeId == 0); + state.visible = statusIcon.visible && !mBlockMobile; state.strengthId = statusIcon.icon; state.typeId = statusType; @@ -184,6 +202,15 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba // Always send a copy to maintain value type semantics mIconController.setMobileIcons(mSlotMobile, MobileIconState.copyStates(mMobileStates)); + + if (typeChanged) { + WifiIconState wifiCopy = mWifiIconState.copy(); + updateShowWifiSignalSpacer(wifiCopy); + if (!Objects.equals(wifiCopy, mWifiIconState)) { + updateWifiIconWithState(wifiCopy); + mWifiIconState = wifiCopy; + } + } } private MobileIconState getState(int subId) { @@ -196,6 +223,14 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba return null; } + private MobileIconState getFirstMobileState() { + if (mMobileStates.size() > 0) { + return mMobileStates.get(0); + } + + return null; + } + /** * It is expected that a call to setSubs will be immediately followed by setMobileDataIndicators