@Override public int getNestedScrollAxes() { return mNestedParent.getNestedScrollAxes(); }
@Override public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes) { // Reset the counter of how much leftover scroll needs to be consumed. mNestedParent.onNestedScrollAccepted(child, target, axes); // Dispatch up to the nested parent mNestedChild.startNestedScroll(axes & ViewCompat.SCROLL_AXIS_VERTICAL); mTotalUnconsumed = mSpinner;//0; mNestedInProgress = true; interceptAnimatorByAction(MotionEvent.ACTION_DOWN); }
@Override public void onStopNestedScroll(@NonNull View target) { mNestedParent.onStopNestedScroll(target); mNestedInProgress = false; // Finish the spinner for nested scrolling if we ever consumed any // unconsumed nested scroll mTotalUnconsumed = 0; overSpinner(); // Dispatch up our nested parent mNestedChild.stopNestedScroll(); } //</editor-fold>
public RecyclerRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final DisplayMetrics metrics = getResources().getDisplayMetrics(); mRefreshViewSize = (int) (DEFAULT_REFRESH_SIZE_DP * metrics.density); mRefreshTargetOffset = DEFAULT_REFRESH_TARGET_OFFSET_DP * metrics.density; mTargetOrRefreshViewOffsetY = 0.0f; mRefreshInitialOffset = 0.0f; mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); initRefreshView(); initDragDistanceConverter(); setNestedScrollingEnabled(true); ViewCompat.setChildrenDrawingOrderEnabled(this, true); }
private void initAttrs(Context context, AttributeSet attrs) { if (getChildCount() > 1) { throw new RuntimeException("WXSwipeLayout should not have more than one child"); } parentHelper = new NestedScrollingParentHelper(this); if (isInEditMode() && attrs == null) { return; } mRefreshViewBgColor = Color.TRANSPARENT; mProgressBgColor = Color.TRANSPARENT; mProgressColor = Color.RED; }
@Override public void onNestedScrollAccepted(View child, View target, int axes) { // Reset the counter of how much leftover scroll needs to be consumed. mNestedScrollingParentHelper.onNestedScrollAccepted(child, target, axes); // Dispatch up to the nested parent startNestedScroll(axes & ViewCompat.SCROLL_AXIS_VERTICAL); mTotalUnconsumed = 0; mNestedScrollInProgress = true; }
@Override public int getNestedScrollAxes() { return mNestedScrollingParentHelper.getNestedScrollAxes(); }
@Override public void onStopNestedScroll(View target) { mNestedScrollingParentHelper.onStopNestedScroll(target); mNestedScrollInProgress = false; // Finish the spinner for nested scrolling if we ever consumed any // unconsumed nested scroll if (mTotalUnconsumed > 0) { finishSpinner(); mTotalUnconsumed = 0; } // Dispatch up our nested parent stopNestedScroll(); }
/** * Constructor that is called when inflating PullToRefreshLayout from XML. * * @param context * @param attrs */ public PullToRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mMediumAnimationDuration = getResources().getInteger( android.R.integer.config_mediumAnimTime); setWillNotDraw(false); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); final DisplayMetrics metrics = getResources().getDisplayMetrics(); mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density); mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density); createProgressView(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); // the absolute offset has to take into account that the circle starts at an offset mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density; mTotalDragDistance = mSpinnerFinalOffset; mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
@Override public void onNestedScrollAccepted(View child, View target, int axes) { parentHelper.onNestedScrollAccepted(child, target, axes); }
@Override public int getNestedScrollAxes() { return mNestedScrollingParentHelper.getNestedScrollAxes(); }
/** * Callback on TouchEvent.ACTION_CANCLE or TouchEvent.ACTION_UP * handler : refresh or loading * @param child : child view of SwipeLayout,RecyclerView or Scroller */ @Override public void onStopNestedScroll(View child) { parentHelper.onStopNestedScroll(child); handlerAction(); }
private void init(Context context) { mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); }
@Override public void onNestedScrollAccepted(View child, View target, int axes) { // Reset the counter of how much leftover scroll needs to be consumed. mNestedScrollingParentHelper.onNestedScrollAccepted(child, target, axes); // Dispatch up to the nested parent startNestedScroll(axes & ViewCompat.SCROLL_AXIS_VERTICAL); mTotalUnconsumed = 0; mNestedScrollInProgress = true; }
@Override public int getNestedScrollAxes() { return parentHelper.getNestedScrollAxes(); }
@Override public void onStopNestedScroll(View target) { mNestedScrollingParentHelper.onStopNestedScroll(target); mNestedScrollInProgress = false; // Finish the spinner for nested scrolling if we ever consumed any // unconsumed nested scroll if (mTotalUnconsumed > 0) { finishSpinner(mTotalUnconsumed); mTotalUnconsumed = 0; } // Dispatch up our nested parent stopNestedScroll(); }
private void init() { mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); }
@Override public void onNestedScrollAccepted(View child, View target, int nestedScrollAxes) { parentHelper.onNestedScrollAccepted(child, target, nestedScrollAxes); }
@Override public int getNestedScrollAxes() { return parentHelper.getNestedScrollAxes(); } }
@Override public void onStopNestedScroll(View target) { parentHelper.onStopNestedScroll(target); }