Fix crash when opening a Gallery in WPP

When moving the logic to calling setupImageGrid (ag/9155926),
I forgot that it can be overridden, so keep setUpImageGrid
as it was so we don't need to dupe the logic in the
overriding methods and move that somewhere else.

Bug: 136241900
Change-Id: I47e92cf519142065ce948bc4c4e329123e3d708c
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index 8f1d380..db21da3 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -305,7 +305,7 @@
                     WallpaperService.SERVICE_INTERFACE);
         }
 
-        setUpImageGrid();
+        maybeSetUpImageGrid();
     }
 
     void fetchWallpapers(boolean forceReload) {
@@ -362,7 +362,7 @@
         }
         GridMarginDecoration.applyTo(mImageGrid);
 
-        setUpImageGrid();
+        maybeSetUpImageGrid();
 
         setUpBottomSheet();
 
@@ -386,7 +386,7 @@
                 gridPaddingPx, gridPaddingPx, 0, paddingBottomPx);
     }
 
-    void setUpImageGrid() {
+    private void maybeSetUpImageGrid() {
         // Skip if mImageGrid been initialized yet
         if (mImageGrid == null) {
             return;
@@ -399,6 +399,14 @@
         if (mAdapter != null) {
             return;
         }
+        setUpImageGrid();
+    }
+
+    /**
+     * Create the adapter and assign it to mImageGrid.
+     * Both mImageGrid and mCategory are guaranteed to not be null when this method is called.
+     */
+    void setUpImageGrid() {
         mAdapter = new IndividualAdapter(mWallpapers);
         mImageGrid.setAdapter(mAdapter);
         mImageGrid.setLayoutManager(new GridLayoutManager(getActivity(), getNumColumns()));