nsclient tweaking
This commit is contained in:
parent
2fceb0b891
commit
9e03087a77
3 changed files with 23 additions and 7 deletions
|
@ -2,6 +2,9 @@ package info.nightscout.androidaps.plugins.NSClientInternal;
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
@ -106,7 +109,19 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase,
|
||||||
getPlugin().clearLog();
|
getPlugin().clearLog();
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_clearqueue:
|
case R.id.nsclientinternal_clearqueue:
|
||||||
getPlugin().queue().clearQueue();
|
final Context context = getContext();
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
|
||||||
|
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
||||||
|
builder.setMessage("Clear queue? All data in queue will be lost!");
|
||||||
|
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
getPlugin().queue().clearQueue();
|
||||||
|
updateGUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(getString(R.string.cancel), null);
|
||||||
|
builder.show();
|
||||||
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()));
|
||||||
|
|
|
@ -156,12 +156,6 @@ public class NSClientInternalPlugin implements PluginBase {
|
||||||
log.debug(ev.action + " " + ev.logText);
|
log.debug(ev.action + " " + ev.logText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onStatusEvent(final EventNSClientRestart ev) {
|
|
||||||
if (nsClientService != null)
|
|
||||||
nsClientService.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventNSClientStatus ev) {
|
public void onStatusEvent(final EventNSClientStatus ev) {
|
||||||
status = ev.status;
|
status = ev.status;
|
||||||
|
|
|
@ -56,6 +56,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSgv;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSStatus;
|
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSStatus;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment;
|
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
|
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
|
||||||
|
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||||
|
@ -173,6 +174,12 @@ public class NSClientService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onStatusEvent(final EventNSClientRestart ev) {
|
||||||
|
latestDateInReceivedData = 0;
|
||||||
|
restart();
|
||||||
|
}
|
||||||
|
|
||||||
public static void setNsProfile(NSProfile profile) {
|
public static void setNsProfile(NSProfile profile) {
|
||||||
nsProfile = profile;
|
nsProfile = profile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue