Coder Social home page Coder Social logo

everythingme / overscroll-decor Goto Github PK

View Code? Open in Web Editor NEW
2.8K 76.0 397.0 3.3 MB

Android: iOS-like over-scrolling effect applicable over almost all scrollable Android views.

License: BSD 2-Clause "Simplified" License

Java 100.00%
overscroll android ios fling recyclerview viewpager listview gridview scrollview

overscroll-decor's Introduction

Announcement

An update regarding Bintray's shutdown: The library has been successfuly republished onto maven central, but with a different Group ID; Please update your Gradle dependencies as follows:

-implementation 'me.everything:overscroll-decor-android:1.1.0'
+implementation 'io.github.everythingme:overscroll-decor-android:1.1.1'

Over-Scroll Support For Android's RecyclerView, ListView, GridView, ScrollView ...

The library provides an iOS-like over-scrolling effect applicable over almost all Android native scrollable views. It is also built to allow for very easy adaptation to support custom views.

The core effect classes are loose-decorators of Android views, and are thus decoupled from the actual view classes' implementations. That allows developers to apply the effect over views while keeping them as untampered 'black-boxes'. Namely, it allows for keeping important optimizations such as view-recycling intact.

RecyclerView demo

Gradle Dependency

Add the following to your module's build.gradle file:

dependencies {
    // ...
    
    implementation 'io.github.everythingme:overscroll-decor-android:1.1.1'
}

Usage

RecyclerView

Supports both linear and staggered-grid layout managers (i.e. all native Android layouts). Can be easily adapted to support custom layout managers.

RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    
// Horizontal
OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);
// Vertical
OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

RecyclerView with items swiping / dragging

See Advanced Usage.

ListView

ListView listView = (ListView) findViewById(R.id.list_view);
OverScrollDecoratorHelper.setUpOverScroll(listView);

GridView

GridView gridView = (GridView) findViewById(R.id.grid_view);
OverScrollDecoratorHelper.setUpOverScroll(gridView);

ViewPager

ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
OverScrollDecoratorHelper.setUpOverScroll(viewPager);

ScrollView, HorizontalScrollView

ScrollView scrollView = (ScrollView) findViewById(R.id.scroll_view);
OverScrollDecoratorHelper.setUpOverScroll(scrollView);
    
HorizontalScrollView horizontalScrollView = (HorizontalScrollView) findViewById(R.id.horizontal_scroll_view);
OverScrollDecoratorHelper.setUpOverScroll(horizontalScrollView);

Any View - Text, Image... (Always Over-Scroll Ready)

View view = findViewById(R.id.demo_view);
    
// Horizontal
OverScrollDecoratorHelper.setUpStaticOverScroll(view, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);
// Vertical
OverScrollDecoratorHelper.setUpStaticOverScroll(view, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

Advanced Usage

// Horizontal RecyclerView
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
new HorizontalOverScrollBounceEffectDecorator(new RecyclerViewOverScrollDecorAdapter(recyclerView));

// ListView (vertical)
ListView listView = (ListView) findViewById(R.id.list_view);
new VerticalOverScrollBounceEffectDecorator(new AbsListViewOverScrollDecorAdapter(listView));

// GridView (vertical)
GridView gridView = (GridView) findViewById(R.id.grid_view);
new VerticalOverScrollBounceEffectDecorator(new AbsListViewOverScrollDecorAdapter(gridView));

// ViewPager
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
new HorizontalOverScrollBounceEffectDecorator(new ViewPagerOverScrollDecorAdapter(viewPager));

// A simple TextView - horizontal
View textView = findViewById(R.id.title);
new HorizontalOverScrollBounceEffectDecorator(new StaticOverScrollDecorAdapter(view));

RecyclerView with ItemTouchHelper based swiping / dragging

As of version 1.0.1, the effect can work smoothly with the RecyclerView's built-in mechanism for items swiping and dragging (based on ItemTouchHelper). BUT, it requires some (very little) explicit configuration work:

// Normally you would attach an ItemTouchHelper & a callback to a RecyclerView, this way:
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
ItemTouchHelper.Callback myCallback = new ItemTouchHelper.Callback() {
	...
};
ItemTouchHelper myHelper = new ItemTouchHelper(myCallback);
myHelper.attachToRecyclerView(recyclerView);

// INSTEAD of attaching the helper yourself, simply use the dedicated adapter c'tor, e.g.:
new VerticalOverScrollBounceEffectDecorator(new RecyclerViewOverScrollDecorAdapter(recyclerView, myCallback));

For more info on the swiping / dragging mechanism, try this useful tutorial.

Over-Scroll Listeners

As of version 1.0.2, the effect provides a means for registering listeners of over-scroll related events. There are two types of listeners, as follows.

State-Change Listener

The over-scroll manager dispatches events onto a state-change listener denoting transitions in the effect's state:

// Note: over-scroll is set-up using the helper method.
IOverScrollDecor decor = OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);

