Java Code Examples for android.support.v4.view.ViewCompat#getOverScrollMode()
The following examples show how to use
android.support.v4.view.ViewCompat#getOverScrollMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NestedScrollView.java From letv with Apache License 2.0 | 6 votes |
public void computeScroll() { boolean canOverscroll = true; if (this.mScroller.computeScrollOffset()) { int oldX = getScrollX(); int oldY = getScrollY(); int x = this.mScroller.getCurrX(); int y = this.mScroller.getCurrY(); if (oldX != x || oldY != y) { int range = getScrollRange(); int overscrollMode = ViewCompat.getOverScrollMode(this); if (overscrollMode != 0 && (overscrollMode != 1 || range <= 0)) { canOverscroll = false; } overScrollByCompat(x - oldX, y - oldY, oldX, oldY, 0, range, 0, 0, false); if (canOverscroll) { ensureGlows(); if (y <= 0 && oldY > 0) { this.mEdgeGlowTop.onAbsorb((int) this.mScroller.getCurrVelocity()); } else if (y >= range && oldY < range) { this.mEdgeGlowBottom.onAbsorb((int) this.mScroller.getCurrVelocity()); } } } } }
Example 2
Source File: NestedScrollView.java From letv with Apache License 2.0 | 5 votes |
private void ensureGlows() { if (ViewCompat.getOverScrollMode(this) == 2) { this.mEdgeGlowTop = null; this.mEdgeGlowBottom = null; } else if (this.mEdgeGlowTop == null) { Context context = getContext(); this.mEdgeGlowTop = new EdgeEffectCompat(context); this.mEdgeGlowBottom = new EdgeEffectCompat(context); } }
Example 3
Source File: NestedScrollView.java From MyBlogDemo with Apache License 2.0 | 5 votes |
@Override public void computeScroll() { if (mScroller.computeScrollOffset()) { int oldX = getScrollX(); int oldY = getScrollY(); int x = mScroller.getCurrX(); int y = mScroller.getCurrY(); if (oldX != x || oldY != y) { final int range = getScrollRange(); final int overscrollMode = ViewCompat.getOverScrollMode(this); final boolean canOverscroll = overscrollMode == ViewCompat.OVER_SCROLL_ALWAYS || (overscrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0); overScrollByCompat(x - oldX, y - oldY, oldX, oldY, 0, range, 0, 0, false); if (canOverscroll) { ensureGlows(); if (y <= 0 && oldY > 0) { mEdgeGlowTop.onAbsorb((int) mScroller.getCurrVelocity()); } else if (y >= range && oldY < range) { mEdgeGlowBottom.onAbsorb((int) mScroller.getCurrVelocity()); } } } } }
Example 4
Source File: WrapContentManagerRecyclerView.java From Expense-Tracker-App with MIT License | 4 votes |
@SuppressWarnings("UnusedDeclaration") public WrapContentManagerRecyclerView(RecyclerView view, int orientation, boolean reverseLayout) { super(view.getContext(), orientation, reverseLayout); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 5
Source File: NestedScrollView.java From letv with Apache License 2.0 | 4 votes |
boolean overScrollByCompat(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { int overScrollMode = ViewCompat.getOverScrollMode(this); boolean canScrollHorizontal = computeHorizontalScrollRange() > computeHorizontalScrollExtent(); boolean canScrollVertical = computeVerticalScrollRange() > computeVerticalScrollExtent(); boolean overScrollHorizontal = overScrollMode == 0 || (overScrollMode == 1 && canScrollHorizontal); boolean overScrollVertical = overScrollMode == 0 || (overScrollMode == 1 && canScrollVertical); int newScrollX = scrollX + deltaX; if (!overScrollHorizontal) { maxOverScrollX = 0; } int newScrollY = scrollY + deltaY; if (!overScrollVertical) { maxOverScrollY = 0; } int left = -maxOverScrollX; int right = maxOverScrollX + scrollRangeX; int top = -maxOverScrollY; int bottom = maxOverScrollY + scrollRangeY; boolean clampedX = false; if (newScrollX > right) { newScrollX = right; clampedX = true; } else if (newScrollX < left) { newScrollX = left; clampedX = true; } boolean clampedY = false; if (newScrollY > bottom) { newScrollY = bottom; clampedY = true; } else if (newScrollY < top) { newScrollY = top; clampedY = true; } if (clampedY) { this.mScroller.springBack(newScrollX, newScrollY, 0, 0, 0, getScrollRange()); } onOverScrolled(newScrollX, newScrollY, clampedX, clampedY); if (clampedX || clampedY) { return true; } return false; }
Example 6
Source File: WrapContentManagerRecyclerView.java From Expense-Tracker-App with MIT License | 4 votes |
@SuppressWarnings("UnusedDeclaration") public WrapContentManagerRecyclerView(RecyclerView view) { super(view.getContext()); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 7
Source File: MyLinearLayoutManager.java From BlueBoard with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public MyLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) { super(view.getContext(), orientation, reverseLayout); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 8
Source File: MyLinearLayoutManager.java From BlueBoard with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public MyLinearLayoutManager(RecyclerView view) { super(view.getContext()); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 9
Source File: VerticalViewPager.java From MiBandDecompiled with Apache License 2.0 | 4 votes |
public void draw(Canvas canvas) { int i1 = 1; super.draw(canvas); int j1 = ViewCompat.getOverScrollMode(this); boolean flag1; if (j1 == 0 || j1 == i1 && k != null && k.getCount() > i1) { boolean flag = Q.isFinished(); flag1 = false; if (!flag) { int j2 = canvas.save(); int k2 = getWidth() - getPaddingLeft() - getPaddingRight(); canvas.rotate(0.0F); Q.setSize(k2, getHeight()); flag1 = false | Q.draw(canvas); canvas.restoreToCount(j2); } if (!R.isFinished()) { int k1 = canvas.save(); int l1 = getWidth() - getPaddingLeft() - getPaddingRight(); int i2 = getHeight(); if (k != null) { i1 = k.getCount(); } canvas.rotate(180F); canvas.translate(-l1 + getPaddingLeft(), -i1 * (i2 + r) + r); R.setSize(l1, i2); flag1 |= R.draw(canvas); canvas.restoreToCount(k1); } } else { Q.finish(); R.finish(); flag1 = false; } if (flag1) { invalidate(); } }
Example 10
Source File: NestedScrollView.java From MyBlogDemo with Apache License 2.0 | 4 votes |
boolean overScrollByCompat(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { final int overScrollMode = ViewCompat.getOverScrollMode(this); final boolean canScrollHorizontal = computeHorizontalScrollRange() > computeHorizontalScrollExtent(); final boolean canScrollVertical = computeVerticalScrollRange() > computeVerticalScrollExtent(); final boolean overScrollHorizontal = overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS || (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollHorizontal); final boolean overScrollVertical = overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS || (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollVertical); int newScrollX = scrollX + deltaX; if (!overScrollHorizontal) { maxOverScrollX = 0; } int newScrollY = scrollY + deltaY; if (!overScrollVertical) { maxOverScrollY = 0; } // Clamp values if at the limits and record final int left = -maxOverScrollX; final int right = maxOverScrollX + scrollRangeX; final int top = -maxOverScrollY; final int bottom = maxOverScrollY + scrollRangeY; boolean clampedX = false; if (newScrollX > right) { newScrollX = right; clampedX = true; } else if (newScrollX < left) { newScrollX = left; clampedX = true; } boolean clampedY = false; if (newScrollY > bottom) { newScrollY = bottom; clampedY = true; } else if (newScrollY < top) { newScrollY = top; clampedY = true; } if (clampedY) { // mScroller.springBack(newScrollX, newScrollY, 0, 0, 0, getScrollRange()); } onOverScrolled(newScrollX, newScrollY, clampedX, clampedY); return clampedX || clampedY; }
Example 11
Source File: LinearLayoutManager2.java From MultiView with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public LinearLayoutManager2(RecyclerView view, int orientation, boolean reverseLayout) { super(view.getContext(), orientation, reverseLayout); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 12
Source File: LinearLayoutManager2.java From MultiView with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public LinearLayoutManager2(RecyclerView view) { super(view.getContext()); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 13
Source File: CustomLinearLayoutManager.java From Loop with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public CustomLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) { super(view.getContext(), orientation, reverseLayout); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 14
Source File: CustomLinearLayoutManager.java From Loop with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public CustomLinearLayoutManager(RecyclerView view) { super(view.getContext()); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 15
Source File: WrapLinearLayoutManager.java From beaconloc with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public WrapLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) { super(view.getContext(), orientation, reverseLayout); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 16
Source File: WrapLinearLayoutManager.java From beaconloc with Apache License 2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public WrapLinearLayoutManager(RecyclerView view) { super(view.getContext()); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 17
Source File: WrappingLinearLayoutManager.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public WrappingLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) { super(view.getContext(), orientation, reverseLayout); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }
Example 18
Source File: WrappingLinearLayoutManager.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("UnusedDeclaration") public WrappingLinearLayoutManager(RecyclerView view) { super(view.getContext()); this.view = view; this.overScrollMode = ViewCompat.getOverScrollMode(view); }