Merge "Bring up IME and focus on input when scroll to top." into tm-qpr-dev am: 15bdce40b0
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20113360 Change-Id: I39f8107029a803733803f2c8a162438481cbeb43 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -107,8 +107,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
|||||||
new RecyclerView.OnScrollListener() {
|
new RecyclerView.OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
updateHeaderScroll(
|
updateHeaderScroll(recyclerView.computeVerticalScrollOffset());
|
||||||
((AllAppsRecyclerView) recyclerView).computeVerticalScrollOffset());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -192,7 +191,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
|||||||
reset(true);
|
reset(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -815,6 +813,10 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onInitializeRecyclerView(RecyclerView rv) {
|
||||||
|
rv.addOnScrollListener(mScrollListener);
|
||||||
|
}
|
||||||
|
|
||||||
/** Holds a {@link BaseAllAppsAdapter} and related fields. */
|
/** Holds a {@link BaseAllAppsAdapter} and related fields. */
|
||||||
public class AdapterHolder {
|
public class AdapterHolder {
|
||||||
public static final int MAIN = 0;
|
public static final int MAIN = 0;
|
||||||
@@ -851,7 +853,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
|||||||
mRecyclerView.setHasFixedSize(true);
|
mRecyclerView.setHasFixedSize(true);
|
||||||
// No animations will occur when changes occur to the items in this RecyclerView.
|
// No animations will occur when changes occur to the items in this RecyclerView.
|
||||||
mRecyclerView.setItemAnimator(null);
|
mRecyclerView.setItemAnimator(null);
|
||||||
mRecyclerView.addOnScrollListener(mScrollListener);
|
onInitializeRecyclerView(mRecyclerView);
|
||||||
FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(mRecyclerView);
|
FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(mRecyclerView);
|
||||||
mRecyclerView.addItemDecoration(focusedItemDecorator);
|
mRecyclerView.addItemDecoration(focusedItemDecorator);
|
||||||
mAdapter.setIconFocusListener(focusedItemDecorator.getFocusListener());
|
mAdapter.setIconFocusListener(focusedItemDecorator.getFocusListener());
|
||||||
|
|||||||
@@ -25,4 +25,11 @@ public class BaseSearchConfig {
|
|||||||
public boolean isKeyboardSyncEnabled() {
|
public boolean isKeyboardSyncEnabled() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether IME is enabled on swipe up.
|
||||||
|
*/
|
||||||
|
public boolean isImeEnabledOnSwipeUp() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,19 +16,50 @@
|
|||||||
package com.android.launcher3.allapps;
|
package com.android.launcher3.allapps;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.android.launcher3.ExtendedEditText;
|
||||||
import com.android.launcher3.Launcher;
|
import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.LauncherState;
|
import com.android.launcher3.LauncherState;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
|
import com.android.launcher3.config.FeatureFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AllAppsContainerView with launcher specific callbacks
|
* AllAppsContainerView with launcher specific callbacks
|
||||||
*/
|
*/
|
||||||
public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<Launcher> {
|
public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<Launcher> {
|
||||||
|
|
||||||
|
private final RecyclerView.OnScrollListener mActivityScrollListener =
|
||||||
|
new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
int scrolledOffset = recyclerView.computeVerticalScrollOffset();
|
||||||
|
ExtendedEditText input = mSearchUiManager.getEditText();
|
||||||
|
// Scroll up and scroll to top
|
||||||
|
if (dy < 0 && scrolledOffset == 0 && input != null) {
|
||||||
|
boolean isImeEnabledOnSwipeUp = Launcher.getLauncher(mActivityContext)
|
||||||
|
.getSearchConfig().isImeEnabledOnSwipeUp();
|
||||||
|
if (isImeEnabledOnSwipeUp || !TextUtils.isEmpty(input.getText())) {
|
||||||
|
input.showKeyboard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onInitializeRecyclerView(RecyclerView rv) {
|
||||||
|
super.onInitializeRecyclerView(rv);
|
||||||
|
if (FeatureFlags.SCROLL_TOP_TO_RESET.get()) {
|
||||||
|
rv.addOnScrollListener(mActivityScrollListener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public LauncherAllAppsContainerView(Context context) {
|
public LauncherAllAppsContainerView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,6 +290,10 @@ public final class FeatureFlags {
|
|||||||
public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
|
public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
|
||||||
"ENABLE_WIDGET_PICKER_DEPTH", true, "Enable changing depth in widget picker.");
|
"ENABLE_WIDGET_PICKER_DEPTH", true, "Enable changing depth in widget picker.");
|
||||||
|
|
||||||
|
public static final BooleanFlag SCROLL_TOP_TO_RESET = new DeviceFlag(
|
||||||
|
"SCROLL_TOP_TO_RESET", false, "Bring up IME and focus on "
|
||||||
|
+ "input when scroll to top if 'Always show keyboard' is enabled or in prefix state");
|
||||||
|
|
||||||
public static final BooleanFlag SHOW_DELIGHTFUL_PAGINATION = getDebugFlag(
|
public static final BooleanFlag SHOW_DELIGHTFUL_PAGINATION = getDebugFlag(
|
||||||
"SHOW_DELIGHTFUL_PAGINATION", false,
|
"SHOW_DELIGHTFUL_PAGINATION", false,
|
||||||
"Enable showing the new 'delightful pagination' which is a brand"
|
"Enable showing the new 'delightful pagination' which is a brand"
|
||||||
|
|||||||
Reference in New Issue
Block a user