Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature list preloader support multiple target sizes #273

Conversation

DavidWiesner
Copy link
Contributor

To provide different target sizes in the ListPreloader, i had to

  1. change the signature of the PreloadSizeProvider<T> to getPreloadSize(T item, int adapterPostion, int itemPosition)
  2. change the PreloadModelProvide to request the preload items one by one. This is needed to provide the itemPosition to PreloadSizeProvider.getPreloadSize() method.

In addition i added some test cases for the new functionality and adapt the old tests to the one by one approach.

I also change the deprecated ListPreloader(int maxPreload) constructor, to remove some null checks and make it easier to later remove the deprecated constructor and the methods.

regard,
David

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.09%) when pulling 33642b1 on DavidWiesner:feature-ListPreloader-support-multiple-sizes into 7dcc877 on bumptech:master.

@TWiStErRob
Copy link
Collaborator

Is that Object item really necessary? I mean can't it be T item?

@DavidWiesner
Copy link
Contributor Author

@TWiStErRob which Object item you mean? I can´t find any Object item except in ListPreloaderTest, all other should be generic.
Or did you mean the Object item in the description? I will change that - sorry

@TWiStErRob
Copy link
Collaborator

getPreloadSize in your PR description. I didn't check the code yet, sorry if it's generic there.

@@ -102,16 +100,36 @@
*/
@Deprecated
public ListPreloader(int maxPreload) {
this(null, null, maxPreload);
this.preloadModelProvider = new PreloadModelProvider<T>() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, this is definitely cleaner, thanks!

… to preloadAdapterPosition(List<T> items, int position, boolean isIncreasing)
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.11%) when pulling 0618cf0 on DavidWiesner:feature-ListPreloader-support-multiple-sizes into 7dcc877 on bumptech:master.

sjudd added a commit that referenced this pull request Nov 21, 2014
…rt-multiple-sizes

Feature list preloader support multiple target sizes
@sjudd sjudd merged commit dc80fe4 into bumptech:master Nov 21, 2014
@DavidWiesner DavidWiesner deleted the feature-ListPreloader-support-multiple-sizes branch November 21, 2014 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants