stepstone-tech / android-material-stepper

This library allows to use Material steppers inside Android applications.
Apache License 2.0
1.78k stars 262 forks source link

[query] Using livedata with stepper #265

Closed root-ansh closed 5 years ago

root-ansh commented 6 years ago

I have 2 questions here :

  1. Does StepperLayout loads all the fragments(i.e the steps) at one go? I mean , i created a sample app having a button on the click of which opens another Activity with StepperLayout's implementation and adapter . It was a simple adaptr with 2 fragments. However , on logging , I found functions of 2nd fragment/step being invocked , when the user is still on first fragment/step .

  2. While using with AAC's livedata and viewmodel , i keep getting empty lists indicating viewmodels/livedata not working properly .It might be some poor implementations on my side,(or OS's side , i heard that viewmodel/livedata don't work nicely with fragments.), but could you confirm it or provide a basic example of ideal usage with livedata ? I am a beginner developer, so just thought of confirming before adding full log scripts or steps to reproduce.

Thankyou .(And by the way, Great library, a ton of thanks!)

zawadz88 commented 6 years ago

Hi, Regarding 1 - StepperLayout uses a ViewPager internally so the nearest Fragments to the left and right are created. If you want to do some operation once the Fragment gets selected you can use one of the callback methods to do that. Regarding 2 - could you elaborate a bit more on:

i keep getting empty lists indicating viewmodels/livedata not working properly

What kind of LiveData sample are you looking for?

root-ansh commented 5 years ago

wow its been open for almost an year. i don't even remember in which project i used this library. not to worry, i think that problem would have been solved. thanks for your help💯