▲ ▲ ▲ /!\ This is a draft▲ ▲ ▲
🚧
Lately, @jenzz created this 3 PRs to dispatch more callbacks :
This exposes the fact that currently the LC API is not consistent. For example ActivityLightCycle provides onCreate, onOptionsItemSelected but not onPostCreate.
Context
Initially, LightCycle were meant to remove the boilerplate to hook up a presenter to an Activity/Fragment lifecycle. The library was basically handling the same callbacks than ActivityLifecycleCallbacks. But, as we used it more and more across the SoundCloud app and other companies apps, we ended adding others callbacks as we felt the need.
We even added boolean onOptionsItemSelected(T activity, MenuItem item);. On the other hand, we decided to not add onCreateOptionsMenu since it was decided it would be the responsibility of the activity to inflate layouts.
Let's rethink the API
Goals
- Define a consistent API for LC
Proposals
Activity
// TODO
Fragment
// TODO
▲ ▲ ▲ /!\ This is a draft▲ ▲ ▲
🚧
Lately, @jenzz created this 3 PRs to dispatch more callbacks :
This exposes the fact that currently the LC API is not consistent. For example ActivityLightCycle provides
onCreate,onOptionsItemSelectedbut notonPostCreate.Context
Initially, LightCycle were meant to remove the boilerplate to hook up a presenter to an Activity/Fragment lifecycle. The library was basically handling the same callbacks than ActivityLifecycleCallbacks. But, as we used it more and more across the SoundCloud app and other companies apps, we ended adding others callbacks as we felt the need.
We even added
boolean onOptionsItemSelected(T activity, MenuItem item);. On the other hand, we decided to not addonCreateOptionsMenusince it was decided it would be the responsibility of the activity to inflate layouts.Let's rethink the API
Goals
Proposals
Activity
// TODO
Fragment
// TODO