Remove sub-text from the lines of AP list in Wi-Fi Slice
- Remove sub-text from the lines of AP list
- Add colors to the AP names to indicate the connection status of each AP
Fixes: 120685004
Bug: 120786304
Test: make RunSettingsRoboTests -j
Change-Id: I7b879248528a293d14d959994bb054275f0d69a1
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 93a785f..30b2d71 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -958,6 +958,22 @@
}
/**
+ * Converts the {@link Drawable} to a {@link Bitmap}.
+ */
+ public static Bitmap drawableToBitmap(Drawable drawable) {
+ if (drawable instanceof BitmapDrawable) {
+ return ((BitmapDrawable)drawable).getBitmap();
+ }
+
+ final Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
+ final Canvas canvas = new Canvas(bitmap);
+ drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+ drawable.draw(canvas);
+ return bitmap;
+ }
+
+ /**
* Get the {@link Drawable} that represents the app icon
*/
public static Drawable getBadgedIcon(IconDrawableFactory iconDrawableFactory,