diff options
author | Jason Monk <jmonk@google.com> | 2015-01-28 10:40:41 -0500 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2015-02-04 15:08:55 -0500 |
commit | d52356aa5e82c7c5db61672bbe8d0f44861f3e59 (patch) | |
tree | b2ccbf3e88c9bacba4921e81b037514156f64c4c /packages/SystemUI/src/com/android/systemui/qs | |
parent | 1a81b83e1ef3ccf13cf32bb621537a6bda5b33f7 (diff) | |
download | frameworks_base-d52356aa5e82c7c5db61672bbe8d0f44861f3e59.zip frameworks_base-d52356aa5e82c7c5db61672bbe8d0f44861f3e59.tar.gz frameworks_base-d52356aa5e82c7c5db61672bbe8d0f44861f3e59.tar.bz2 |
Move Settings wifi tracking to SettingsLib
Make SettingsLib capable of tracking which wifi networks are
available/saved and their state.
Also modify Quick Settings to use this code rather than having
its own logic.
Bug: 19180466
Change-Id: Iff9f9aed240d79323dba41496496e8076b9fa6f2
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/qs')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java | 27 |
1 files changed, 11 insertions, 16 deletions
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 bd4dbe6..70746c7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -16,6 +16,8 @@ package com.android.systemui.qs.tiles; +import java.util.List; + import android.content.Context; import android.content.Intent; import android.content.res.Resources; @@ -24,16 +26,15 @@ import android.util.Log; import android.view.View; import android.view.ViewGroup; +import com.android.settingslib.wifi.AccessPoint; import com.android.systemui.R; import com.android.systemui.qs.QSDetailItems; import com.android.systemui.qs.QSDetailItems.Item; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTileView; import com.android.systemui.qs.SignalTileView; -import com.android.systemui.statusbar.phone.QSTileHost; import com.android.systemui.statusbar.policy.NetworkController; 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 **/ @@ -282,10 +283,10 @@ public class WifiTile extends QSTile<QSTile.SignalState> { } @Override - public void onAccessPointsChanged(final AccessPoint[] accessPoints) { - mAccessPoints = accessPoints; + public void onAccessPointsChanged(final List<AccessPoint> accessPoints) { + mAccessPoints = accessPoints.toArray(new AccessPoint[accessPoints.size()]); updateItems(); - if (accessPoints != null && accessPoints.length > 0) { + if (accessPoints != null && accessPoints.size() > 0) { fireScanStateChanged(false); } } @@ -299,7 +300,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { public void onDetailItemClick(Item item) { if (item == null || item.tag == null) return; final AccessPoint ap = (AccessPoint) item.tag; - if (!ap.isConnected) { + if (!ap.isActive()) { if (mWifiController.connect(ap)) { mHost.collapsePanels(); } @@ -326,16 +327,10 @@ public class WifiTile extends QSTile<QSTile.SignalState> { final AccessPoint ap = mAccessPoints[i]; final Item item = new Item(); item.tag = ap; - item.icon = ap.iconId; - item.line1 = ap.ssid; - if (ap.isConnected) { - item.line2 = mContext.getString(ap.isConfigured ? - R.string.quick_settings_connected : - R.string.quick_settings_connected_via_wfa); - } else if (ap.networkId >= 0) { - item.line2 = mContext.getString(R.string.quick_settings_saved); - } - item.overlay = ap.hasSecurity + item.icon = mWifiController.getIcon(ap); + item.line1 = ap.getSsid(); + item.line2 = ap.getSummary(); + item.overlay = ap.getSecurity() != AccessPoint.SECURITY_NONE ? mContext.getDrawable(R.drawable.qs_ic_wifi_lock) : null; items[i] = item; |