decor.setOverScrollStateListener(new IOverScrollStateListener() {
    @Override
	public void onOverScrollStateChange(IOverScrollDecor decor, int oldState, int newState) {
	    switch (newState) {
	        case STATE_IDLE:
	            // No over-scroll is in effect.
	            break;
	        case STATE_DRAG_START_SIDE:
	            // Dragging started at the left-end.
	            break;
	        case STATE_DRAG_END_SIDE:
	            // Dragging started at the right-end.
	            break;
	        case STATE_BOUNCE_BACK:
	            if (oldState == STATE_DRAG_START_SIDE) {
	                // Dragging stopped -- view is starting to bounce back from the *left-end* onto natural position.
	            } else { // i.e. (oldState == STATE_DRAG_END_SIDE)
	                // View is starting to bounce back from the *right-end*.
	            }
	            break;
	    }
	}
}

Real-time Updates Listener

The over-scroll manager can also dispatch real-time, as-it-happens over-scroll events denoting the current offset resulting due to an over-scroll being in-effect (the offset thus denotes the current 'intensity').

// Note: over-scroll is set-up by explicity instantiating a decorator rather than using the helper; The two methods can be used interchangeably for registering listeners.
VerticalOverScrollBounceEffectDecorator decor = new VerticalOverScrollBounceEffectDecorator(new RecyclerViewOverScrollDecorAdapter(recyclerView, itemTouchHelperCallback));

decor.setOverScrollUpdateListener(new IOverScrollUpdateListener() {
    @Override
    public void onOverScrollUpdate(IOverScrollDecor decor, int state, float offset) {
    	final View view = decor.getView();
    	if (offset > 0) {
    		// 'view' is currently being over-scrolled from the top.
    	} else if (offset < 0) {
    		// 'view' is currently being over-scrolled from the bottom.
    	} else {
    		// No over-scroll is in-effect.
    		// This is synonymous with having (state == STATE_IDLE).
    	}
    }
});

The two type of listeners can be used either separately or in conjunction, depending on your needs. Refer to the demo project's RecyclerView-demo section for actual concrete usage.

Custom Views

public class CustomView extends View {
    // ...
}
    
final CustomView view = (CustomView) findViewById(R.id.custom_view);
new VerticalOverScrollBounceEffectDecorator(new IOverScrollDecoratorAdapter() {

    @Override
    public View getView() {
        return view;
    }

    @Override
    public boolean isInAbsoluteStart() {
	    // canScrollUp() is an example of a method you must implement
        return !view.canScrollUp();
    }

    @Override
    public boolean isInAbsoluteEnd() {
	     // canScrollDown() is an example of a method you must implement
        return !view.canScrollDown();
    }
});

Effect Behavior Configuration

/// Make over-scroll applied over a list-view feel more 'stiff'
new VerticalOverScrollBounceEffectDecorator(new AbsListViewOverScrollDecorAdapter(view),
        5f, // Default is 3
        VerticalOverScrollBounceEffectDecorator.DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK,
        VerticalOverScrollBounceEffectDecorator.DEFAULT_DECELERATE_FACTOR);
                
// Make over-scroll applied over a list-view bounce-back more softly
new VerticalOverScrollBounceEffectDecorator(new AbsListViewOverScrollDecorAdapter(view),
        VerticalOverScrollBounceEffectDecorator.DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD,
        VerticalOverScrollBounceEffectDecorator.DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK,
        -1f // Default is -2
        );

Dynamic Effect Disabling

As of version 1.0.4, the effect can be dynamically disabled (detached) and reenabled (attached) at runtime:

IOverScrollDecor decor = OverScrollDecoratorHelper.setUpOverScroll(view);

// Detach. You are strongly encouraged to only call this when overscroll isn't
// in-effect: Either add getCurrentState()==STATE_IDLE as a precondition,
// or use a state-change listener.
decor.detach();
// Attach.
decor.attach();

attach() and detach() can be used repeatedly - as necessary, as can be seen in the demo project (refer to action-bar menu in recycler-view demo).

Credits

App icons by P.J. Onori, Timothy Miller, Icons4Android, Icons8.com

overscroll-decor's People

Contributors

amiteverythingme avatar brucetoo avatar d4vidi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

overscroll-decor's Issues

need help for ParallaxScollListView to apply decor view

Am using ParallaxScollListView as parent view and inside many views are rendering based on index position.
index 0> images
index 1> Viewpager
index 2 > viewpager
index 3> recyclerview with NestedScrollView as parent.

finally i need to apply Decor view at bottom of screen or end of recycler view ending. need offset value whether how much user has dragged & has to pull up easily.

i have applied like 3 ways , but no use.

IOverScrollDecor decor = OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL); - tried adding for recyclerview , not helped

final IOverScrollDecor decor = new VerticalOverScrollBounceEffectDecorator(new NestedScrollViewOverScrollDecorAdapter(nestedScrollView )); - tried adding for NestedScrollView

final IOverScrollDecor decor = OverScrollDecoratorHelper.setUpOverScroll(mParallaxScollListView); - tried adding for parallaxScrollView

Any help please...

SwipeToRefreshLayout and overscroll of RecyclerView

If RecyclerView is nested to SwipeToRefreshLayout and has Overscroll applied to it, then swipe-to-refresh does not work at all, though overscroll is working. Is it possible to have both swipe-to-refresh and overscroll enabled simultaneously?

Overscroll effect not smooth as IOS

I have implement this project in my project. this is working in it. but gettng some issue with that. I have found Overscroll effect not smooth as IOS. and when I scroll listview at bottom overscroll then it top part comes over other view so its look like overlap view

how to use ORIENTATION_VERTICAL in android.support.v4.widget.NestedScrollView

i using vertical animation for recyclerView with this code :
OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_profile">

<android.support.v7.widget.RecyclerView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layoutManager="LinearLayoutManager" />

</android.support.v4.widget.NestedScrollView>

but nestedScrollView dosent work :(

Scrolling is tight on a few devices such as LG G Stylo

I find that in class MotionAttributes,
MotionEvent.getHistoricalX/Y(0,0) was not the last point .
It is closer to current point.
For example:
First event: getY(0) is 15f.
Second event: getY(0)is 20f but event.getHistoricalY(0,0) is 18f
On LG G Stylo , scroll distance is only about 1/4 of other devices'.

Overscroll effect does not work on ViewPager last page

Hi,

Thank you for adding overscroll to viewpager.
I am having the issue with viewpager, that on the last page overscroll does not happen. Please can you help? I am trying to scroll from right to left and hopping to see an overscroll effect the right side of the last page.
Thank you.

Scrollview inside viewpager issue

When i slide up and down at the same time, scrollview and viewpager are not sliding at same time. Only one of them is sliding.

Sorry for my bad English.

Listener isn't working

Hello, I'm using your code from README, but your listeners doesn't work. It doesn't resolve method setOverScrollUpdateListener on decorator class. Can you help me please?

a problem

In the list, slide the time, especially easy to click events (my list is nested in frament+fragment)

Custom layout managers

I am trying to use your library on my recycler view. I use a default GridLayoutManager however, I get the error

Recycler views with custom layout managers are not supported by this adapter out of the box

How can I solve this error?

OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

    layoutManager = new GridLayoutManager(this, spanCount, GridLayoutManager.VERTICAL, false);
    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            //stagger rows custom
            //return (position == 0 ? 2 : 1);
            return (position % 3 == 0 ? 1 : 1);
        }
    });


    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(layoutManager);

Heads up

Just to give you a heads up, and I may not be correct or 100 percent accurate. I believe this design pattern (and possibly the code) may be infringing on apples scroll patent. I would do some research and make sure that this is legal. Infringing on apples over-scroll patent. I would do some research and make sure that this is legal. If it is not or you are not sure, you should notify the users before they implement it within their project. I hope it is legal. Cheers.

why is my recyclerview doesnt overscroll when fast scrolling to top or bottom?

i do see the bounce effect if i hit the top or bottom then keep scrolling.

but let's say if i try to scroll to top from the middle of the list. my recyclerview stops when it hits the first item. it doesnt do the overscroll effect. if i try to scroll more, then i see the effect.

it's like scrolling fast to the top but suddenly stopped.
is it by design? or i missed anything?

all I did was just

new VerticalOverScrollBounceEffectDecorator(new RecyclerViewOverScrollDecorAdapter(recyclerView, callback));

unexpected long press event

Hi

I'm trying to use the decorator with a RecyclerView. If I fling twice quickly an unexpected long press event is dispatched:

04-25 11:28:29.516 25881-25881/me.everything.overscrolldemo D/anagaf: drag start java.lang.Throwable
                                                                          at me.everything.overscrolldemo.view.RecyclerViewDemoFragment$1.onSelectedChanged(RecyclerViewDemoFragment.java:72)
                                                                          at me.everything.android.ui.overscroll.adapters.RecyclerViewOverScrollDecorAdapter$ItemTouchHelperCallbackWrapper.onSelectedChanged(RecyclerViewOverScrollDecorAdapter.java:213)
                                                                          at me.everything.android.ui.overscroll.adapters.RecyclerViewOverScrollDecorAdapter$1.onSelectedChanged(RecyclerViewOverScrollDecorAdapter.java:73)
                                                                          at android.support.v7.widget.helper.ItemTouchHelper.select(ItemTouchHelper.java:669)
                                                                          at android.support.v7.widget.helper.ItemTouchHelper.access$800(ItemTouchHelper.java:76)
                                                                          at android.support.v7.widget.helper.ItemTouchHelper$ItemTouchHelperGestureListener.onLongPress(ItemTouchHelper.java:2289)
                                                                          at android.view.GestureDetector.dispatchLongPress(GestureDetector.java:770)
                                                                          at android.view.GestureDetector.-wrap0(GestureDetector.java)
                                                                          at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:293)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

I suppose it's because BounceBackState#handleUpOrCancelTouchEvent() and OverScrollingState#handleUpOrCancelTouchEvent() always return true. If touch up event happens during the animation it's missed so the next touch up event is treated as a long press.

It is possible to change these methods to return false?

Thanks,
Andrey

Real Pixel Offset

Is it possible to get the real pixel Offset so I can get a layout view to fallow the drag/scroll?

mVertOverScrollEffect = OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

        mVertOverScrollEffect.setOverScrollUpdateListener(new IOverScrollUpdateListener() {
            @Override
            public void onOverScrollUpdate(IOverScrollDecor decor, int state, float offset) {

                Toast.makeText(getApplicationContext(), "Offset Pixels " + (int) offset,Toast.LENGTH_LONG).show();

                RelativeLayout.LayoutParams params= new RelativeLayout.LayoutParams(screenWidth,(int) offset);
                params.addRule(RelativeLayout.BELOW, R.id.header);
                firstCellLayout.setLayoutParams(params);
            }
        });

EverythingMe/overscroll-decor is bug with google CollapsingToolbar

EverythingMe/overscroll-decor is bug with google CollapsingToolbar

on the first item of recyclerview there is a bug when i pull up on Collapsing IDLE mode (a half on tool bar) for hide toolbar and while the appbar is half I pull down, I can't pull the appbar show because bouncy effect is working.

how to fix it or how to disable bouncy effect I try to recyclerview.setOverScrollMode(View.NAVER) is not work. do you have solution I like you library but i want to know how to disable

Overscroll on a view gets stuck

When you move the view at rather fast speeds, up and down, with only 1 direction of overscroll, the idle position of the view changes.
In my case, I'm allowing a card view to scroll only downward. If I move it too much, randomly, it's rest position becomes lower position. This can be performed many times, making the view stop at lower and lower positions. There is no way to revert this, only by resetting the layout.

Edit: This issue is also happening randomly, with the view getting stuck for no reason, when I swipe at a normal speed (i can then overscroll it as usual, but the view is displaced for the original position).

ViewPager?

Can you ever plan to be compatible support VIewPager?

