Merge changes from topic "wpp-revamped-ui-clean-up-grid-option" into main
* changes:
Pre-revamped UI cleanup grid option rename
Pre-revamped UI unused grid option cleanup
diff --git a/res/layout/fragment_grid.xml b/res/layout/fragment_grid.xml
index 8c97d45..f022268 100644
--- a/res/layout/fragment_grid.xml
+++ b/res/layout/fragment_grid.xml
@@ -81,7 +81,7 @@
It's critical for any TextViews inside the included layout to have text.
-->
<include
- layout="@layout/grid_option_2"
+ layout="@layout/grid_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible" />
diff --git a/res/layout/grid_option.xml b/res/layout/grid_option.xml
index 0931dea..efed018 100644
--- a/res/layout/grid_option.xml
+++ b/res/layout/grid_option.xml
@@ -1,47 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2019 The Android Open Source Project
+ ~ Copyright (C) 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="@dimen/option_item_size"
android:layout_height="wrap_content"
- android:paddingBottom="@dimen/option_bottom_margin"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:gravity="center_horizontal"
+ android:clipChildren="false">
<FrameLayout
- android:id="@+id/option_tile"
- android:layout_width="@dimen/option_tile_width"
- android:layout_height="@dimen/option_tile_width"
- android:layout_gravity="center_horizontal"
- android:padding="@dimen/option_tile_padding_vertical"
- android:background="@drawable/option_border"
- android:gravity="center">
+ android:layout_width="@dimen/option_item_size"
+ android:layout_height="@dimen/option_item_size"
+ android:clipChildren="false">
+
<ImageView
- android:id="@+id/grid_option_thumbnail"
+ android:id="@id/selection_border"
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_height="match_parent"
+ android:background="@drawable/option_item_border"
+ android:alpha="0"
+ android:importantForAccessibility="no" />
+
+ <ImageView
+ android:id="@id/background"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/option_item_background"
+ android:importantForAccessibility="no" />
+
+ <ImageView
+ android:id="@id/foreground"
+ android:layout_width="58dp"
+ android:layout_height="58dp"
+ android:layout_gravity="center" />
+
</FrameLayout>
+ <View
+ android:layout_width="0dp"
+ android:layout_height="8dp" />
+
<TextView
- android:id="@+id/option_label"
+ android:id="@id/text"
android:layout_width="wrap_content"
- android:layout_height="24dp"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="@dimen/theme_option_label_margin"
- android:gravity="center"
- android:textAppearance="@style/OptionTitleTextAppearance" />
+ android:layout_height="wrap_content"
+ android:textColor="@color/system_on_surface"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:text="Placeholder for stable size calculation, please do not remove."
+ tools:ignore="HardcodedText" />
+
</LinearLayout>
diff --git a/res/layout/grid_option_2.xml b/res/layout/grid_option_2.xml
deleted file mode 100644
index efed018..0000000
--- a/res/layout/grid_option_2.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2023 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="@dimen/option_item_size"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:gravity="center_horizontal"
- android:clipChildren="false">
-
- <FrameLayout
- android:layout_width="@dimen/option_item_size"
- android:layout_height="@dimen/option_item_size"
- android:clipChildren="false">
-
- <ImageView
- android:id="@id/selection_border"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/option_item_border"
- android:alpha="0"
- android:importantForAccessibility="no" />
-
- <ImageView
- android:id="@id/background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/option_item_background"
- android:importantForAccessibility="no" />
-
- <ImageView
- android:id="@id/foreground"
- android:layout_width="58dp"
- android:layout_height="58dp"
- android:layout_gravity="center" />
-
- </FrameLayout>
-
- <View
- android:layout_width="0dp"
- android:layout_height="8dp" />
-
- <TextView
- android:id="@id/text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/system_on_surface"
- android:singleLine="true"
- android:ellipsize="end"
- android:text="Placeholder for stable size calculation, please do not remove."
- tools:ignore="HardcodedText" />
-
-</LinearLayout>
diff --git a/src/com/android/customization/model/grid/GridOption.java b/src/com/android/customization/model/grid/GridOption.java
index a5307c9..347929c 100644
--- a/src/com/android/customization/model/grid/GridOption.java
+++ b/src/com/android/customization/model/grid/GridOption.java
@@ -15,14 +15,11 @@
*/
package com.android.customization.model.grid;
-import android.content.Context;
-import android.graphics.PorterDuff.Mode;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.view.View;
-import android.widget.ImageView;
import androidx.annotation.Nullable;
@@ -30,7 +27,6 @@
import com.android.customization.model.CustomizationOption;
import com.android.customization.widget.GridTileDrawable;
import com.android.wallpaper.R;
-import com.android.wallpaper.util.ResourceUtils;
/**
* Represents a grid layout option available in the current launcher.
@@ -94,21 +90,7 @@
@Override
public void bindThumbnailTile(View view) {
- Context context = view.getContext();
-
- int colorFilter = ResourceUtils.getColorAttr(context,
- view.isActivated()
- ? (mIsCurrent
- ? android.R.attr.textColorPrimary
- : android.R.attr.textColorPrimaryInverse)
- : android.R.attr.textColorTertiary);
- mTileDrawable.setColorFilter(colorFilter, Mode.SRC_ATOP);
- ((ImageView) view.findViewById(R.id.grid_option_thumbnail))
- .setImageDrawable(mTileDrawable);
-
- int backgroundResource = view.isActivated() && !mIsCurrent
- ? R.drawable.option_border_new_selection : R.drawable.option_border;
- view.findViewById(R.id.option_tile).setBackgroundResource(backgroundResource);
+ // Do nothing. This function will no longer be used in the Revamped UI
}
@Override
diff --git a/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt b/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt
index a05a9c1..bcb3737 100644
--- a/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt
+++ b/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt
@@ -55,7 +55,7 @@
optionView.addItemDecoration(ItemSpacing(ItemSpacing.ITEM_SPACING_DP))
val adapter =
OptionItemAdapter(
- layoutResourceId = R.layout.grid_option_2,
+ layoutResourceId = R.layout.grid_option,
lifecycleOwner = lifecycleOwner,
backgroundDispatcher = backgroundDispatcher,
foregroundTintSpec =