Code Monkey home page Code Monkey logo

recyclerviewpager's Introduction

Deprecated

Android Arsenal

RecyclerViewPager

A ViewPager implemention base on RecyclerView. Support fling operation like gallary.

android.support.v4.view.ViewPager的完美替代品

Features:

  1. Base on RecyclerView.
  2. Custom fling factor.
  3. Custom paging trigger.
  4. Support Vertical and Horizontal orientation.
  5. Support FragmentViewPager (api 12+)
  6. Infinite-Loop-ViewPager
  7. Support TabLayout

特性:

  1. 扩展自RecyclerView.
  2. 可自定义fling滑动速率.
  3. 可自定义翻页触发条件.
  4. 支持垂直ViewPager.
  5. 支持Fragment (api 12+)
  6. 支持无限循环
  7. 支持和TabLayout配合使用

RecyclerViewPager RecyclerViewPager RecyclerViewPager

Usage

how to import?

add this into gradle

// Yes, I have switched to jitpack.io.

repositories {
    ...
    maven { url "https://jitpack.io" }
    ...
}

dependencies {
    ...
    compile 'com.github.lsjwzh.RecyclerViewPager:lib:v1.2.0@aar'
    ...
}

add proguard rules if need

-keep class com.lsjwzh.widget.recyclerviewpager.**
-dontwarn com.lsjwzh.widget.recyclerviewpager.**

Basic Usage:

It is easy to setup like a Recycler List View.

xml:

<com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="15dp"
    android:paddingRight="15dp"
    app:rvp_triggerOffset="0.1"
    app:rvp_singlePageFling="true"
    android:clipToPadding="false"/>

code:

RecyclerViewPager mRecyclerView = (RecyclerViewPager) view.findViewById(R.id.list);

// setLayoutManager like normal RecyclerView, you do not need to change any thing.
LinearLayoutManager layout = new LinearLayoutManager(getActivity(),LinearLayoutManager.HORIZONTAL,false);
mRecyclerView.setLayoutManager(layout);

//set adapter
//You just need to implement ViewPageAdapter by yourself like a normal RecyclerView.Adpater.
mRecyclerView.setAdapter(new RecyclerView.Adpater<X>());

// That is all.

Support TabLayout:

1.Add Dependency:

dependencies {
    ...
    compile 'com.github.lsjwzh.RecyclerViewPager:tablayoutsupport:v1.1.2@aar'
    ...
}

2.Call 'setupWithViewPager'

TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
TabLayoutSupport.setupWithViewPager(tabLayout, mRecyclerView, mAdapter);

Infinite Loop ViewPager:

<com.lsjwzh.widget.recyclerviewpager.LoopRecyclerViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="20dp"
        android:clipToPadding="false"
        android:paddingTop="15dp"
        android:paddingBottom="15dp"/>

You just need to use LoopRecyclerViewPager replace RecyclerViewPager. The usage of LoopRecyclerViewPager is the same as RecyclerViewPager. No matter what you specify position you want to scroll, LoopRecyclerViewPager will transform it to right position. Ex:In a LoopRecyclerViewPager with 10 items, scrollToPosition(1) will get same scroll behavior as scrollToPosition(11)scrollToPosition(21) and so on.

How to get actual position in LoopRecyclerViewPager:

    int actualPosition = mLoopRecyclerViewPager.transformToActualPosition(adapterPosition);

If you just want to get current actual position, you can do it like this:

    int actualCurrentPosition = mLoopRecyclerViewPager.getActualCurrentPosition();

Release Notes:

