Add wallpapaer edit button to BottomActionBar

Also remove the Cancel buttom from Enum, the cancel button should be always visible and can't be disabled, since it's binding with BACK key. It does not make sense to disable the cancel button but back key still be cilckable.

Test: Manually
Bug: 155043943
Change-Id: Ie240da481716cc0c893ecb58cd7a64f7a4cd7ae9
diff --git a/res/layout/bottom_actions_layout.xml b/res/layout/bottom_actions_layout.xml
index 29aed44..cb25823 100644
--- a/res/layout/bottom_actions_layout.xml
+++ b/res/layout/bottom_actions_layout.xml
@@ -49,7 +49,7 @@
         android:layoutDirection="locale">
 
         <ImageView
-            android:id="@+id/action_cancel"
+            android:id="@+id/action_back"
             android:layout_width="@dimen/bottom_action_button_size"
             android:layout_height="@dimen/bottom_action_button_size"
             android:padding="@dimen/bottom_action_button_padding"
@@ -72,7 +72,7 @@
             android:visibility="gone"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintEnd_toStartOf="@id/action_delete"
-            app:layout_constraintStart_toEndOf="@id/action_cancel" />
+            app:layout_constraintStart_toEndOf="@id/action_back" />
 
         <ImageView
             android:id="@+id/action_delete"
@@ -100,18 +100,32 @@
             app:layout_constraintEnd_toStartOf="@id/action_edit"
             app:layout_constraintStart_toEndOf="@id/action_delete" />
 
+        <!-- TODO(b/155043943): Update the image once we get it. -->
         <ImageView
             android:id="@+id/action_edit"
             android:layout_width="@dimen/bottom_action_button_size"
             android:layout_height="@dimen/bottom_action_button_size"
             android:padding="@dimen/bottom_action_button_padding"
+            android:src="@drawable/stretch_grey"
+            android:background="?android:attr/selectableItemBackgroundBorderless"
+            android:contentDescription="@string/bottom_action_bar_edit"
+            android:visibility="gone"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintEnd_toStartOf="@id/action_customize"
+            app:layout_constraintStart_toEndOf="@id/action_information" />
+
+        <ImageView
+            android:id="@+id/action_customize"
+            android:layout_width="@dimen/bottom_action_button_size"
+            android:layout_height="@dimen/bottom_action_button_size"
+            android:padding="@dimen/bottom_action_button_padding"
             android:src="@drawable/ic_tune_black_24dp"
             android:background="?android:attr/selectableItemBackgroundBorderless"
             android:contentDescription="@string/tab_customize"
             android:visibility="gone"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintEnd_toStartOf="@id/action_download"
-            app:layout_constraintStart_toEndOf="@id/action_information" />
+            app:layout_constraintStart_toEndOf="@id/action_edit" />
 
         <ImageView
             android:id="@+id/action_download"
@@ -124,7 +138,7 @@
             android:visibility="gone"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintEnd_toStartOf="@id/action_progress"
-            app:layout_constraintStart_toEndOf="@id/action_edit" />
+            app:layout_constraintStart_toEndOf="@id/action_customize" />
 
         <ProgressBar
             android:id="@+id/action_progress"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 597595f..9cde4fd 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -319,6 +319,9 @@
     <!-- Content description of back button on the bottom action bar. [CHAR LIMIT=30] -->
     <string name="bottom_action_bar_back">Back</string>
 
+    <!-- Content description of edit button on the bottom action bar. [CHAR LIMIT=30] -->
+    <string name="bottom_action_bar_edit">Edit</string>
+
     <!-- TODO(b/154299462): Separate downloadable related actions from WallpaperPicker. -->
     <!-- Content description of download button on the bottom action bar. [CHAR LIMIT=30] -->
     <string name="bottom_action_bar_download">Download</string>
diff --git a/src/com/android/wallpaper/picker/BottomActionBarFragment.java b/src/com/android/wallpaper/picker/BottomActionBarFragment.java
index b23afa3..961e4b9 100644
--- a/src/com/android/wallpaper/picker/BottomActionBarFragment.java
+++ b/src/com/android/wallpaper/picker/BottomActionBarFragment.java
@@ -40,7 +40,7 @@
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
         mBottomActionBar = ((BottomActionBarHost) getActivity()).getBottomActionBar();
