androidx.core.view.NestedScrollingChildHelper Java Examples

The following examples show how to use androidx.core.view.NestedScrollingChildHelper. 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 vote down vote up
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: NestedWebview.java    From SimplicityBrowser with MIT License 6 votes vote down vote up
public NestedWebview(Context context, AppCompatActivity activity, AnimatedProgressBar pBar, final SimpleAutoComplete txt)  {
	super(activity);
       mScrollOffset = new int[2];
       mScrollConsumed = new int[2];
       mChildHelper = new NestedScrollingChildHelper(this);
       setNestedScrollingEnabled(true);
	P_BAR = pBar;
	WEB_ACTIVITY = activity;
	text = txt;
       setWebChromeClient(MainActivity.mWebChromeClient);
       setWebViewClient(new SimplicityWebViewClient(text, WEB_ACTIVITY,this));
       setDownloadListener(MainActivity.mDownloadlistener);
    //setDownloadListener(new CiobanDownloadListener(WEB_ACTIVITY, this));
       setOnLongClickListener(((MainActivity) MainActivity.getMainActivity()).onLongClickListener);
       initializeSettings();
}
 
Example #3
Source File: NestedScrollingChildView.java    From zone-sdk with MIT License 5 votes vote down vote up
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);
}
 
Example #4
Source File: NestedScrollAppBarLayout.java    From Mysplash with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void initialize() {
    this.nestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    this.nestedScrollingChildHelper.setNestedScrollingEnabled(true);

    this.touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setStateListAnimator(
                AnimatorInflater.loadStateListAnimator(getContext(), R.animator.appbar_elevation)
        );
    }
}
 
Example #5
Source File: BothWaySwipeRefreshLayout.java    From Mysplash with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 #6
Source File: NestedScrollingPhotoView.java    From Mysplash with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void init() {
    attacher = new NestedScrollingPhotoViewAttacher(this);
    //We always pose as a Matrix scale type, though we can change to another scale type
    //via the attacher
    super.setScaleType(ScaleType.MATRIX);
    //apply the previously applied scale type
    if (pendingScaleType != null) {
        setScaleType(pendingScaleType);
        pendingScaleType = null;
    }

    nestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    nestedScrollingChildHelper.setNestedScrollingEnabled(true);
}
 
Example #7
Source File: NestedWebview.java    From SimplicityBrowser with MIT License 5 votes vote down vote up
public NestedWebview(Context c, Activity activity){
	super(c);
       mScrollOffset = new int[2];
       mScrollConsumed = new int[2];
       mChildHelper = new NestedScrollingChildHelper(this);
       setNestedScrollingEnabled(true);
	WEB_ACTIVITY = (AppCompatActivity) activity;
}
 
Example #8
Source File: NestedWebview.java    From SimplicityBrowser with MIT License 5 votes vote down vote up
public NestedWebview(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setOverScrollMode(WebView.OVER_SCROLL_NEVER);
    initScrollView();
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #9
Source File: NestedScrollWebView.java    From Hentoid with Apache License 2.0 4 votes vote down vote up
private void init() {
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #10
Source File: NestedWebView.java    From firefox-echo-show with Mozilla Public License 2.0 4 votes vote down vote up
public NestedWebView(Context context, AttributeSet attrs) {
    super(context, attrs);

    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #11
Source File: PrivateWebview.java    From SimplicityBrowser with MIT License 4 votes vote down vote up
public PrivateWebview(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #12
Source File: NestedScrollView.java    From AndroidAnimationExercise with Apache License 2.0 4 votes vote down vote up
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 #13
Source File: NestedGeckoView.java    From focus-android with Mozilla Public License 2.0 4 votes vote down vote up
public NestedGeckoView(Context context, AttributeSet attrs) {
    super(context, attrs);

    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #14
Source File: NestedWebView.java    From focus-android with Mozilla Public License 2.0 4 votes vote down vote up
public NestedWebView(Context context, AttributeSet attrs) {
    super(context, attrs);

    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #15
Source File: NestedRelativeLayout.java    From UIWidget with Apache License 2.0 4 votes vote down vote up
private void init() {
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #16
Source File: NestedFrameLayout.java    From UIWidget with Apache License 2.0 4 votes vote down vote up
private void init() {
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #17
Source File: NestedLinearLayout.java    From UIWidget with Apache License 2.0 4 votes vote down vote up
private void init() {
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #18
Source File: NestedWebView.java    From NestedWebView with MIT License 4 votes vote down vote up
protected void init() {
    ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
    this.touchSlop = viewConfiguration.getScaledTouchSlop();
    this.childHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
Example #19
Source File: CustomSwipeRefreshLayout.java    From NewFastFrame with Apache License 2.0 4 votes vote down vote up
/**
 * 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 #20
Source File: NestedGeckoView.java    From firefox-echo-show with Mozilla Public License 2.0 4 votes vote down vote up
public NestedGeckoView(Context context, AttributeSet attrs, GeckoViewSettings settings) {
    super(context, attrs, settings);

    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}