public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.mTempRect = new Rect(); this.mIsLayoutDirty = true; this.mIsLaidOut = false; this.mChildToScrollTo = null; this.mIsBeingDragged = false; this.mSmoothScrollingEnabled = true; this.mActivePointerId = -1; this.mScrollOffset = new int[2]; this.mScrollConsumed = new int[2]; initScrollView(); TypedArray a = context.obtainStyledAttributes(attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0); setFillViewport(a.getBoolean(0, false)); a.recycle(); this.mParentHelper = new NestedScrollingParentHelper(this); this.mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE); }
public PullToRefreshView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RefreshView); final int type = a.getInteger(R.styleable.RefreshView_type, STYLE_SUN); a.recycle(); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mTotalDragDistance = Utils.convertDpToPixel(context, DRAG_MAX_DISTANCE); mRefreshView = new ImageView(context); setRefreshStyle(type); addView(mRefreshView); setWillNotDraw(false); ViewCompat.setChildrenDrawingOrderEnabled(this, true); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
private void init() { mPullHandler = new ProxyPullHeader(HEADER_FACTORY.made(getContext())); mIsPinContent = HEADER_FACTORY.isPinContent(); if (mIsPinContent) { scrollerHelper = new PinContentScroller(); } else { scrollerHelper = new AllScroller(); } setWillNotDraw(false); addHeadView(); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
public StickyNavigationLayout(Context context, AttributeSet attrs) { super(context, attrs); //setOrientation(LinearLayout.VERTICAL); mGroupStickyDelegate = new GroupStickyDelegate(); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); mScroller = new OverScroller(context); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();//触摸阙值 mMaximumVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity(); mMinimumVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity(); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StickyNavigationLayout); // mCodeSet will set stick view from onFinishInflate. mTopViewId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_top_id, 0); mIndicatorId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_indicator_id, 0); mContentId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_content_id, 0); mAutoFitScroll = a.getBoolean(R.styleable.StickyNavigationLayout_stickyLayout_auto_fit_scroll, false); a.recycle(); //getWindowVisibleDisplayFrame(mExpectTopRect); }
public StickyNavigationLayout_backup(Context context, AttributeSet attrs) { super(context, attrs); //setOrientation(LinearLayout.VERTICAL); mGroupStickyDelegate = new GroupStickyDelegate(); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); mScroller = new OverScroller(context); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();//触摸阙值 mMaximumVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity(); mMinimumVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity(); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StickyNavigationLayout); // mCodeSet will set stick view from onFinishInflate. if(!mCodeSet) { mTopViewId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_top_id, 0); mIndicatorId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_indicator_id, 0); mContentId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_content_id, 0); } mAutoFitScroll = a.getBoolean(R.styleable.StickyNavigationLayout_stickyLayout_auto_fit_scroll, false); mAutoFitPercent = a.getFloat(R.styleable.StickyNavigationLayout_stickyLayout_threshold_percent, 0.5f); a.recycle(); //getWindowVisibleDisplayFrame(mExpectTopRect); }
public NestedScrollView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) { super(paramContext, paramAttributeSet, paramInt); setFocusable(true); setDescendantFocusability(262144); setWillNotDraw(false); ViewConfiguration localViewConfiguration = ViewConfiguration.get(getContext()); this.mTouchSlop = localViewConfiguration.getScaledTouchSlop(); this.mMinimumVelocity = localViewConfiguration.getScaledMinimumFlingVelocity(); this.mMaximumVelocity = localViewConfiguration.getScaledMaximumFlingVelocity(); TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, SCROLLVIEW_STYLEABLE, paramInt, 0); setFillViewport(localTypedArray.getBoolean(0, false)); localTypedArray.recycle(); this.mParentHelper = new NestedScrollingParentHelper(this); this.mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE); }
public SwipeRefreshLayout(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); this.mTouchSlop = ViewConfiguration.get(paramContext).getScaledTouchSlop(); this.mMediumAnimationDuration = getResources().getInteger(17694721); setWillNotDraw(false); this.mDecelerateInterpolator = new DecelerateInterpolator(2.0F); TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, LAYOUT_ATTRS); setEnabled(localTypedArray.getBoolean(0, true)); localTypedArray.recycle(); DisplayMetrics localDisplayMetrics = getResources().getDisplayMetrics(); this.mCircleWidth = ((int)(40.0F * localDisplayMetrics.density)); this.mCircleHeight = ((int)(40.0F * localDisplayMetrics.density)); this.mCircleView = new CircleImageView(getContext()); this.mProgress = new MaterialProgressDrawable(getContext(), this); this.mProgress.setBackgroundColor(-328966); this.mCircleView.setImageDrawable(this.mProgress); this.mCircleView.setVisibility(8); addView(this.mCircleView); ViewCompat.setChildrenDrawingOrderEnabled$4d3af60(this); this.mSpinnerFinalOffset = (64.0F * localDisplayMetrics.density); this.mTotalDragDistance = this.mSpinnerFinalOffset; this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); this.mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
/** */ @SuppressWarnings("deprecation") public AbsRefreshLayout(View listView) { this(listView.getContext()); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); mTargetView = listView; ViewGroup group = (ViewGroup) mTargetView.getParent(); if (group != null) { LayoutParams params = mTargetView.getLayoutParams(); int index = group.indexOfChild(listView); group.removeView(listView); group.addView(this, index, params); } mTargetView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); super.addView(mTargetView); }
/** * @param context * @param attrs * @param defStyleAttr */ private void init(Context context, AttributeSet attrs, int defStyleAttr) { mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); mScroller = new Scroller(context, new DecelerateInterpolator()); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AbsRefreshLayout, defStyleAttr, 0); final int N = a.getIndexCount(); int resFooter = R.layout.layout_loadmore; for (int i = 0; i < N; i++) { int attr = a.getIndex(i); if (attr == R.styleable.AbsRefreshLayout_footerNestLayout) { resFooter = a.getResourceId(attr, resFooter); break; } } a.recycle(); /** * Convert values in dp to values in px; */ setFooterView(inflate(context, resFooter, null)); }
public NestedScrollView(Context context, AttributeSet attributeset, int i) { super(context, attributeset, i); mTempRect = new Rect(); mIsLayoutDirty = true; mIsLaidOut = false; mChildToScrollTo = null; mIsBeingDragged = false; mSmoothScrollingEnabled = true; mActivePointerId = -1; mScrollOffset = new int[2]; mScrollConsumed = new int[2]; initScrollView(); context = context.obtainStyledAttributes(attributeset, SCROLLVIEW_STYLEABLE, i, 0); setFillViewport(context.getBoolean(0, false)); context.recycle(); mParentHelper = new NestedScrollingParentHelper(this); mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE); }
public TwinklingRefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwinklingRefreshLayout, defStyleAttr, 0); try { mMaxHeadHeight = a.getDimensionPixelSize(R.styleable.TwinklingRefreshLayout_tr_max_head_height, (int) DensityUtil.dp2px(context, 120)); mHeadHeight = a.getDimensionPixelSize(R.styleable.TwinklingRefreshLayout_tr_head_height, (int) DensityUtil.dp2px(context, 80)); mMaxBottomHeight = a.getDimensionPixelSize(R.styleable.TwinklingRefreshLayout_tr_max_bottom_height, (int) DensityUtil.dp2px(context, 120)); mBottomHeight = a.getDimensionPixelSize(R.styleable.TwinklingRefreshLayout_tr_bottom_height, (int) DensityUtil.dp2px(context, 60)); mOverScrollHeight = a.getDimensionPixelSize(R.styleable.TwinklingRefreshLayout_tr_overscroll_height, (int) mHeadHeight); enableRefresh = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_enable_refresh, true); enableLoadmore = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_enable_loadmore, true); isPureScrollModeOn = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_pureScrollMode_on, false); isOverScrollTopShow = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_overscroll_top_show, true); isOverScrollBottomShow = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_overscroll_bottom_show, true); enableOverScroll = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_enable_overscroll, true); floatRefresh = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_floatRefresh, false); autoLoadMore = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_autoLoadMore, false); enableKeepIView = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_enable_keepIView, true); showRefreshingWhenOverScroll = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_showRefreshingWhenOverScroll, true); showLoadingWhenOverScroll = a.getBoolean(R.styleable.TwinklingRefreshLayout_tr_showLoadingWhenOverScroll, true); } finally { a.recycle(); } cp = new CoContext(); addHeader(); addFooter(); setFloatRefresh(floatRefresh); setAutoLoadMore(autoLoadMore); setEnableRefresh(enableRefresh); setEnableLoadmore(enableLoadmore); mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
private void init() { setWillNotDraw(false); startScrollerTask(); setOverScrollMode(View.OVER_SCROLL_NEVER); childHelper = new NestedScrollingChildHelper(this); childHelper.setNestedScrollingEnabled(true); }
/** * Constructor that is called when inflating ISwipeRefreshLayout from XML. * * @param context * @param attrs */ public ISwipeRefreshLayout(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(); mRefreshViewHeight = (int) (DEFAULT_HEADER_HEIGHT * metrics.density); HEADER_VIEW_MIN_HEIGHT = mRefreshViewHeight; ViewCompat.setChildrenDrawingOrderEnabled(this, true); mTotalDragDistance = (int) (DEFAULT_HEADER_TARGET * metrics.density); 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(); //add default refreshview setRefreshHeaderView(new ClassicIRefreshHeaderView(getContext())); }
public NestedWebView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOverScrollMode(WebView.OVER_SCROLL_NEVER); initScrollView(); mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
private void i() { helper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); // Add a dummy view that will receive inner touch events. View dummyView = new View(getContext()); dummyBehavior = new DummyBehavior(); // I *think* this is needed for dummyView to be identified as "topmost" and receive events // before any other view. ViewCompat.setElevation(dummyView, ViewCompat.getElevation(this)); // Make sure it does not fit windows, or it will consume insets before the AppBarLayout. ViewCompat.setFitsSystemWindows(dummyView, false); LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.setBehavior(dummyBehavior); addView(dummyView, params); }
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ public SwipeRefreshLayout(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(); mCircleDiameter = (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 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(); }
private void init() { mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); mScroller = new Scroller(getContext(), new DecelerateInterpolator()); ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mRefreshContainer.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM); mDefaultScrollUpProcessor = new DefaultScrollUpProcessor(); addRefreshStateListener(mRefreshStateWatcher); }
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ public DistRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); 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(); // the absolute offset has to take into account that the circle starts at an offset // mSpinnerFinalOffset = mTotalDragDistance = DEFAULT_REFRESH_TARGET * metrics.density; createProgressView(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
public NestedWebView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); }
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. */ public SwipeRefreshLayout(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); }
public NestedWebView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mChildHelper = new NestedScrollingChildHelper(this); ViewConfiguration viewConfiguration = ViewConfiguration.get(this.getContext()); this.mMinimumVelocity = viewConfiguration.getScaledMinimumFlingVelocity(); this.mMaximumVelocity = viewConfiguration.getScaledMaximumFlingVelocity(); this.touchSlop = viewConfiguration.getScaledTouchSlop(); this.density = this.getResources().getDisplayMetrics().density; this.setOverScrollMode(OVER_SCROLL_NEVER); //setNestedScrollingEnabled(true); }
private void init() { this.mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); ViewConfiguration configuration = ViewConfiguration.get(getContext()); this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); this.mTouchSlop = configuration.getScaledTouchSlop(); this.directionDetector = new DirectionDetector(); this.density = getScale(); setOverScrollMode(View.OVER_SCROLL_NEVER); this.settings = getSettings(); // addJavascriptInterface(new JSGetContentHeight(), "InjectedObject"); Log.i(TAG, "max -- min Velocity = " + this.mMaximumVelocity + " -- " + this.mMinimumVelocity + " touchSlop = " + this.mTouchSlop); }
public NWebView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); ViewConfiguration configuration = ViewConfiguration.get(getContext()); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mTouchSlop = configuration.getScaledTouchSlop(); directionDetector = new DirectionDetector(); density = getScale(); // setOverScrollMode(View.OVER_SCROLL_NEVER); }
public CodeWebView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); listView = ButterKnife.findById(view, android.R.id.list); if (listView != null) { listView.setOnTouchListener(new ScrollListener(getActivity())); nestedScrollingChildHelper = new NestedScrollingChildHelper(listView); nestedScrollingChildHelper.setNestedScrollingEnabled(true); } }
private void initialize() { this.nestedScrollingChildHelper = new NestedScrollingChildHelper(this); this.nestedScrollingParentHelper = new NestedScrollingParentHelper(this); setNestedScrollingEnabled(true); setForceScrolling(false); this.touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); }
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(); }
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ public SwipeRefreshPlusLayout(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(); createLoadMoreProgressView(); 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 RefreshLayout(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); mAccelerateInterpolator = new AccelerateInterpolator(ACCELERATE_INTERPOLATION_FACTOR); final DisplayMetrics metrics = getResources().getDisplayMetrics(); mCircleDiameter = (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 mHeaderSpinnerOffsetEnd = (int) (DEFAULT_CIRCLE_TARGET * metrics.density); mHeaderTotalDragDistance = mHeaderSpinnerOffsetEnd; mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); mHeaderOriginalOffsetTop = mHeaderCurrentTargetOffsetTop = -mCircleDiameter; moveToStart(1.0f); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); mProgressBar = new SwipeProgressBar(this); mProgressBarHeight = (int) (metrics.density * PROGRESS_BAR_HEIGHT); }
public NestedScrollingChildView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOrientation(LinearLayout.VERTICAL); mScroller = new OverScroller(context); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); mDetector = new GestureDetectorCompat(context, this); //todo 1 setNestedScrollingEnabled(true); }
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 * 120))); }