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

Commit 26bca080 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Handle requestFocus for ENABLE_DEVICE_SEARCH

Bug: 161594550

Change-Id: Ic99c04f1235e48e90b64df86e3739f8e14bc648f
parent f737f00d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -58,6 +58,17 @@ public class AllAppsInsetTransitionController {
        mApps = appsView;
    }

    public void hide() {
        if (!BuildCompat.isAtLeastR()) return;

        WindowInsets insets = mApps.getRootWindowInsets();
        if (insets == null) return;

        if (insets.isVisible(WindowInsets.Type.ime())) {
            mApps.getWindowInsetsController().hide(WindowInsets.Type.ime());
        }
    }

    /**
     * Initializes member variables and requests for the {@link WindowInsetsAnimationController}
     * object.
+10 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.animation.ObjectAnimator;
import android.util.FloatProperty;
import android.view.View;
import android.view.animation.Interpolator;
import android.widget.EditText;

import androidx.core.os.BuildCompat;

@@ -267,8 +268,16 @@ public class AllAppsTransitionController implements StateHandler<LauncherState>,
        }
        if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) {
            mInsetController.onAnimationEnd(mProgress);
            if (Float.compare(mProgress, 0f) == 0) {
                EditText editText = mAppsView.getSearchUiManager().getEditText();
                if (editText != null) {
                    editText.requestFocus();
                }
            }
            if (Float.compare(mProgress, 1f) == 0) {
                mAppsView.getSearchUiManager().setTextSearchEnabled(true).requestFocus();
                // Called when home gesture closes all apps container.
                // TODO: should make the controller hide synchronously
                mInsetController.hide();
            }
        }
    }
+2 −6
Original line number Diff line number Diff line
@@ -66,12 +66,8 @@ public interface SearchUiManager {
    }

    /**
     * Called to control how the search UI result should be handled.
     *
     * @param isEnabled when {@code true}, the search is all handled inside AOSP
     *                  and is not overlayable.
     * @return the searchbox edit text object
     * @return the edit text object
     */
    @Nullable
    EditText setTextSearchEnabled(boolean isEnabled);
    EditText getEditText();
}
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public class AppsSearchContainerLayout extends ExtendedEditText
    }

    @Override
    public EditText setTextSearchEnabled(boolean isEnabled) {
    public EditText getEditText() {
        return this;
    }
}