Update reachability UI styles to be decendants of Theme.AppCompat

Letterbox reachability uses AppCompatTextView's which requires its
themes to be descendants of Theme.AppCompat or Theme.AppCompat itself and produces a warning if else.

To prevent this warning from being triggered, set the reachability UI
styles to be children of Theme.AppCompat. Also update the reachability UI layout to declare styles using 'android:theme' instead of 'style' so ThemeUtils theme check can locate them.

Remove 'android:visibility="invisible" from style and apply to components individually and remove 'android:contentDescription' as it is not needed.

Fix: 281804869
Test: atest WMShellUnitTests:ReachabilityEduLayoutTest
atest WMShellUnitTests:LetterboxEduWindowManagerTest
atest WMShellUnitTests:ReachabilityEduWindowManagerTest

Change-Id: I3b62f1c5ccaa748326030b8c2812fb5fe7e5dfe5
This commit is contained in:
Eghosa Ewansiha-Vlachavas
2023-05-12 10:01:24 +00:00
parent a9d7a0f035
commit c1be417be6
3 changed files with 12 additions and 15 deletions

View File

@@ -20,47 +20,48 @@
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:theme="@style/ReachabilityEduHandLayout">
<androidx.appcompat.widget.AppCompatTextView
style="@style/ReachabilityEduHandLayout"
android:text="@string/letterbox_reachability_reposition_text"
app:drawableTopCompat="@drawable/reachability_education_ic_right_hand"
android:layout_gravity="center_horizontal|top"
android:layout_marginTop="@dimen/letterbox_reachability_education_dialog_margin"
android:id="@+id/reachability_move_up_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:visibility="invisible"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/ReachabilityEduHandLayout"
android:text="@string/letterbox_reachability_reposition_text"
app:drawableTopCompat="@drawable/reachability_education_ic_right_hand"
android:layout_gravity="center_vertical|right"
android:layout_marginTop="@dimen/letterbox_reachability_education_dialog_margin"
android:id="@+id/reachability_move_right_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:visibility="invisible"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/ReachabilityEduHandLayout"
android:text="@string/letterbox_reachability_reposition_text"
app:drawableTopCompat="@drawable/reachability_education_ic_left_hand"
android:layout_gravity="center_vertical|left"
android:layout_marginTop="@dimen/letterbox_reachability_education_dialog_margin"
android:id="@+id/reachability_move_left_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:visibility="invisible"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/ReachabilityEduHandLayout"
android:text="@string/letterbox_reachability_reposition_text"
app:drawableTopCompat="@drawable/reachability_education_ic_right_hand"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="@dimen/letterbox_reachability_education_dialog_margin"
android:id="@+id/reachability_move_down_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:visibility="invisible"/>
</com.android.wm.shell.compatui.ReachabilityEduLayout>

View File

@@ -17,12 +17,10 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ReachabilityEduHandLayout">
<style name="ReachabilityEduHandLayout" parent="Theme.AppCompat">
<item name="android:focusable">false</item>
<item name="android:focusableInTouchMode">false</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:contentDescription">@string/restart_button_description</item>
<item name="android:visibility">invisible</item>
<item name="android:lineSpacingExtra">-1sp</item>
<item name="android:textSize">12sp</item>
<item name="android:textAlignment">center</item>

View File

@@ -151,12 +151,10 @@
</item>
</style>
<style name="ReachabilityEduHandLayout">
<style name="ReachabilityEduHandLayout" parent="Theme.AppCompat.Light">
<item name="android:focusable">false</item>
<item name="android:focusableInTouchMode">false</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:contentDescription">@string/restart_button_description</item>
<item name="android:visibility">invisible</item>
<item name="android:lineSpacingExtra">-1sp</item>
<item name="android:textSize">12sp</item>
<item name="android:textAlignment">center</item>