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:
Jake Hamby
2011-01-19 14:53:44 -08:00
parent 2fdd006b1a
commit cde015b3d4
5 changed files with 25 additions and 3 deletions

View File

@@ -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) {
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
.getProfileManager(mLocalManager, profile);
int iconResource = profileManager.getDrawableResource();
int iconResource;
if (profile == Profile.HID && mBtClass != null) {
iconResource = getHidClassDrawable();
} else {
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
.getProfileManager(mLocalManager, profile);
iconResource = profileManager.getDrawableResource();
}
if (iconResource != 0) {
drawables.put(profile, mContext.getResources().getDrawable(iconResource));
}