more Answers to user actions

This commit is contained in:
Milos Kozak 2017-03-03 21:12:59 +01:00
parent ebf4697150
commit 2af1ab6ac4
14 changed files with 57 additions and 1 deletions

View file

@ -18,6 +18,9 @@ import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
@ -166,6 +169,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("Fill"));
} }
} }
}); });

View file

@ -14,6 +14,9 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.Constants; 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); builder.setNegativeButton(getString(R.string.cancel), null);

View file

@ -16,6 +16,9 @@ import android.widget.LinearLayout;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.Constants; 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); builder.setNegativeButton(getString(R.string.cancel), null);

View file

@ -24,6 +24,8 @@ import android.widget.RadioButton;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.j256.ormlite.dao.Dao; import com.j256.ormlite.dao.Dao;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout; import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
@ -627,6 +629,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
data.put("percentage", cpp.percentage); data.put("percentage", cpp.percentage);
} }
ConfigBuilderPlugin.uploadCareportalEntryToNS(data); ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -657,6 +660,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
dao.createIfNotExists(tempTarget); dao.createIfNotExists(tempTarget);
MainApp.bus().post(new EventTempTargetRangeChange()); MainApp.bus().post(new EventTempTargetRangeChange());
ConfigBuilderPlugin.uploadCareportalEntryToNS(data); ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("TempTarget"));
} catch (JSONException | SQLException e) { } catch (JSONException | SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -668,6 +672,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
} }
} else { } else {
ConfigBuilderPlugin.uploadCareportalEntryToNS(data); ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("NSTreatment"));
} }
} }
}); });

View file

@ -16,6 +16,9 @@ import android.widget.ListAdapter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import java.util.ArrayList; import java.util.ArrayList;
import info.nightscout.androidaps.MainApp; 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 EventRefreshGui(true));
MainApp.bus().post(new EventConfigBuilderChange()); MainApp.bus().post(new EventConfigBuilderChange());
getPlugin().logPluginStatus(); getPlugin().logPluginStatus();
Answers.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
} }
}); });

View file

@ -10,6 +10,8 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -84,6 +86,7 @@ public class LoopFragment extends Fragment implements View.OnClickListener, Frag
} }
}); });
thread.start(); thread.start();
Answers.getInstance().logCustom(new CustomEvent("Loop_Run"));
break; break;
} }

View file

@ -18,6 +18,8 @@ import android.widget.CompoundButton;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -101,9 +103,11 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase,
switch (view.getId()) { switch (view.getId()) {
case R.id.nsclientinternal_restart: case R.id.nsclientinternal_restart:
MainApp.bus().post(new EventNSClientRestart()); MainApp.bus().post(new EventNSClientRestart());
Answers.getInstance().logCustom(new CustomEvent("NSClientRestart"));
break; break;
case R.id.nsclientinternal_delivernow: case R.id.nsclientinternal_delivernow:
getPlugin().resend("GUI"); getPlugin().resend("GUI");
Answers.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
break; break;
case R.id.nsclientinternal_clearlog: case R.id.nsclientinternal_clearlog:
getPlugin().clearLog(); getPlugin().clearLog();
@ -118,6 +122,7 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase,
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
getPlugin().queue().clearQueue(); getPlugin().queue().clearQueue();
updateGUI(); updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientClearQueue"));
} }
}); });
builder.setNegativeButton(getString(R.string.cancel), null); builder.setNegativeButton(getString(R.string.cancel), null);
@ -125,6 +130,7 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase,
break; break;
case R.id.nsclientinternal_showqueue: case R.id.nsclientinternal_showqueue:
MainApp.bus().post(new EventNSClientNewLog("QUEUE", getPlugin().queue().textList())); MainApp.bus().post(new EventNSClientNewLog("QUEUE", getPlugin().queue().textList()));
Answers.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
break; break;
} }
} }
@ -137,6 +143,7 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase,
getPlugin().paused = isChecked; getPlugin().paused = isChecked;
MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused)); MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
updateGUI(); updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientPause"));
break; break;
case R.id.nsclientinternal_autoscroll: case R.id.nsclientinternal_autoscroll:
SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked); SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked);

View file

@ -9,6 +9,8 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.json.JSONArray; import org.json.JSONArray;
@ -74,6 +76,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
switch (view.getId()) { switch (view.getId()) {
case R.id.openapsma_run: case R.id.openapsma_run:
getPlugin().invoke("OpenAPSAMA button"); getPlugin().invoke("OpenAPSAMA button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
break; break;
} }

View file

@ -9,6 +9,8 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -68,6 +70,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
switch (view.getId()) { switch (view.getId()) {
case R.id.openapsma_run: case R.id.openapsma_run:
getPlugin().invoke("OpenAPSMA button"); getPlugin().invoke("OpenAPSMA button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_MA_Run"));
break; break;
} }

View file

@ -12,6 +12,9 @@ import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -73,6 +76,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
final Double bg = bgText.getValue(); final Double bg = bgText.getValue();
XdripCalibrations.confirmAndSendCalibration(bg, parentContext); XdripCalibrations.confirmAndSendCalibration(bg, parentContext);
dismiss(); dismiss();
Answers.getInstance().logCustom(new CustomEvent("Calibration"));
break; break;
} }
} }

View file

@ -16,6 +16,9 @@ import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
@ -117,6 +120,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("Bolus"));
} }
} }
}); });

View file

@ -24,6 +24,9 @@ import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -238,6 +241,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("Wizard"));
} }
} }
}); });

View file

@ -28,6 +28,8 @@ import android.widget.CompoundButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; 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.GraphView;
import com.jjoe64.graphview.ValueDependentColor; import com.jjoe64.graphview.ValueDependentColor;
import com.jjoe64.graphview.series.BarGraphSeries; import com.jjoe64.graphview.series.BarGraphSeries;
@ -236,6 +238,7 @@ public class OverviewFragment extends Fragment {
public void run() { public void run() {
pump.cancelTempBasal(); pump.cancelTempBasal();
MainApp.bus().post(new EventTempBasalChange()); MainApp.bus().post(new EventTempBasalChange());
Answers.getInstance().logCustom(new CustomEvent("CancelTemp"));
} }
}); });
} }
@ -282,6 +285,7 @@ public class OverviewFragment extends Fragment {
updateGUIIfVisible(); updateGUIIfVisible();
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("AcceptTemp"));
} }
}); });
builder.setNegativeButton(getContext().getString(R.string.cancel), null); builder.setNegativeButton(getContext().getString(R.string.cancel), null);
@ -392,6 +396,7 @@ public class OverviewFragment extends Fragment {
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("QuickWizard"));
} }
} }
}); });

View file

@ -21,6 +21,8 @@ import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -149,6 +151,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
MainApp.getDbHelper().delete(treatment); MainApp.getDbHelper().delete(treatment);
treatmentsPlugin.initializeData(); treatmentsPlugin.initializeData();
updateGUI(); updateGUI();
Answers.getInstance().logCustom(new CustomEvent("RefreshTreatments"));
} }
}); });
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);