Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LightCycleAppCompatActivity swallows onOptionsItemSelected #53

Open
xrigau opened this issue Jul 20, 2016 · 1 comment
Open

LightCycleAppCompatActivity swallows onOptionsItemSelected #53

xrigau opened this issue Jul 20, 2016 · 1 comment

Comments

@xrigau
Copy link

xrigau commented Jul 20, 2016

If you create an activity which extends LightCycleAppCompatActivity and it contains a fragment which extends LightCycleSupportFragment, the activity receives a callback to onOptionsItemSelected when you select an option item (as usual), but the fragment doesn't.

It seems like this might be due to LightCycleAppCompatActivity not calling super.onOptionsItemSelected() - therefore the event doesn't get propagated to the fragments in the activity.

See: https://github.com/soundcloud/lightcycle/blob/master/lightcycle-lib/src/main/java/com/soundcloud/lightcycle/LightCycleAppCompatActivity.java#L47

@xrigau
Copy link
Author

xrigau commented Jul 20, 2016

As a temporary solution, forwarding the call manually does the trick. Example:

// In the Activity
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    String tag = getString(R.string.fragment_example);
    return findExampleFragment(tag).onOptionsItemSelected(item);
}

@xrigau xrigau changed the title LightCycle swallows onOptionsItemSelected LightCycleAppCompatActivity swallows onOptionsItemSelected Jul 20, 2016
@michaelengland michaelengland mentioned this issue Dec 8, 2016
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant