Merge "Add content description for preview card of Theme and Grid" into ub-launcher3-master
diff --git a/res/layout/grid_preview_card.xml b/res/layout/grid_preview_card.xml
index 2939f80..e824460 100644
--- a/res/layout/grid_preview_card.xml
+++ b/res/layout/grid_preview_card.xml
@@ -17,6 +17,8 @@
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/FullContentPreviewCard"
+ android:id="@+id/grid_preview_card"
+ android:contentDescription="@string/grid_preview_card_content_description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
@@ -35,5 +37,6 @@
<FrameLayout
android:id="@+id/grid_preview_container"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:importantForAccessibility="noHideDescendants" />
</androidx.cardview.widget.CardView>
\ No newline at end of file
diff --git a/res/layout/theme_preview_card.xml b/res/layout/theme_preview_card.xml
index 74d1e68..e1e3491 100644
--- a/res/layout/theme_preview_card.xml
+++ b/res/layout/theme_preview_card.xml
@@ -17,6 +17,8 @@
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/FullContentPreviewCard"
+ android:id="@+id/theme_preview_card"
+ android:contentDescription="@string/theme_preview_card_content_description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
@@ -35,5 +37,6 @@
<FrameLayout
android:id="@+id/theme_preview_container"
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_height="match_parent"
+ android:importantForAccessibility="noHideDescendants" />
</androidx.cardview.widget.CardView>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d80f74d..569600e 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -46,6 +46,12 @@
[CHAR LIMIT=20] -->
<string name="apply_btn">Apply</string>
+ <!-- Content description of theme preview card. [CHAR_LIMIT=30]-->
+ <string name="theme_preview_card_content_description">Style preview</string>
+
+ <!-- Content description of grid preview card. [CHAR_LIMIT=30]-->
+ <string name="grid_preview_card_content_description">Grid preview</string>
+
<!-- Content description indicating that the selected option is currently applied to the device. [CHAR_LIMIT=NONE] -->
<string name="option_applied_description"><xliff:g name="style_name">%1$s</xliff:g>, currently applied</string>
diff --git a/src/com/android/customization/picker/grid/GridFragment.java b/src/com/android/customization/picker/grid/GridFragment.java
index 29c6ca8..b6a749e 100644
--- a/src/com/android/customization/picker/grid/GridFragment.java
+++ b/src/com/android/customization/picker/grid/GridFragment.java
@@ -30,7 +30,6 @@
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -136,12 +135,9 @@
Glide.get(getContext()).clearMemory();
setUpOptions(savedInstanceState);
- ImageView wallpaperPreviewImage = view.findViewById(R.id.wallpaper_preview_image);
- wallpaperPreviewImage.setOnClickListener(v -> showFullPreview());
SurfaceView wallpaperSurface = view.findViewById(R.id.wallpaper_preview_surface);
- WallpaperPreviewer wallpaperPreviewer = new WallpaperPreviewer(
- getLifecycle(), getActivity(), wallpaperPreviewImage, wallpaperSurface);
-
+ WallpaperPreviewer wallpaperPreviewer = new WallpaperPreviewer(getLifecycle(),
+ getActivity(), view.findViewById(R.id.wallpaper_preview_image), wallpaperSurface);
// Loads current Wallpaper.
CurrentWallpaperInfoFactory factory = InjectorProvider.getInjector()
.getCurrentWallpaperFactory(getContext().getApplicationContext());
@@ -161,6 +157,8 @@
view.removeOnLayoutChangeListener(this);
}
});
+
+ view.findViewById(R.id.grid_preview_card).setOnClickListener(v -> showFullPreview());
return view;
}
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index 090158b..18cc3b4 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -123,12 +123,10 @@
.getCurrentWallpaperFactory(getActivity().getApplicationContext());
mOptionsContainer = view.findViewById(R.id.options_container);
- ViewGroup previewContainer = view.findViewById(R.id.theme_preview_container);
- previewContainer.setOnClickListener(v -> showFullPreview());
mThemeOptionPreviewer = new ThemeOptionPreviewer(
getLifecycle(),
getContext(),
- previewContainer);
+ view.findViewById(R.id.theme_preview_container));
// Set Wallpaper background.
mWallpaperImage = view.findViewById(R.id.wallpaper_preview_image);
@@ -158,6 +156,8 @@
view.removeOnLayoutChangeListener(this);
}
});
+
+ view.findViewById(R.id.theme_preview_card).setOnClickListener(v -> showFullPreview());
return view;
}