Display correct HID icon for pointing and misc. devices
Added placeholder icons and code for non-keyboard HID devices. ic_bt_pointing_hid.png - pointing device ic_bt_misc_hid.png - gamepad, remote control, card reader, etc. Bug: 3137982 Change-Id: Iac7a53a6fbafa9c6ed794a29aa330da314d580d8
This commit is contained in:
BIN
res/drawable-hdpi/ic_bt_misc_hid.png
Executable file
BIN
res/drawable-hdpi/ic_bt_misc_hid.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-hdpi/ic_bt_pointing_hid.png
Executable file
BIN
res/drawable-hdpi/ic_bt_pointing_hid.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-mdpi/ic_bt_misc_hid.png
Executable file
BIN
res/drawable-mdpi/ic_bt_misc_hid.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 954 B |
BIN
res/drawable-mdpi/ic_bt_pointing_hid.png
Executable file
BIN
res/drawable-mdpi/ic_bt_pointing_hid.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 954 B |
@@ -531,6 +531,9 @@ class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
||||
|
||||
case BluetoothClass.Device.Major.PHONE:
|
||||
return R.drawable.ic_bt_cellphone;
|
||||
|
||||
case BluetoothClass.Device.Major.PERIPHERAL:
|
||||
return getHidClassDrawable();
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "mBtClass is null");
|
||||
@@ -554,6 +557,20 @@ class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int getHidClassDrawable() {
|
||||
switch (mBtClass.getDeviceClass()) {
|
||||
case BluetoothClass.Device.PERIPHERAL_KEYBOARD:
|
||||
case BluetoothClass.Device.PERIPHERAL_KEYBOARD_POINTING:
|
||||
return R.drawable.ic_bt_keyboard_hid;
|
||||
|
||||
case BluetoothClass.Device.PERIPHERAL_POINTING:
|
||||
return R.drawable.ic_bt_pointing_hid;
|
||||
|
||||
default:
|
||||
return R.drawable.ic_bt_misc_hid;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a new value for the cached BT class.
|
||||
*/
|
||||
@@ -661,9 +678,14 @@ class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
||||
Map<Profile, Drawable> drawables = new HashMap<Profile, Drawable>();
|
||||
|
||||
for (Profile profile : mProfiles) {
|
||||
int iconResource;
|
||||
if (profile == Profile.HID && mBtClass != null) {
|
||||
iconResource = getHidClassDrawable();
|
||||
} else {
|
||||
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
|
||||
.getProfileManager(mLocalManager, profile);
|
||||
int iconResource = profileManager.getDrawableResource();
|
||||
iconResource = profileManager.getDrawableResource();
|
||||
}
|
||||
if (iconResource != 0) {
|
||||
drawables.put(profile, mContext.getResources().getDrawable(iconResource));
|
||||
}
|
||||
|
Reference in New Issue
Block a user