use of android.widget.Scroller in project JustAndroid by chinaltz.
the class AbWheelView method initData.
/**
* Initializes class data.
*
* @param context the context
*/
private void initData(Context context) {
mContext = context;
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context);
}
use of android.widget.Scroller in project SmartAndroidSource by jaychou2012.
the class DragGridViewPager method initDraggableGridViewPager.
private void initDraggableGridViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
setChildrenDrawingOrderEnabled(true);
final Context context = getContext();
final ViewConfiguration configuration = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mGridGap = (int) (DEFAULT_GRID_GAP * density);
// internal paddings
mPaddingLeft = getPaddingLeft();
mPaddingTop = getPaddingTop();
mPaddingRight = getPaddingRight();
mPaddingButtom = getPaddingBottom();
super.setPadding(0, 0, 0, 0);
mScroller = new Scroller(context, sInterpolator);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
mCloseEnough = (int) (CLOSE_ENOUGH * density);
}
use of android.widget.Scroller in project Lazy by l123456789jy.
the class NoPreloadViewPager method initViewPager.
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
float density = context.getResources().getDisplayMetrics().density;
mBaseLineFlingVelocity = 2500.0f * density;
mFlingVelocityInfluence = 0.4f;
}
use of android.widget.Scroller in project SlidingMenu by jfeinstein10.
the class CustomViewAbove method initCustomViewAbove.
void initCustomViewAbove() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
setInternalPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
if (mViewBehind != null) {
switch(position) {
case 0:
case 2:
mViewBehind.setChildrenEnabled(true);
break;
case 1:
mViewBehind.setChildrenEnabled(false);
break;
}
}
}
});
final float density = context.getResources().getDisplayMetrics().density;
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
}
use of android.widget.Scroller in project MyDiary by erttyy8821.
the class PageEffectView method init.
private void init(Context context, Calendar calendar) {
//In the Android 4.2 , LAYER_TYPE_SOFTWARE will cause some question
int year = YearClass.get(context.getApplicationContext());
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1 || year < 2012) {
this.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
//View
setScreen(context);
createBitmaps();
//Set calendar , this object should be created after w,h was set.
calendarFactory = new CalendarFactory(context, calendar, mWidth, mHeight);
//Page effect
mPath0 = new Path();
mPath1 = new Path();
createDrawable();
mPaint = new Paint();
mPaint.setStyle(Paint.Style.FILL);
ColorMatrix cm = new ColorMatrix();
float[] array = { 0.55f, 0, 0, 0, 80.0f, 0, 0.55f, 0, 0, 80.0f, 0, 0, 0.55f, 0, 80.0f, 0, 0, 0, 0.2f, 0 };
cm.set(array);
mColorMatrixFilter = new ColorMatrixColorFilter(cm);
mMatrix = new Matrix();
mScroller = new Scroller(getContext());
// 不让x,y为0,否则在点计算时会有问题
mTouch.x = 0.01f;
mTouch.y = 0.01f;
//Set today text
calendarFactory.onDraw(mCurrentPageCanvas);
}
Aggregations