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

Commit 74480b7b authored by Mario Bertschler's avatar Mario Bertschler Committed by Android (Google) Code Review
Browse files

Merge "Setting soft input to adjust resize while all apps is open." into ub-launcher3-dorval

parents 4ff3457e acbf5704
Loading
Loading
Loading
Loading
+30 −4
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.OvershootInterpolator;
@@ -174,6 +175,13 @@ public class Launcher extends BaseActivity
     */
    protected static final int REQUEST_LAST = 100;

    private static final int SOFT_INPUT_MODE_DEFAULT =
            WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
                | WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED;
    private static final int SOFT_INPUT_MODE_ALL_APPS =
            WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
                | WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED;

    // The Intent extra that defines whether to ignore the launch animation
    static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION =
            "com.android.launcher3.intent.extra.shortcut.INGORE_LAUNCH_ANIMATION";
@@ -2875,7 +2883,7 @@ public class Launcher extends BaseActivity
        }

        // Change the state *after* we've called all the transition code
        mState = State.WORKSPACE;
        setState(State.WORKSPACE);

        if (changed) {
            // Send an accessibility event to announce the context change
@@ -2912,12 +2920,30 @@ public class Launcher extends BaseActivity
        mWorkspace.setVisibility(View.VISIBLE);
        mStateTransitionAnimation.startAnimationToWorkspace(mState, mWorkspace.getState(),
                Workspace.State.OVERVIEW, animated, postAnimRunnable);
        mState = State.WORKSPACE;
        setState(State.WORKSPACE);

        // If animated from long press, then don't allow any of the controller in the drag
        // layer to intercept any remaining touch.
        mWorkspace.requestDisallowInterceptTouchEvent(animated);
    }

    private void setState(State state) {
        this.mState = state;
        updateSoftInputMode();
    }

    private void updateSoftInputMode() {
        if (FeatureFlags.LAUNCHER3_UPDATE_SOFT_INPUT_MODE) {
            final int mode;
            if (isAppsViewVisible()) {
                mode = SOFT_INPUT_MODE_ALL_APPS;
            } else {
                mode = SOFT_INPUT_MODE_DEFAULT;
            }
            getWindow().setSoftInputMode(mode);
        }
    }

    /**
     * Shows the apps view.
     */
@@ -2979,7 +3005,7 @@ public class Launcher extends BaseActivity
        }

        // Change the state *after* we've called all the transition code
        mState = toState;
        setState(toState);
        AbstractFloatingView.closeAllOpenViews(this);

        // Send an accessibility event to announce the context change
@@ -3009,7 +3035,7 @@ public class Launcher extends BaseActivity
        mStateTransitionAnimation.startAnimationToWorkspace(mState, mWorkspace.getState(),
                Workspace.State.SPRING_LOADED, true /* animated */,
                null /* onCompleteRunnable */);
        mState = State.WORKSPACE_SPRING_LOADED;
        setState(State.WORKSPACE_SPRING_LOADED);
    }

    public void exitSpringLoadedDragModeDelayed(final boolean successfulDrop, int delay,
+5 −2
Original line number Diff line number Diff line
@@ -29,6 +29,11 @@ public final class FeatureFlags {
    public static boolean LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW = false;
    public static boolean LAUNCHER3_ALL_APPS_PULL_UP = true;
    public static boolean LAUNCHER3_NEW_FOLDER_ANIMATION = false;
    // When enabled allows to use any point on the fast scrollbar to start dragging.
    public static boolean LAUNCHER3_DIRECT_SCROLL = true;
    // When enabled while all-apps open, the soft input will be set to adjust resize .
    public static boolean LAUNCHER3_UPDATE_SOFT_INPUT_MODE = false;


    // Feature flag to enable moving the QSB on the 0th screen of the workspace.
    public static final boolean QSB_ON_FIRST_SCREEN = true;
@@ -38,8 +43,6 @@ public final class FeatureFlags {
    public static final boolean PULLDOWN_SEARCH = false;
    // When enabled the status bar may show dark icons based on the top of the wallpaper.
    public static final boolean LIGHT_STATUS_BAR = false;
    // When enabled allows to use any point on the fast scrollbar to start dragging.
    public static final boolean LAUNCHER3_DIRECT_SCROLL = true;
    // When enabled icons are badged with the number of notifications associated with that app.
    public static final boolean BADGE_ICONS = true;
    // When enabled, icons not supporting {@link MaskableIconDrawable} will be wrapped in this class.