-        mBottomActionBar.bindCancelButtonToBackKey(getActivity());
+        mBottomActionBar.bindBackButtonToSystemBackKey(getActivity());
         onBottomActionBarReady(mBottomActionBar);
     }
 
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index e2ca794..58cb84f 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -16,7 +16,6 @@
 package com.android.wallpaper.picker.individual;
 
 import static com.android.wallpaper.widget.BottomActionBar.BottomAction.APPLY;
-import static com.android.wallpaper.widget.BottomActionBar.BottomAction.CANCEL;
 import static com.android.wallpaper.widget.BottomActionBar.BottomAction.INFORMATION;
 import static com.android.wallpaper.widget.BottomActionBar.BottomAction.ROTATION;
 
@@ -537,9 +536,7 @@
         if (TEMP_BOTTOM_ACTION_BAR_FEATURE) {
             mBottomActionBar = bottomActionBar;
             if (isRotationEnabled()) {
-                mBottomActionBar.showActionsOnly(CANCEL, ROTATION);
-            } else {
-                mBottomActionBar.showActionsOnly(CANCEL);
+                mBottomActionBar.showActionsOnly(ROTATION);
             }
             mBottomActionBar.setActionClickListener(ROTATION, unused -> {
                 DialogFragment startRotationDialogFragment = new StartRotationDialogFragment();
@@ -899,9 +896,9 @@
 
     void updateBottomActions(boolean hasWallpaperSelected) {
         if (hasWallpaperSelected) {
-            mBottomActionBar.showActionsOnly(CANCEL, INFORMATION, APPLY);
+            mBottomActionBar.showActionsOnly(INFORMATION, APPLY);
         } else {
-            mBottomActionBar.showActionsOnly(CANCEL, ROTATION);
+            mBottomActionBar.showActionsOnly(ROTATION);
         }
     }
 
diff --git a/src/com/android/wallpaper/widget/BottomActionBar.java b/src/com/android/wallpaper/widget/BottomActionBar.java
index 39fd5eb..b5bbdd5 100644
--- a/src/com/android/wallpaper/widget/BottomActionBar.java
+++ b/src/com/android/wallpaper/widget/BottomActionBar.java
@@ -58,7 +58,7 @@
     // TODO(b/154299462): Separate downloadable related actions from WallpaperPicker.
     /** The action items in the bottom action bar. */
     public enum BottomAction {
-        CANCEL, ROTATION, DELETE, INFORMATION, EDIT, DOWNLOAD, PROGRESS, APPLY,
+        ROTATION, DELETE, INFORMATION, EDIT, CUSTOMIZE, DOWNLOAD, PROGRESS, APPLY,
     }
 
     private final Map<BottomAction, View> mActionMap = new EnumMap<>(BottomAction.class);
@@ -75,11 +75,11 @@
         mAttributionSubtitle1 = findViewById(R.id.preview_attribution_pane_subtitle1);
         mAttributionSubtitle2 = findViewById(R.id.preview_attribution_pane_subtitle2);
 
-        mActionMap.put(BottomAction.CANCEL, findViewById(R.id.action_cancel));
         mActionMap.put(BottomAction.ROTATION, findViewById(R.id.action_rotation));
         mActionMap.put(BottomAction.DELETE, findViewById(R.id.action_delete));
         mActionMap.put(BottomAction.INFORMATION, findViewById(R.id.action_information));
         mActionMap.put(BottomAction.EDIT, findViewById(R.id.action_edit));
+        mActionMap.put(BottomAction.CUSTOMIZE, findViewById(R.id.action_customize));
         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));
@@ -131,20 +131,18 @@
      */
     public void setActionClickListener(
             BottomAction bottomAction, OnClickListener actionClickListener) {
-        if (BottomAction.CANCEL.equals(bottomAction)) {
-            throw new IllegalArgumentException("Can't set OnClickListener to cancel button");
-        }
         mActionMap.get(bottomAction).setOnClickListener(actionClickListener);
     }
 
     /** Binds the cancel button to back key. */
-    public void bindCancelButtonToBackKey(Activity activity) {
-        mActionMap.get(BottomAction.CANCEL).setOnClickListener(v -> activity.onBackPressed());
+    public void bindBackButtonToSystemBackKey(Activity activity) {
+        findViewById(R.id.action_back).setOnClickListener(v -> activity.onBackPressed());
     }
 
     /** Clears all the actions' click listeners */
     public void clearActionClickListeners() {
         mActionMap.forEach((bottomAction, view) -> view.setOnClickListener(null));
+        findViewById(R.id.action_back).setOnClickListener(null);
     }
 
     /**