Search in sources :

Example 11 with OverScroller

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);
}
Also used : ViewConfiguration(android.view.ViewConfiguration) OverScroller(android.widget.OverScroller)

Example 12 with OverScroller

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();
}
Also used : ViewConfiguration(android.view.ViewConfiguration) OverScroller(android.widget.OverScroller)

Example 13 with OverScroller

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();
        }
    });
}
Also used : ViewConfiguration(android.view.ViewConfiguration) FrameLayout(android.widget.FrameLayout) TouchInterceptionFrameLayout(com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout) SlidingTabLayout(com.google.samples.apps.iosched.ui.widget.SlidingTabLayout) OverScroller(android.widget.OverScroller)

Example 14 with OverScroller

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);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) GestureDetector(android.view.GestureDetector) View(android.view.View) OverScroller(android.widget.OverScroller)

Example 15 with OverScroller

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);
}
Also used : TypedArray(android.content.res.TypedArray) OverScroller(android.widget.OverScroller)

Aggregations

OverScroller (android.widget.OverScroller)23 ViewConfiguration (android.view.ViewConfiguration)10 TypedArray (android.content.res.TypedArray)5 GestureDetector (android.view.GestureDetector)5 Handler (android.os.Handler)4 Paint (android.graphics.Paint)2 Rect (android.graphics.Rect)2 GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)2 TextPaint (android.text.TextPaint)2 Scroller (android.widget.Scroller)2 Context (android.content.Context)1 FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)1 ScaleGestureDetector (android.view.ScaleGestureDetector)1 View (android.view.View)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 FrameLayout (android.widget.FrameLayout)1 TouchInterceptionFrameLayout (com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout)1 SlidingTabLayout (com.google.samples.apps.iosched.ui.widget.SlidingTabLayout)1