Add battery indicator to bluetooth icon
This cl change util method in bluetooth package to return drawable instead of resId. If the bt device has battery level, then method return customized layerDrawable, otherwise return a simple drawable created from resId. Bug: 63393322 Test: RunSettingsRoboTests Change-Id: Ib21822eafda0e8570212ce5cb070478e4f4876a2 Merged-In: Ib21822eafda0e8570212ce5cb070478e4f4876a2
This commit is contained in:
@@ -21,6 +21,7 @@ import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserManager;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
@@ -120,9 +121,9 @@ public final class BluetoothDevicePreference extends GearPreference implements
|
||||
// Null check is done at the framework
|
||||
setSummary(mCachedDevice.getConnectionSummary());
|
||||
|
||||
Pair<Integer, String> pair = Utils.getBtClassDrawableWithDescription(mResources,
|
||||
final Pair<Drawable, String> pair = Utils.getBtClassDrawableWithDescription(getContext(),
|
||||
mCachedDevice);
|
||||
if (pair.first != 0) {
|
||||
if (pair.first != null) {
|
||||
setIcon(pair.first);
|
||||
contentDescription = pair.second;
|
||||
}
|
||||
|
Reference in New Issue
Block a user