Move the lock item for the QS WifiPicker.
This matches the new Wifi Picker style used in WifiSettings.
Bug: 35164592
Test: See screenshot in comments
Change-Id: I6b1203adf4b217071510b3411aadc3f38f2650d6
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java
index dad8bea..65238b1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java
@@ -203,16 +203,28 @@
}
}
});
- final ImageView disconnect = (ImageView) view.findViewById(android.R.id.icon2);
- disconnect.setVisibility(item.canDisconnect ? VISIBLE : GONE);
- disconnect.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mCallback != null) {
- mCallback.onDetailItemDisconnect(item);
+
+ final ImageView icon2 = (ImageView) view.findViewById(android.R.id.icon2);
+ if (item.canDisconnect) {
+ icon2.setImageResource(R.drawable.ic_qs_cancel);
+ icon2.setVisibility(VISIBLE);
+ icon2.setClickable(true);
+ icon2.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mCallback != null) {
+ mCallback.onDetailItemDisconnect(item);
+ }
}
- }
- });
+ });
+ } else if (item.icon2 != -1) {
+ icon2.setVisibility(VISIBLE);
+ icon2.setImageResource(item.icon2);
+ icon2.setClickable(false);
+ } else {
+ icon2.setVisibility(GONE);
+ }
+
return view;
}
};
@@ -245,6 +257,7 @@
public CharSequence line2;
public Object tag;
public boolean canDisconnect;
+ public int icon2 = -1;
}
public interface Callback {
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 90a9db6..796967c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
@@ -372,9 +372,9 @@
item.icon = mWifiController.getIcon(ap);
item.line1 = ap.getSsid();
item.line2 = ap.isActive() ? ap.getSummary() : null;
- item.overlay = ap.getSecurity() != AccessPoint.SECURITY_NONE
- ? mContext.getDrawable(R.drawable.qs_ic_wifi_lock)
- : null;
+ item.icon2 = ap.getSecurity() != AccessPoint.SECURITY_NONE
+ ? R.drawable.qs_ic_wifi_lock
+ : -1;
items[i] = item;
}
}