Update MediaDevice icon

- This CL update MediaDevice icon.
- Update test case.

Bug: 157208551
Test: make -j42 RunSettingsLibRoboTests
Change-Id: I1030ca9cbd0a4c05b3f56a463b83bb6b4d3b7756
This commit is contained in:
hughchen
2020-05-27 17:18:40 +08:00
parent 148fb0e8c2
commit cae61a70e6
8 changed files with 97 additions and 28 deletions

View File

@@ -0,0 +1,29 @@
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000000"
android:pathData="M19,15v3c0,0.55 -0.45,1 -1,1h-1v-4h2M7,15v4H6c-0.55,
0 -1,-0.45 -1,-1v-3h2m5,-13c-4.97,0 -9,4.03 -9,9v7c0,1.66 1.34,3 3,3h3v-8H5v-2c0,
-3.87 3.13,-7 7,-7s7,3.13 7,7v2h-4v8h3c1.66,0 3,-1.34 3,-3v-7c0,-4.97 -4.03,
-9 -9,-9z"/>
</vector>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 The Android Open Source Project
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,19 +15,16 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="24"
android:viewportHeight="24"
android:width="24dp"
android:height="24dp"
android:width="14dp"
android:height="11dp"
android:viewportWidth="14"
android:viewportHeight="11"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#00000000"
android:fillAlpha=".1"
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="#00000000"
android:pathData="M0 0h24v24H0z" />
<path
android:pathData="M10,10v1H4v-1H1.5A1.5,1.5 0,0 1,0 8.5v-7A1.5,1.5 0,
0 1,1.5 0h11A1.5,1.5 0,0 1,14 1.5v7a1.5,1.5 0,0 1,-1.5 1.5H10zM1.5,
1a0.5,0.5 0,0 0,-0.5 0.5v7a0.5,0.5 0,0 0,0.5 0.5h11a0.5,0.5 0,0 0,
0.5 -0.5v-7a0.5,0.5 0,0 0,-0.5 -0.5h-11z"
android:fillColor="#000000"
android:pathData="M21 3H3c-1.1 0-2 0.9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2 -0.9 2-2V5c0-1.1 -0.9-2-2-2zM1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0-4v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11z" />
android:fillType="evenOdd"/>
</vector>

View File

@@ -21,12 +21,16 @@
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:pathData="M18.2,1L9.8,1C8.81,1 8,1.81 8,2.8v14.4c0,0.99 0.81,1.79 1.8,1.79l8.4,0.01c0.99,0 1.8,-0.81 1.8,-1.8L20,2.8c0,-0.99 -0.81,-1.8 -1.8,-1.8zM14,3c1.1,0 2,0.89 2,2s-0.9,2 -2,2 -2,-0.89 -2,-2 0.9,-2 2,-2zM14,16.5c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4 4,1.79 4,4 -1.79,4 -4,4z"
android:fillColor="#000000"/>
android:fillColor="#000000"
android:pathData="M19,4v14l-10,-0.01V4h10m0,-2H9c-1.1,0 -2,0.9 -2,2v13.99c0,1.1 0.89,
2 2,2L19,20c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2z"/>
<path
android:pathData="M14,12.5m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0"
android:fillColor="#000000"/>
android:fillColor="#000000"
android:pathData="M14,7m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:pathData="M6,5H4v16c0,1.1 0.89,2 2,2h10v-2H6V5z"
android:fillColor="#000000"/>
android:fillColor="#000000"
android:pathData="M14,17c1.93,0 3.5,-1.57 3.5,-3.5S15.93,10 14,10s-3.5,
1.57 -3.5,3.5S12.07,17 14,17zM14,12c0.83,0 1.5,0.67 1.5,1.5S14.83,15 14,
15s-1.5,-0.67 -1.5,-1.5 0.67,-1.5 1.5,-1.5zM6,5L4,5v16c0,1.1 0.89,2 2,
2h10v-2L6,21L6,5z"/>
</vector>

View File

@@ -0,0 +1,30 @@
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000000"
android:pathData="M17,2L7,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,1.99 2,1.99L17,
22c1.1,0 2,-0.9 2,-2L19,4c0,-1.1 -0.9,-2 -2,-2zM7,20L7,4h10v16L7,20zM12,9c1.1,0 2,
-0.9 2,-2s-0.9,-2 -2,-2c-1.11,0 -2,0.9 -2,2s0.89,2 2,2zM12,11c-2.21,0 -4,1.79 -4,
4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,
0.9 2,2 -0.9,2 -2,2z"/>
</vector>

View File

@@ -20,10 +20,9 @@
android:width="24dp"
android:height="24dp"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#00000000"
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="#000000"
android:pathData="M17 1.01L7 1c-1.1 0-2 0.9-2 2v18c0 1.1 0.9 2 2 2h10c1.1 0 2 -0.9 2-2V3c0-1.1 -0.9-1.99-2-1.99zM17 19H7V5h10v14z" />
android:pathData="M17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,
2 2,2h10c1.1,0 2,-0.9 2,-2L19,3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,
21L7,21v-1h10v1zM17,18L7,18L7,6h10v12zM7,4L7,3h10v1L7,4z"/>
</vector>

View File

@@ -59,12 +59,18 @@ public class BluetoothMediaDevice extends MediaDevice {
public Drawable getIcon() {
final Pair<Drawable, String> pair = BluetoothUtils
.getBtRainbowDrawableWithDescription(mContext, mCachedDevice);
return pair.first;
return isFastPairDevice()
? pair.first
: BluetoothUtils.buildBtRainbowDrawable(mContext,
mContext.getDrawable(R.drawable.ic_headphone),
mCachedDevice.getAddress().hashCode());
}
@Override
public Drawable getIconWithoutBackground() {
return BluetoothUtils.getBtDrawableWithDescription(mContext, mCachedDevice).first;
return isFastPairDevice()
? BluetoothUtils.getBtDrawableWithDescription(mContext, mCachedDevice).first
: mContext.getDrawable(R.drawable.ic_headphone);
}
@Override

View File

@@ -73,9 +73,11 @@ public class InfoMediaDevice extends MediaDevice {
resId = R.drawable.ic_media_group_device;
break;
case TYPE_REMOTE_TV:
resId = R.drawable.ic_media_display_device;
break;
case TYPE_REMOTE_SPEAKER:
default:
resId = R.drawable.ic_media_device;
resId = R.drawable.ic_media_speaker_device;
break;
}
return resId;

View File

@@ -95,11 +95,13 @@ public class InfoMediaDeviceTest {
public void getDrawableResId_returnCorrectResId() {
when(mRouteInfo.getType()).thenReturn(TYPE_REMOTE_TV);
assertThat(mInfoMediaDevice.getDrawableResId()).isEqualTo(R.drawable.ic_media_device);
assertThat(mInfoMediaDevice.getDrawableResId()).isEqualTo(
R.drawable.ic_media_display_device);
when(mRouteInfo.getType()).thenReturn(TYPE_REMOTE_SPEAKER);
assertThat(mInfoMediaDevice.getDrawableResId()).isEqualTo(R.drawable.ic_media_device);
assertThat(mInfoMediaDevice.getDrawableResId()).isEqualTo(
R.drawable.ic_media_speaker_device);
when(mRouteInfo.getType()).thenReturn(TYPE_GROUP);