diff options
author | Alex Zolotarev <alex@mapswithme.com> | 2013-03-17 01:08:48 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:51:52 +0300 |
commit | ac40a717e5b2fc56a4fe11166460d290336661e8 (patch) | |
tree | cecc3237fd84d544d8b8f370638805f2ea2f7c74 /android | |
parent | cad6497eb13f2f3c22ef298b19d3fe08f34eff39 (diff) |
Pass the context into Stats.
Diffstat (limited to 'android')
9 files changed, 40 insertions, 29 deletions
diff --git a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java index a2253d02d8..685efc0b86 100644 --- a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java +++ b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java @@ -357,7 +357,7 @@ public class DownloadResourcesActivity extends Activity implements LocationServi { super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); } @Override @@ -365,7 +365,7 @@ public class DownloadResourcesActivity extends Activity implements LocationServi { super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); } @Override diff --git a/android/src/com/mapswithme/maps/DownloadUI.java b/android/src/com/mapswithme/maps/DownloadUI.java index 718d29b1ae..329e1ac0a3 100644 --- a/android/src/com/mapswithme/maps/DownloadUI.java +++ b/android/src/com/mapswithme/maps/DownloadUI.java @@ -618,7 +618,7 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener { super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); } @Override @@ -626,7 +626,7 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener { super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); } private DownloadAdapter getDA() diff --git a/android/src/com/mapswithme/maps/SearchActivity.java b/android/src/com/mapswithme/maps/SearchActivity.java index a91d9dc373..66840c3443 100644 --- a/android/src/com/mapswithme/maps/SearchActivity.java +++ b/android/src/com/mapswithme/maps/SearchActivity.java @@ -466,7 +466,7 @@ public class SearchActivity extends ListActivity implements LocationService.List { super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); } @Override @@ -474,7 +474,7 @@ public class SearchActivity extends ListActivity implements LocationService.List { super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); } @Override diff --git a/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkActivity.java b/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkActivity.java index 5cfe4c4f45..8509d26295 100644 --- a/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkActivity.java +++ b/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkActivity.java @@ -36,7 +36,7 @@ public abstract class AbstractBookmarkActivity extends Activity { super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); } @Override @@ -44,7 +44,7 @@ public abstract class AbstractBookmarkActivity extends Activity { super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); } @Override diff --git a/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkListActivity.java b/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkListActivity.java index afb07e9359..37c9cf1c5a 100644 --- a/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkListActivity.java +++ b/android/src/com/mapswithme/maps/bookmarks/AbstractBookmarkListActivity.java @@ -37,7 +37,7 @@ public abstract class AbstractBookmarkListActivity extends ListActivity { super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); } @Override @@ -45,7 +45,7 @@ public abstract class AbstractBookmarkListActivity extends ListActivity { super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); } @Override diff --git a/android/src/com/mapswithme/maps/settings/SettingsActivity.java b/android/src/com/mapswithme/maps/settings/SettingsActivity.java index f6f325a80f..d5e1d2a9c1 100644 --- a/android/src/com/mapswithme/maps/settings/SettingsActivity.java +++ b/android/src/com/mapswithme/maps/settings/SettingsActivity.java @@ -52,7 +52,7 @@ public class SettingsActivity extends PreferenceActivity { super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); } @Override @@ -60,6 +60,6 @@ public class SettingsActivity extends PreferenceActivity { super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); } } diff --git a/android/src/com/mapswithme/maps/settings/StoragePathActivity.java b/android/src/com/mapswithme/maps/settings/StoragePathActivity.java index 50bee410a3..c7c917cc04 100644 --- a/android/src/com/mapswithme/maps/settings/StoragePathActivity.java +++ b/android/src/com/mapswithme/maps/settings/StoragePathActivity.java @@ -493,7 +493,7 @@ public class StoragePathActivity extends ListActivity { super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); } @Override @@ -501,7 +501,7 @@ public class StoragePathActivity extends ListActivity { super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); } @Override diff --git a/android/src/com/mapswithme/util/Statistics.java b/android/src/com/mapswithme/util/Statistics.java index 99e5addc07..9ccc94863d 100644 --- a/android/src/com/mapswithme/util/Statistics.java +++ b/android/src/com/mapswithme/util/Statistics.java @@ -1,44 +1,55 @@ package com.mapswithme.util; +import android.content.Context; import android.util.Log; +import com.flurry.android.FlurryAgent; +import com.mapswithme.maps.R; public enum Statistics { INSTANCE; - private Statistics() + private Statistics() { Log.d("Stats", "Created Statistics instance."); + + FlurryAgent.setUseHttps(true); + + FlurryAgent.setLogEnabled(true); + FlurryAgent.setLogLevel(Log.DEBUG); } - - public void startActivity(String name) + + public void startActivity(Context context) { - synchronized ("live") + synchronized ("live") { if (liveActivities == 0) { Log.d(TAG, "NEW SESSION."); + FlurryAgent.onStartSession(context, (String)context.getResources().getText( + R.string.flurry_app_key)); } - + ++liveActivities; } - - Log.d(TAG, "Started activity: " + name + "."); + + Log.d(TAG, "Started activity: " + context.getClass().getSimpleName() + "."); } - - public void stopActivity(String name) + + public void stopActivity(Context context) { - Log.d(TAG, "Stopped activity: " + name + "."); - - synchronized ("live") + Log.d(TAG, "Stopped activity: " + context.getClass().getSimpleName() + "."); + + synchronized ("live") { --liveActivities; if (liveActivities == 0) { Log.d(TAG, "FINISHED SESSION."); + FlurryAgent.onEndSession(context); } } } - + private int liveActivities = 0; private final String TAG = "Stats"; // private FlurryAgent flurryAgent; diff --git a/android/src/com/nvidia/devtech/NvEventQueueActivity.java b/android/src/com/nvidia/devtech/NvEventQueueActivity.java index 02a88b4a6a..e43c54e1b9 100644 --- a/android/src/com/nvidia/devtech/NvEventQueueActivity.java +++ b/android/src/com/nvidia/devtech/NvEventQueueActivity.java @@ -160,7 +160,7 @@ public abstract class NvEventQueueActivity extends Activity System.out.println("**** onStart"); super.onStart(); - Statistics.INSTANCE.startActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.startActivity(this); if (m_nativeLaunched) onStartNative(); @@ -224,7 +224,7 @@ public abstract class NvEventQueueActivity extends Activity System.out.println("**** onStop"); super.onStop(); - Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName()); + Statistics.INSTANCE.stopActivity(this); if (m_nativeLaunched) onStopNative(); |