Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2a74bad authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge "Clean up ENABLE_KEYBOARD_TRANSITION_SYNC flag." into main

parents d7e3d8ab 2bb6abad
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -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<LauncherState>
    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<LauncherState>
        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<LauncherState>
        return mOldConfig.orientation;
    }

    public BaseSearchConfig getSearchConfig() {
        return mBaseSearchConfig;
    }

    /**
     * Returns the CellLayout of the specified container at the specified screen.
     *
+0 −39
Original line number Diff line number Diff line
@@ -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
+0 −28
Original line number Diff line number Diff line
/*
 * 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;
    }
}