-
Notifications
You must be signed in to change notification settings - Fork 729
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
Conversation
6a7ee01
to
dddbe98
Compare
@@ -58,40 +58,31 @@ class ModelGroupHolder : EpoxyHolder() { | |||
} | |||
|
|||
private fun createViewStubData(viewGroup: ViewGroup): List<ViewStubData> { | |||
val stubs = ArrayList<ViewStubData>(4) | |||
return ArrayList<ViewStubData>(4).apply { |
There was a problem hiding this comment.
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>()
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, why 4 ?
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ;)
Should fix #672 and #675
Tests were updated to catch these issues