Merge "Update bt icon color"

This commit is contained in:
Lei Yu
2019-04-02 17:34:21 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 11 deletions

View File

@@ -20,13 +20,13 @@
<color name="usage_graph_dots">@*android:color/tertiary_device_default_settings</color>
<color name="list_divider_color">#64000000</color>
<color name="bt_color_icon_1">#48a50e0e</color> <!-- 72% Material Red 900 -->
<color name="bt_color_icon_2">#480d652d</color> <!-- 72% Material Green 900 -->
<color name="bt_color_icon_3">#48e37400</color> <!-- 72% Material Yellow 900 -->
<color name="bt_color_icon_4">#48b06000</color> <!-- 72% Material Orange 900 -->
<color name="bt_color_icon_5">#489c166b</color> <!-- 72% Material Pink 900 -->
<color name="bt_color_icon_6">#48681da8</color> <!-- 72% Material Purple 900 -->
<color name="bt_color_icon_7">#48007b83</color> <!-- 72% Material Cyan 900 -->
<color name="bt_color_icon_1">#b4a50e0e</color> <!-- 72% Material Red 900 -->
<color name="bt_color_icon_2">#b40d652d</color> <!-- 72% Material Green 900 -->
<color name="bt_color_icon_3">#b4e37400</color> <!-- 72% Material Yellow 900 -->
<color name="bt_color_icon_4">#b4b06000</color> <!-- 72% Material Orange 900 -->
<color name="bt_color_icon_5">#b49c166b</color> <!-- 72% Material Pink 900 -->
<color name="bt_color_icon_6">#b4681da8</color> <!-- 72% Material Purple 900 -->
<color name="bt_color_icon_7">#b4007b83</color> <!-- 72% Material Cyan 900 -->
<color name="bt_color_bg_1">#fad2cf</color> <!-- Material Red 100 -->
<color name="bt_color_bg_2">#ceead6</color> <!-- Material Green 100 -->

View File

@@ -6,7 +6,6 @@ import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.MediaStore;
@@ -135,7 +134,7 @@ public class BluetoothUtils {
final BluetoothDevice bluetoothDevice = cachedDevice.getDevice();
final boolean untetheredHeadset = bluetoothDevice != null
? Boolean.parseBoolean(bluetoothDevice.getMetadata(
BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
: false;
final int iconSize = context.getResources().getDimensionPixelSize(
R.dimen.bt_nearby_icon_size);
@@ -181,8 +180,8 @@ public class BluetoothUtils {
final int[] iconBgColors = resources.getIntArray(R.array.bt_icon_bg_colors);
// get color index based on mac address
final int index = Math.abs(hashCode % iconBgColors.length);
drawable.setColorFilter(iconFgColors[index], PorterDuff.Mode.SRC_ATOP);
final int index = Math.abs(hashCode % iconBgColors.length);
drawable.setTint(iconFgColors[index]);
final Drawable adaptiveIcon = new AdaptiveIcon(context, drawable);
((AdaptiveIcon) adaptiveIcon).setBackgroundColor(iconBgColors[index]);