From b27ec6d37d277fe54cb8b85590758a7ad1767ff0 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Mon, 1 Dec 2014 17:50:16 -0500 Subject: QS Wifi panel show icon on secure networks Bug: 18365695 Change-Id: Ib63822643a5b033d8b73591e9b379b3539b8865e --- packages/SystemUI/res/drawable/qs_ic_wifi_lock.xml | 28 ++++++++++++++++++++++ .../src/com/android/systemui/qs/QSDetailItems.java | 9 ++++++- .../com/android/systemui/qs/tiles/WifiTile.java | 5 ++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 packages/SystemUI/res/drawable/qs_ic_wifi_lock.xml diff --git a/packages/SystemUI/res/drawable/qs_ic_wifi_lock.xml b/packages/SystemUI/res/drawable/qs_ic_wifi_lock.xml new file mode 100644 index 0000000..2ac223b --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_ic_wifi_lock.xml @@ -0,0 +1,28 @@ + + + + + + diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java index ce0d5f4..a311d6e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java @@ -18,13 +18,13 @@ package com.android.systemui.qs; import android.content.Context; import android.content.res.Configuration; +import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; -import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -162,6 +162,12 @@ public class QSDetailItems extends FrameLayout { view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE); final ImageView iv = (ImageView) view.findViewById(android.R.id.icon); iv.setImageResource(item.icon); + iv.getOverlay().clear(); + if (item.overlay != null) { + item.overlay.setBounds(0, 0, item.overlay.getIntrinsicWidth(), + item.overlay.getIntrinsicHeight()); + iv.getOverlay().add(item.overlay); + } final TextView title = (TextView) view.findViewById(android.R.id.title); title.setText(item.line1); final TextView summary = (TextView) view.findViewById(android.R.id.summary); @@ -213,6 +219,7 @@ public class QSDetailItems extends FrameLayout { public static class Item { public int icon; + public Drawable overlay; public String line1; public String line2; public Object tag; 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 699240c..a920624 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -326,7 +326,12 @@ public class WifiTile extends QSTile { item.line2 = mContext.getString(ap.isConfigured ? R.string.quick_settings_connected : R.string.quick_settings_connected_via_wfa); + } else if (ap.networkId >= 0) { + // TODO: Set line 2 to wifi saved string here. } + item.overlay = ap.hasSecurity + ? mContext.getDrawable(R.drawable.qs_ic_wifi_lock) + : null; items[i] = item; } } -- cgit v1.1