From 2bb6abadd7d00d2f203802f46d5dd0fba714d8ba Mon Sep 17 00:00:00 2001 From: Luca Zuccarini Date: Tue, 10 Oct 2023 14:10:07 +0000 Subject: [PATCH] Clean up ENABLE_KEYBOARD_TRANSITION_SYNC flag. Fix: 297592348 Flag: NA Test: manual Change-Id: I995acd511a3c7ebc630aaac977f8c380ddfa445f --- src/com/android/launcher3/Launcher.java | 9 ----- .../allapps/AllAppsTransitionController.java | 39 ------------------- .../launcher3/allapps/BaseSearchConfig.java | 28 ------------- 3 files changed, 76 deletions(-) delete mode 100644 src/com/android/launcher3/allapps/BaseSearchConfig.java diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index b629ec2add..c0520c1e2d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -143,7 +143,6 @@ import com.android.launcher3.allapps.ActivityAllAppsContainerView; import com.android.launcher3.allapps.AllAppsRecyclerView; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AllAppsTransitionController; -import com.android.launcher3.allapps.BaseSearchConfig; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.PropertyListBuilder; @@ -418,7 +417,6 @@ public class Launcher extends StatefulActivity private LauncherState mPrevLauncherState; private StringCache mStringCache; - private BaseSearchConfig mBaseSearchConfig; private StartupLatencyLogger mStartupLatencyLogger; private CellPosMapper mCellPosMapper = CellPosMapper.DEFAULT; private boolean mIsFirstPagePinnedItemEnabled = QSB_ON_FIRST_SCREEN @@ -532,9 +530,6 @@ public class Launcher extends StatefulActivity mAllAppsController = new AllAppsTransitionController(this); mStateManager = new StateManager<>(this, NORMAL); - // TODO: move the SearchConfig to SearchState when new LauncherState is created. - mBaseSearchConfig = new BaseSearchConfig(); - setupViews(); mAppWidgetManager = new WidgetManagerHelper(this); @@ -3316,10 +3311,6 @@ public class Launcher extends StatefulActivity return mOldConfig.orientation; } - public BaseSearchConfig getSearchConfig() { - return mBaseSearchConfig; - } - /** * Returns the CellLayout of the specified container at the specified screen. * diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 278e4e5226..03ac9dfa26 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -33,7 +33,6 @@ import static com.android.launcher3.util.SystemUiController.FLAG_LIGHT_NAV; import static com.android.launcher3.util.SystemUiController.UI_STATE_ALL_APPS; import android.animation.Animator; -import android.animation.Animator.AnimatorListener; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.util.FloatProperty; @@ -54,7 +53,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; -import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.config.FeatureFlags; @@ -171,9 +169,6 @@ public class AllAppsTransitionController private boolean mIsVerticalLayout; - // Whether this class should take care of closing the keyboard. - private boolean mShouldControlKeyboard; - // Animation in this class is controlled by a single variable {@link mProgress}. // Visually, it represents top y coordinate of the all apps container if multiplied with // {@link mShiftRange}. @@ -276,7 +271,6 @@ public class AllAppsTransitionController public void setState(LauncherState state) { setProgress(state.getVerticalProgress(mLauncher)); setAlphas(state, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER); - onProgressAnimationEnd(); } @Override @@ -339,25 +333,11 @@ public class AllAppsTransitionController public void setStateWithAnimation(LauncherState toState, StateAnimationConfig config, PendingAnimation builder) { if (mLauncher.isInState(ALL_APPS) && !ALL_APPS.equals(toState)) { - // For atomic animations, we close the keyboard immediately. - if (!config.userControlled && mShouldControlKeyboard) { - mLauncher.getAppsView().getSearchUiManager().getEditText().hideKeyboard(); - } - builder.addEndListener(success -> { // Reset pull back progress and alpha after switching states. ALL_APPS_PULL_BACK_TRANSLATION.set(this, ALL_APPS_PULL_BACK_TRANSLATION_DEFAULT); ALL_APPS_PULL_BACK_ALPHA.set(this, ALL_APPS_PULL_BACK_ALPHA_DEFAULT); - // We only want to close the keyboard if the animation has completed successfully. - // The reason is that with keyboard sync, if the user swipes down from All Apps with - // the keyboard open and then changes their mind and swipes back up, we want the - // keyboard to remain open. However an onCancel signal is sent to the listeners - // (success = false), so we need to check for that. - if (config.userControlled && success && mShouldControlKeyboard) { - mLauncher.getAppsView().getSearchUiManager().getEditText().hideKeyboard(); - } - mAllAppScale.updateValue(1f); }); } @@ -390,7 +370,6 @@ public class AllAppsTransitionController config.userControlled ? LINEAR : DECELERATE_1_7); Animator anim = createSpringAnimation(mProgress, targetProgress); anim.setInterpolator(verticalProgressInterpolator); - anim.addListener(getProgressAnimatorListener()); builder.add(anim); setAlphas(toState, config, builder); @@ -428,10 +407,6 @@ public class AllAppsTransitionController mScrimView.setDrawingController(shouldProtectHeader ? mAppsView : null); } - public AnimatorListener getProgressAnimatorListener() { - return AnimatorListeners.forSuccessCallback(this::onProgressAnimationEnd); - } - /** * see Launcher#setupViews */ @@ -445,8 +420,6 @@ public class AllAppsTransitionController mAppsViewAlpha.setUpdateVisibility(true); mAppsViewTranslationY = new MultiPropertyFactory<>( mAppsView, VIEW_TRANSLATE_Y, APPS_VIEW_INDEX_COUNT, Float::sum); - - mShouldControlKeyboard = !mLauncher.getSearchConfig().isKeyboardSyncEnabled(); } /** @@ -529,18 +502,6 @@ public class AllAppsTransitionController mShiftRange = shiftRange; } - /** - * Set the final view states based on the progress. - * TODO: This logic should go in {@link LauncherState} - */ - private void onProgressAnimationEnd() { - if (Float.compare(mProgress, 1f) == 0) { - if (mShouldControlKeyboard) { - mLauncher.getAppsView().getSearchUiManager().getEditText().hideKeyboard(); - } - } - } - /** * This VibrationAnimatorUpdateListener class takes in four parameters, a controller, start * threshold, end threshold, and a Vibrator wrapper. We use the progress given by the controller diff --git a/src/com/android/launcher3/allapps/BaseSearchConfig.java b/src/com/android/launcher3/allapps/BaseSearchConfig.java deleted file mode 100644 index 9f47e8d82f..0000000000 --- a/src/com/android/launcher3/allapps/BaseSearchConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package com.android.launcher3.allapps; - -/** Base config values for search. */ -public class BaseSearchConfig { - public BaseSearchConfig() {} - - /** - * Returns whether to enable the synchronized keyboard transition between Home and All Apps. - */ - public boolean isKeyboardSyncEnabled() { - return false; - } -}