Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3475)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapView.java

Issue 2843973002: Use larger vector graphics for special tiles and fix selection ring. (Closed)
Patch Set: Address feedback from Theresa Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapView.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapView.java
index 268ae51d33a68c584ff748812d9b55822fb3429d..270c4b7c0b3d7d6389db052605be3667807de259 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapView.java
@@ -56,13 +56,19 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
private View mScrim;
// The control that signifies the image has been selected.
- private ImageView mSelectedView;
+ private View mSelectedView;
// The control that signifies the image has not been selected.
private View mUnselectedView;
// The camera/gallery special tile (with icon as drawable).
- private TextView mSpecialTile;
+ private View mSpecialTile;
+
+ // The camera/gallery icon.
+ public ImageView mSpecialTileIcon;
+
+ // The label under the special tile.
+ public TextView mSpecialTileLabel;
// Whether the image has been loaded already.
private boolean mImageLoaded;
@@ -83,9 +89,11 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
super.onFinishInflate();
mIconView = (ImageView) findViewById(R.id.bitmap_view);
mScrim = findViewById(R.id.scrim);
- mSelectedView = (ImageView) findViewById(R.id.selected);
+ mSelectedView = findViewById(R.id.selected);
mUnselectedView = findViewById(R.id.unselected);
- mSpecialTile = (TextView) findViewById(R.id.special_tile);
+ mSpecialTile = findViewById(R.id.special_tile);
+ mSpecialTileIcon = (ImageView) findViewById(R.id.special_tile_icon);
+ mSpecialTileLabel = (TextView) findViewById(R.id.special_tile_label);
}
@Override
@@ -218,12 +226,13 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
labelStringId = R.string.photo_picker_browse;
}
- ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
- mSpecialTile, null, image, null, null);
- mSpecialTile.setText(labelStringId);
+ mSpecialTileIcon.setImageDrawable(image);
+ mSpecialTileLabel.setText(labelStringId);
// Reset visibility, since #initialize() sets mSpecialTile visibility to GONE.
mSpecialTile.setVisibility(View.VISIBLE);
+ mSpecialTileIcon.setVisibility(View.VISIBLE);
+ mSpecialTileLabel.setVisibility(View.VISIBLE);
}
/**
@@ -274,6 +283,8 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
mSelectedView.setVisibility(View.GONE);
mScrim.setVisibility(View.GONE);
mSpecialTile.setVisibility(View.GONE);
+ mSpecialTileIcon.setVisibility(View.GONE);
+ mSpecialTileLabel.setVisibility(View.GONE);
}
/**
@@ -300,22 +311,21 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
if (!special) {
bgColorId = R.color.photo_picker_tile_bg_color;
fgColorId = R.color.photo_picker_special_tile_color;
- } else if (!anySelection) {
- bgColorId = R.color.photo_picker_special_tile_bg_color;
- fgColorId = R.color.photo_picker_special_tile_color;
} else {
- bgColorId = R.color.photo_picker_special_tile_disabled_bg_color;
- fgColorId = R.color.photo_picker_special_tile_disabled_color;
- }
+ if (!anySelection) {
+ bgColorId = R.color.photo_picker_special_tile_bg_color;
+ fgColorId = R.color.photo_picker_special_tile_color;
+ } else {
+ bgColorId = R.color.photo_picker_special_tile_disabled_bg_color;
+ fgColorId = R.color.photo_picker_special_tile_disabled_color;
+ }
- Resources resources = mContext.getResources();
- setBackgroundColor(ApiCompatibilityUtils.getColor(resources, bgColorId));
- mSpecialTile.setTextColor(ApiCompatibilityUtils.getColor(resources, fgColorId));
- Drawable[] drawables = mSpecialTile.getCompoundDrawables();
- // The textview only has a top compound drawable (2nd element).
- if (drawables[1] != null) {
+ Resources resources = mContext.getResources();
+ setBackgroundColor(ApiCompatibilityUtils.getColor(resources, bgColorId));
+ mSpecialTileLabel.setTextColor(ApiCompatibilityUtils.getColor(resources, fgColorId));
+ Drawable drawable = mSpecialTileIcon.getDrawable();
int color = ApiCompatibilityUtils.getColor(resources, fgColorId);
- drawables[1].setColorFilter(color, PorterDuff.Mode.SRC_IN);
+ drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
// The visibility of the unselected image is a little more complex because we don't want
« chrome/android/java/res/values/colors.xml ('K') | « chrome/android/java/res/values/colors.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698