当前位置: 首页>>代码示例>>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;未经允许,请勿转载。