androidx.core.view.NestedScrollingParentHelper Java Examples
The following examples show how to use
androidx.core.view.NestedScrollingParentHelper.
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: PullRefreshLayout.java From QuickDevFramework with Apache License 2.0 | 6 votes |
private void init(Context context, AttributeSet attrs) { mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mDurationToStartPosition = getResources().getInteger(android.R.integer.config_longAnimTime); mDurationToCorrectPosition = getResources().getInteger(android.R.integer.config_longAnimTime); mSpinnerFinalOffset = mTotalDragDistance = dp2px(DEFAULT_MAX_DRAG_DISTANCE); mDecelerateInterpolator = new DecelerateInterpolator(2); setWillNotDraw(false); ViewCompat.setChildrenDrawingOrderEnabled(this, true); setRefreshView(new DefaultRefreshView(context)); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
Example #2
Source File: BothWaySwipeRefreshLayout.java From Mysplash with GNU Lesser General Public License v3.0 | 5 votes |
public BothWaySwipeRefreshLayout(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 DisplayMetrics metrics = getResources().getDisplayMetrics(); mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density); mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density); mDragTriggerDistances[DIRECTION_TOP] = DEFAULT_CIRCLE_TARGET * metrics.density; mDragTriggerDistances[DIRECTION_BOTTOM] = DEFAULT_CIRCLE_TARGET * metrics.density; createProgressView(); setChildrenDrawingOrderEnabled(true); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); mNestedScrollingChildHelper.setNestedScrollingEnabled(true); setNestedScrollingEnabled(true); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); }
Example #3
Source File: CustomSwipeRefreshLayout.java From NewFastFrame with Apache License 2.0 | 4 votes |
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ public CustomSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { // 如果水平方向的偏移量大于竖直方向的偏移量,就消化该事件, return Math.abs(distanceX) > Math.abs(distanceY) || super.onScroll(e1, e2, distanceX, distanceY); } }); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mMediumAnimationDuration = getResources().getInteger( android.R.integer.config_mediumAnimTime); setWillNotDraw(false); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); final DisplayMetrics metrics = getResources().getDisplayMetrics(); if (((IAdaptScreen) getContext()).cancelAdapt()) { mCircleDiameter = (int) (MaterialProgressDrawable.CIRCLE_DIAMETER_LARGE * metrics.density); } else { mCircleDiameter = (int) (MaterialProgressDrawable.CIRCLE_DIAMETER * metrics.density); } createProgressView(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); // the absolute offset has to take into account that the circle starts at an offset mSpinnerOffsetEnd = (int) (DEFAULT_CIRCLE_TARGET * metrics.density); mTotalDragDistance = mSpinnerOffsetEnd; mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); mOriginalOffsetTop = mCurrentTargetOffsetTop = -mCircleDiameter; moveToStart(1.0f); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); }
Example #4
Source File: HomeView.java From android with MIT License | 4 votes |
public HomeView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mHelper = new NestedScrollingParentHelper(this); }
Example #5
Source File: NestedScrollView.java From AndroidAnimationExercise with Apache License 2.0 | 4 votes |
public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initScrollView(); final TypedArray a = context.obtainStyledAttributes( attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0); setFillViewport(a.getBoolean(0, false)); a.recycle(); mParentHelper = new NestedScrollingParentHelper(this); mChildHelper = new NestedScrollingChildHelper(this); // ...because why else would you be using this widget? setNestedScrollingEnabled(true); ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE); }
Example #6
Source File: NestedScrollingParentView.java From zone-sdk with MIT License | 4 votes |
public NestedScrollingParentView(Context context, AttributeSet attrs) { super(context, attrs); setOrientation(LinearLayout.VERTICAL); mScroller = new OverScroller(context); mNestedScrollingParentHelper=new NestedScrollingParentHelper(this); }
Example #7
Source File: BottomSheet.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public ContainerView(Context context) { super(context); nestedScrollingParentHelper = new NestedScrollingParentHelper(this); setWillNotDraw(false); }
Example #8
Source File: BottomSheet.java From Telegram with GNU General Public License v2.0 | 4 votes |
public ContainerView(Context context) { super(context); nestedScrollingParentHelper = new NestedScrollingParentHelper(this); setWillNotDraw(false); }