Decouple MyPhotosLauncher from the Activity
Rather than assuming that the host activity in the
picker Fragments supports launching "my photos" picker,
use interfaces to allow for different implementations.
Bug: 120559978
Change-Id: I63d648ddc774f7ae44c907f57fc45594ca7486c6
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index 37c2477..22309b6 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -35,6 +35,13 @@
import android.widget.TextView;
import android.widget.Toast;
+import androidx.fragment.app.DialogFragment;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
+import androidx.recyclerview.widget.RecyclerView.ViewHolder;
+
import com.android.wallpaper.R;
import com.android.wallpaper.asset.Asset;
import com.android.wallpaper.asset.Asset.DrawableLoadedListener;
@@ -59,6 +66,7 @@
import com.android.wallpaper.module.WallpaperPreferences;
import com.android.wallpaper.picker.BaseActivity;
import com.android.wallpaper.picker.CurrentWallpaperBottomSheetPresenter;
+import com.android.wallpaper.picker.MyPhotosStarter.MyPhotosStarterProvider;
import com.android.wallpaper.picker.RotationStarter;
import com.android.wallpaper.picker.SetWallpaperErrorDialogFragment;
import com.android.wallpaper.picker.StartRotationDialogFragment;
@@ -77,13 +85,6 @@
import java.util.List;
import java.util.Random;
-import androidx.fragment.app.DialogFragment;
-import androidx.fragment.app.Fragment;
-import androidx.recyclerview.widget.GridLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
-import androidx.recyclerview.widget.RecyclerView.ViewHolder;
-
/**
* Displays the Main UI for picking an individual wallpaper image.
*/
@@ -894,7 +895,9 @@
LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
View view = layoutInflater.inflate(R.layout.grid_item_my_photos, parent, false);
- return new MyPhotosViewHolder(getActivity(), mTileSizePx.y, view);
+ return new MyPhotosViewHolder(getActivity(),
+ ((MyPhotosStarterProvider) getActivity()).getMyPhotosStarter(),
+ mTileSizePx.y, view);
}
/**