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

refactor: Migrate MPLifecycleCallbackDelegate and MPLocationListener class to Kotlin #506

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.mparticle.internal

import android.annotation.TargetApi
import android.app.Activity
import android.app.Application.ActivityLifecycleCallbacks
import android.os.Build
import android.os.Bundle

/**
* This class is used by the AppStateManager to determine when the app is visible or in the background.
*
* Separated into its own class to avoid annoying logcat messages on pre-ICS devices.
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
Mansi-mParticle marked this conversation as resolved.
Show resolved Hide resolved
internal class MPLifecycleCallbackDelegate(private val mStateManager: AppStateManager) :
ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
mStateManager.onActivityCreated(activity, savedInstanceState)
}

override fun onActivityStarted(activity: Activity) {
mStateManager.onActivityStarted(activity)
}

override fun onActivityResumed(activity: Activity) {
mStateManager.onActivityResumed(activity)
}

override fun onActivityPaused(activity: Activity) {
mStateManager.onActivityPaused(activity)
}

override fun onActivityStopped(activity: Activity) {
mStateManager.onActivityStopped(activity)
}

override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
Mansi-mParticle marked this conversation as resolved.
Show resolved Hide resolved
mStateManager.onActivitySaveInstanceState(activity, outState)
}

override fun onActivityDestroyed(activity: Activity) {
mStateManager.onActivityDestroyed(activity)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.mparticle.internal

import android.location.Location
import android.location.LocationListener
import android.os.Bundle
import com.mparticle.MParticle

class MPLocationListener(private val mParticle: MParticle) : LocationListener {
override fun onLocationChanged(location: Location) {
mParticle.setLocation(location)
}

override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {
}

override fun onProviderEnabled(provider: String) {
}

override fun onProviderDisabled(provider: String) {
}
}
Loading