forked from organicmaps/organicmaps
Add the Statistics class. Put in Activity hooks.
This commit is contained in:
parent
b038b09dd7
commit
cad6497eb1
9 changed files with 169 additions and 0 deletions
|
@ -18,6 +18,7 @@ import android.widget.Toast;
|
|||
import com.mapswithme.maps.MapStorage.Index;
|
||||
import com.mapswithme.maps.location.LocationService;
|
||||
import com.mapswithme.util.ConnectionState;
|
||||
import com.mapswithme.util.Statistics;
|
||||
|
||||
public class DownloadResourcesActivity extends Activity implements LocationService.Listener, MapStorage.Listener
|
||||
{
|
||||
|
@ -351,6 +352,22 @@ public class DownloadResourcesActivity extends Activity implements LocationServi
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy()
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.mapswithme.maps.MapStorage.Index;
|
||||
import com.mapswithme.util.ConnectionState;
|
||||
import com.mapswithme.util.Statistics;
|
||||
|
||||
|
||||
public class DownloadUI extends ListActivity implements MapStorage.Listener
|
||||
|
@ -611,6 +612,22 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener
|
|||
|
||||
setListAdapter(new DownloadAdapter(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
private DownloadAdapter getDA()
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.widget.Spinner;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.mapswithme.maps.location.LocationService;
|
||||
import com.mapswithme.util.Statistics;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
|
||||
|
@ -460,6 +461,22 @@ public class SearchActivity extends ListActivity implements LocationService.List
|
|||
setListAdapter(new SearchAdapter(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.view.MenuItem;
|
|||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.util.Statistics;
|
||||
|
||||
public abstract class AbstractBookmarkActivity extends Activity
|
||||
{
|
||||
|
@ -29,6 +30,22 @@ public abstract class AbstractBookmarkActivity extends Activity
|
|||
bar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.view.MenuItem;
|
|||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.util.Statistics;
|
||||
|
||||
public abstract class AbstractBookmarkListActivity extends ListActivity
|
||||
{
|
||||
|
@ -31,6 +32,22 @@ public abstract class AbstractBookmarkListActivity extends ListActivity
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.preference.Preference.OnPreferenceClickListener;
|
|||
import android.preference.PreferenceActivity;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.Statistics;
|
||||
|
||||
public class SettingsActivity extends PreferenceActivity
|
||||
{
|
||||
|
@ -45,4 +46,20 @@ public class SettingsActivity extends PreferenceActivity
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.widget.ListView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.Statistics;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
|
||||
|
@ -487,6 +488,22 @@ public class StoragePathActivity extends ListActivity
|
|||
setListAdapter(new StoragePathAdapter(this, currPath, defPath));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(final ListView l, View v, final int position, long id)
|
||||
{
|
||||
|
|
45
android/src/com/mapswithme/util/Statistics.java
Normal file
45
android/src/com/mapswithme/util/Statistics.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package com.mapswithme.util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public enum Statistics
|
||||
{
|
||||
INSTANCE;
|
||||
private Statistics()
|
||||
{
|
||||
Log.d("Stats", "Created Statistics instance.");
|
||||
}
|
||||
|
||||
public void startActivity(String name)
|
||||
{
|
||||
synchronized ("live")
|
||||
{
|
||||
if (liveActivities == 0)
|
||||
{
|
||||
Log.d(TAG, "NEW SESSION.");
|
||||
}
|
||||
|
||||
++liveActivities;
|
||||
}
|
||||
|
||||
Log.d(TAG, "Started activity: " + name + ".");
|
||||
}
|
||||
|
||||
public void stopActivity(String name)
|
||||
{
|
||||
Log.d(TAG, "Stopped activity: " + name + ".");
|
||||
|
||||
synchronized ("live")
|
||||
{
|
||||
--liveActivities;
|
||||
if (liveActivities == 0)
|
||||
{
|
||||
Log.d(TAG, "FINISHED SESSION.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int liveActivities = 0;
|
||||
private final String TAG = "Stats";
|
||||
// private FlurryAgent flurryAgent;
|
||||
}
|
|
@ -20,6 +20,7 @@ import android.view.SurfaceHolder.Callback;
|
|||
import android.view.SurfaceView;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.Statistics;
|
||||
|
||||
public abstract class NvEventQueueActivity extends Activity
|
||||
{
|
||||
|
@ -159,6 +160,8 @@ public abstract class NvEventQueueActivity extends Activity
|
|||
System.out.println("**** onStart");
|
||||
super.onStart();
|
||||
|
||||
Statistics.INSTANCE.startActivity(this.getClass().getSimpleName());
|
||||
|
||||
if (m_nativeLaunched)
|
||||
onStartNative();
|
||||
}
|
||||
|
@ -220,6 +223,8 @@ public abstract class NvEventQueueActivity extends Activity
|
|||
{
|
||||
System.out.println("**** onStop");
|
||||
super.onStop();
|
||||
|
||||
Statistics.INSTANCE.stopActivity(this.getClass().getSimpleName());
|
||||
|
||||
if (m_nativeLaunched)
|
||||
onStopNative();
|
||||
|
|
Loading…
Add table
Reference in a new issue