Loading src/com/android/calendar/AllInOneActivity.java +9 −5 Original line number Diff line number Diff line Loading @@ -16,11 +16,6 @@ package com.android.calendar; import static android.provider.CalendarContract.EXTRA_EVENT_ALL_DAY; import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME; import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME; import static android.provider.CalendarContract.Attendees.ATTENDEE_STATUS; import android.accounts.AccountManager; import android.accounts.AccountManagerCallback; import android.accounts.AccountManagerFuture; Loading Loading @@ -82,6 +77,11 @@ import java.util.List; import java.util.Locale; import java.util.TimeZone; import static android.provider.CalendarContract.Attendees.ATTENDEE_STATUS; import static android.provider.CalendarContract.EXTRA_EVENT_ALL_DAY; import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME; import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME; public class AllInOneActivity extends AbstractCalendarActivity implements EventHandler, OnSharedPreferenceChangeListener, SearchView.OnQueryTextListener, ActionBar.TabListener, ActionBar.OnNavigationListener, OnSuggestionListener { Loading Loading @@ -886,6 +886,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH mActionBar.setSelectedNavigationItem(CalendarViewAdapter.AGENDA_BUTTON_INDEX); } frag = new AgendaFragment(timeMillis, false); ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("agenda"); break; case ViewType.DAY: if (mActionBar != null && (mActionBar.getSelectedTab() != mDayTab)) { Loading @@ -895,6 +896,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH mActionBar.setSelectedNavigationItem(CalendarViewAdapter.DAY_BUTTON_INDEX); } frag = new DayFragment(timeMillis, 1); ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("day"); break; case ViewType.MONTH: if (mActionBar != null && (mActionBar.getSelectedTab() != mMonthTab)) { Loading @@ -907,6 +909,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH if (mShowAgendaWithMonth) { secFrag = new AgendaFragment(timeMillis, false); } ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("month"); break; case ViewType.WEEK: default: Loading @@ -917,6 +920,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH mActionBar.setSelectedNavigationItem(CalendarViewAdapter.WEEK_BUTTON_INDEX); } frag = new DayFragment(timeMillis, 7); ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("week"); break; } Loading src/com/android/calendar/AnalyticsLogger.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package com.android.calendar; import android.content.Context; /** * Interface for analytics logging. */ public interface AnalyticsLogger { /** * Open backend of logger. * * @param context need to open backend of logger. * @return true, if analytics logging is ready to be use. */ public boolean initialize(Context context); /** * Track what view people are using. * * @param name of the view. */ public void trackView(String name); } src/com/android/calendar/ExtensionsFactory.java +53 −21 Original line number Diff line number Diff line Loading @@ -42,9 +42,11 @@ public class ExtensionsFactory { private static String ALL_IN_ONE_MENU_KEY = "AllInOneMenuExtensions"; private static String CLOUD_NOTIFICATION_KEY = "CloudNotificationChannel"; private static String ANALYTICS_LOGGER_KEY = "AnalyticsLogger"; private static Properties sProperties = new Properties(); private static AllInOneMenuExtensionsInterface sAllInOneMenuExtensions = null; private static AnalyticsLogger sAnalyticsLogger = null; public static void init(AssetManager assetManager) { try { Loading Loading @@ -74,7 +76,10 @@ public class ExtensionsFactory { } public static AllInOneMenuExtensionsInterface getAllInOneMenuExtensions() { if (sAllInOneMenuExtensions == null) { if ((sAllInOneMenuExtensions != null)) { return sAllInOneMenuExtensions; } String className = sProperties.getProperty(ALL_IN_ONE_MENU_KEY); if (className != null) { sAllInOneMenuExtensions = createInstance(className); Loading @@ -95,8 +100,6 @@ public class ExtensionsFactory { } }; } } return sAllInOneMenuExtensions; } Loading Loading @@ -134,4 +137,33 @@ public class ExtensionsFactory { return cnb; } public static AnalyticsLogger getAnalyticsLogger(Context context) { if (sAnalyticsLogger != null) { return sAnalyticsLogger; } String className = sProperties.getProperty(ANALYTICS_LOGGER_KEY); if (className != null) { sAnalyticsLogger = createInstance(className); } else { Log.d(TAG, ANALYTICS_LOGGER_KEY + " not found in properties file."); } if (sAnalyticsLogger == null) { sAnalyticsLogger = new AnalyticsLogger() { @Override public boolean initialize(Context context) { return true; } @Override public void trackView(String name) { } }; } sAnalyticsLogger.initialize(context); return sAnalyticsLogger; } } Loading
src/com/android/calendar/AllInOneActivity.java +9 −5 Original line number Diff line number Diff line Loading @@ -16,11 +16,6 @@ package com.android.calendar; import static android.provider.CalendarContract.EXTRA_EVENT_ALL_DAY; import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME; import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME; import static android.provider.CalendarContract.Attendees.ATTENDEE_STATUS; import android.accounts.AccountManager; import android.accounts.AccountManagerCallback; import android.accounts.AccountManagerFuture; Loading Loading @@ -82,6 +77,11 @@ import java.util.List; import java.util.Locale; import java.util.TimeZone; import static android.provider.CalendarContract.Attendees.ATTENDEE_STATUS; import static android.provider.CalendarContract.EXTRA_EVENT_ALL_DAY; import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME; import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME; public class AllInOneActivity extends AbstractCalendarActivity implements EventHandler, OnSharedPreferenceChangeListener, SearchView.OnQueryTextListener, ActionBar.TabListener, ActionBar.OnNavigationListener, OnSuggestionListener { Loading Loading @@ -886,6 +886,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH mActionBar.setSelectedNavigationItem(CalendarViewAdapter.AGENDA_BUTTON_INDEX); } frag = new AgendaFragment(timeMillis, false); ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("agenda"); break; case ViewType.DAY: if (mActionBar != null && (mActionBar.getSelectedTab() != mDayTab)) { Loading @@ -895,6 +896,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH mActionBar.setSelectedNavigationItem(CalendarViewAdapter.DAY_BUTTON_INDEX); } frag = new DayFragment(timeMillis, 1); ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("day"); break; case ViewType.MONTH: if (mActionBar != null && (mActionBar.getSelectedTab() != mMonthTab)) { Loading @@ -907,6 +909,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH if (mShowAgendaWithMonth) { secFrag = new AgendaFragment(timeMillis, false); } ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("month"); break; case ViewType.WEEK: default: Loading @@ -917,6 +920,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH mActionBar.setSelectedNavigationItem(CalendarViewAdapter.WEEK_BUTTON_INDEX); } frag = new DayFragment(timeMillis, 7); ExtensionsFactory.getAnalyticsLogger(getBaseContext()).trackView("week"); break; } Loading
src/com/android/calendar/AnalyticsLogger.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package com.android.calendar; import android.content.Context; /** * Interface for analytics logging. */ public interface AnalyticsLogger { /** * Open backend of logger. * * @param context need to open backend of logger. * @return true, if analytics logging is ready to be use. */ public boolean initialize(Context context); /** * Track what view people are using. * * @param name of the view. */ public void trackView(String name); }
src/com/android/calendar/ExtensionsFactory.java +53 −21 Original line number Diff line number Diff line Loading @@ -42,9 +42,11 @@ public class ExtensionsFactory { private static String ALL_IN_ONE_MENU_KEY = "AllInOneMenuExtensions"; private static String CLOUD_NOTIFICATION_KEY = "CloudNotificationChannel"; private static String ANALYTICS_LOGGER_KEY = "AnalyticsLogger"; private static Properties sProperties = new Properties(); private static AllInOneMenuExtensionsInterface sAllInOneMenuExtensions = null; private static AnalyticsLogger sAnalyticsLogger = null; public static void init(AssetManager assetManager) { try { Loading Loading @@ -74,7 +76,10 @@ public class ExtensionsFactory { } public static AllInOneMenuExtensionsInterface getAllInOneMenuExtensions() { if (sAllInOneMenuExtensions == null) { if ((sAllInOneMenuExtensions != null)) { return sAllInOneMenuExtensions; } String className = sProperties.getProperty(ALL_IN_ONE_MENU_KEY); if (className != null) { sAllInOneMenuExtensions = createInstance(className); Loading @@ -95,8 +100,6 @@ public class ExtensionsFactory { } }; } } return sAllInOneMenuExtensions; } Loading Loading @@ -134,4 +137,33 @@ public class ExtensionsFactory { return cnb; } public static AnalyticsLogger getAnalyticsLogger(Context context) { if (sAnalyticsLogger != null) { return sAnalyticsLogger; } String className = sProperties.getProperty(ANALYTICS_LOGGER_KEY); if (className != null) { sAnalyticsLogger = createInstance(className); } else { Log.d(TAG, ANALYTICS_LOGGER_KEY + " not found in properties file."); } if (sAnalyticsLogger == null) { sAnalyticsLogger = new AnalyticsLogger() { @Override public boolean initialize(Context context) { return true; } @Override public void trackView(String name) { } }; } sAnalyticsLogger.initialize(context); return sAnalyticsLogger; } }