1.2.0 update support lib to 26.0.2
1.1.2 merge some fix.
1.1.1 merge some fix.
1.1.0stable fix bug:LoopViewPager position confusion;LoopViewPager non stop spinning;
1.1.0beta5 feat: TabLayoutSupport Lib supports LoopViewPager
1.1.0beta4 fix bug:support ItemDecorations;
1.1.0beta3 support reverse;
1.1.0 refactor;support TabLayout;
1.0.11 support infinite loop
1.0.10 make touch gesture smother;
1.0.8 override swapAdapter;support singlePageFling;
1.0.7 remove redandunt codes; support cancel action
1.0.6 resolve potential id conflicting on FragmentViewPagerApdater
1.0.4 fix bug : exception happens if  ItemView LayoutParam is not MarginLayoutParam
1.0.3 add method: getCurrentPosition
1.0.2 support FragmentViewPager, add OnPageChangedListener
1.0.1 fix bug: smoothScrollToPosition index out of range
1.0.0 reimplement RecyclerViewPager without coping RecyclerView's codes.

0.5.4 add 'HorizontalCenterLayoutManager' to implement ViewPager
0.5.3 fix bug: setHasStableIds not work
0.1.0

Special Thanks:

saadfarooq taxomania

ToDo:

Vertical ViewPager FragmentViewPager observe OnPageChanged Infinite-Loop-ViewPager ~~Support TabLayout ~~ Support ViewPagerIndicator Wrap Content? dispatchTouchEvent override demo

License

Copyright 2015 lsjwzh

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

recyclerviewpager's People

Contributors

arizz96 avatar biaowu avatar cymen avatar daisuke-nomura avatar doronk avatar dryaz avatar esmasui avatar fcolin-ecocea avatar giantramen avatar gildor avatar icalo35 avatar kazukinr avatar kongdy avatar lsjwzh avatar mateusz0matti avatar mitkins avatar richard1122 avatar saadfarooq avatar shakenbeer avatar stankocken avatar taxomania avatar thinwonton avatar vansonleung 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recyclerviewpager's Issues

Issue with Vertical support

Hi,

I've tried to use the example on README with VERTICAL orientation but I faced many issues:

  • scrolling is broken (not centered in current element)
  • padding is applied but with left / right when we expected top / bottom

There is my Activity:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        pager = (RecyclerViewPager) findViewById(R.id.viewpager);
        final LinearLayoutManagerEx layout = new LinearLayoutManagerEx(
                this, LinearLayoutManagerEx.VERTICAL, false);
        pager.setLayoutManager(layout);
        pager.setDisplayPadding(dip2px(this, 30));
        pager.setAdapter(new RecyclerViewEx.Adapter<VH>() {
            @Override
            public VH onCreateViewHolder(ViewGroup parent, int i) {
                return new VH(LayoutInflater.from(Home.this).inflate(R.layout.item, parent, false));
            }

            @Override
            public void onBindViewHolder(VH holder, int position) {
                ((TextView) ((ViewGroup) holder.itemView).getChildAt(0))
                        .setText(String.valueOf(position));
            }

            @Override
            public int getItemCount() {
                return 10;
            }
        });
    }

    private int dip2px(Context context, int dp) {
        return (int) (context.getResources().getDisplayMetrics().density * dp);
    }

Thx for this amazing library :)

Android studio cannot import by gradle

Hi,

Android studio cannot import by gradle

when i add compile('com.lsjwzh:recyclerviewpager:0.1.0-RELEASE') into gradle,and sync it

then,android studio show me:

image

Divider not working correctly

Hi, I read this page #45 and i added a divider from your link. But when I change page divider still visible and if I go to previous page divider invisible. How can I fix it
Because normally it should be like page 0 like below the image, not page 1

1
0
3

my divider xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">

    <size
        android:width="10dp"
        android:height="10dp" />

    <solid android:color="#ff0000" />

</shape>

Thanks

reverse viewpager

Hi! I want create a reverse viewPager with use LinearLayoutManager (context, horizontal, true). when i scroll the viewPager to left, the currentPosition had changed to 1, but the view can't scroll;

Delegate all public methods from the wrapper adapter to the view adapter

In your current implenentation the RecyclerViewPagerAdapter only delegates the methods for view creation to the wrapped adapter.
It should delegate all public methods to the wrapped adapter.

Example:

public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        mAdapter.onAttachedToRecyclerView(recyclerView);
}

Calling notifyDataSetChanged() during a transition

