Bluetooth: Use string in remote device summary

am: 04f5967c95

Change-Id: Ib8673c03e6875d4661015f9fa0eb25b658090ad2
This commit is contained in:
Jack He
2017-07-06 03:23:43 +00:00
committed by android-build-merger
5 changed files with 29 additions and 27 deletions

View File

@@ -53,12 +53,11 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController
protected void setHeaderProperties() {
Pair<Integer, String> pair = Utils.getBtClassDrawableWithDescription
(mContext.getResources(), mCachedDevice);
int summaryResourceId = mCachedDevice.getConnectionSummary();
String summaryText = mCachedDevice.getConnectionSummary();
mHeaderController.setLabel(mCachedDevice.getName());
mHeaderController.setIcon(mContext.getDrawable(pair.first));
mHeaderController.setIconContentDescription(pair.second);
mHeaderController.setSummary(
summaryResourceId > 0 ? mContext.getString(summaryResourceId) : null);
mHeaderController.setSummary(summaryText);
}
@Override

View File

@@ -117,14 +117,8 @@ public final class BluetoothDevicePreference extends GearPreference implements
* any preference info has changed from the previous value.
*/
setTitle(mCachedDevice.getName());
int summaryResId = mCachedDevice.getConnectionSummary();
if (summaryResId != 0) {
setSummary(summaryResId);
} else {
setSummary(null); // empty summary for unpaired devices
}
// Null check is done at the framework
setSummary(mCachedDevice.getConnectionSummary());
Pair<Integer, String> pair = Utils.getBtClassDrawableWithDescription(mResources,
mCachedDevice);