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

Fix model group issues #676

Merged
merged 2 commits into from
Feb 5, 2019
Merged

Fix model group issues #676

merged 2 commits into from
Feb 5, 2019

Conversation

elihart
Copy link
Contributor

@elihart elihart commented Feb 5, 2019

Should fix #672 and #675

Tests were updated to catch these issues

@elihart elihart force-pushed the eli-fix_model_group branch from 6a7ee01 to dddbe98 Compare February 5, 2019 06:15
@@ -58,40 +58,31 @@ class ModelGroupHolder : EpoxyHolder() {
}

private fun createViewStubData(viewGroup: ViewGroup): List<ViewStubData> {
val stubs = ArrayList<ViewStubData>(4)
return ArrayList<ViewStubData>(4).apply {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why don't you use Kotlin list : mutableListOf<ViewStubData>() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it was so I could give an initial capacity value

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, why 4 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a somewhat arbitrary guess - groups are generally small, but non zero size

@@ -117,7 +108,7 @@ class ModelGroupHolder : EpoxyHolder() {
if (usingStubs() && stubs.size < modelCount) {
throw IllegalStateException(
"Insufficient view stubs for EpoxyModelGroup. " + modelCount +
" models were provided but only " + stubs.size + " view stubs exist."
" models were provided but only " + stubs.size + " view stubs exist."
Copy link
Contributor

Choose a reason for hiding this comment

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

You could rewrite strings with "...only ${stubs.size} view..."

@@ -217,7 +210,12 @@ private class ViewStubData(
}
}

fun removeView() {
fun resetStub() {
Copy link
Contributor

Choose a reason for hiding this comment

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

private ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's actually used in the holder class in the same file, but ViewStubData is private

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, could reduce to internal then ;)

@elihart elihart merged commit 6f8e85a into master Feb 5, 2019
@elihart elihart deleted the eli-fix_model_group branch February 5, 2019 18:46
@elihart elihart mentioned this pull request Feb 5, 2019
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.

EpoxyModelGroup with ViewStub
2 participants