From 2af1ab6ac4c1a5ed812e9e3a3dd5b25121205712 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 3 Mar 2017 21:12:59 +0100 Subject: [PATCH] more Answers to user actions --- .../androidaps/plugins/Actions/dialogs/FillDialog.java | 4 ++++ .../plugins/Actions/dialogs/NewExtendedBolusDialog.java | 4 ++++ .../plugins/Actions/dialogs/NewTempBasalDialog.java | 5 ++++- .../plugins/Careportal/Dialogs/NewNSTreatmentDialog.java | 5 +++++ .../plugins/ConfigBuilder/ConfigBuilderFragment.java | 4 ++++ .../nightscout/androidaps/plugins/Loop/LoopFragment.java | 3 +++ .../plugins/NSClientInternal/NSClientInternalFragment.java | 7 +++++++ .../androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java | 3 +++ .../androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java | 3 +++ .../plugins/Overview/Dialogs/CalibrationDialog.java | 4 ++++ .../plugins/Overview/Dialogs/NewTreatmentDialog.java | 4 ++++ .../androidaps/plugins/Overview/Dialogs/WizardDialog.java | 4 ++++ .../androidaps/plugins/Overview/OverviewFragment.java | 5 +++++ .../androidaps/plugins/Treatments/TreatmentsFragment.java | 3 +++ 14 files changed, 57 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java index 3331228f65..8f50ac28e0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java @@ -18,6 +18,9 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; + import java.text.DecimalFormat; import info.nightscout.androidaps.Constants; @@ -166,6 +169,7 @@ public class FillDialog extends DialogFragment implements OnClickListener { } } }); + Answers.getInstance().logCustom(new CustomEvent("Fill")); } } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java index 56ffa69d5f..ee726efb4d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java @@ -14,6 +14,9 @@ import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; + import java.text.DecimalFormat; import info.nightscout.androidaps.Constants; @@ -117,6 +120,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli } } }); + Answers.getInstance().logCustom(new CustomEvent("ExtendedBolus")); } }); builder.setNegativeButton(getString(R.string.cancel), null); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java index f29d6e18ff..75d9bcec11 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java @@ -16,6 +16,9 @@ import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; + import java.text.DecimalFormat; import info.nightscout.androidaps.Constants; @@ -158,7 +161,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi } } }); - + Answers.getInstance().logCustom(new CustomEvent("TempBasal")); } }); builder.setNegativeButton(getString(R.string.cancel), null); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java index b7fcab69a7..68d24b7dda 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java @@ -24,6 +24,8 @@ import android.widget.RadioButton; import android.widget.Spinner; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; import com.j256.ormlite.dao.Dao; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout; @@ -627,6 +629,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick data.put("percentage", cpp.percentage); } ConfigBuilderPlugin.uploadCareportalEntryToNS(data); + Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch")); } catch (JSONException e) { e.printStackTrace(); } @@ -657,6 +660,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick dao.createIfNotExists(tempTarget); MainApp.bus().post(new EventTempTargetRangeChange()); ConfigBuilderPlugin.uploadCareportalEntryToNS(data); + Answers.getInstance().logCustom(new CustomEvent("TempTarget")); } catch (JSONException | SQLException e) { e.printStackTrace(); } @@ -668,6 +672,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick } } else { ConfigBuilderPlugin.uploadCareportalEntryToNS(data); + Answers.getInstance().logCustom(new CustomEvent("NSTreatment")); } } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java index 62fe0042e3..6436441890 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java @@ -16,6 +16,9 @@ import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; + import java.util.ArrayList; import info.nightscout.androidaps.MainApp; @@ -214,6 +217,7 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase { MainApp.bus().post(new EventRefreshGui(true)); MainApp.bus().post(new EventConfigBuilderChange()); getPlugin().logPluginStatus(); + Answers.getInstance().logCustom(new CustomEvent("ConfigurationChange")); } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java index a183e28345..43a8fa3c83 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java @@ -10,6 +10,8 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; import com.squareup.otto.Subscribe; import org.slf4j.Logger; @@ -84,6 +86,7 @@ public class LoopFragment extends Fragment implements View.OnClickListener, Frag } }); thread.start(); + Answers.getInstance().logCustom(new CustomEvent("Loop_Run")); break; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java index 88e4f6eb13..3514285473 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java @@ -18,6 +18,8 @@ import android.widget.CompoundButton; import android.widget.ScrollView; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; import com.squareup.otto.Subscribe; import org.slf4j.Logger; @@ -101,9 +103,11 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase, switch (view.getId()) { case R.id.nsclientinternal_restart: MainApp.bus().post(new EventNSClientRestart()); + Answers.getInstance().logCustom(new CustomEvent("NSClientRestart")); break; case R.id.nsclientinternal_delivernow: getPlugin().resend("GUI"); + Answers.getInstance().logCustom(new CustomEvent("NSClientDeliverNow")); break; case R.id.nsclientinternal_clearlog: getPlugin().clearLog(); @@ -118,6 +122,7 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase, public void onClick(DialogInterface dialog, int id) { getPlugin().queue().clearQueue(); updateGUI(); + Answers.getInstance().logCustom(new CustomEvent("NSClientClearQueue")); } }); builder.setNegativeButton(getString(R.string.cancel), null); @@ -125,6 +130,7 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase, break; case R.id.nsclientinternal_showqueue: MainApp.bus().post(new EventNSClientNewLog("QUEUE", getPlugin().queue().textList())); + Answers.getInstance().logCustom(new CustomEvent("NSClientShowQueue")); break; } } @@ -137,6 +143,7 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase, getPlugin().paused = isChecked; MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused)); updateGUI(); + Answers.getInstance().logCustom(new CustomEvent("NSClientPause")); break; case R.id.nsclientinternal_autoscroll: SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java index 4a8ce51266..76753e86a7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java @@ -9,6 +9,8 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; import com.squareup.otto.Subscribe; import org.json.JSONArray; @@ -74,6 +76,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener switch (view.getId()) { case R.id.openapsma_run: getPlugin().invoke("OpenAPSAMA button"); + Answers.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run")); break; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java index 8805ba18b7..bfe4bb5dab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java @@ -9,6 +9,8 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; import com.squareup.otto.Subscribe; import org.slf4j.Logger; @@ -68,6 +70,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener, switch (view.getId()) { case R.id.openapsma_run: getPlugin().invoke("OpenAPSMA button"); + Answers.getInstance().logCustom(new CustomEvent("OpenAPS_MA_Run")); break; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java index bb06b1ed9d..5c96cb58e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java @@ -12,6 +12,9 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,6 +76,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis final Double bg = bgText.getValue(); XdripCalibrations.confirmAndSendCalibration(bg, parentContext); dismiss(); + Answers.getInstance().logCustom(new CustomEvent("Calibration")); break; } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java index 81762b6382..ec25d2a0b0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java @@ -16,6 +16,9 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; + import java.text.DecimalFormat; import info.nightscout.androidaps.Constants; @@ -117,6 +120,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene } } }); + Answers.getInstance().logCustom(new CustomEvent("Bolus")); } } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index f6b319664c..7916291ccc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -24,6 +24,9 @@ import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; + import org.json.JSONException; import org.json.JSONObject; import org.slf4j.Logger; @@ -238,6 +241,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener { } } }); + Answers.getInstance().logCustom(new CustomEvent("Wizard")); } } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 7d2950b554..b925080c17 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -28,6 +28,8 @@ import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; import com.jjoe64.graphview.GraphView; import com.jjoe64.graphview.ValueDependentColor; import com.jjoe64.graphview.series.BarGraphSeries; @@ -236,6 +238,7 @@ public class OverviewFragment extends Fragment { public void run() { pump.cancelTempBasal(); MainApp.bus().post(new EventTempBasalChange()); + Answers.getInstance().logCustom(new CustomEvent("CancelTemp")); } }); } @@ -282,6 +285,7 @@ public class OverviewFragment extends Fragment { updateGUIIfVisible(); } }); + Answers.getInstance().logCustom(new CustomEvent("AcceptTemp")); } }); builder.setNegativeButton(getContext().getString(R.string.cancel), null); @@ -392,6 +396,7 @@ public class OverviewFragment extends Fragment { } } }); + Answers.getInstance().logCustom(new CustomEvent("QuickWizard")); } } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java index 4e1b41906e..320aba3956 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java @@ -21,6 +21,8 @@ import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.CustomEvent; import com.squareup.otto.Subscribe; import org.slf4j.Logger; @@ -149,6 +151,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener MainApp.getDbHelper().delete(treatment); treatmentsPlugin.initializeData(); updateGUI(); + Answers.getInstance().logCustom(new CustomEvent("RefreshTreatments")); } }); builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);