If I call notifyDataSetChanged() to update my views during a smooth transition (started with a fling gesture), the animation will stop mid-way, in between 2 views, and from there the RecyclerViewPager will start behaving weird.

screenshot_2016-02-11-15-08-22

Add transitions like ViewPager

I don't think my code is good enough to be added into a library but maybe I could inspire you a bit to add this functionality. However, I really like this lib so I share my thoughts with you:

TLDR: Add beautiful transitions like ViewPager (or even just scale/alpha animate a Dialog), but with one big extra: This way you get notifyItemInserted() and notifyItemRemoved() which is not possible with viewPager(Adapter).

RecyclerViewPager.java:

float extent = 0;
float last = 0;

@Override
public void onScrolled(int dx, int dy) { // debugLog says this function takes 0ms on my old Samsung S3
    super.onScrolled(dx, dy);

    if (extent == 0){
        extent = computeHorizontalScrollExtent();
    }

    if (dx != 0) {

        float offset = computeHorizontalScrollOffset();
        if (last == 0) {
            last = offset;
        } else if (dx < 0 && offset > last){ // this was necessary due to some unwanted behavior
            last += dx;
        } else {
            last = offset;
        }

        while (last > extent) {
            last -= extent;
        }

        adapter.transform(extent, last);
    }
}

public interface OnSwipeTransformation {
void onSwipeTransformation(View left,View right,float extent,float offset);
}

Adapter.java:

public void transform(float extent, float offset) { // get the last item in my item list (which implemented the OnSwipeTransformation interface and pass the event)
int last = getItemCount() - 1;
swipeBackItems.get(last).transform(swipeBackItems.get(last-1).itemView, swipeBackItems.get(last).itemView, extent, offset);
}

Simple transformation:

public class SwipeScaleTransformer extends SwipeTransformer {
private static final float MIN_SCALE = 0.9f;

@Override
public void onSwipeTransformation(View left, View right, float extent, float offset) {
    left.setTranslationX(offset); 
    float scaleFactor = 1f - (1f - MIN_SCALE) * Math.abs(offset/extent); // add little scale
    left.setScaleX(scaleFactor);
    left.setScaleY(scaleFactor);
}

}

Little more complex:

public class DialogTransformer extends SwipeTransformer {

@Override
public void onSwipeTransformation(View left, View right, float extent, float offset) {
    Log.e("DIALOG", "onTransform - extent:" + extent + " offset:" + offset);

// countermove both the left and the right item so it's instantly visible...
left.setTranslationX(offset);
right.setTranslationX(-(extent-offset));
// ...and just scale it up
float factor = offset/extent;
right.setScaleY(factor);
right.setScaleX(factor);
right.setAlpha(factor);

}

}

If you like to add this functionality to your library I'd suggest to think about the implementation of the transformer "per adapter" or "per item". In my case it's not sufficient to have just one transition but rather add a transition style per new listItem.

issue loop

Hi I used RVPager in fragmentviewpager. when I enable the loop, I can only flip to left because flip to right changes the tap to next tab. Can you help me to fix it?
Thanks and Best Regards

getCurrentItem()

Hi,

Thank you for this library.
Do you think you can implement a getCurrentItem() method like we would have on a ViewPager?
(just a way to avoid using the pagechangedlistener if possible)

Enable child scroll

Hello, I'm using your library to create a vertical pager with a custom recyclerview adapter that inflate other recyclerviews and scrollviews. I can't figure out a way to enable the scroll on childs that is not working actually. Do you know any solution for this? thank you!

Question: How to reliably get the previous and next position of the currently visible position?

What I'd like to figure out is, if it is possible to always know what the next position will be and what the previous position was.

My case;

I'm using this as a gallery for images, using the currently visible images bitmap to generate a palette and use that to color my UI.

Doing so works great, however on page change the palette takes at least 3 or so seconds to generate and change.

So I was thinking if I could always grab the image for the last visible and next visible position, I can maybe do some of that work before the actual page change.

Any advice would be greatly appreciated.
Thanks.

Proguard rules

Great job with this library.
Is there any proguard rules to be added? I cannot create a production build.

Question on FragmentViewPager

