Add 50% opacity if detect there is no device image yet
Screenshot: https://screenshot.googleplex.com/Ah9DKn85S3AWB4r.png Bug: 177901821 Test: build pass and manual test Change-Id: Ia5142cdd1cf105d978043987ad92c5c4e8c79e0c
This commit is contained in:
@@ -85,6 +85,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
|||||||
private static final int RIGHT_DEVICE_ID = 2;
|
private static final int RIGHT_DEVICE_ID = 2;
|
||||||
private static final int CASE_DEVICE_ID = 3;
|
private static final int CASE_DEVICE_ID = 3;
|
||||||
private static final int MAIN_DEVICE_ID = 4;
|
private static final int MAIN_DEVICE_ID = 4;
|
||||||
|
private static final float HALF_ALPHA = 0.5f;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
LayoutPreference mLayoutPreference;
|
LayoutPreference mLayoutPreference;
|
||||||
@@ -425,10 +426,12 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void updateIcon(ImageView imageView, String iconUri) {
|
void updateIcon(ImageView imageView, String iconUri) {
|
||||||
if (mIconCache.containsKey(iconUri)) {
|
if (mIconCache.containsKey(iconUri)) {
|
||||||
|
imageView.setAlpha(1f);
|
||||||
imageView.setImageBitmap(mIconCache.get(iconUri));
|
imageView.setImageBitmap(mIconCache.get(iconUri));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageView.setAlpha(HALF_ALPHA);
|
||||||
ThreadUtils.postOnBackgroundThread(() -> {
|
ThreadUtils.postOnBackgroundThread(() -> {
|
||||||
final Uri uri = Uri.parse(iconUri);
|
final Uri uri = Uri.parse(iconUri);
|
||||||
try {
|
try {
|
||||||
@@ -439,6 +442,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
|||||||
mContext.getContentResolver(), uri);
|
mContext.getContentResolver(), uri);
|
||||||
ThreadUtils.postOnMainThread(() -> {
|
ThreadUtils.postOnMainThread(() -> {
|
||||||
mIconCache.put(iconUri, bitmap);
|
mIconCache.put(iconUri, bitmap);
|
||||||
|
imageView.setAlpha(1f);
|
||||||
imageView.setImageBitmap(bitmap);
|
imageView.setImageBitmap(bitmap);
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Reference in New Issue
Block a user