mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Merge "Hide IME when scrolling happens on all apps screen/scroller" into ub-launcher3-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
8d65ab8c81
@@ -44,6 +44,7 @@ import android.view.WindowInsets;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.core.os.BuildCompat;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -110,7 +111,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
|
||||
|
||||
private final MultiValueAlpha mMultiValueAlpha;
|
||||
|
||||
Rect mInsets = new Rect();
|
||||
private Rect mInsets = new Rect();
|
||||
|
||||
public AllAppsContainerView(Context context) {
|
||||
this(context, null);
|
||||
@@ -206,6 +207,17 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
|
||||
mAH[AdapterHolder.WORK].applyPadding();
|
||||
}
|
||||
|
||||
private void hideInput() {
|
||||
if (!BuildCompat.isAtLeastR() || !FeatureFlags.ENABLE_DEVICE_SEARCH.get()) return;
|
||||
|
||||
WindowInsets insets = getRootWindowInsets();
|
||||
if (insets == null) return;
|
||||
|
||||
if (insets.isVisible(WindowInsets.Type.ime())) {
|
||||
getWindowInsetsController().hide(WindowInsets.Type.ime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the view itself will handle the touch event or not.
|
||||
*/
|
||||
@@ -221,9 +233,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
|
||||
}
|
||||
if (rv.getScrollbar().getThumbOffsetY() >= 0 &&
|
||||
mLauncher.getDragLayer().isEventOverView(rv.getScrollbar(), ev)) {
|
||||
hideInput();
|
||||
return false;
|
||||
}
|
||||
return rv.shouldContainerScroll(ev, mLauncher.getDragLayer());
|
||||
boolean shouldScroll = rv.shouldContainerScroll(ev, mLauncher.getDragLayer());
|
||||
if (shouldScroll) {
|
||||
hideInput();
|
||||
}
|
||||
return shouldScroll;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user