當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrollerCompat類代碼示例

本文整理匯總了Java中android.support.v4.widget.ScrollerCompat的典型用法代碼示例。如果您正苦於以下問題:Java ScrollerCompat類的具體用法?Java ScrollerCompat怎麽用?Java ScrollerCompat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ScrollerCompat類屬於android.support.v4.widget包,在下文中一共展示了ScrollerCompat類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: CustomViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private CustomViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:houshuai0816,項目名稱:DragVideos,代碼行數:29,代碼來源:CustomViewDragHelper.java

示例2: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:29,代碼來源:ViewDragHelper.java

示例3: KDragViewHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private KDragViewHelper(Context context, ViewGroup forParent, android.support.v4.widget.ViewDragHelper.Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:Kaufland,項目名稱:andswipeframework,代碼行數:29,代碼來源:KDragViewHelper.java

示例4: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:29,代碼來源:ViewDragHelper.java

示例5: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context
 *            Context to initialize config-dependent params from
 * @param forParent
 *            Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
	if (forParent == null) {
		throw new IllegalArgumentException("Parent view may not be null");
	}
	if (cb == null) {
		throw new IllegalArgumentException("Callback may not be null");
	}

	mParentView = forParent;
	mCallback = cb;

	final ViewConfiguration vc = ViewConfiguration.get(context);
	final float density = context.getResources().getDisplayMetrics().density;
	mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

	mTouchSlop = vc.getScaledTouchSlop();
	mMaxVelocity = vc.getScaledMaximumFlingVelocity();
	mMinVelocity = vc.getScaledMinimumFlingVelocity();
	mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:dibakarece,項目名稱:DMAudioStreamer,代碼行數:31,代碼來源:ViewDragHelper.java

示例6: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:eventtus,項目名稱:photo-editor-android,代碼行數:29,代碼來源:ViewDragHelper.java

示例7: SlideViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private SlideViewDragHelper(Context context, ViewGroup forParent, SlideViewDragHelper.Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:29,代碼來源:SlideViewDragHelper.java

示例8: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    } else if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    } else {
        this.mParentView = forParent;
        this.mCallback = cb;
        ViewConfiguration vc = ViewConfiguration.get(context);
        this.mEdgeSize = (int) ((20.0f * context.getResources().getDisplayMetrics().density)
                + 0.5f);
        this.mTouchSlop = vc.getScaledTouchSlop();
        this.mMaxVelocity = (float) vc.getScaledMaximumFlingVelocity();
        this.mMinVelocity = (float) vc.getScaledMinimumFlingVelocity();
        this.mScroller = ScrollerCompat.create(context, sInterpolator);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:ViewDragHelper.java

示例9: fling

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
final boolean fling(CoordinatorLayout coordinatorLayout, V layout, int minOffset, int maxOffset, float velocityY) {
    if (this.mFlingRunnable != null) {
        layout.removeCallbacks(this.mFlingRunnable);
        this.mFlingRunnable = null;
    }
    if (this.mScroller == null) {
        this.mScroller = ScrollerCompat.create(layout.getContext());
    }
    this.mScroller.fling(0, getTopAndBottomOffset(), 0, Math.round(velocityY), 0, 0, minOffset, maxOffset);
    if (this.mScroller.computeScrollOffset()) {
        this.mFlingRunnable = new FlingRunnable(coordinatorLayout, layout);
        ViewCompat.postOnAnimation(layout, this.mFlingRunnable);
        return true;
    }
    onFlingFinished(coordinatorLayout, layout);
    return false;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:HeaderBehavior.java

示例10: getLastVelocity

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * 滾動結束後時的速率
 */
public float getLastVelocity() {
    Object mViewFlinger = Reflect.getMember(RecyclerView.class, this, "mViewFlinger");
    Object mScroller = Reflect.getMember(mViewFlinger, "mScroller");
    float currVelocity = 0f;
    if (mScroller instanceof OverScroller) {
        currVelocity = ((OverScroller) mScroller).getCurrVelocity();
    } else if (mScroller instanceof ScrollerCompat) {
        currVelocity = ((ScrollerCompat) mScroller).getCurrVelocity();
    } else {
        throw new IllegalArgumentException("未兼容的mScroller類型:" + mScroller.getClass().getSimpleName());
    }

    if (Float.isNaN(currVelocity)) {
        currVelocity = mLastVelocity;
    } else {
        mLastVelocity = currVelocity;
    }
    return currVelocity;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:23,代碼來源:RRecyclerView.java

示例11: TranslationViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private TranslationViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:Commit451,項目名稱:TranslationViewDragHelper,代碼行數:29,代碼來源:TranslationViewDragHelper.java

示例12: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:zwx191044354,項目名稱:RxZhiHu,代碼行數:29,代碼來源:ViewDragHelper.java

示例13: init

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/** 初始化一些常量 */
private void init() {
	//把一個值從dip轉換成px
	mIndicatorHeight = UIUtils.dip2px(mIndicatorHeight);
	mDividerPadding = UIUtils.dip2px(mDividerPadding);
	mTabPadding = UIUtils.dip2px(mTabPadding);
	mDividerWidth = UIUtils.dip2px(mDividerWidth);
	mTabTextSize = UIUtils.dip2px(mTabTextSize);
	//創建一個scroller
	mScroller = ScrollerCompat.create(mActivity);
	//獲取一個係統關於View的常量配置類
	final ViewConfiguration configuration = ViewConfiguration.get(mActivity);
	//獲取滑動的最小距離
	mTouchSlop = configuration.getScaledTouchSlop();
	//獲取fling的最小速度
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	//獲取fling的最大速度
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

	mLeftEdge = new EdgeEffectCompat(mActivity);
	mRightEdge = new EdgeEffectCompat(mActivity);
}
 
開發者ID:cuilitang,項目名稱:CuiMarket,代碼行數:23,代碼來源:PagerTab.java

示例14: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:pinguo-sunjianfei,項目名稱:Android-Application-ZJB,代碼行數:28,代碼來源:ViewDragHelper.java

示例15: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //導入依賴的package包/類
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 * 
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
開發者ID:LiangMaYong,項目名稱:android-base,代碼行數:29,代碼來源:ViewDragHelper.java


注:本文中的android.support.v4.widget.ScrollerCompat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。