Skip to content

Commit

Permalink
Make ActivityLifecycleListener extend ActivityLifecycleCallacks with …
Browse files Browse the repository at this point in the history
…no-op defaults (#1124)

## Goal

Make the listener implement `ActivityLifecycleCallbacks` with default no-op implementations so we can observe more lifecycle events.
  • Loading branch information
bidetofevil authored Jul 26, 2024
1 parent 0a3fa76 commit a7d76f3
Showing 1 changed file with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
package io.embrace.android.embracesdk.internal.session.lifecycle

import android.app.Activity
import android.app.Application.ActivityLifecycleCallbacks
import android.os.Bundle

/**
* Listener implemented by observers of the [ActivityLifecycleTracker].
* Implementation of [ActivityLifecycleCallbacks] with no-op defaults
*/
public interface ActivityLifecycleListener {

/**
* Triggered when an activity is opened.
*
* @param activity details of the activity
*/
public fun onActivityStarted(activity: Activity) {}

/**
* Triggered when an activity is closed.
*
* @param activity details of the activity
*/
public fun onActivityStopped(activity: Activity) {}

/**
* Triggered when an activity is created.
*
* @param activity the activity
* @param bundle the bundle
*/
public fun onActivityCreated(activity: Activity, bundle: Bundle?) {}
public interface ActivityLifecycleListener : ActivityLifecycleCallbacks {

public override fun onActivityCreated(activity: Activity, bundle: Bundle?) {}

public override fun onActivityStarted(activity: Activity) {}

public override fun onActivityResumed(activity: Activity) {}

public override fun onActivityPaused(activity: Activity) {}

public override fun onActivityStopped(activity: Activity) {}

public override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}

public override fun onActivityDestroyed(activity: Activity) {}
}

0 comments on commit a7d76f3

Please sign in to comment.