Round thumbnail for individual picker
This CL configures IndividualPickerFragment to use a round thumbnail for the applied wallpaper.
Screenshots
* Day - https://screenshot.googleplex.com/3tzed4USi4VyR38.png
* Night - https://screenshot.googleplex.com/mcF6nM4NQwWuWTk.png
Bug: 178745862
Fixes: 178745862
Test: added in IndividualPickerActivityTest.java
Change-Id: Icb9142d2c3d43e312be8c9c0b1647eedededef87
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index 71d70e3..3d23e50 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -1008,7 +1008,8 @@
? index + 1 : index;
ViewHolder holder = mImageGrid.findViewHolderForAdapterPosition(index);
if (holder != null) {
- holder.itemView.setActivated(isActivated);
+ CircularImageView thumbnail = holder.itemView.findViewById(R.id.thumbnail);
+ thumbnail.setClipped(isActivated);
} else {
// Item is not visible, make sure the item is re-bound when it becomes visible.
mAdapter.notifyItemChanged(index);
@@ -1023,10 +1024,7 @@
index = (shouldShowRotationTile() || mCategory.supportsCustomPhotos())
? index + 1 : index;
ViewHolder holder = mImageGrid.findViewHolderForAdapterPosition(index);
- if (holder != null) {
- holder.itemView.findViewById(R.id.check_circle)
- .setVisibility(isApplied ? View.VISIBLE : View.GONE);
- } else {
+ if (holder == null) {
// Item is not visible, make sure the item is re-bound when it becomes visible.
mAdapter.notifyItemChanged(index);
}
@@ -1075,6 +1073,45 @@
return mFormFactor == FormFactorChecker.FORM_FACTOR_DESKTOP && isRotationEnabled();
}
+ class EmptySelectionAnimator implements SelectionAnimator{
+ EmptySelectionAnimator() {}
+
+ public boolean isSelected() {
+ return false;
+ }
+
+ /**
+ * Sets the UI to selected immediately with no animation.
+ */
+ public void selectImmediately() {}
+
+ /**
+ * Sets the UI to deselected immediately with no animation.
+ */
+ public void deselectImmediately() {}
+
+ /**
+ * Sets the UI to selected with a smooth animation.
+ */
+ public void animateSelected() {}
+
+ /**
+ * Sets the UI to deselected with a smooth animation.
+ */
+ public void animateDeselected() {}
+
+ /**
+ * Sets the UI to show a loading indicator.
+ */
+ public void showLoading() {}
+
+ /**
+ * Sets the UI to hide the loading indicator.
+ */
+ public void showNotLoading() {}
+
+ }
+
/**
* RecyclerView Adapter subclass for the wallpaper tiles in the RecyclerView.
*/
@@ -1154,8 +1191,7 @@
private ViewHolder createRotationHolder(ViewGroup parent) {
LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
View view = layoutInflater.inflate(R.layout.grid_item_rotation_desktop, parent, false);
- SelectionAnimator selectionAnimator =
- new CheckmarkSelectionAnimator(getActivity(), view);
+ SelectionAnimator selectionAnimator = new EmptySelectionAnimator();
return new DesktopRotationHolder(getActivity(), mTileSizePx.y, view, selectionAnimator,
IndividualPickerFragment.this);
}
@@ -1165,8 +1201,7 @@
View view = layoutInflater.inflate(R.layout.grid_item_image, parent, false);
if (mFormFactor == FormFactorChecker.FORM_FACTOR_DESKTOP) {
- SelectionAnimator selectionAnimator =
- new CheckmarkSelectionAnimator(getActivity(), view);
+ SelectionAnimator selectionAnimator = new EmptySelectionAnimator();
return new SetIndividualHolder(
getActivity(), mTileSizePx.y, view,
selectionAnimator,
@@ -1319,10 +1354,8 @@
mAppliedWallpaperInfo = wallpaper;
}
- holder.itemView.setActivated(
- (isWallpaperApplied && !hasUserSelectedWallpaper) || isWallpaperSelected);
- holder.itemView.findViewById(R.id.check_circle).setVisibility(
- isWallpaperApplied ? View.VISIBLE : View.GONE);
+ CircularImageView thumbnail = holder.itemView.findViewById(R.id.thumbnail);
+ thumbnail.setClipped(isWallpaperApplied);
}
}