Advertisement
drinfernoo

Untitled

Aug 20th, 2022
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. good day all :wave: i'm working on a leanback app (have a *bit* of standard android experience, but it was many years ago, and i'm quite rusty), and attempting to embrace support libraries, kotlin, and a handful of the other "new" stuff that has come along in my absence...
  2.  
  3. i'm really struggling to wrap my head around the idea of callbacks, the concept of coroutines in kotlin, the relationship between the two, and how to use them effectively and cleanly.
  4.  
  5. in particular, my current project is a "simple" video browser (at this point), which so far uses the provided leanback support classes, to query TMDb for lists of movies, then queries for extended details about each movie in the list, in order to get artwork, details, etc.
  6.  
  7. i'm doing this with retrofit + moshi (for the queries), and glide (for the images, obviously), which works fine for loading the images themselves, but has got me in "callback hell" already, and doesn't really lend itself well to the next feature i'd like to implement: palette matching.
  8.  
  9. the logic i'm using for all the aforementioned callbacks is included here: https://gist.github.com/dmyoung9/8641facbc9214c3f35e11df28d7b60c5, but is only the pertinent code rather than the entire contents. this also seems to work "fine", but has a couple unintended behaviors at the moment that i can't quite figure out:
  10.  
  11. * palette colors often don't get shown until the VH has been rebound
  12. * the currently selected card often has the wrong color (in some cases very obviously a color from an adjacent card)
  13. * callbacks :face_with_symbols_over_mouth:
  14.  
  15. are there any recommended resources, tips, or any other help you guys could offer me here?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement