Milestone D3R3, continue to D4R1
This commit is contained in:
1 parent
492c0b5498
commit
436b59f0d4
158 files changed
+3621
-49382
No files matched your search
@@ -65,6 +65,7 @@ import com.android.launcher3.views.ActivityContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import app.lawnchair.preferences.PreferenceManager;
|
||||
import app.lawnchair.ui.StretchEdgeEffect;
|
||||
|
||||
/**
|
||||
@@ -85,6 +86,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.4f;
|
||||
|
||||
private static final float MAX_SCROLL_PROGRESS = 1.0f;
|
||||
|
||||
private PreferenceManager prefs = PreferenceManager.getInstance(getContext());
|
||||
|
||||
private boolean mFreeScroll = false;
|
||||
|
||||
@@ -1416,19 +1419,27 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
// test for a large move if a fling has been registered. That is, a large
|
||||
// move to the left and fling to the right will register as a fling to the right.
|
||||
|
||||
boolean infiniteScroll = prefs.getInstance(getContext()).getInfiniteScrolling().get();
|
||||
|
||||
if (((isSignificantMove && !isDeltaLeft && !isFling) ||
|
||||
(isFling && !isVelocityLeft)) && mCurrentPage > 0) {
|
||||
finalPage = returnToOriginalPage
|
||||
? mCurrentPage : mCurrentPage - getPanelCount();
|
||||
runOnPageScrollsInitialized(
|
||||
() -> snapToPageWithVelocity(finalPage, velocity));
|
||||
} else if (((isSignificantMove && isDeltaLeft && !isFling) ||
|
||||
(isFling && isVelocityLeft)) &&
|
||||
mCurrentPage < getChildCount() - 1) {
|
||||
finalPage = returnToOriginalPage
|
||||
? mCurrentPage : mCurrentPage + getPanelCount();
|
||||
runOnPageScrollsInitialized(
|
||||
() -> snapToPageWithVelocity(finalPage, velocity));
|
||||
() -> snapToPageWithVelocity(finalPage, velocity));
|
||||
} else if (((isSignificantMove && isDeltaLeft && !isFling) || (isFling && isVelocityLeft)) && mCurrentPage < getChildCount() - 1) {
|
||||
|
||||
finalPage = returnToOriginalPage ? mCurrentPage : mCurrentPage + getPanelCount();
|
||||
runOnPageScrollsInitialized(() -> snapToPageWithVelocity(finalPage, velocity));
|
||||
} else if (mCurrentPage == getChildCount() - 1 && infiniteScroll) {
|
||||
finalPage = returnToOriginalPage ? mCurrentPage : 0;
|
||||
snapToPageWithVelocity(finalPage, velocity);
|
||||
|
||||
|
||||
} else if (mCurrentPage == 0 && infiniteScroll) {
|
||||
finalPage = returnToOriginalPage ? mCurrentPage : getChildCount() - 1;
|
||||
snapToPageWithVelocity(finalPage, velocity);
|
||||
|
||||
} else {
|
||||
runOnPageScrollsInitialized(this::snapToDestination);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user