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


Java ScrollerCompat.create方法代碼示例

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


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

示例1: 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

示例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:wheat7,項目名稱:Cashew,代碼行數:29,代碼來源:ViewDragHelper.java

示例3: 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

示例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:dibakarece,項目名稱:DMAudioStreamer,代碼行數:31,代碼來源:ViewDragHelper.java

示例5: 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

示例6: init

import android.support.v4.widget.ScrollerCompat; //導入方法依賴的package包/類
public void init() {
	mGestureListener = new SimpleOnGestureListener() {
		@Override
		public boolean onDown(MotionEvent e) {
			isFling = false;
			return true;
		}

		@Override
		public boolean onFling(MotionEvent e1, MotionEvent e2,
							   float velocityX, float velocityY) {

			if (velocityX > mViewConfiguration.getScaledMinimumFlingVelocity() || velocityY > mViewConfiguration.getScaledMinimumFlingVelocity())
				isFling = true;
			return isFling;
		}
	};
	mGestureDetector = new GestureDetectorCompat(getContext(),
			mGestureListener);

	mCloseScroller = ScrollerCompat.create(getContext());
	mOpenScroller = ScrollerCompat.create(getContext());
}
 
開發者ID:PhongHuynh93,項目名稱:SwipeMenuRecyclerView-master,代碼行數:24,代碼來源:SwipeMenuLayout.java

示例7: 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:justingboy,項目名稱:CouldBooks,代碼行數:31,代碼來源:ViewDragHelper.java

示例8: 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:bestarandyan,項目名稱:ShoppingMall,代碼行數:29,代碼來源:ViewDragHelper.java

示例9: 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:eric-lian,項目名稱:GooglePlay,代碼行數:23,代碼來源:PagerTab.java

示例10: 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:kyze8439690,項目名稱:v2ex-daily-android,代碼行數:29,代碼來源:ViewDragHelper.java

示例11: MenuLayout

import android.support.v4.widget.ScrollerCompat; //導入方法依賴的package包/類
public MenuLayout(View contentView, MenuView menuView) {
			super(contentView.getContext());
			this.mContentView = contentView;
			this.mMenuView = menuView;
			this.mMenuView.setMenuLayout(this);
			setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
//			mGestureDetector = new GestureDetectorCompat(getContext(), mGestureListener);
			LayoutParams contentParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
			mContentView.setLayoutParams(contentParams);
			if (mContentView.getId() < 1) {
				mContentView.setId(CONTENT_VIEW_ID);
			}
			mMenuView.setId(MENU_VIEW_ID);
			mMenuView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
			addView(mContentView);
			addView(mMenuView);
			mShowScroller = ScrollerCompat.create(getContext());
			mHideScroller = ScrollerCompat.create(getContext());
		}
 
開發者ID:Soniy7x,項目名稱:Auie,代碼行數:20,代碼來源:UIListView.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.
 * If the interpolator is null, the default interpolator will be used.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 * @param interpolator interpolator for scroller
 */
private ViewDragHelper(Context context, ViewGroup forParent, Interpolator interpolator, 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, interpolator != null ? interpolator : sInterpolator);
}
 
開發者ID:umano,項目名稱:AndroidSlidingUpPanel,代碼行數:31,代碼來源:ViewDragHelper.java

示例13: init

import android.support.v4.widget.ScrollerCompat; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.InsertAbleGridView, defStyleAttr, R.style.InsertAbleGridViewDefaultStyle);
    mRowCount = a.getInt(R.styleable.InsertAbleGridView_RowCount, 2);
    mColumnCount = a.getInt(R.styleable.InsertAbleGridView_ColumnCount, 2);
    mRowGap = a.getDimensionPixelSize(R.styleable.InsertAbleGridView_RowGap, 10);
    mColumnGap = a.getDimensionPixelSize(R.styleable.InsertAbleGridView_ColumnGap, 10);
    mOutLinePadding = a.getDimensionPixelSize(R.styleable.InsertAbleGridView_OutlinePadding, 10);
    mInnerPadding = a.getDimensionPixelOffset(R.styleable.InsertAbleGridView_InnerPadding, 10);
    mBagDrawable = new BagDrawable(mOutLinePadding);
    mBagDrawable.setOutlineStyle(a.getColor(R.styleable.InsertAbleGridView_OutlineColor, 0), a.getDimensionPixelSize(R.styleable.InsertAbleGridView_OutlineWidth, 3));
    setBackgroundDrawable(mBagDrawable);
    a.recycle();
    mScroller = ScrollerCompat.create(context);
}
 
開發者ID:AlphaBoom,項目名稱:ClassifyView,代碼行數:15,代碼來源:InsertAbleGridView.java

示例14: PieChartTouchHandler

import android.support.v4.widget.ScrollerCompat; //導入方法依賴的package包/類
public PieChartTouchHandler(Context context, PieChartView chart) {
    super(context, chart);
    pieChart = (PieChartView) chart;
    scroller = ScrollerCompat.create(context);
    gestureDetector = new GestureDetector(context, new ChartGestureListener());
    scaleGestureDetector = new ScaleGestureDetector(context, new ChartScaleGestureListener());
    isZoomEnabled = false;// Zoom is not supported by PieChart.
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:PieChartTouchHandler.java

示例15: init

import android.support.v4.widget.ScrollerCompat; //導入方法依賴的package包/類
private void init(Context context){
    mScroller = ScrollerCompat.create(context);
    mMiniVelocityFling = ViewConfiguration.get(getContext()).getScaledMinimumFlingVelocity();
    mScaledTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
    if(mTextSizeNormal == 0) mTextSizeNormal = sp2px(context, DEFAULT_TEXT_SIZE_NORMAL_SP);
    if(mTextSizeSelected == 0) mTextSizeSelected = sp2px(context, DEFAULT_TEXT_SIZE_SELECTED_SP);
    if(mTextSizeHint == 0) mTextSizeHint = sp2px(context, DEFAULT_TEXT_SIZE_HINT_SP);
    if(mMarginStartOfHint == 0) mMarginStartOfHint = dp2px(context, DEFAULT_MARGIN_START_OF_HINT_DP);
    if(mMarginEndOfHint == 0) mMarginEndOfHint = dp2px(context, DEFAULT_MARGIN_END_OF_HINT_DP);

    mPaintDivider.setColor(mDividerColor);
    mPaintDivider.setAntiAlias(true);
    mPaintDivider.setStyle(Paint.Style.STROKE);
    mPaintDivider.setStrokeWidth(mDividerHeight);

    mPaintText.setColor(mTextColorNormal);
    mPaintText.setAntiAlias(true);
    mPaintText.setTextAlign(Align.CENTER);

    mPaintHint.setColor(mTextColorHint);
    mPaintHint.setAntiAlias(true);
    mPaintHint.setTextAlign(Align.CENTER);
    mPaintHint.setTextSize(mTextSizeHint);

    if(mShowCount % 2 == 0){
        mShowCount++;
    }
    if(mMinShowIndex == -1 || mMaxShowIndex == -1){
        updateValueForInit();
    }
    initHandler();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:PickerView.java


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