The tiles in "Live wallpaper" category should show the wallpaper name in the new UI's style.
Video: https://drive.google.com/file/d/10CX4b-F9md2LXB-M8rQXzGSF95X9SENf/view?usp=sharing
Bug: 157650301
Change-Id: Ibb63212cb62cf55aedd122a8f4a903fcfee1ef34
diff --git a/res/layout/grid_item_image.xml b/res/layout/grid_item_image.xml
index 69a59bd..254a3b9 100755
--- a/res/layout/grid_item_image.xml
+++ b/res/layout/grid_item_image.xml
@@ -13,74 +13,83 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/tile"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="8dp"
- android:contentDescription="@string/wallpaper_thumbnail"
- app:cardCornerRadius="?android:dialogCornerRadius"
- app:cardElevation="0dp">
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="@dimen/grid_item_individual_padding_top">
- <RelativeLayout xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/tile"
- android:layout_width="wrap_content"
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:clickable="true"
- android:focusable="true"
- android:foreground="@drawable/wallpaper_option_border">
+ android:layout_marginTop="@dimen/grid_item_individual_label_padding_top"
+ android:layout_marginBottom="@dimen/grid_item_individual_label_padding_bottom"
+ android:background="@color/category_title_scrim_color"
+ android:ellipsize="end"
+ android:gravity="center"
+ android:maxLines="1"
+ android:minHeight="@dimen/grid_item_category_label_minimum_height"
+ android:textAppearance="@style/OptionTitleTextAppearance"
+ android:visibility="gone"
+ tools:text="Wallpaper" />
- <ImageView
- android:id="@+id/thumbnail"
+ <androidx.cardview.widget.CardView
+ android:id="@+id/wallpaper_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/wallpaper_thumbnail"
+ app:cardCornerRadius="?android:dialogCornerRadius"
+ app:cardElevation="0dp">
+
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/secondary_color"
- android:scaleType="centerCrop" />
+ android:foreground="@drawable/wallpaper_option_border">
+
+ <ImageView
+ android:id="@+id/thumbnail"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/secondary_color"
+ android:scaleType="centerCrop" />
+
+ <ImageView
+ android:id="@+id/overlay_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true" />
+
+ <FrameLayout
+ android:id="@+id/loading_indicator_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/black_67_alpha"
+ android:visibility="gone">
+
+ <ProgressBar
+ android:id="@+id/loading_indicator"
+ android:layout_width="@dimen/tile_desktop_progress_bar_size"
+ android:layout_height="@dimen/tile_desktop_progress_bar_size"
+ android:layout_gravity="center"
+ android:indeterminate="true"
+ android:indeterminateTint="@color/accent_color" />
+
+ </FrameLayout>
+ </RelativeLayout>
<ImageView
- android:id="@+id/overlay_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true" />
+ android:id="@+id/check_circle"
+ android:layout_width="@dimen/grid_item_individual_wallpaper_check_circle_size"
+ android:layout_height="@dimen/grid_item_individual_wallpaper_check_circle_size"
+ android:layout_gravity="bottom|right"
+ android:layout_marginEnd="@dimen/grid_item_individual_wallpaper_check_circle_offset"
+ android:layout_marginBottom="@dimen/grid_item_individual_wallpaper_check_circle_offset"
+ android:src="@drawable/check_circle_blue"
+ android:visibility="gone" />
- <TextView
- android:id="@+id/title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:background="@color/individual_tile_title_scrim_color"
- android:padding="@dimen/grid_item_category_label_padding"
- android:textColor="@color/individual_tile_title_text_color"
- android:textSize="@dimen/abc_text_size_subhead_material"
- android:visibility="gone"
- tools:text="Wallpaper" />
-
- <FrameLayout
- android:id="@+id/loading_indicator_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/black_67_alpha"
- android:visibility="gone">
-
- <ProgressBar
- android:id="@+id/loading_indicator"
- android:layout_width="@dimen/tile_desktop_progress_bar_size"
- android:layout_height="@dimen/tile_desktop_progress_bar_size"
- android:layout_gravity="center"
- android:indeterminate="true"
- android:indeterminateTint="@color/accent_color" />
-
- </FrameLayout>
- </RelativeLayout>
-
- <ImageView
- android:id="@+id/check_circle"
- android:layout_width="@dimen/grid_item_individual_wallpaper_check_circle_size"
- android:layout_height="@dimen/grid_item_individual_wallpaper_check_circle_size"
- android:layout_gravity="bottom|right"
- android:layout_marginEnd="@dimen/grid_item_individual_wallpaper_check_circle_offset"
- android:layout_marginBottom="@dimen/grid_item_individual_wallpaper_check_circle_offset"
- android:src="@drawable/check_circle_blue"
- android:visibility="gone" />
-
-</androidx.cardview.widget.CardView>
+ </androidx.cardview.widget.CardView>
+</LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 28a804c..99dbbb0 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -35,6 +35,9 @@
<dimen name="grid_item_individual_wallpaper_selected_inset">14dp</dimen>
<dimen name="grid_item_individual_wallpaper_check_circle_offset">4dp</dimen>
<dimen name="grid_item_individual_wallpaper_check_circle_size">24dp</dimen>
+ <dimen name="grid_item_individual_padding_top">8dp</dimen>
+ <dimen name="grid_item_individual_label_padding_top">4dp</dimen>
+ <dimen name="grid_item_individual_label_padding_bottom">4dp</dimen>
<!-- Dimensions for "single metadata card" configuration. -->
<dimen name="single_metadata_card_elevation">2dp</dimen>
diff --git a/src/com/android/wallpaper/picker/individual/IndividualHolder.java b/src/com/android/wallpaper/picker/individual/IndividualHolder.java
index 5ef61c3..294efa8 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualHolder.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualHolder.java
@@ -19,22 +19,22 @@
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
-import android.widget.RelativeLayout;
import android.widget.TextView;
+import androidx.recyclerview.widget.RecyclerView.ViewHolder;
+
import com.android.wallpaper.R;
import com.android.wallpaper.model.WallpaperInfo;
import java.util.List;
-import androidx.recyclerview.widget.RecyclerView.ViewHolder;
-
/**
* Base class for ViewHolders for individual wallpaper tiles.
*/
abstract class IndividualHolder extends ViewHolder {
protected Activity mActivity;
- protected RelativeLayout mTileLayout;
+ protected View mTileLayout;
+ protected View mWallpaperContainer;
protected ImageView mThumbnailView;
protected ImageView mOverlayIconView;
protected TextView mTitleView;
@@ -44,13 +44,13 @@
super(itemView);
mActivity = hostActivity;
- mTileLayout = (RelativeLayout) itemView.findViewById(R.id.tile);
+ mTileLayout = itemView.findViewById(R.id.tile);
mThumbnailView = (ImageView) itemView.findViewById(R.id.thumbnail);
mOverlayIconView = (ImageView) itemView.findViewById(R.id.overlay_icon);
mTitleView = (TextView) itemView.findViewById(R.id.title);
+ mWallpaperContainer = itemView.findViewById(R.id.wallpaper_container);
- mTileLayout.getLayoutParams().height = tileHeightPx;
- itemView.getLayoutParams().height = tileHeightPx;
+ mWallpaperContainer.getLayoutParams().height = tileHeightPx;
}
/**