time spent

This commit is contained in:
Milos Kozak 2019-10-15 23:50:09 +02:00
parent 7bbf30ec65
commit 3a16339516
2 changed files with 42 additions and 1 deletions

View file

@ -51,6 +51,7 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
import info.nightscout.androidaps.plugins.general.signatureVerifier.SignatureVerifier;
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
import info.nightscout.androidaps.plugins.general.timeSpent.TS;
import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerPlugin;
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
@ -138,6 +139,8 @@ public class MainApp extends Application {
log.error("Error with Fabric init! " + e);
}
registerActivityLifecycleCallbacks(TS.INSTANCE);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseAnalytics.setAnalyticsCollectionEnabled(!Boolean.getBoolean("disableFirebase"));
@ -438,7 +441,7 @@ public class MainApp extends Application {
if (timeDateOrTZChangeReceiver != null) {
unregisterReceiver(timeDateOrTZChangeReceiver);
}
unregisterActivityLifecycleCallbacks(TS.INSTANCE);
}
public static int dpToPx(int dp) {

View file

@ -0,0 +1,38 @@
package info.nightscout.androidaps.plugins.general.timeSpent
import android.app.Activity
import android.app.Application
import android.os.Bundle
import info.nightscout.androidaps.logging.L
import org.slf4j.LoggerFactory
object TS : Application.ActivityLifecycleCallbacks {
private val log = LoggerFactory.getLogger(L.CORE)
override fun onActivityPaused(activity: Activity?) {
log.debug("onActivityPaused " + activity?.localClassName)
}
override fun onActivityResumed(activity: Activity?) {
log.debug("onActivityResumed " + activity?.localClassName)
}
override fun onActivityStarted(activity: Activity?) {
log.debug("onActivityStarted " + activity?.localClassName)
}
override fun onActivityDestroyed(activity: Activity?) {
log.debug("onActivityDestroyed " + activity?.localClassName)
}
override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
log.debug("onActivitySaveInstanceState " + activity?.localClassName)
}
override fun onActivityStopped(activity: Activity?) {
log.debug("onActivityStopped " + activity?.localClassName)
}
override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
log.debug("onActivityCreated " + activity?.localClassName)
}
}