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

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: Fix unused variable issue 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
« no previous file with comments | « chrome/android/java/res/values/colors.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4ae42dae62435c6a9b952c9121f5b52c0c11a112 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
@@ -53,16 +53,22 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
// The little shader in the top left corner (provides backdrop for selection ring on
// unfavorable image backgrounds).
- private View mScrim;
+ private ImageView mScrim;
// The control that signifies the image has been selected.
private ImageView mSelectedView;
// The control that signifies the image has not been selected.
- private View mUnselectedView;
+ private ImageView 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;
@@ -82,10 +88,12 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
protected void onFinishInflate() {
super.onFinishInflate();
mIconView = (ImageView) findViewById(R.id.bitmap_view);
- mScrim = findViewById(R.id.scrim);
+ mScrim = (ImageView) findViewById(R.id.scrim);
mSelectedView = (ImageView) findViewById(R.id.selected);
- mUnselectedView = findViewById(R.id.unselected);
- mSpecialTile = (TextView) findViewById(R.id.special_tile);
+ mUnselectedView = (ImageView) findViewById(R.id.unselected);
+ 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);
}
/**
@@ -295,29 +306,28 @@ public class PickerBitmapView extends SelectableItemView<PickerBitmap> {
boolean checked = super.isChecked();
boolean anySelection =
mSelectionDelegate != null && mSelectionDelegate.isSelectionEnabled();
+ Resources resources = mContext.getResources();
int bgColorId;
- int fgColorId;
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;
- }
+ int fgColorId;
+ 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) {
+ 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);
}
+ setBackgroundColor(ApiCompatibilityUtils.getColor(resources, bgColorId));
+
// The visibility of the unselected image is a little more complex because we don't want
// to show it when nothing is selected and also not on a blank canvas.
mSelectedView.setVisibility(!special && checked ? View.VISIBLE : View.GONE);
« no previous file with comments | « 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