Add APPLY text button for BottomActionBar am: 1ec44b7416

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/WallpaperPicker2/+/14957120

Change-Id: If92c38627472d05e81d992ded5ce49b4a878101d
diff --git a/res/drawable/btn_transparent_background.xml b/res/drawable/btn_transparent_background.xml
index 7ddff6b..f71b9d8 100644
--- a/res/drawable/btn_transparent_background.xml
+++ b/res/drawable/btn_transparent_background.xml
@@ -17,11 +17,10 @@
 -->
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
     android:color="?android:colorControlHighlight">
-
     <item android:id="@android:id/mask">
         <shape android:shape="rectangle">
             <solid android:color="@android:color/white"/>
-            <corners android:radius="?android:attr/buttonCornerRadius"/>
+            <corners android:radius="@dimen/bottom_action_button_radius" />
         </shape>
     </item>
 </ripple>
diff --git a/res/layout/bottom_actions_layout.xml b/res/layout/bottom_actions_layout.xml
index 2d317a9..91e8f1d 100644
--- a/res/layout/bottom_actions_layout.xml
+++ b/res/layout/bottom_actions_layout.xml
@@ -154,8 +154,22 @@
             android:visibility="gone"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toStartOf="@id/action_apply_text_button"
+            app:layout_constraintStart_toEndOf="@id/action_progress"/>
+
+        <Button
+            android:id="@+id/action_apply_text_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:background="@drawable/btn_transparent_background"
+            android:textColor="?android:attr/colorAccent"
+            android:text="@string/bottom_action_bar_apply"
+            android:visibility="gone"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toEndOf="@id/action_progress" />
+            app:layout_constraintStart_toEndOf="@id/action_apply"/>
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 </RelativeLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4f3d62e..f370463 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -321,7 +321,7 @@
     <!-- Content description of "slideshow wallpaper" button on the bottom action bar. [CHAR LIMIT=50] -->
     <string name="bottom_action_bar_slideshow_wallpaper">Slideshow Wallpaper</string>
 
-    <!-- Content description of apply button on the bottom action bar. [CHAR LIMIT=30] -->
+    <!-- Apply button on the bottom action bar. [CHAR LIMIT=30] -->
     <string name="bottom_action_bar_apply">Apply</string>
 
     <!-- Accessibility label for paging indicator in theme picker preview [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/wallpaper/picker/BottomActionBarFragment.java b/src/com/android/wallpaper/picker/BottomActionBarFragment.java
index 24aa3ea..6802b76 100644
--- a/src/com/android/wallpaper/picker/BottomActionBarFragment.java
+++ b/src/com/android/wallpaper/picker/BottomActionBarFragment.java
@@ -54,10 +54,6 @@
 
     /** Returns {@code true} if the fragment would handle the event. */
     public boolean onBackPressed() {
-        if (mBottomActionBar != null && mBottomActionBar.isVisible()) {
-            mBottomActionBar.hide();
-            return true;
-        }
         return false;
     }
 
diff --git a/src/com/android/wallpaper/widget/BottomActionBar.java b/src/com/android/wallpaper/widget/BottomActionBar.java
index 76415bb..fda4c8b 100644
--- a/src/com/android/wallpaper/widget/BottomActionBar.java
+++ b/src/com/android/wallpaper/widget/BottomActionBar.java
@@ -95,7 +95,7 @@
     // TODO(b/154299462): Separate downloadable related actions from WallpaperPicker.
     /** The action items in the bottom action bar. */
     public enum BottomAction {
-        ROTATION, DELETE, INFORMATION, EDIT, CUSTOMIZE, DOWNLOAD, PROGRESS, APPLY
+        ROTATION, DELETE, INFORMATION, EDIT, CUSTOMIZE, DOWNLOAD, PROGRESS, APPLY, APPLY_TEXT
     }
 
     private final Map<BottomAction, View> mActionMap = new EnumMap<>(BottomAction.class);
@@ -123,6 +123,7 @@
         mActionMap.put(BottomAction.DOWNLOAD, findViewById(R.id.action_download));
         mActionMap.put(BottomAction.PROGRESS, findViewById(R.id.action_progress));
         mActionMap.put(BottomAction.APPLY, findViewById(R.id.action_apply));
+        mActionMap.put(BottomAction.APPLY_TEXT, findViewById(R.id.action_apply_text_button));
 
         mBottomSheetView = findViewById(R.id.action_bottom_sheet);
         SizeCalculator.adjustBackgroundCornerRadius(mBottomSheetView);