First off, great work! I was checking this library out and works pretty neat :)
From the readme your todo has plans for a FragmentViewPager (can't wait this!! :) )
I was curios on how you'd be implementing it given that the RecyclerViewPagerAdapter works with recycling RecyclerView.ViewHolder but what you'd want is a Fragment instead? Ideas?
Thanks a ton

Bug - page change notification isn't sent if swipe back a few pages

I've got an application that plays a sound file for each page. When the sound file finishes, it waits a second and then advances to the next page. This works great with RecyclerViewPager however if I go back a page or two, the page change notification comes in for that change, I play the sound file and programmatically advance to the next page (smoothScrollToPosition) and then the bug happens -- no notification of page change (from RecyclerViewPager) after the animation to the new page finishes. So basically:

1->2->3->4 then 4->3 then 3->4 but no notification page changed to 4.

I'm trying to debug locally. Can I build the lib and then use the built lib in the demo? The app seems to be using compile('com.lsjwzh:recyclerviewpager:1.0.7-SNAPSHOT') in the build.gradle -- is that going out to maven or looking at the locally built lib?

scrollToPosition

when use scrollToPosition, Infinite-Loop-ViewPager is not work

onPageChanged alternative.

I'm sorry if this is a dumb question...

I'm attempting to switch over from a VieePager to this library.

However I can't seem to figure out if there is a way to mimic the onPageSelected(int position) method in any of the RecyclerView listeners.

Would you have any advice as to how to get this function with your library.

Thank you.

onViewAttachedToWindow() not called

Hi,

I am trying to update the ViewHolder just as the View appears on the Window from the Adapter. However, I am unable to do so, as the onViewAttachedToWindow() callback is not triggered as views are recycled and displayed in the pager.

Please state the best way to achieve this. Using onBindViewHolder() callback, the layout can be changed when not visible on screen. Essentially I have a View Animator holding several ImageViews for a slideshow. My dilemma is: I only wish to add Images to the layout when the view is becoming visible in the RecyclerViewPager.

Moreover, is there a way to limit the number of Views created in the pager? I'm looking for a method similar to the standard ViewPager's setOffscreenPageLimit(int pages)

Thanks,
Arjun

Calling getLayoutManager().canScrollHorizontally when getLayoutManager() is null.

I am using your RecyclerViewPager within the Umano AndroidScrollingUpPanel. (https://github.com/umano/AndroidSlidingUpPanel). I am getting the following error:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollHorizontally()' on a null object reference
at com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager.dispatchTouchEvent(RecyclerViewPager.java:384)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
...

This is called when the Umano's dispatchTouchEvent returns super.dispatchTouchEvent(ev);

at com.sothree.slidinguppanel.SlidingUpPanelLayout.dispatchTouchEvent(SlidingUpPanelLayout.java:1035)

The fix was very easy for me. Here is your original code within RecyclerViewPager.java:

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        mPositionOnTouchDown = getLayoutManager().canScrollHorizontally()
                ? ViewUtils.getCenterXChildPosition(this)
                : ViewUtils.getCenterYChildPosition(this);
        if (DEBUG) {
            Log.d("@", "mPositionOnTouchDown:" + mPositionOnTouchDown);
        }
    }
    return super.dispatchTouchEvent(ev);
}

I changed this as following by simply making sure getLayoutManager is not null:

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {

        if (getLayoutManager() != null) {              // *** CHANGE IS HERE! ***
            mPositionOnTouchDown = getLayoutManager().canScrollHorizontally()
                                   ? ViewUtils.getCenterXChildPosition(this)
                                   : ViewUtils.getCenterYChildPosition(this);
        }
        if (DEBUG) {
            Log.d("@", "mPositionOnTouchDown:" + mPositionOnTouchDown);
        }
    }
    return super.dispatchTouchEvent(ev);
}

It now works. Do you have any thoughts on this? Is what I did just a hack? Is it a good idea?

java.lang.IllegalArgumentException: Invalid target position

when no network have this ,the oldpostion -1 new position 0