ViewPager OverScroll effect works on first element but not when moved to last element and back to first

A strange one. I have a ViewPager with 3 TextViews. The ViewPager moves between these three textviews but the width is such that you can see a preview of the next word. Each word is a different length.

The OverScroll works on the first element when scrolling to the left. If the user goes to the end of the ViewPager, the Overscroll works fine on the final element. But when returning to the first element, the overscroll no longer works. The ViewPager just won't scroll to the left anymore, as per normal ViewPager behaviour.

This does not happen when there are two elements. Only three elements.

I can confirm that this does not happen when I am not overriding getPageWidth() in the Adapter. How would I go about supporting this? The TextView is off the screen and destroyItem() is not being called even with setOffscreenPageLimit(0).

Here's the source code for that method:

        public float getPageWidth(int position)
        {
            if (position != 2)
            {
                viewHolders.get(position).fontText.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
                int deviceWidth = getResources().getDisplayMetrics().widthPixels;
                int textViewWidth = viewHolders.get(position).fontText.getMeasuredWidth();
                viewWidth = deviceWidth - textViewWidth;
                float widthPercentageWithoutMultiplication = ((float) viewWidth / deviceWidth);
                return 1 - widthPercentageWithoutMultiplication;
            }
            else
            {
                return super.getPageWidth(position);
            }
        }

The length in characters for the words is: 5, 9, 8. It's possible that having a very short first element, and therefore very short page width, is causing this issue?

Overscrolling not working

Sometime for some scrollview layouts or Recyclerview when we scroll to bottom overscroll not works from bottom. Overscroll from top of the view works well in every scenario.

Back press programmatically is not working

Below is my code inside fragment. I want to go back when overscroll threshold reaches 60. But it is getting count of backstack 0 and goes out of the Application. I am having only single fragment in before this.

Below code is written in second fragment which is added in backstack.

final MainActivity activity = (MainActivity) getActivity();

IOverScrollDecor decor = OverScrollDecoratorHelper.setUpOverScroll(mScrollView);
decor.setOverScrollUpdateListener(new IOverScrollUpdateListener() {
@OverRide
public void onOverScrollUpdate(IOverScrollDecor decor, int state, float offset) {
if (((int) offset) > 60) {
activity.onBackPressed();
}
}
});

Feature request: overscroll listener

It'd be great to have some kind of onOverScrolled(float) listener, which accurately calls the overscroll amount whenever it occurs.

I've currently hooked into translateView(), but this does not get called when the view is settling back into place. Hooking into the settling animation doesn't seem possible externally.

My use case: having views react to a RecyclerView's overscroll and transform in various ways, and reverse these transformations when the overscroll touch is released. I'm sure there are many others :)

a suggestion

your design is nice for my android app,but with the overscroll animation,i can't set my own loading gif logo,and can't find a chance to pull new data.

when scrollview's measure hight cannot fill whole screen, overscroll on textview or other widget not woking.

step
1, fill layout xml using several linelayout, including in one linearlayout, wrapped by a scrollview;
2, but layout's height doesn't fill whole screen;
3, touch finger over linearlayout or other widget(space between widgets is woking well);
4, cannot scroll this UI;

