voddan
10/31/2019, 8:58 PMPablichjenkov
10/31/2019, 9:15 PMonLayout
methods.voddan
10/31/2019, 10:22 PMPablichjenkov
10/31/2019, 10:24 PMmanually recreate lifecycle for the view
Pablichjenkov
10/31/2019, 10:38 PMonLayout
overide.
After the CustomFrameLayout is Layout then I would subscribe to the Observable to start receiving events. Every time a new event arrives then update your View. Depending on the type of subviews you are updating you may need to call `invalidate()`inside your CustomFrameLayout.
OnAttach/onDetach are called when your View is remove from the ViewTree. In most cases due to ViewTree destruction. You can also send an onComplete()
signal from the data source to the View to indicate completion.
If you want a more fine control over the specific Activity LifeCycle then you will need a mechanism to propagate them up to the View manually. There is no a nice class that propagate them to the View. I think it was one of the initial handy features about Fragments.czuckie
10/31/2019, 10:57 PMvoddan
11/01/2019, 10:03 AMThere is no a nice class that propagate them to the View. I think it was one of the initial handy features about Fragments.That's what i have been searching for. Good to know that there isn't one from Google. Will try to implement myself or find a 3rd party one
voddan
11/01/2019, 10:06 AMusing the lifecycle management library would probably be the best bet.I am trying to use lifecycle components the best i can. How would you implement it? Pass it though from the activity or implement a new lifecycle object?
Steve
11/01/2019, 5:18 PMvoddan
11/01/2019, 6:40 PMCaution: A ViewModel must never reference a view, Lifecycle, or any class that may hold a reference to the activity context.