Add explore button to bottom action bar
Video: https://drive.google.com/file/d/11aNHw3ysjy_X8dklFB-8B7T-hX8g52L5/view?usp=sharing
Test: Manually
Bug: 155589657
Change-Id: Icc962cdf85c6a1db8c3ec20ae4100c529188db50
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index 9fdd1a6..c87c4cd 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -23,6 +23,7 @@
import android.app.ProgressDialog;
import android.app.WallpaperManager;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources.NotFoundException;
import android.graphics.Point;
@@ -70,6 +71,7 @@
import com.android.wallpaper.module.Injector;
import com.android.wallpaper.module.InjectorProvider;
import com.android.wallpaper.module.PackageStatusNotifier;
+import com.android.wallpaper.module.UserEventLogger;
import com.android.wallpaper.module.WallpaperChangedNotifier;
import com.android.wallpaper.module.WallpaperPersister;
import com.android.wallpaper.module.WallpaperPersister.Destination;
@@ -84,6 +86,7 @@
import com.android.wallpaper.picker.SetWallpaperErrorDialogFragment;
import com.android.wallpaper.picker.StartRotationDialogFragment;
import com.android.wallpaper.picker.StartRotationErrorDialogFragment;
+import com.android.wallpaper.picker.WallpaperInfoHelper;
import com.android.wallpaper.picker.WallpapersUiContainer;
import com.android.wallpaper.picker.individual.SetIndividualHolder.OnSetListener;
import com.android.wallpaper.util.DiskBasedLogger;
@@ -212,6 +215,7 @@
WallpaperInfoView mWallpaperInfoView;
@Nullable WallpaperInfo mSelectedWallpaperInfo;
+ private UserEventLogger mUserEventLogger;
private ProgressDialog mProgressDialog;
private boolean mTestingMode;
private CurrentWallpaperBottomSheetPresenter mCurrentWallpaperBottomSheetPresenter;
@@ -334,6 +338,8 @@
mPackageStatusNotifier = injector.getPackageStatusNotifier(appContext);
+ mUserEventLogger = injector.getUserEventLogger(appContext);
+
mWallpaperPersister = injector.getWallpaperPersister(appContext);
mWallpaperSetter = new WallpaperSetter(
mWallpaperPersister,
@@ -949,7 +955,13 @@
updateThumbnail(mSelectedWallpaperInfo);
// Populate wallpaper info into view.
if (mSelectedWallpaperInfo != null && mWallpaperInfoView != null) {
- mWallpaperInfoView.populateWallpaperInfo(mSelectedWallpaperInfo);
+ WallpaperInfoHelper.loadExploreIntent(
+ getContext(),
+ mSelectedWallpaperInfo,
+ (actionLabel, exploreIntent) ->
+ mWallpaperInfoView.populateWallpaperInfo(
+ mSelectedWallpaperInfo, actionLabel, exploreIntent,
+ v -> onExploreClicked(exploreIntent)));
}
if (mWallpaperSelectedListener != null) {
@@ -957,6 +969,17 @@
}
}
+ private void onExploreClicked(Intent exploreIntent) {
+ if (getContext() == null) {
+ return;
+ }
+ Context context = getContext();
+ mUserEventLogger.logActionClicked(mSelectedWallpaperInfo.getCollectionId(context),
+ mSelectedWallpaperInfo.getActionLabelRes(context));
+
+ startActivity(exploreIntent);
+ }
+
private void updateActivatedStatus(WallpaperInfo wallpaperInfo, boolean isActivated) {
if (wallpaperInfo == null) {
return;