Following code is a layout, when it appeared on the screen, all widgets cannot fill full screen height, so put your finger on "actionChangePassword", the view cannot scrolled.

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPageBackground"
    android:fitsSystemWindows="true"
    >

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none"
        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="?attr/actionBarSize"
            android:paddingBottom="48dip"
            android:orientation="vertical"
            >

            <RelativeLayout
                android:id="@+id/actionChangePassword"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/bg_action_item"
                android:layout_marginTop="20dip"
                >

                <TextView
                    style="@style/styleMoreSettingsActionItemTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="?attr/actionBarSize"
                    android:layout_toRightOf="@id/vIconMobilePhone"
                    android:text="@string/title_btn_change_password"
                    />

                <View
                    style="@style/styleActionItemArrowRight"
                    android:layout_width="16dip"
                    android:layout_height="16dip"
                    />

                <View
                    style="@style/styleActionItemUnderline"
                    android:layout_width="match_parent"
                    android:layout_height="1px"
                    />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/actionClearCache"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/bg_action_item"
                >

                <TextView
                    style="@style/styleMoreSettingsActionItemTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="?attr/actionBarSize"
                    android:text="@string/title_btn_clear_cache"
                    />

                <View
                    style="@style/styleActionItemArrowRight"
                    android:layout_width="16dip"
                    android:layout_height="16dip"
                    />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/actionNotificationCenter"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="32dip"
                android:background="@drawable/bg_action_item"
                >

                <TextView
                    style="@style/styleMoreSettingsActionItemTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="?attr/actionBarSize"
                    android:layout_toRightOf="@id/vIconMobilePhone"
                    android:text="@string/title_btn_notification_center"
                    />

                <View
                    style="@style/styleActionItemArrowRight"
                    android:layout_width="16dip"
                    android:layout_height="16dip"
                    />

                <View
                    style="@style/styleActionItemUnderline"
                    android:layout_width="match_parent"
                    android:layout_height="1px"
                    />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/actionChangeFontSize"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/bg_action_item"
                >

                <TextView
                    style="@style/styleMoreSettingsActionItemTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="?attr/actionBarSize"
                    android:text="@string/title_change_font_size"
                    />

                <View
                    style="@style/styleActionItemArrowRight"
                    android:layout_width="16dip"
                    android:layout_height="16dip"
                    />
            </RelativeLayout>
        </LinearLayout>
    </ScrollView>
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@drawable/bg_tool_bar"
        android:minHeight="?attr/actionBarSize"
        app:contentInsetLeft="0dp"
        app:contentInsetStart="0dp"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@android:color/transparent"
            >

            <TextView
                android:id="@+id/tbTitle"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignBaseline="@+id/tbLeftBtn"
                android:gravity="center"
                android:text="@string/title_activity_more_settings"
                android:textColor="@color/colorMainText"
                android:textSize="@dimen/font_size_large"
                />

            <ImageView
                android:id="@+id/tbLeftBtn"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:scaleType="center"
                android:src="@drawable/ic_arrow_left"
                />

        </RelativeLayout>
    </android.support.v7.widget.Toolbar>


</RelativeLayout>

Glow Effect

Is it possible to add somehow edge glow color?

Not registering onClick in RecyclerView

Using the VerticalOverScrollBounceEffectDecorator on a RecyclerView causes the first touch over the overscroll to be ignored.

Reproduce steps:

  • Swipe to overscroll (couple times)
  • Tap the first item in the recyclerview
  • No onclick is notified.

When debugging, it seems like the onTouchListener of the Recyclerview in the OverScrollBounceEffectDecoratorBase is called. This calls the UP on the IdleState and returns false.

But in a normal usecase, the onTouchListener shouldn't be called when a item is clicked.
So it seems like the first touch after the overscroll goes to the children instead of the RecyclerView items.

Currently using:
new VerticalOverScrollBounceEffectDecorator(new RecyclerViewOverScrollDecorAdapter(mRecyclerView), 1.8f, VerticalOverScrollBounceEffectDecorator.DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK, VerticalOverScrollBounceEffectDecorator.DEFAULT_DECELERATE_FACTOR);

Cannot resolve method attach()

Hi there,

I'm defining an HorizontalOverScrollBounceEffectDecorator that way:

HorizontalOverScrollBounceEffectDecorator decor = new HorizontalOverScrollBounceEffectDecorator(new RecyclerViewOverScrollDecorAdapter(mRecyclerView), 2.5f, 5f, HorizontalOverScrollBounceEffectDecorator.DEFAULT_DECELERATE_FACTOR);

When I try to run

decor.attach();

I got a compiler error:

Cannot resolved method attach()

I can do decor.detach(); though.

minSdkVersion 16

Is there any reason for using minSdkVersion 16? Is it not working with lower versions?

ImageView in ScrollView problems

If I set 2 images for example to ScrollView, when I touching overScroll I can see some whiteline (1px) below 1 Image. Can I fix it?

Can not work with SwipeRefresh

Can not work when recyclerView with SwipeRefresh

and can not use with Layout

LinearLayout llRootView=find...

OverScrollDecoratorHelper.setUpStaticOverScroll(llRootView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

can not

Multi gesture

Is it possible to configure multi gesture on the scroll view with this lib?

By the way: is it possible to change how much does the ScrollView scroll over?

selector status

How cacel pressing drawable when overScrollingState of use in ListView.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.