Add personal / work tabs for work profile widgets

Video: https://drive.google.com/file/d/1TORRNcvVM7fIvNd_WZaajLbI7D9z4VFA/view?usp=sharing


Test: Main profile only: run AddConfigWidgetTest.
      With work profile: manually launch the full widgets sheet.
      Go to the personal tab: only personal widgets are shown.
      Go to the work tab: only work widgets are shown
      Successfully add personal / work widgets from the full widgets
      sheet.

Bug: 179797520

Change-Id: Iad8b90c2af35e0580319d7a05510ec88e4f8b86c
This commit is contained in:
Steven Ng
2021-02-17 15:58:23 +00:00
parent dfdeddc66a
commit 391404fcb7
9 changed files with 222 additions and 75 deletions

View File

@@ -96,6 +96,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
private static final int MIN_FLING_VELOCITY = 250;
private boolean mFreeScroll = false;
/** If {@code false}, disable swipe gesture to switch between pages. */
private boolean mSwipeGestureEnabled = true;
protected final int mFlingThresholdVelocity;
protected final int mEasyFlingThresholdVelocity;
@@ -857,6 +859,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
}
/**
* If {@code enableSwipeGesture} is {@code true}, enables swipe gesture to navigate between
* pages. Otherwise, disables the navigation gesture.
*/
public void setSwipeGestureEnabled(boolean swipeGestureEnabled) {
mSwipeGestureEnabled = swipeGestureEnabled;
}
/**
* {@inheritDoc}
*/
@@ -879,6 +889,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
* scrolling there.
*/
if (!mSwipeGestureEnabled) return false;
// Skip touch handling if there are no pages to swipe
if (getChildCount() <= 0) return false;