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

CustomTabsActivityLifecycleCallbacks for applications with multiple activites #10

Closed
ghost opened this issue Jan 31, 2018 · 2 comments
Closed

Comments

@ghost
Copy link

ghost commented Jan 31, 2018

Hello,

I'd like to register the CustomTabsActivityLifecycleCallbacks, but my application has two activities, one is the splash screen and one is the main activity. Is there a way that this callback can only do operations on a specified activity? I'd like to only use this for our main activity.

Thanks for the awesome library!

@saschpe
Copy link
Owner

saschpe commented Feb 5, 2018

I could provide another implementation based on the lifecycle library (https://developer.android.com/topic/libraries/architecture/lifecycle.html) but that would add another dependency. It would allow to pre-load only for specific activities but needs more setup in onCreate(). However, re-creating what the CustomTabsActivityLifecycleCallbacks does is simple:

private CustomTabsHelper customTabsHelper;
@Override
public void onCreate(Bundle savedInstanceState) {
    customTabsHelper = new CustomTabsHelper();
}
@Override
public void onResume() {
    customTabsHelper.bindCustomTabsService(activity);
}
@Override
public void onPause() {
    customTabsHelper.unbindCustomTabsService(activity);
}

@ghost
Copy link
Author

ghost commented Feb 5, 2018

Gotcha, recreating would be the way to go. Thanks for the help

@ghost ghost closed this as completed Feb 5, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant