packages/apps/Settings
Revision | 8c21955e135b7482936a7ce935afd2900767afdb (tree) |
---|---|
Time | 2016-10-05 05:26:38 |
Author | Steve Kondik <steve@cyng...> |
Commiter | Steve Kondik |
Merge tag 'android-7.0.0_r14' of https://android.googlesource.com/platform/packages/apps/Settings into cm-14.0
Android 7.0.0 Release 14 (NBD90Z)
Change-Id: I82c1b165066d47989d012667de1391900f5774e9
@@ -385,11 +385,10 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem | ||
385 | 385 | messageId = R.string.bluetooth_empty_list_user_restricted; |
386 | 386 | break; |
387 | 387 | } |
388 | - if (getPreferenceScreen().getPreferenceCount() == 0) { | |
389 | - getPreferenceScreen().addPreference(mPairedDevicesCategory); | |
390 | - getPreferenceScreen().addPreference(mAvailableDevicesCategory); | |
391 | - getPreferenceScreen().addPreference(mMyDevicePreference); | |
392 | - } | |
388 | + getPreferenceScreen().removeAll(); | |
389 | + getPreferenceScreen().addPreference(mPairedDevicesCategory); | |
390 | + getPreferenceScreen().addPreference(mAvailableDevicesCategory); | |
391 | + getPreferenceScreen().addPreference(mMyDevicePreference); | |
393 | 392 | |
394 | 393 | // Paired devices category |
395 | 394 | addDeviceCategory(mPairedDevicesCategory, |
@@ -43,6 +43,7 @@ import android.provider.Settings; | ||
43 | 43 | import android.support.v7.preference.Preference; |
44 | 44 | import android.support.v7.preference.PreferenceViewHolder; |
45 | 45 | import android.text.Spannable; |
46 | +import android.text.TextUtils; | |
46 | 47 | import android.text.style.TextAppearanceSpan; |
47 | 48 | import android.util.Log; |
48 | 49 | import android.view.ContextMenu; |
@@ -55,6 +56,7 @@ import android.widget.ProgressBar; | ||
55 | 56 | import android.widget.TextView; |
56 | 57 | import android.widget.TextView.BufferType; |
57 | 58 | import android.widget.Toast; |
59 | + | |
58 | 60 | import com.android.internal.logging.MetricsLogger; |
59 | 61 | import com.android.internal.logging.MetricsProto.MetricsEvent; |
60 | 62 | import com.android.settings.LinkifyUtils; |
@@ -114,6 +116,8 @@ public class WifiSettings extends RestrictedSettingsFragment | ||
114 | 116 | private static final String SAVE_DIALOG_ACCESS_POINT_STATE = "wifi_ap_state"; |
115 | 117 | private static final String SAVED_WIFI_NFC_DIALOG_STATE = "wifi_nfc_dlg_state"; |
116 | 118 | |
119 | + private static final String PREF_KEY_EMPTY_WIFI_LIST = "wifi_empty_list"; | |
120 | + | |
117 | 121 | protected WifiManager mWifiManager; |
118 | 122 | private WifiManager.ActionListener mConnectListener; |
119 | 123 | private WifiManager.ActionListener mSaveListener; |
@@ -647,7 +651,6 @@ public class WifiSettings extends RestrictedSettingsFragment | ||
647 | 651 | // AccessPoints are automatically sorted with TreeSet. |
648 | 652 | final Collection<AccessPoint> accessPoints = |
649 | 653 | mWifiTracker.getAccessPoints(); |
650 | - getPreferenceScreen().removeAll(); | |
651 | 654 | |
652 | 655 | boolean hasAvailableAccessPoints = false; |
653 | 656 | int index = 0; |
@@ -656,6 +659,9 @@ public class WifiSettings extends RestrictedSettingsFragment | ||
656 | 659 | // Ignore access points that are out of range. |
657 | 660 | if (accessPoint.getLevel() != -1) { |
658 | 661 | String key = accessPoint.getBssid(); |
662 | + if (TextUtils.isEmpty(key)) { | |
663 | + key = accessPoint.getSsidStr(); | |
664 | + } | |
659 | 665 | hasAvailableAccessPoints = true; |
660 | 666 | LongPressAccessPointPreference pref = (LongPressAccessPointPreference) |
661 | 667 | getCachedPreference(key); |
@@ -693,6 +699,7 @@ public class WifiSettings extends RestrictedSettingsFragment | ||
693 | 699 | pref.setSelectable(false); |
694 | 700 | pref.setSummary(R.string.wifi_empty_list_wifi_on); |
695 | 701 | pref.setOrder(0); |
702 | + pref.setKey(PREF_KEY_EMPTY_WIFI_LIST); | |
696 | 703 | getPreferenceScreen().addPreference(pref); |
697 | 704 | mAddPreference.setOrder(1); |
698 | 705 | getPreferenceScreen().addPreference(mAddPreference); |
@@ -903,8 +910,19 @@ public class WifiSettings extends RestrictedSettingsFragment | ||
903 | 910 | } |
904 | 911 | |
905 | 912 | @Override |
906 | - public void onAccessPointChanged(AccessPoint accessPoint) { | |
907 | - ((LongPressAccessPointPreference) accessPoint.getTag()).refresh(); | |
913 | + public void onAccessPointChanged(final AccessPoint accessPoint) { | |
914 | + View view = getView(); | |
915 | + if (view != null) { | |
916 | + view.post(new Runnable() { | |
917 | + @Override | |
918 | + public void run() { | |
919 | + Object tag = accessPoint.getTag(); | |
920 | + if (tag != null) { | |
921 | + ((LongPressAccessPointPreference) tag).refresh(); | |
922 | + } | |
923 | + } | |
924 | + }); | |
925 | + } | |
908 | 926 | } |
909 | 927 | |
910 | 928 | @Override |