crosswall / Android-Coverflow

A beautiful coverflow lib for android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After call notifyDataSetChanged() problem

yick1993 opened this issue · comments

commented

After call notifyDataSetChanged(), the scale of item will has some problem(e.g. even the item is not the center one, their scale will become 1.0f, as big as the center one ) but after scroll a little bit, it will become normal. So, any idea of this problem ? Thank you

Hello,I had the same issue, the solution:

private void saveItem() { pagerAdapter.addItem(new Item("ItemAdded")); cardPager.setOffscreenPageLimit(pagerAdapter.getCount()); // this is the important thing cardPager.setCurrentItem(pagerAdapter.getCount()); // this is cos the problem still there when we add an item, but if you select the item inserted then the pager will show the new item added correctly }

Hi there!

Same issue here while removing item from my ViewPager (which calls notifyDataSetChanged()). I am currently using a library that wraps the ViewPager with additional features. When removing my item, the library takes care of updating the ViewPager content and scroll to next position. However both scale and margins are broken and only scrolling the content refreshes the pager correctly.

I tried to force an invalidate() that is done in the onPageScrolled() callback but with no success. I obviously tried the solution above but it is not always working. Plus this is not the wanted behavior as I definitely don't want to have my pager scrolling the last item.

Any idea how to simply achieve this force refresh to keep the CoverFlow correctly configured

Actually combining both setOffscreenPageLimit() setCurrentItem() seems to do the trick for all items except the first and last item in the pager, especially if you only want to scroll forward (after add item to pager) or back (after remove item from pager). Seems erratic to me :)

I've stumbled with this issue too. Simulating a MotionEvent was the only thing that worked, though it obviously looks bad, and is prone to looking worse across devices.

Confirm bug. Angle issue.

@djshanne After call notifyDataSetChanged(),my view has no cos。event if i setOffscreenPageLimit,can you sovle it??

Can you tell me, what do you mean with has no cos ? Sorry I dont get it. @catroom

I also have the same problem can anyone have a solution for it ?

same issue..

i use a trick this
pagerAdapter.notifyDataSetChanged(); viewPager.setAdapter(null); viewPager.setAdapter(pagerAdapter); viewPager.setCurrentItem(viewPosition);

i'm working