Exception dispatching input event.
02-16 08:46:38.551 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: java.lang.IllegalArgumentException: Invalid target position
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.support.v7.widget.RecyclerView$SmoothScroller.start(RecyclerView.java:8859)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.support.v7.widget.RecyclerView$LayoutManager.startSmoothScroll(RecyclerView.java:6122)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.support.v7.widget.LinearLayoutManager.smoothScrollToPosition(LinearLayoutManager.java:433)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.support.v7.widget.RecyclerView.smoothScrollToPosition(RecyclerView.java:1377)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at com.damai.dmlive.support.widget.RecyclerViewPager.smoothScrollToPosition(RecyclerViewPager.java:179)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at com.damai.dmlive.support.widget.RecyclerViewPager.onScrollStateChanged(RecyclerViewPager.java:424)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.support.v7.widget.RecyclerView.dispatchOnScrollStateChanged(RecyclerView.java:3732)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.support.v7.widget.RecyclerView.setScrollState(RecyclerView.java:1182)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2438)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at com.damai.dmlive.support.widget.RecyclerViewPager.onTouchEvent(RecyclerViewPager.java:360)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.View.dispatchTouchEvent(View.java:9148)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2680)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2351)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at com.damai.dmlive.support.widget.RecyclerViewPager.dispatchTouchEvent(RecyclerViewPager.java:346)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2366)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2366)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2366)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2366)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2366)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2366)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2366)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2747)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1840)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.app.Activity.dispatchTouchEvent(Activity.java:3027)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2708)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.View.dispatchPointerEvent(View.java:9358)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5044)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4874)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4337)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4390)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4356)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4482)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4364)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4539)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4337)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4390)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4356)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4364)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4337)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6940)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6813)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6784)
02-16 08:46:38.561 31953-31953/com.noglon.kk.com E/MessageQueue-JNI: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:70

1.0.8 aar in maven repository have problem

