diff options
author | Jason Monk <jmonk@google.com> | 2014-11-19 21:18:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-11-19 21:18:22 +0000 |
commit | 2e982258f10e9af21ec328faf41e77b38b109738 (patch) | |
tree | 82190bb0f68c735d0c4d4510e127508301c00c38 /packages/SystemUI/src/com/android/systemui/qs | |
parent | 800bf3ae6e9affb151b3b0b368c4a3dd22bb1fa0 (diff) | |
parent | d2263cd9db36d5f74a124c5ffaf8594ef702408f (diff) | |
download | frameworks_base-2e982258f10e9af21ec328faf41e77b38b109738.zip frameworks_base-2e982258f10e9af21ec328faf41e77b38b109738.tar.gz frameworks_base-2e982258f10e9af21ec328faf41e77b38b109738.tar.bz2 |
Merge "SysUI: Refactor the NetworkControllerImpl" into lmp-mr1-dev
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/qs')
3 files changed, 20 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index 178590b..80ddd4a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -29,7 +29,8 @@ import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTileView; import com.android.systemui.qs.SignalTileView; import com.android.systemui.statusbar.policy.NetworkController; -import com.android.systemui.statusbar.policy.NetworkController.DataUsageInfo; +import com.android.systemui.statusbar.policy.NetworkController.MobileDataController; +import com.android.systemui.statusbar.policy.NetworkController.MobileDataController.DataUsageInfo; import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback; /** Quick settings tile: Cellular **/ @@ -38,11 +39,13 @@ public class CellularTile extends QSTile<QSTile.SignalState> { "com.android.settings", "com.android.settings.Settings$DataUsageSummaryActivity")); private final NetworkController mController; + private final MobileDataController mDataController; private final CellularDetailAdapter mDetailAdapter; public CellularTile(Host host) { super(host); mController = host.getNetworkController(); + mDataController = mController.getMobileDataController(); mDetailAdapter = new CellularDetailAdapter(); } @@ -72,7 +75,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { @Override protected void handleClick() { - if (mController.isMobileDataSupported()) { + if (mDataController.isMobileDataSupported()) { showDetail(true); } else { mHost.startSettingsActivity(CELLULAR_SETTINGS); @@ -199,7 +202,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> { @Override public Boolean getToggleState() { - return mController.isMobileDataSupported() ? mController.isMobileDataEnabled() : null; + return mDataController.isMobileDataSupported() + ? mDataController.isMobileDataEnabled() : null; } @Override @@ -209,7 +213,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { @Override public void setToggleState(boolean state) { - mController.setMobileDataEnabled(state); + mDataController.setMobileDataEnabled(state); } @Override @@ -217,7 +221,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { final DataUsageDetailView v = (DataUsageDetailView) (convertView != null ? convertView : LayoutInflater.from(mContext).inflate(R.layout.data_usage, parent, false)); - final DataUsageInfo info = mController.getDataUsageInfo(); + final DataUsageInfo info = mDataController.getDataUsageInfo(); if (info == null) return v; v.bind(info); return v; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java index 7bdb58f..eb816b7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java @@ -20,7 +20,6 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.util.AttributeSet; -import android.util.TypedValue; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; @@ -61,7 +60,7 @@ public class DataUsageDetailView extends LinearLayout { R.dimen.qs_data_usage_text_size); } - public void bind(NetworkController.DataUsageInfo info) { + public void bind(NetworkController.MobileDataController.DataUsageInfo info) { final Resources res = mContext.getResources(); final int titleId; final long bytes; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 7aa884e..4fb1189 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -31,7 +31,8 @@ import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTileView; import com.android.systemui.qs.SignalTileView; import com.android.systemui.statusbar.policy.NetworkController; -import com.android.systemui.statusbar.policy.NetworkController.AccessPoint; +import com.android.systemui.statusbar.policy.NetworkController.AccessPointController; +import com.android.systemui.statusbar.policy.NetworkController.AccessPointController.AccessPoint; import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback; /** Quick settings tile: Wifi **/ @@ -39,12 +40,14 @@ public class WifiTile extends QSTile<QSTile.SignalState> { private static final Intent WIFI_SETTINGS = new Intent(Settings.ACTION_WIFI_SETTINGS); private final NetworkController mController; + private final AccessPointController mWifiController; private final WifiDetailAdapter mDetailAdapter; private final QSTile.SignalState mStateBeforeClick = newTileState(); public WifiTile(Host host) { super(host); mController = host.getNetworkController(); + mWifiController = mController.getAccessPointController(); mDetailAdapter = new WifiDetailAdapter(); } @@ -62,10 +65,10 @@ public class WifiTile extends QSTile<QSTile.SignalState> { public void setListening(boolean listening) { if (listening) { mController.addNetworkSignalChangedCallback(mCallback); - mController.addAccessPointCallback(mDetailAdapter); + mWifiController.addAccessPointCallback(mDetailAdapter); } else { mController.removeNetworkSignalChangedCallback(mCallback); - mController.removeAccessPointCallback(mDetailAdapter); + mWifiController.removeAccessPointCallback(mDetailAdapter); } } @@ -87,7 +90,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override protected void handleSecondaryClick() { - if (!mController.canConfigWifi()) { + if (!mWifiController.canConfigWifi()) { mHost.startSettingsActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); return; } @@ -231,7 +234,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { }; private final class WifiDetailAdapter implements DetailAdapter, - NetworkController.AccessPointCallback, QSDetailItems.Callback { + NetworkController.AccessPointController.AccessPointCallback, QSDetailItems.Callback { private QSDetailItems mItems; private AccessPoint[] mAccessPoints; @@ -261,7 +264,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { public View createDetailView(Context context, View convertView, ViewGroup parent) { if (DEBUG) Log.d(TAG, "createDetailView convertView=" + (convertView != null)); mAccessPoints = null; - mController.scanForAccessPoints(); + mWifiController.scanForAccessPoints(); fireScanStateChanged(true); mItems = QSDetailItems.convertOrInflate(context, convertView, parent); mItems.setTagSuffix("Wifi"); @@ -287,7 +290,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { if (item == null || item.tag == null) return; final AccessPoint ap = (AccessPoint) item.tag; if (!ap.isConnected) { - if (mController.connect(ap)) { + if (mWifiController.connect(ap)) { mHost.collapsePanels(); } } |