devlight / infinitecycleviewpager Goto Github PK
View Code? Open in Web Editor NEWInfinite cycle ViewPager with two-way orientation and interactive effect.
License: Apache License 2.0
Infinite cycle ViewPager with two-way orientation and interactive effect.
License: Apache License 2.0
I have already initialized VerticalInfinitiveCycleViewPager and i'm calling method getRealmItem()
for getting position of element in array. Here is my code:
@Override
public void liked(LikeButton likeButton) {
int position = infiniteCycleViewPager.getRealItem(); // Here i'm getting an error
final Post post = mPosts.get(position);
Like like = new Like.Builder().build();
mSimpleFacebook.publish(post.getPhotoId(), like, new OnPublishListener() {
@Override
public void onComplete(String response) {
TastyToast.makeText(HomeActivity.this, response, TastyToast.LENGTH_LONG,
TastyToast.DEFAULT);
}
@Override
public void onException(Throwable throwable) {
super.onException(throwable);
}
@Override
public void onFail(String reason) {
super.onFail(reason);
}
@Override
public void onThinking() {
super.onThinking();
}
});
}
infiniteCycleViewPager.notifyDataSetChanged(); not working
Hello,
Is that possible to increase the height of the card view. instead of using icvp_max_page_scale.
then you could just apply a padding to left and right to be able to see the preview and next card ?
Because I am using this library for an table app only.
I have a lot white space on top and on bottom.
Thanks
I am using it Horizontal:
<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
android:id="@+id/hicvp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/line_color"
app:icvp_center_page_scale_offset="30dp"
app:icvp_min_page_scale_offset="5dp"
app:icvp_scroll_duration="1000"
app:icvp_max_page_scale="0.9"
app:icvp_min_page_scale="0.6"
app:icvp_medium_scaled="false"/>
CAN'T ABLE TO FIND NavigationTabStrip JAVA FILE and also IntentHelper ,please add it
Credits Name Written in Read Me file is Yegor Kosinov. while The Correct Name is Yehor Kosinov.
1. adapter.notifyDataSetChanged() is not working for the active fragments which are viewing. Except the active fragments other fragments dataSet are changed. So there is problem in notifyDataSetChanged() .
2. We can even setOffScreenPageLimit to 1 because default is two.
// YOUR CODE
public void setOffscreenPageLimit(int limit) {
super.setOffscreenPageLimit(2);
}
Get error when i use it a fragment of "android.support.v4.view.ViewPager" .
E/ViewPager: Error changing children drawing order
java.lang.IllegalAccessException: access to method denied
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.support.v4.view.ViewPager.setChildrenDrawingOrderEnabledCompat(ViewPager.java:789)
at android.support.v4.view.ViewPager.setPageTransformer(ViewPager.java:768)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.setPageTransformer(HorizontalInfiniteCycleViewPager.java:109)
at com.gigamole.infinitecycleviewpager.InfiniteCycleManager.<init>(InfiniteCycleManager.java:143)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.init(HorizontalInfiniteCycleViewPager.java:30)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.<init>(HorizontalInfiniteCycleViewPager.java:26)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:601)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:703)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:762)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:771)
at android.view.LayoutInflater.inflate(LayoutInflater.java:499)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1638)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:679)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1240)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1088)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
at android.view.View.measure(View.java:16677)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5286)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:700)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:90)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1364)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:765)
at android.view.View.measure(View.java:16677)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5286)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
at android.view.View.measure(View.java:16677)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5286)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16677)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5286)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16677)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5286)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16677)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5286)
at android.widget
I have used your adapter in my fragment (A).
Once you click on a card I will load Activity (B), or the back press or on close of Activity (B). Fragment (A), takes too long to load. only show a full back screen and the App becomes unresponsive.
My code:
@BindView(R.id.hicvp) HorizontalInfiniteCycleViewPager hicvp;
hicvp.setAdapter(new HorizontalPagerAdapter(getActivity(), false, newContent, imgLoader));
hicvp.setScrollDuration(500);
hicvp.setInterpolator(AnimationUtils.loadInterpolator(getActivity(), android.R.anim.decelerate_interpolator));
hicvp.setMediumScaled(false);
hicvp.setMaxPageScale(0.95F);
hicvp.setMinPageScale(0.82F);
hicvp.setCenterPageScaleOffset(30.0F);
hicvp.setMinPageScaleOffset(1.0F);
public class HorizontalPagerAdapter extends PagerAdapter {
private Context mContext;
private LayoutInflater mLayoutInflater;
private boolean mIsTwoWay;
private ArrayList<ContentList> newContent;
private ImageLoader imgLoader;
public HorizontalPagerAdapter(final Context context, final boolean isTwoWay, ArrayList<ContentList> newContent, ImageLoader imgLoader) {
mContext = context;
mLayoutInflater = LayoutInflater.from(context);
mIsTwoWay = isTwoWay;
this.newContent = newContent;
this.imgLoader = imgLoader;
}
@Override
public int getCount() {
return newContent.size();
}
@Override
public int getItemPosition(final Object object) {
return POSITION_NONE;
}
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
final View view = mLayoutInflater.inflate(R.layout.movie_detail, container, false);
container.addView(view);
//------
//VIEWs
CardView cardView = (CardView) view.findViewById(R.id.movie_card_wrapper);
cardView.setCardBackgroundColor(ContextCompat.getColor(mContext, R.color.white));
//TITLES
final ImageView movie_poster = (ImageView) view.findViewById(R.id.movie_poster);
final TextView movie_title = (TextView) view.findViewById(R.id.movie_title);
final TextView movie_title_year = (TextView) view.findViewById(R.id.movie_title_year);
//DATA
final ContentList data = newContent.get(position);
//poster image
String imgUri = data.getImages();
imgLoader.displayImage(imgUri, R.drawable.img_loading, movie_poster);
//titles
movie_title.setText(data.getTitle());
movie_title_year.setText(data.getYear());
//PlayMovie
movie_poster.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AnalyticSingleton.getInstance().addData(Screen.VIDEO_CONTENT, String.valueOf(data.getCategory()), data.getTitle(), data.getId());
showVideo(mContext, data, false);
Toast.makeText(mContext, "movie_poster CLICK - ", Toast.LENGTH_SHORT).show();
}
});
return view;
}
@Override
public boolean isViewFromObject(final View view, final Object object) {
return view.equals(object);
}
@Override
public void destroyItem(final ViewGroup container, final int position, final Object object) {
container.removeView((View) object);
}
}
i find a bug.
you can set LIBRARIES has three items in HorizontalPagerAdapter. then run app and fast scroll view pager,you can see some fragment disappeared
Captured images looks wonderful, but when running on genuine android device, its fluency makes me sad. Your idea about displaying pages is creative, however, lacking of fluency is a fatal deficiency. Hope you can optimize it, and make it a great repository.
onPostTransform is called many times when a it should be only called once when a view changes.
I have pages witch contain webview, the content of webviews are different in size. if the content does not fill the view everything is fine, with large content there is some glitch when scrolling. sometimes i scrolling down and suddenly webview scroll to its top. and every time i hold finger to select text the page getting scrolled as well.
any help or note would be appreciated.
note: i use com.gigamole.infinitecycleviewpager.VerticalViewPager
HorizontalInfiniteCycleViewPager.setCurrentItem() not working if called after view created.
i'm using HorizontalInfiniteCycleViewPager in my application with 5 fragments.
the issue is when i'm scrolling backwards (only backwards) after 2 scrolls everything is disappeared and i should scroll 5 times again in backwards to reveal fragments again.
i'v tried FragmentStatePagerAdapter and FragmentPagerAdapter for my adapter but got nothing.
First of all thanks for creating such a cool library.
Tried creating this from activity worked fine but I when am trying to implement this from inside my fragment but could not get it working.
In Fragment implementation I implemented changing few things like:
final ViewPager viewPager = (ViewPager) view.findViewById(R.id.vp_main); viewPager.setAdapter(new MainPagerAdapter(getChildFragmentManager())); viewPager.setOffscreenPageLimit(2);
In HorizontalPagerFragment changed like:
final HorizontalInfiniteCycleViewPager horizontalInfiniteCycleViewPager = (HorizontalInfiniteCycleViewPager) view.findViewById(R.id.hicvp); horizontalInfiniteCycleViewPager.setAdapter(new HorizontalPagerAdapter(getParentFragment().getContext() ,getParentFragment().getActivity()));
also tried without using
getParentFragment()
but Viewpager content is not showing up.
First of all thanks for this amazing library. However, I noticed that due to parts of the left and right fragment being visible apart from the one currently in focus, some of my click listeners on elements on these side fragments get fired if the user accidentally touches the right thing.
Is there any way to disable interaction with fragments that are not currently in focus so as to avoid this issue?
Thanks
in a material world, we accelerate than decelerate. we don't run the stop sign, reverse, run it again by a lesser amount, then reverse into the correct position.
<3
How can i use setOnClickListener method for go to pager position index?
Scroll event not smooth. If first time scroll success, the next scroll event always fail and cause click event. How to solve?
滑动事件不流畅,通常第一次滑动成功,第二次滑动的时候通常会引起点击事件,如何解决这个问题?
If Number of Items in the View are less than 5 , It becomes Invisible after several number of scrolls.
09-21 14:49:33.244 11939-11939/com.gigamole.sample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.gigamole.sample, PID: 11939
java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:613)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:440)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
at android.content.res.Resources.loadDrawable(Resources.java:2174)
at com.huawei.android.content.res.ResourcesEx.loadDrawable(ResourcesEx.java:636)
at android.content.res.Resources.getDrawable(Resources.java:747)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:177)
at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:170)
at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:53)
at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:74)
at com.gigamole.sample.utils.Utils.setupItem(Utils.java:20)
at com.gigamole.sample.adapters.HorizontalPagerAdapter.instantiateItem(HorizontalPagerAdapter.java:74)
at com.gigamole.infinitecycleviewpager.InfiniteCyclePagerAdapter.instantiateItem(InfiniteCyclePagerAdapter.java:68)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:870)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1086)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:552)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:514)
at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:506)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.setCurrentItem(HorizontalInfiniteCycleViewPager.java:222)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.setCurrentItem(HorizontalInfiniteCycleViewPager.java:216)
at com.gigamole.infinitecycleviewpager.InfiniteCycleManager$1.run(InfiniteCycleManager.java:126)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:711)
at dalvik.system.NativeStart.main(Native Method)
After repeated cycles
Why to shield when the automatic change of the manual sliding events?
If you forget to click on it, I won't be able to switch to what I want, only waiting for the silly next chance next time.
If the user hasn't finished it to the operation, the waiting time will be very long.....
public boolean onTouchEvent(final MotionEvent event) {
if (mViewPageable.getAdapter() == null || mViewPageable.getAdapter().getCount() == 0)
return false;
if (mIsAutoScroll || mIsInitialItem || mViewPageable.isFakeDragging()) return false;
if (event.getPointerCount() > MIN_POINTER_COUNT || !mViewPageable.hasWindowFocus())
event.setAction(MotionEvent.ACTION_UP);
checkHitRect(event);
return true;
}
Hi,
It is nice control and great job, I have an issue when I use this with five items and images, I got images correctly all five card, but title is only showing for third item and other four cards title are missing
any idea why?
We need to wait for the animation to complete.
Hi, this is very usefull libray.
With the help of button (previous,next) change page.
Hi,
When i load more than 100 items into adapter for HorizontalInfiniteCycleViewPager, application crashes with below messages while swiping pages. How can i fix it?
A/OpenGLRenderer: Error: Spot pair overflow!!! used 170, total 71
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 4433 (hwuiTask1)
How do I insert coding Intent to Other Activity In InfiniteCycleViewPager
hi
InfiniteCycleViewPager is very Beautiful library .
but i have a problem and its that i want to setOnClickListener for the cardViews
I make a button in cardView but i cannot use this
if possible help me
tanx my freind
Hi,
Thanks for the awesome library. I have a problem that I need to make the items appear as a normal horizontal list with the same effects. So, basically is there any way i can switch off the infinite adapter. The main reason for it being that the user should not be able to go beyond the first & last items.
how to ban the loop, thanks
There are problems with adding and removing items..
HI, as I download the full code source from this repository, I cannot show the view right in landscape mode. All single item view was scaled as the picture showing below and the translation in InfiniteCyclePageTransformer was measured by screen width. So my question is what can I do when the app is all in landscape Activity and shows the effect of portrait the same, when the code is only for portrait screens? Thank you
VerticalInfiniteCycleViewPager can set FragmentPagerAdapter?
how can i create a custom layout for each card or add a picture for each background stretched
Here is a code from main layout where is located vertical cycler view pager:
`
<com.solaris.want2know.infinitecyclerviewpager.VerticalInfiniteCycleViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:icvp_interpolator="@android:anim/overshoot_interpolator"
app:icvp_center_page_scale_offset="0dp"
app:icvp_max_page_scale="0.9"
app:icvp_medium_scaled="true"
app:icvp_min_page_scale="0.7"
app:icvp_min_page_scale_offset="-20dp"
app:icvp_scroll_duration="500"/>
</FrameLayout>`
And here is located item view for every card in vertical cycle view pager:
`
<android.support.v7.widget.CardView
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="300dp"
app:cardUseCompatPadding="true"
app:cardPreventCornerOverlap="false"
app:cardCornerRadius="10dp"
app:cardElevation="20dp">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="center"/>
</android.support.v7.widget.CardView>
`
你好,感谢您的开源,但是我使用这个库出现了这个问题
Hello, thank you for your open source, but I have this problem with this library
java.lang.IllegalAccessException: access to method denied
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.support.v4.view.ViewPager.setChildrenDrawingOrderEnabledCompat(ViewPager.java:817)
at android.support.v4.view.ViewPager.setPageTransformer(ViewPager.java:795)
at android.support.v4.view.ViewPager.setPageTransformer(ViewPager.java:769)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.setPageTransformer(HorizontalInfiniteCycleViewPager.java:109)
at com.gigamole.infinitecycleviewpager.InfiniteCycleManager.(InfiniteCycleManager.java:143)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.init(HorizontalInfiniteCycleViewPager.java:30)
at com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager.(HorizontalInfiniteCycleViewPager.java:26)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.view.View.inflate(View.java:17465)
at com.ciweek.myapplication.View.View.Fragment.BookListFragment.getContentView(BookListFragment.java:43)
at com.ciweek.myapplication.Base.BaseFragment.onCreateView(BaseFragment.java:20)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5045)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.