Refactor BottomActionBar
- BottomActionBar accept setting content view into bottomsheet.
- Wallpaper preview can reuse the existing logic of bottom sheet view, and work with BottomActionBar(ag/11261779).
- BottomActionBar can accept 1+ bottom sheet content per action button.
- Vedio:
Info button: https://drive.google.com/a/google.com/file/d/1FBbrMlRWynjeSNwV5cYRWEyUzt6xBxkM/view?usp=sharing
Two button for bottom sheet case(Demo, not implemented): https://drive.google.com/a/google.com/file/d/1ONZqdobGnmoydkGmwE6NEkAOuyUFl9T1/view?usp=sharing
Test: Manually
Fixes: 155157385
Change-Id: I2c62583e7b54a60721a7ec1fc0fb46af8f85487d
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index 58cb84f..0f042ab 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -89,6 +89,7 @@
import com.android.wallpaper.util.DiskBasedLogger;
import com.android.wallpaper.util.TileSizeCalculator;
import com.android.wallpaper.widget.BottomActionBar;
+import com.android.wallpaper.widget.WallpaperInfoView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.MemoryCategory;
@@ -207,6 +208,7 @@
};
PackageStatusNotifier.Listener mAppStatusListener;
BottomActionBar mBottomActionBar;
+ WallpaperInfoView mWallpaperInfoView;
@Nullable WallpaperInfo mSelectedWallpaperInfo;
private ProgressDialog mProgressDialog;
@@ -549,6 +551,11 @@
mWallpaperSetter.requestDestination(getActivity(), getFragmentManager(), this,
mSelectedWallpaperInfo instanceof LiveWallpaperInfo);
});
+
+ mWallpaperInfoView =
+ (WallpaperInfoView) mBottomActionBar.inflateViewToBottomSheetAndBindAction(
+ R.layout.wallpaper_info_view, R.id.wallpaper_info, INFORMATION);
+
mBottomActionBar.show();
}
}
@@ -941,8 +948,8 @@
updateBottomActions(mSelectedWallpaperInfo != null);
updateThumbnail(mSelectedWallpaperInfo);
// Populate wallpaper info to bottom sheet page.
- if (mSelectedWallpaperInfo != null) {
- mBottomActionBar.populateInfoPage(
+ if (mSelectedWallpaperInfo != null && mWallpaperInfoView != null) {
+ mWallpaperInfoView.populateWallpaperInfo(
mSelectedWallpaperInfo.getAttributions(getContext()),
shouldShowMetadataInPreview(mSelectedWallpaperInfo));
}