<!-- [CHAR LIMIT=NONE] The preference summary for enabling cross-profile remote contact search -->
<string name="managed_profile_contact_search_summary">Allow contact searches by your organization to identify callers and contacts</string>
+ <!-- Message for telling the user the kind of BT device being displayed in list. -->
+ <string name="bluetooth_talkback_computer">Computer</string>
+
+ <!-- Message for telling the user the kind of BT device being displayed in list. -->
+ <string name="bluetooth_talkback_headset">Headset</string>
+
+ <!-- Message for telling the user the kind of BT device being displayed in list. -->
+ <string name="bluetooth_talkback_phone">Phone</string>
+
+ <!-- Message for telling the user the kind of BT device being displayed in list. -->
+ <string name="bluetooth_talkback_imaging">Imaging</string>
+
+ <!-- Message for telling the user the kind of BT device being displayed in list. -->
+ <string name="bluetooth_talkback_headphone">Headphone</string>
+
+ <!-- Message for telling the user the kind of BT device being displayed in list. -->
+ <string name="bluetooth_talkback_input_peripheral">Input Peripheral</string>
+
+ <!-- Message for telling the user the kind of BT device being displayed in list. -->
+ <string name="bluetooth_talkback_bluetooth">Bluetooth</string>
</resources>
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.res.Resources;
import android.os.UserManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
+import android.util.Pair;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
private AlertDialog mDisconnectDialog;
+ private String contentDescription = null;
+
+ /* Talk-back descriptions for various BT icons */
+ Resources r = getContext().getResources();
+ public final String COMPUTER = r.getString(R.string.bluetooth_talkback_computer);
+ public final String INPUT_PERIPHERAL = r.getString(
+ R.string.bluetooth_talkback_input_peripheral);
+ public final String HEADSET = r.getString(R.string.bluetooth_talkback_headset);
+ public final String PHONE = r.getString(R.string.bluetooth_talkback_phone);
+ public final String IMAGING = r.getString(R.string.bluetooth_talkback_imaging);
+ public final String HEADPHONE = r.getString(R.string.bluetooth_talkback_headphone);
+ public final String BLUETOOTH = r.getString(R.string.bluetooth_talkback_bluetooth);
+
public BluetoothDevicePreference(Context context, CachedBluetoothDevice cachedDevice) {
super(context);
setSummary(null); // empty summary for unpaired devices
}
- int iconResId = getBtClassDrawable();
- if (iconResId != 0) {
- setIcon(iconResId);
+
+ Pair<Integer, String> pair = getBtClassDrawableWithDescription();
+ if (pair.first != 0) {
+ setIcon(pair.first);
+ contentDescription = pair.second;
}
// Used to gray out the item
deviceDetails.setTag(mCachedDevice);
}
}
-
+ final ImageView imageView = (ImageView) view.findViewById(android.R.id.icon);
+ if (imageView != null) {
+ imageView.setContentDescription(contentDescription);
+ }
super.onBindViewHolder(view);
}
}
}
- private int getBtClassDrawable() {
+ private Pair<Integer, String> getBtClassDrawableWithDescription() {
BluetoothClass btClass = mCachedDevice.getBtClass();
if (btClass != null) {
switch (btClass.getMajorDeviceClass()) {
case BluetoothClass.Device.Major.COMPUTER:
- return R.drawable.ic_bt_laptop;
+ return new Pair<Integer, String>(R.drawable.ic_bt_laptop, COMPUTER);
case BluetoothClass.Device.Major.PHONE:
- return R.drawable.ic_bt_cellphone;
+ return new Pair<Integer, String>(R.drawable.ic_bt_cellphone, PHONE);
case BluetoothClass.Device.Major.PERIPHERAL:
- return HidProfile.getHidClassDrawable(btClass);
+ return new Pair<Integer, String>(HidProfile.getHidClassDrawable(btClass),
+ INPUT_PERIPHERAL);
case BluetoothClass.Device.Major.IMAGING:
- return R.drawable.ic_bt_imaging;
+ return new Pair<Integer, String>(R.drawable.ic_bt_imaging, IMAGING);
default:
// unrecognized device class; continue
for (LocalBluetoothProfile profile : profiles) {
int resId = profile.getDrawableResource(btClass);
if (resId != 0) {
- return resId;
+ return new Pair<Integer, String>(resId, null);
}
}
if (btClass != null) {
if (btClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
- return R.drawable.ic_bt_headphones_a2dp;
-
+ return new Pair<Integer, String>(R.drawable.ic_bt_headphones_a2dp, HEADPHONE);
}
if (btClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) {
- return R.drawable.ic_bt_headset_hfp;
+ return new Pair<Integer, String>(R.drawable.ic_bt_headset_hfp, HEADSET);
}
}
- return R.drawable.ic_settings_bluetooth;
+ return new Pair<Integer, String>(R.drawable.ic_settings_bluetooth, BLUETOOTH);
}
}