Pre-revamped UI customization picker activity & fragment cleanup
Clean up revamped UI flags in the customization picker activity &
fragment.
Bug: 262780002
Test: manually verified
Change-Id: I0b6012d568a6662a783ab1d9a1533c9f40f9cfe5
diff --git a/res/layout/collapsing_toolbar_container_layout.xml b/res/layout/collapsing_toolbar_container_layout.xml
deleted file mode 100644
index 9d20c13..0000000
--- a/res/layout/collapsing_toolbar_container_layout.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2022 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<androidx.coordinatorlayout.widget.CoordinatorLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:id="@+id/content_parent"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true">
-
- <com.google.android.material.appbar.AppBarLayout
- android:id="@+id/app_bar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="?android:attr/colorPrimary"
- android:fitsSystemWindows="true"
- android:outlineAmbientShadowColor="@android:color/transparent"
- android:outlineSpotShadowColor="@android:color/transparent"
- android:theme="@style/Theme.CollapsingToolbar.Settings">
-
- <com.google.android.material.appbar.CollapsingToolbarLayout
- android:id="@+id/collapsing_toolbar"
- android:layout_width="match_parent"
- android:layout_height="@dimen/settingslib_toolbar_layout_height"
- android:clipToPadding="false"
- app:forceApplySystemWindowInsetTop="true"
- app:extraMultilineHeightEnabled="true"
- app:contentScrim="@color/settingslib_colorSurfaceHeader"
- app:maxLines="3"
- app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
- app:scrimAnimationDuration="50"
- app:scrimVisibleHeightTrigger="@dimen/settingslib_scrim_visible_height_trigger"
- app:statusBarScrim="@null"
- app:titleCollapseMode="fade"
- app:collapsedTitleTextAppearance="@style/CollapsingToolbar.Collapsed"
- app:expandedTitleTextAppearance="@style/CollapsingToolbar.Expanded"
- app:expandedTitleMarginEnd="@dimen/expanded_title_margin_end"
- app:toolbarId="@id/action_bar">
-
- <Toolbar
- android:id="@+id/action_bar"
- android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- android:theme="?android:attr/actionBarTheme"
- app:layout_collapseMode="pin"/>
-
- </com.google.android.material.appbar.CollapsingToolbarLayout>
- </com.google.android.material.appbar.AppBarLayout>
-
- <FrameLayout
- android:id="@+id/content_frame"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
-
-</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
diff --git a/src/com/android/wallpaper/picker/CustomizationPickerActivity.java b/src/com/android/wallpaper/picker/CustomizationPickerActivity.java
index 76e5635..c033b48 100644
--- a/src/com/android/wallpaper/picker/CustomizationPickerActivity.java
+++ b/src/com/android/wallpaper/picker/CustomizationPickerActivity.java
@@ -83,7 +83,6 @@
private BottomActionBar mBottomActionBar;
private boolean mIsSafeToCommitFragmentTransaction;
- private boolean mIsUseRevampedUi;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -93,7 +92,6 @@
mNetworkStatusNotifier = injector.getNetworkStatusNotifier(this);
mNetworkStatus = mNetworkStatusNotifier.getNetworkStatus();
mDisplayUtils = injector.getDisplayUtils(this);
- mIsUseRevampedUi = injector.getFlags().isUseRevampedUiEnabled(this);
enforceOrientation();
@@ -131,9 +129,8 @@
// Switch to the target fragment.
switchFragment(isWallpaperOnlyMode(getIntent())
- ? WallpaperOnlyFragment.newInstance(mIsUseRevampedUi)
- : CustomizationPickerFragment.newInstance(
- mIsUseRevampedUi, startFromLockScreen));
+ ? WallpaperOnlyFragment.newInstance()
+ : CustomizationPickerFragment.newInstance(startFromLockScreen));
// Cache the categories, but only if we're not restoring state (b/276767415).
mDelegate.prefetchCategories();
@@ -142,9 +139,7 @@
if (savedInstanceState == null) {
// We only want to start a new undo session if this activity is brand-new. A non-new
// activity will have a non-null savedInstanceState.
- if (mIsUseRevampedUi) {
- injector.getUndoInteractor(this, this).startSession();
- }
+ injector.getUndoInteractor(this, this).startSession();
}
final Intent intent = getIntent();
@@ -353,7 +348,7 @@
if (mDelegate.handleActivityResult(requestCode, resultCode, data)) {
if (isSUWMode(this)) {
finishActivityForSUW();
- } else if (mIsUseRevampedUi) {
+ } else {
// We don't finish in the revamped UI to let the user have a chance to reset the
// change they made, should they want to. We do, however, remove all the fragments
// from our back stack to reveal the root fragment, revealing the main screen of the
@@ -362,8 +357,6 @@
while (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStackImmediate();
}
- } else {
- finishActivityWithResultOk();
}
}
}
diff --git a/src/com/android/wallpaper/picker/CustomizationPickerFragment.java b/src/com/android/wallpaper/picker/CustomizationPickerFragment.java
index c6bb189..0b93931 100644
--- a/src/com/android/wallpaper/picker/CustomizationPickerFragment.java
+++ b/src/com/android/wallpaper/picker/CustomizationPickerFragment.java
@@ -62,17 +62,13 @@
private static final String TAG = "CustomizationPickerFragment";
private static final String SCROLL_POSITION_Y = "SCROLL_POSITION_Y";
- protected static final String KEY_IS_USE_REVAMPED_UI = "is_use_revamped_ui";
private static final String KEY_START_FROM_LOCK_SCREEN = "start_from_lock_screen";
private DisposableHandle mBinding;
/** Returns a new instance of {@link CustomizationPickerFragment}. */
- public static CustomizationPickerFragment newInstance(
- boolean isUseRevampedUi,
- boolean startFromLockScreen) {
+ public static CustomizationPickerFragment newInstance(boolean startFromLockScreen) {
final CustomizationPickerFragment fragment = new CustomizationPickerFragment();
final Bundle args = new Bundle();
- args.putBoolean(KEY_IS_USE_REVAMPED_UI, isUseRevampedUi);
args.putBoolean(KEY_START_FROM_LOCK_SCREEN, startFromLockScreen);
fragment.setArguments(args);
return fragment;
@@ -95,10 +91,7 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Nullable Bundle savedInstanceState) {
- final boolean shouldUseRevampedUi = shouldUseRevampedUi();
- final int layoutId = shouldUseRevampedUi
- ? R.layout.toolbar_container_layout
- : R.layout.collapsing_toolbar_container_layout;
+ final int layoutId = R.layout.toolbar_container_layout;
final View view = inflater.inflate(layoutId, container, false);
if (ActivityUtils.isLaunchedFromSettingsRelated(getActivity().getIntent())) {
setUpToolbar(view, !ActivityEmbeddingUtils.shouldHideNavigateUpButton(
@@ -198,7 +191,7 @@
@Override
protected int getToolbarId() {
- return shouldUseRevampedUi() ? R.id.toolbar : R.id.action_bar;
+ return R.id.toolbar;
}
@Override
@@ -379,17 +372,6 @@
return (WallpaperPreviewNavigator) getActivity();
}
- private boolean shouldUseRevampedUi() {
- final Bundle args = getArguments();
- if (args != null && args.containsKey(KEY_IS_USE_REVAMPED_UI)) {
- return args.getBoolean(KEY_IS_USE_REVAMPED_UI);
- } else {
- throw new IllegalStateException(
- "Must contain KEY_IS_USE_REVAMPED_UI argument, did you instantiate directly"
- + " instead of using the newInstance function?");
- }
- }
-
// TODO (b/282237387): Move wallpaper picker out of the 2-pane settings and make it a
// standalone app. Remove this flag when the bug is fixed.
private boolean getIsTwoPaneAndSmallWidth(Activity activity) {
diff --git a/src/com/android/wallpaper/picker/WallpaperOnlyFragment.java b/src/com/android/wallpaper/picker/WallpaperOnlyFragment.java
index 033b8e9..fd7cae1 100644
--- a/src/com/android/wallpaper/picker/WallpaperOnlyFragment.java
+++ b/src/com/android/wallpaper/picker/WallpaperOnlyFragment.java
@@ -29,10 +29,9 @@
public class WallpaperOnlyFragment extends CustomizationPickerFragment {
/** Returns a new instance of {@link WallpaperOnlyFragment}. */
- public static WallpaperOnlyFragment newInstance(boolean isUseRevampedUi) {
+ public static WallpaperOnlyFragment newInstance() {
final WallpaperOnlyFragment fragment = new WallpaperOnlyFragment();
final Bundle args = new Bundle();
- args.putBoolean(KEY_IS_USE_REVAMPED_UI, isUseRevampedUi);
fragment.setArguments(args);
return fragment;
}