emilsjolander / android-FlipView

A small, easy to use android library for implementing flipping between views as seen in the popular Flipboard application
Apache License 2.0
924 stars 273 forks source link

Adapter should preload next page #16

Open JackDanyels opened 11 years ago

JackDanyels commented 11 years ago

Hi,

great Library but I'm missing a way to force the adapter to preload the next page by calling getView? Is there a way to do this?

thanks in advance and greetings from germany,

JackDanyels

emilsjolander commented 11 years ago

Yeah, the adapter should automatically do this. It's something i've missed. I'll mark it as a bug and hopefully get to fixing it this week

JackDanyels commented 11 years ago

Hey, have you been able to fix it meanwhile? I tried out to simply add the next View in dispatchDraw. First it looked like that this would do the trick, unfortunately some times the touchevents are dispatched wrong to the next page and not on the current View

JackDanyels commented 11 years ago

I was able to fix it. I'm just post adding the next View. When I flip forward, i just remove and readd the View. I assume that doing it this way restores the hirachy. As dispatchDraw is not called when the Adapter is setted, I was in need to do it in an similar way as mentioned before. As I only needed the preload functionality on one section of my app, I also added a boolean to control.

Here's what I do in dispatchDraw() (FlipView.java)

image

To readd already added Views I altered the postAddView() (FlipView.java)

image

And here the minor changes in setupAdapter() (FlipView.java)

image

If you have any suggestions to improve this solution or even a better one, plz drop a comment!

Greetings from Germany,

JackDanyels

emilsjolander commented 11 years ago

i'm in the progress of rewriting some of the core logik of how the flipview handles views from the adapter. I'm hoping i can finish that up this weekend but it might have to wait until next weekend ;)

ashoksinghal commented 9 years ago

Hi JackDanyels,

I am using this library. I am having some glitches issues while flipping the second half of the next pages.

I think, its because my adater is taking some time in drawing the views as its a bit complexe view drawing in the adapter. So, I should also preload the adapter.So, can you please share your code of FlipView class which you may have upadted for preloading the next or previous page of the adapter.

Also, can you and emilsjolader please suggest me, why there may be glitches in the flipping.. and some solution for that.

Thanks In Advace....

JackDanyels commented 9 years ago

Hey ashoksinghal, I'm afraid i have no longer the src-file. The steps I mentioned above should do the trick, well at least it done it for me 1 and half years ago.

What sort of glichtes are you experiencing, maybe you should post some shots of it?

feel free to ask, if you have any further problems,

with regards, Danyel

ashoksinghal commented 9 years ago

Hi Danyel,

Thank you for your quick response. but I found the real issue of the glitching of the flipping. Actually that wasn't because of the library. It was because of the data that is coming from server side. Actually a bulk of text data was coming from the server and i was using setting whole data in a textview which has some weight set so, that was taking that much time and causing the UI to be weighted and was shwoing as glitches.

By the way, Thanks man!! Thank you very much!!! for your prompt reply to my query.

I will ask you furthur if any help will be needed.

Thanks Ashok

Mr-wangyong commented 9 years ago

hello! I'm very glad to use open source library, thank you very much! My problems in the process of use, when the page turn 90 degrees, under a page refresh and from the Internet (not the network is a local cache) to access the image to flip to the process of this period of time will be caton, lead to bad user experience, my boss in the rush me fix the BUG Hope to receive your reply, how to load the page refresh data in page flip over? Perhaps, we can make the operation of the load data in the child thread execution, what do you think? Programmer from China, looking forward to your international solutions, very grateful!

mithleshjs commented 8 years ago

Calling notifyDataSetChanged() when on current page solves the problem.

mohsinabid commented 7 years ago

How to stop loading view of position 1, when it's showing 0 position view. It's loading in advance. I want opposite to this issues. @emilsjolander