I wrote a project using your lib, when package release variant, proguard fail, and print the following errors:

Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'int access$102(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager,int)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'float access$202(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager,float)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'float access$300(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'int access$400(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager,int,int)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'int access$500(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'int access$100(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'java.util.List access$600(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
Warning: com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager$ScrollListener: can't find referenced method 'android.support.v7.widget.RecyclerView$OnScrollListener access$700(com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager)' in program class com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager

I thought maybe you forgot to clean project before assembling the aar file.

Hope this bug could be fixed!

not compatible with Smart-Adapter library ?

https://github.com/mrmans0n/smart-adapters

Item

public class Item {
    public String number;

    public Item(String number) {
        this.number = number;
    }
}

ItemView

public class ItemView extends BindableLayout<Item> {
    @InjectView(R.id.text) public TextView text;

    public ItemView(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_layout;
    }

    @Override
    public void onViewInflated() {
        ButterKnife.inject(this);
    }

    @Override
    public void bind(Item item) {
        this.text.setText(item.number);
    }
}
RecyclerMultiAdapter adapter = SmartAdapter.empty().map(Item.class, ItemView.class).into(this.mRecyclerView);
        for(int i = 0; i < 30; i++) {
            adapter.addItem(new Item("" + i));
        }

        LinearLayoutManager layout = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
        mRecyclerView.setLayoutManager(layout);
        mRecyclerView.setHasFixedSize(true);
        mRecyclerView.setAdapter(adapter);

Error Exception on launch :

Caused by: java.lang.IllegalStateException: Cannot change whether this adapter has stable IDs while the adapter has registered observers.
            at android.support.v7.widget.RecyclerView$Adapter.setHasStableIds(RecyclerView.java:5114)
            at com.lsjwzh.widget.recyclerviewpager.RecyclerViewPagerAdapter.setHasStableIds(RecyclerViewPagerAdapter.java:57)
            at com.lsjwzh.widget.recyclerviewpager.RecyclerViewPagerAdapter.<init>(RecyclerViewPagerAdapter.java:22)
            at com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager.setAdapter(RecyclerViewPager.java:108)
            at ir.fadesign.myapplication.MainActivity.onCreate(MainActivity.java:40)

RecyclerViewPager & CoordinatorLayout

RecyclerViewPager does not allow for the full functionality of CoordinatorLayout to be taken into effect. I'm using a full page horizontally scrolling pager and am trying to hide the toolbar when a user scrolls inside each recyclerview. Currently CoordinatorLayout is unable to detect scrolling within RecyclerViewPager's recycler views.

Question: Facebook style pager?

Nice lib.

Have you seen how the facebook app will occasionally have a list of horizontal picture/links. You'll have the main one lined up center, but a picture slightly off screen on the right. Swiping reveals the next picture and now you have 3.

Would I be correct with some sizing settings your lib could mimic that behavior?

开源组件android-auto-scroll-view-pager遇到的一些问题

您好。您上次在github上回复我的
@OverRide
public boolean dispatchTouchEvent(MotionEvent event) {
boolean inBannerArea = isInBannerArea(event);
if ((event.getAction() == MotionEvent.ACTION_DOWN
&& inBannerArea) || mActionDownOnBannerArea) {
//如果在banner区域按下,则开始触发bannerViewPager的ontouch事件
mActionDownOnBannerArea = true;
try {
mBannerViews.bannerViewPager.onTouchEvent(event);
} catch (IllegalStateException e) {

    }
}
if (event.getAction() == MotionEvent.ACTION_UP) {
    mActionDownOnBannerArea = false;
    mBannerViews.bannerViewPager.startAutoScroll();
}
return false;

}
isInBannerArea(event)和mBannerViews.bannerViewPager 找不到?
还有一个问题就是我下拉刷新的时候想修改展示的图片数量,然后让图片跳转到第一张该怎么改呢。
修改数据源 调用adapter.notifyDataSetChanged();刷新没效果呢。

LayoutAdapter not recognized by Android Studio

I am running into errors in my Android Studio like LayoutAdapter, RecyclerViewEx not recognized. I included compile('com.lsjwzh:recyclerviewpager:1.0.4') in my grade file. I want to know if I am missing something.
..Regards
Durga.

No other view can be put before recyclerviewpager?

i have tried to use com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager and some other elements, but no luck, error occured. I found that if there is any viewgroup set before the RecyclerViewPager, it will crash.

    <ImageView
        android:id="@+id/test"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="left"
        android:contentDescription="@null" />
</LinearLayout>

<com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
    android:id="@+id/sliding_viewpager"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:background="@android:color/transparent" />

the above xml layout will give error ClassCastException: android.widget.ImageView cannot be cast to android.view.ViewGroup

swapAdapter not overridden

The swapAdapter function is not overridden, so if you try to call it, it will replace RecyclerViewPagerAdapter instead of the contained Adapter

wrap_content make match_parrent

I,
I bing RVP with picture, so I want that the RCP just wrap content. In xml this trigger behavior like match parent.

If I fix the size, the size is fixed, that works.

VerticalPagerActivity

If try to change orientation of layout manager after setup in between like in VerticalPagerActivity
layout.setOrientation(LinearLayoutManager.HORIZONTAL) if recycler view layount manager was initially Vertical in orientation then recycler view collapse each item take width as wrap_content instead of match_parent.

this happen more often if you have less elements like 3 or 4.

sample code

findViewById(R.id.tvVertical).setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
layout.setOrientation(LinearLayoutManager.VERTICAL);
}
});
findViewById(R.id.tvHorizontal).setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
layout.setOrientation(LinearLayoutManager.HORIZONTAL);
}
});

screenshot_20160219-175922

Resources$NotFoundException

Hi,

I set the pager as in the demo, but I got this exception:
android.content.res.Resources$NotFoundException: Unable to find resource ID #0xd7282e18
at android.content.res.Resources.getResourceName(Resources.java:3357)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:490)
at com.lsjwzh.widget.recyclerviewpager.FragmentStatePagerAdapter$FragmentViewHolder.onViewAttachedToWindow(FragmentStatePagerAdapter.java:147)

v1.0.5

Thanks,
Robert

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.