use of android.widget.Scroller in project Launcher3 by chislon.
the class SmoothPagedView method init.
/**
* Initializes various states for this workspace.
*/
@Override
protected void init() {
super.init();
mScrollMode = getScrollMode();
if (mScrollMode == DEFAULT_MODE) {
mBaseLineFlingVelocity = 2500.0f;
mFlingVelocityInfluence = 0.4f;
mScrollInterpolator = new OvershootInterpolator();
mScroller = new Scroller(getContext(), mScrollInterpolator);
}
}
use of android.widget.Scroller in project UltimateAndroid by cymcsg.
the class PullDoorView method setupView.
@SuppressLint("NewApi")
private void setupView() {
// 这个Interpolator你可以设置别的 我这里选择的是有弹跳效果的Interpolator
Interpolator polator = new BounceInterpolator();
mScroller = new Scroller(mContext, polator);
// 获取屏幕分辨率
WindowManager wm = (WindowManager) (mContext.getSystemService(Context.WINDOW_SERVICE));
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm);
mScreenHeigh = dm.heightPixels;
mScreenWidth = dm.widthPixels;
// 这里你一定要设置成透明背景,不然会影响你看到底层布局
this.setBackgroundColor(Color.argb(0, 0, 0, 0));
mImgView = new ImageView(mContext);
mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// 填充整个屏幕
mImgView.setScaleType(ImageView.ScaleType.FIT_XY);
// 默认背景
mImgView.setImageResource(R.drawable.test);
addView(mImgView);
}
use of android.widget.Scroller in project UltimateAndroid by cymcsg.
the class PullDoorView method setupView.
@SuppressLint("NewApi")
private void setupView() {
Interpolator polator = new BounceInterpolator();
mScroller = new Scroller(mContext, polator);
WindowManager wm = (WindowManager) (mContext.getSystemService(Context.WINDOW_SERVICE));
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm);
mScreenHeigh = dm.heightPixels;
mScreenWidth = dm.widthPixels;
this.setBackgroundColor(Color.argb(0, 0, 0, 0));
mImgView = new ImageView(mContext);
mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mImgView.setScaleType(ImageView.ScaleType.FIT_XY);
mImgView.setImageResource(R.drawable.circle_button_ic_action_tick);
addView(mImgView);
}
use of android.widget.Scroller in project GreenDroid by cyrilmottier.
the class PagedView method initPagedView.
private void initPagedView() {
final Context context = getContext();
mScroller = new Scroller(context, new DecelerateInterpolator());
final ViewConfiguration conf = ViewConfiguration.get(context);
// getScaledPagingTouchSlop() only available in API Level 8
mPagingTouchSlop = conf.getScaledTouchSlop() * 2;
mMaximumVelocity = conf.getScaledMaximumFlingVelocity();
final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
mMinimumVelocity = (int) (metrics.density * MINIMUM_PAGE_CHANGE_VELOCITY + 0.5f);
}
use of android.widget.Scroller in project android-app by eoecn.
the class XListView method initWithContext.
private void initWithContext(Context context) {
mScroller = new Scroller(context, new DecelerateInterpolator());
// XListView need the scroll event, and it will dispatch the event to
// user's listener (as a proxy).
super.setOnScrollListener(this);
// init header view
mHeaderView = new XListViewHeader(context);
mHeaderViewContent = (RelativeLayout) mHeaderView.findViewById(R.id.xlistview_header_content);
mHeaderTimeView = (TextView) mHeaderView.findViewById(R.id.xlistview_header_time);
addHeaderView(mHeaderView);
// init footer view
mFooterView = new XListViewFooter(context);
// init header height
mHeaderView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mHeaderViewHeight = mHeaderViewContent.getHeight();
getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
}
Aggregations