Bind BottomActionBar#cancel button to backkey
So that the behavior of cancel button and backkey would be same.
Test: Manually
Bug: 151287994
Change-Id: I3634a6e8dc2cb9b818e5aaebb8cd359a641e619e
diff --git a/src/com/android/customization/picker/CustomizationPickerActivity.java b/src/com/android/customization/picker/CustomizationPickerActivity.java
index c3b3057..0dde0eb 100644
--- a/src/com/android/customization/picker/CustomizationPickerActivity.java
+++ b/src/com/android/customization/picker/CustomizationPickerActivity.java
@@ -291,17 +291,17 @@
@Override
public void onBackPressed() {
- // For wallpaper tab, since it had child fragment.
- if (mWallpaperCategoryFragment != null && mWallpaperCategoryFragment.popChildFragment()) {
- return;
- }
-
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
if (fragment instanceof BottomActionBarFragment
&& ((BottomActionBarFragment) fragment).onBackPressed()) {
return;
}
+ // For wallpaper tab, since it had child fragment.
+ if (mWallpaperCategoryFragment != null && mWallpaperCategoryFragment.popChildFragment()) {
+ return;
+ }
+
if (getSupportFragmentManager().popBackStackImmediate()) {
return;
}
diff --git a/src/com/android/customization/picker/grid/GridFragment.java b/src/com/android/customization/picker/grid/GridFragment.java
index 1a26755..eac1527 100644
--- a/src/com/android/customization/picker/grid/GridFragment.java
+++ b/src/com/android/customization/picker/grid/GridFragment.java
@@ -209,7 +209,6 @@
protected void onBottomActionBarReady(BottomActionBar bottomActionBar) {
mBottomActionBar = bottomActionBar;
mBottomActionBar.showActionsOnly(CANCEL, APPLY);
- mBottomActionBar.setActionClickListener(CANCEL, unused -> getActivity().onBackPressed());
mBottomActionBar.setActionClickListener(APPLY, unused -> {
mBottomActionBar.disableActions();
mGridManager.apply(mSelectedOption, mApplyGridCallback);