summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/PagedView.java
diff options
context:
space:
mode:
authorLuca Stefani <luca.stefani.ge1@gmail.com>2020-03-07 13:43:59 +0100
committerLuca Stefani <luca.stefani.ge1@gmail.com>2020-03-07 13:43:59 +0100
commit0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0 (patch)
tree2bc4acf2f54df560a34dcc7b7844d9d18cc58131 /src/com/android/launcher3/PagedView.java
parent744d192669a148bde24d36bef02deb05c2f7a1fa (diff)
parent02826bbe04d9dc1e6111f5d6ffd8706ac1f8f908 (diff)
downloadandroid_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.gz
android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.bz2
android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.zip
Merge tag 'android-10.0.0_r31' into HEAD
Android 10.0.0 release 31 * tag 'android-10.0.0_r31': (218 commits) Increase drag distance threshold when drag starts from deep press Fix shortcut componentname in workspace layout logging Fix shortcut componentname in workspace layout logging perform accessbility focus when the recyclerview doesn't gain focus after fragment replacement in SettingsActivity Persist predicted items when dragged to workspace Import translations. DO NOT MERGE Import translations. DO NOT MERGE Align badging logic with platform IconDrawableFactory. Fix bug where icon remains invisible after returning home. Fix quick switch from home biased towards returning home Fix recents scale sometimes lagging behind window scale Fix folder open/close animation when grid size is small. fix custom shortcut test Improve quick switch from home by tracking both x and y motion Move shelf peeking anim code to ShelfPeekAnim class Fix folder available height calculation Tapl: AllApps: ensuring a minimal vertical size of an icon Enable a11y scrolling with item drag disable custom shortcut test in oop include predicted_rank in app launch logging ... Change-Id: Id824c350cd133c4c8fa91de0f8793faed9003393
Diffstat (limited to 'src/com/android/launcher3/PagedView.java')
-rw-r--r--src/com/android/launcher3/PagedView.java33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 050d75bf1..1fccd4f7b 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1302,6 +1302,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
+ Launcher launcher = Launcher.getLauncher(getContext());
+ if (launcher != null) {
+ AbstractFloatingView.closeAllOpenViews(launcher);
+ }
// Handle mouse (or ext. device) by shifting the page depending on the scroll
final float vscroll;
final float hscroll;
@@ -1312,6 +1316,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);
hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
}
+ if (Math.abs(vscroll) > Math.abs(hscroll) && !isVerticalScrollable()) {
+ return true;
+ }
if (hscroll != 0 || vscroll != 0) {
boolean isForwardScroll = mIsRtl ? (hscroll < 0 || vscroll < 0)
: (hscroll > 0 || vscroll > 0);
@@ -1328,6 +1335,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return super.onGenericMotionEvent(event);
}
+ protected boolean isVerticalScrollable() {
+ return true;
+ }
+
private void acquireVelocityTrackerAndAddMovement(MotionEvent ev) {
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
@@ -1545,7 +1556,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
snapToPage(getNextPage() - 1);
return true;
}
- return false;
+ return onOverscroll(-getMeasuredWidth());
}
public boolean scrollRight() {
@@ -1553,7 +1564,15 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
snapToPage(getNextPage() + 1);
return true;
}
- return false;
+ return onOverscroll(getMeasuredWidth());
+ }
+
+ protected boolean onOverscroll(int amount) {
+ if (!mAllowOverScroll) return false;
+ onScrollInteractionBegin();
+ overScroll(amount);
+ onScrollInteractionEnd();
+ return true;
}
@Override
@@ -1573,8 +1592,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
final boolean pagesFlipped = isPageOrderFlipped();
- info.setScrollable(getPageCount() > 1);
- if (getCurrentPage() < getPageCount() - 1) {
+ int offset = (mAllowOverScroll ? 0 : 1);
+ info.setScrollable(getPageCount() > offset);
+ if (getCurrentPage() < getPageCount() - offset) {
info.addAction(pagesFlipped ?
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
@@ -1582,7 +1602,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT);
}
- if (getCurrentPage() > 0) {
+ if (getCurrentPage() >= offset) {
info.addAction(pagesFlipped ?
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
@@ -1590,7 +1610,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT);
}
-
// Accessibility-wise, PagedView doesn't support long click, so disabling it.
// Besides disabling the accessibility long-click, this also prevents this view from getting
// accessibility focus.
@@ -1609,7 +1628,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
- event.setScrollable(getPageCount() > 1);
+ event.setScrollable(mAllowOverScroll || getPageCount() > 1);
}
@Override