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

Commit 64896f30 authored by Andy Wickham's avatar Andy Wickham
Browse files

Put the "floating" in ENABLE_FLOATING_SEARCH_BAR.

This means adding the search view to the drag layer, so it can
persist and animate across Launcher states (i.e. Home, All Apps,
Overview, Overview from App).

Some high level things:
 - LauncherState now has a flag indicating if the floating
   search bar should be visible, as well as a method indicating
   how high it should rest when the keyboard is not showing. By
   default the height is set negative if the flag is not present,
   so the search bar will rest off screen in that state.
 - LauncherState also has a new method indicating if the search
   bar should show as a pill when not focused. Currently this is
   done in phone portrait mode in all apps and overview.
 - SearchUiManager now has a method for gestures to hint that
   the search bar will be focused or unfocused soon, e.g. for
   the app -> overview case, we hint that it will be focused
   when crossing the threshold, and unfocused if retracting.
   This allows the search bar to animate during the gesture
   and take or release focus after the state change completes.
 - AllAppsTransitionController lets the apps panel translate in
   from the bottom of the screen, for example when coming from
   an app and we don't want to pop it in halfway up the screen.
   Instead it can slide in gracefully from behind the keyboard
   and floating search bar.
 - KeyboardInsetAnimationCallback can now notify listeners of
   keyboard alpha changes during controlled animations. And
   StateAnimationConfig has a new animation type to control
   the keyboard alpha during the all apps transition.
 - This new ANIM_ALL_APPS_KEYBOARD_FADE is used to pop the
   keyboard in at the threshold for going from an app to all apps.
   Note that its position moves linearly before this, so the
   search bar starts moving up accordingly before the keyboard
   alpha is non-0.

Fix: 266761289
Fix: 268845147
Fix: 267683921
Fix: 265849321
Fix: 266446733
Fix: 269301440
Bug: 275635606
Bug: 259619990
Bug: 261866704
Test: Manual with all the state transitions on phone and tablet
(also folding/unfolding foldable).
Flag: ENABLE_FLOATING_SEARCH_BAR, ENABLE_ALL_APPS_FROM_OVERVIEW
(latter just for the background app interpolator changes).

Change-Id: I6f06552e95747348a62260279626cf407bf145b0
parent a6a71d5a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -47,9 +47,9 @@ public class TaskbarAllAppsContainerView extends
    }

    @Override
    protected View inflateSearchBox() {
    protected View inflateSearchBar() {
        if (isSearchSupported()) {
            return super.inflateSearchBox();
            return super.inflateSearchBar();
        }

        // Remove top padding of header, since we do not have any search
+7 −0
Original line number Diff line number Diff line
@@ -169,6 +169,13 @@ public final class TaskbarAllAppsController {
    }

    private void cleanUpOverlay() {
        // Floating search bar is added to the drag layer in ActivityAllAppsContainerView onAttach;
        // removed here as this is a special case that we remove the all apps panel.
        if (mAppsView != null && mOverlayContext != null
                && mAppsView.getSearchUiDelegate().isSearchBarFloating()) {
            mOverlayContext.getDragLayer().removeView(mAppsView.getSearchView());
            mAppsView.getSearchUiDelegate().onDestroySearchBar();
        }
        if (mSearchSessionController != null) {
            mSearchSessionController.onDestroy();
            mSearchSessionController = null;
+18 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAP

import android.content.Context;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -104,9 +105,23 @@ public class AllAppsState extends LauncherState {

    @Override
    public int getVisibleElements(Launcher launcher) {
        // Don't add HOTSEAT_ICONS for non-tablets in ALL_APPS state.
        return launcher.getDeviceProfile().isTablet ? ALL_APPS_CONTENT | HOTSEAT_ICONS
                : ALL_APPS_CONTENT;
        int elements = ALL_APPS_CONTENT | FLOATING_SEARCH_BAR;
        // Only add HOTSEAT_ICONS for tablets in ALL_APPS state.
        if (launcher.getDeviceProfile().isTablet) {
            elements |= HOTSEAT_ICONS;
        }
        return elements;
    }

    @Override
    public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) {
        return 0;
    }

    @Override
    public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) {
        DeviceProfile dp = launcher.getDeviceProfile();
        return dp.isPhone && !dp.isLandscape;
    }

    @Override
+26 −1
Original line number Diff line number Diff line
@@ -107,7 +107,32 @@ public class OverviewState extends LauncherState {

    @Override
    public int getVisibleElements(Launcher launcher) {
        return CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS;
        int elements = CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS;
        DeviceProfile dp = launcher.getDeviceProfile();
        boolean showFloatingSearch;
        if (dp.isPhone) {
            // Only show search in phone overview in portrait mode.
            showFloatingSearch = !dp.isLandscape;
        } else {
            // Only show search in tablet overview if taskbar is not visible.
            showFloatingSearch = !dp.isTaskbarPresent || isTaskbarStashed(launcher);
        }
        if (showFloatingSearch) {
            elements |= FLOATING_SEARCH_BAR;
        }
        return elements;
    }

    @Override
    public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) {
        return areElementsVisible(launcher, FLOATING_SEARCH_BAR) ? 0
                : super.getFloatingSearchBarRestingMarginBottom(launcher);
    }

    @Override
    public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) {
        DeviceProfile dp = launcher.getDeviceProfile();
        return dp.isPhone && !dp.isLandscape;
    }

    @Override
+4 −0
Original line number Diff line number Diff line
@@ -811,6 +811,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        VibratorWrapper.INSTANCE.get(mContext).vibrate(OVERVIEW_HAPTIC);
        maybeUpdateRecentsAttachedState(true);

        if (mActivity != null) {
            mActivity.getAppsView().getSearchUiManager().prepareToFocusEditText(mIsInAllAppsRegion);
        }

        // Draw active task below Launcher so that All Apps can appear over it.
        runActionOnRemoteHandles(remoteTargetHandle ->
                remoteTargetHandle.getTaskViewSimulator().setDrawsBelowRecents(isInAllAppsRegion));
Loading