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; }
/** * 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); }
private void init(Context context) { mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); }
private void init() { mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); }
private void init() { mParentHelper = new NestedScrollingParentHelper(this); mChildHelper = new NestedScrollingChildHelper(this); }
public TLRNestedLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mCalculator = calculator(); mParentHelper = new NestedScrollingParentHelper(this); ViewCompat.setNestedScrollingEnabled(this, true); }
public HVScrollView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initScrollView(); final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.HVScrollView, defStyleAttr, 0); mChildLayoutCenter = a.getBoolean(R.styleable.HVScrollView_childLayoutCenter, false); mFillViewportH = a.getBoolean(R.styleable.HVScrollView_fillViewportH, false); mFillViewportV = a.getBoolean(R.styleable.HVScrollView_fillViewportV, false); mScrollOrientation = a.getInt(R.styleable.HVScrollView_scrollOrientation, SCROLL_ORIENTATION_BOTH); 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); }
private void initialize() { this.nestedScrollingChildHelper = new NestedScrollingChildHelper(this); this.nestedScrollingParentHelper = new NestedScrollingParentHelper(this); setNestedScrollingEnabled(true); setForceScrolling(false); this.touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); }
public ApptentiveNestedScrollView(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); }
public NestingScrollPlanLayout(Context context, AttributeSet attrs) { super(context, attrs); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.NestingScrollPlanLayout, 0, 0); mHeaderViewId = array.getResourceId(R.styleable.NestingScrollPlanLayout_header_view, 0); mTargetViewId = array.getResourceId(R.styleable.NestingScrollPlanLayout_target_view, 0); mHeaderInitOffset = array.getDimensionPixelSize(R.styleable. EventDispatchPlanLayout_header_init_offset, Util.dp2px(getContext(), 20)); mTargetInitOffset = array.getDimensionPixelSize(R.styleable. EventDispatchPlanLayout_target_init_offset, Util.dp2px(getContext(), 40)); mHeaderCurrentOffset = mHeaderInitOffset; mTargetCurrentOffset = mTargetInitOffset; array.recycle(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mScroller = new Scroller(getContext()); mScroller.setFriction(0.98f); }
public EventResolver(FlingLayout.FlingLayoutContext flingLayoutContext) { this.c = flingLayoutContext; mParentHelper = new NestedScrollingParentHelper(c.getFlingLayout()); mChildHelper = new NestedScrollingChildHelper(c.getFlingLayout()); }
public HeaderRefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); header = new TouchCircleView(getContext()); header.addLoadingListener(this); float density = context.getResources().getDisplayMetrics().density; addView(header, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (density * 130))); }
public SwipeRefreshLayout(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); }
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(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); }
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); }
/** * 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); }
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ 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 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); }
private void init(final Context context, AttributeSet attrs,int defStyleAttr){ mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); setOrientation(VERTICAL); ViewConfiguration config = ViewConfiguration.get(context);