Office Hours — Today, October 5

Thursday, October 3

Oct 5
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:25 PM
Joshua R.
has entered the room
Joshua R.
Hello!
Mark M.
hello, Joshua!
how can I help you today?
Joshua R.
Hey, thanks for hosting this!
Mark M.
thanks for subscribing! :-)
Joshua R.
So I had a question about dealing with dynamic views in a recyclerview item
I'll give you an example design
So i have this currently implemented, however its not very performant
Each of those cards are recyclerview items and inside I can have any number of rows
Mark M.
unless there are going to be a lot more cards, you won't actually recycle much, if anything
Joshua R.
Yea, there wouldn't be too many generally, but even with this few.
When i scroll it lags pretty badly
I tried keeping a viewPool so I don't inflate views each time I bind
it improved a bit, but its still pretty slow
Mark M.
RecyclerView already does that
Joshua R.
How would you go about designing this?
4:30 PM
Mark M.
what is the maximum likely number of cards, and what is the maximum likely number of rows per card?
Joshua R.
Number of rows could be anything honestly, same with the cards
Someone could decide to have a exercise with 100 sets (not likely but who knows)
which would mean 100 rows in one card
Mark M.
and you're sure that you want this all on one screen? that design seems to be aimed for a tablet
Joshua R.
I've looked at other designs (particularly fitness apps)
This seems to be what I would want to go with
but regardless the main issue with the performance is adding those rows into the view dynamically while binding
its definitely slow
Remember the card itself is the recyclerview item, the views inside are added as the recyclerview binds the card itself
Mark M.
yeah, I'm not sure that I'd go about it that way
Joshua R.
View paste
So what would be the best way then?

Would i just need to change my design?
Mark M.
I mean, you can do it, but I would lean towards a flatter implementation, where each horizontal thing is a row in the RecyclerView, with a variety of row types
Joshua R.
I was thinking about that
However I would like to keep the card design
Mark M.
you still can
Joshua R.
Maybe I'd implement a background in each item?
Mark M.
right
Joshua R.
so it looks like its a whole card
Hmm
good idea
I think I'll try that Mark!
Mark M.
if I am understanding what's in the RV correctly, I think you wind up with three row types:
4:35 PM
Mark M.
no, sorry, four: one for the short title, one for the table heading, one for an interior row, and one for an end row
Joshua R.
Yea
Mark M.
alternatively, you could consider all rows to be "interior" and have the bottom of the card be another row
Joshua R.
Yea that sounds right
okay that sounds awesome to me
Mark M.
AFAIK, if you do not set up any item decorations, each RV element should be immediately adjacent to the next one
so, the cards should be seamless
Joshua R.
Awesome.
I'll try that out Mark! Thanks for the help
Mark M.
you're welcome!
if you think of it, let me know how it turns out!
Joshua R.
I'll come back in a future session for an update!
Sure!
thanks!
4:50 PM
Joshua R.
has left the room
5:00 PM
Mark M.
turned off guest access

Thursday, October 3

 

Office Hours

People in this transcript

  • Joshua Rodriguez
  • Mark Murphy

Files in this transcript