Let CategorySelectorFragment and IndividualPickerFragment can have their own tool bar.

So that they can set the title to their own tool bar if their host doesn't have the tool bar.

Bug: 181299737
Test: Manual
Change-Id: Ic44ee55c2d4de15ece45efdcaab4828a7e23c9d8
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index 3d23e50..d87049c 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -76,8 +76,8 @@
 import com.android.wallpaper.module.WallpaperPersister.Destination;
 import com.android.wallpaper.module.WallpaperPreferences;
 import com.android.wallpaper.module.WallpaperSetter;
+import com.android.wallpaper.picker.AppbarFragment;
 import com.android.wallpaper.picker.BaseActivity;
-import com.android.wallpaper.picker.BottomActionBarFragment;
 import com.android.wallpaper.picker.CurrentWallpaperBottomSheetPresenter;
 import com.android.wallpaper.picker.FragmentTransactionChecker;
 import com.android.wallpaper.picker.MyPhotosStarter.MyPhotosStarterProvider;
@@ -109,7 +109,7 @@
 /**
  * Displays the Main UI for picking an individual wallpaper image.
  */
-public class IndividualPickerFragment extends BottomActionBarFragment
+public class IndividualPickerFragment extends AppbarFragment
         implements RotationStarter, StartRotationErrorDialogFragment.Listener,
         CurrentWallpaperBottomSheetPresenter.RefreshListener,
         SetWallpaperErrorDialogFragment.Listener, SetWallpaperDialogFragment.Listener,
@@ -178,7 +178,13 @@
      */
     public interface IndividualPickerFragmentHost {
         /**
-         * Sets the title in the toolbar.
+         * Indicates if the host has toolbar to show the title. If it does, we should set the title
+         * there.
+         */
+        boolean isHostToolbarShown();
+
+        /**
+         * Sets the title in the host's toolbar.
          */
         void setToolbarTitle(CharSequence title);
 
@@ -397,7 +403,11 @@
         if (getIndividualPickerFragmentHost() == null) {
             return;
         }
-        getIndividualPickerFragmentHost().setToolbarTitle(mCategory.getTitle());
+        if (getIndividualPickerFragmentHost().isHostToolbarShown()) {
+            getIndividualPickerFragmentHost().setToolbarTitle(mCategory.getTitle());
+        } else {
+            setTitle(mCategory.getTitle());
+        }
         mWallpaperRotationInitializer = mCategory.getWallpaperRotationInitializer();
         // Avoids the "rotation" action is not shown correctly
         // in a rare case : onCategoryLoaded() is called after onBottomActionBarReady().
@@ -480,6 +490,14 @@
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
         View view = inflater.inflate(R.layout.fragment_individual_picker, container, false);
+        if (getIndividualPickerFragmentHost().isHostToolbarShown()) {
+            view.findViewById(R.id.header_bar).setVisibility(View.GONE);
+        } else {
+            setUpToolbar(view);
+            if (mCategory != null) {
+                setTitle(mCategory.getTitle());
+            }
+        }
 
         mTileSizePx = SizeCalculator.getIndividualTileSize(getActivity());