use of android.widget.OverScroller in project android_frameworks_base by crdroidandroid.
the class NotificationStackScrollLayout method initView.
private void initView(Context context) {
mScroller = new OverScroller(getContext());
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setClipChildren(false);
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = configuration.getScaledTouchSlop();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mOverflingDistance = configuration.getScaledOverflingDistance();
mCollapsedSize = context.getResources().getDimensionPixelSize(R.dimen.notification_min_height);
mBottomStackPeekSize = context.getResources().getDimensionPixelSize(R.dimen.bottom_stack_peek_amount);
mStackScrollAlgorithm.initView(context);
mPaddingBetweenElements = Math.max(1, context.getResources().getDimensionPixelSize(R.dimen.notification_divider_height));
mIncreasedPaddingBetweenElements = context.getResources().getDimensionPixelSize(R.dimen.notification_divider_height_increased);
mBottomStackSlowDownHeight = mStackScrollAlgorithm.getBottomStackSlowDownLength();
mMinTopOverScrollToEscape = getResources().getDimensionPixelSize(R.dimen.min_top_overscroll_to_qs);
}
use of android.widget.OverScroller in project BGARefreshLayout-Android by bingoogolapple.
the class BGAStickyNavLayout method init.
private void init(Context context) {
setOrientation(VERTICAL);
mOverScroller = new OverScroller(context);
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = configuration.getScaledTouchSlop();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
}
use of android.widget.OverScroller in project Android-ObservableScrollView by ksoichiro.
the class FlexibleSpaceWithImageWithViewPagerTab2Activity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flexiblespacewithimagewithviewpagertab2);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ViewCompat.setElevation(findViewById(R.id.header), getResources().getDimension(R.dimen.toolbar_elevation));
mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
mImageView = findViewById(R.id.image);
mOverlayView = findViewById(R.id.overlay);
// Padding for ViewPager must be set outside the ViewPager itself
// because with padding, EdgeEffect of ViewPager become strange.
mFlexibleSpaceHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
mTabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
findViewById(R.id.pager_wrapper).setPadding(0, mFlexibleSpaceHeight, 0, 0);
mTitleView = (TextView) findViewById(R.id.title);
mTitleView.setText(getTitle());
setTitle(null);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
((FrameLayout.LayoutParams) slidingTabLayout.getLayoutParams()).topMargin = mFlexibleSpaceHeight - mTabHeight;
ViewConfiguration vc = ViewConfiguration.get(this);
mSlop = vc.getScaledTouchSlop();
mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
mScroller = new OverScroller(getApplicationContext());
ScrollUtils.addOnGlobalLayoutListener(mInterceptionLayout, new Runnable() {
@Override
public void run() {
// Extra space is required to move mInterceptionLayout when it's scrolled.
// It's better to adjust its height when it's laid out
// than to adjust the height when scroll events (onMoveMotionEvent) occur
// because it causes lagging.
// See #87: https://github.com/ksoichiro/Android-ObservableScrollView/issues/87
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
lp.height = getScreenHeight() + mFlexibleSpaceHeight;
mInterceptionLayout.requestLayout();
updateFlexibleSpace();
}
});
}
use of android.widget.OverScroller in project weiciyuan by qii.
the class SwipeFrameLayout method init.
private void init() {
scroller = new OverScroller(getContext(), new DecelerateInterpolator());
setBackground(ThemeUtility.getDrawable(android.R.attr.windowBackground));
this.activity = (Activity) getContext();
this.topView = ((View) (activity.findViewById(android.R.id.content).getParent()));
this.max_motion_event_down_x_position = Utility.dip2px(25);
this.gestureDetector = new GestureDetector(getContext(), new SwipeRightToCloseOnGestureListener());
this.setId(R.id.swipe_framelayout);
}
use of android.widget.OverScroller in project platform_frameworks_base by android.
the class ActionBarOverlayLayout method init.
private void init(Context context) {
TypedArray ta = getContext().getTheme().obtainStyledAttributes(ATTRS);
mActionBarHeight = ta.getDimensionPixelSize(0, 0);
mWindowContentOverlay = ta.getDrawable(1);
setWillNotDraw(mWindowContentOverlay == null);
ta.recycle();
mIgnoreWindowContentOverlay = context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.KITKAT;
mFlingEstimator = new OverScroller(context);
}
Aggregations