- added cpying to cplipboard for PodInfoRecentPulseLog (#41)

- added returning pumpId from addToHistory method, so that we can use it
This commit is contained in:
Andy Rozman 2019-12-30 13:06:05 +01:00
parent 9dee52cd0f
commit 54464cf2b6
2 changed files with 15 additions and 6 deletions

View file

@ -1,6 +1,9 @@
package info.nightscout.androidaps.plugins.pump.omnipod; package info.nightscout.androidaps.plugins.pump.omnipod;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.Bundle; import android.os.Bundle;
@ -383,9 +386,13 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
} else { } else {
LOG.warn("Result was NOT null."); LOG.warn("Result was NOT null.");
ClipboardManager clipboard = (ClipboardManager) MainApp.instance().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("PodInfoRecentPulseLog", result.toString());
clipboard.setPrimaryClip(clip);
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror); i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", "Pulse Log:\n" + result.toString()); i.putExtra("status", "Pulse Log (copied to clipboard):\n" + result.toString());
i.putExtra("title", MainApp.gs(R.string.combo_warning)); i.putExtra("title", MainApp.gs(R.string.combo_warning));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i); MainApp.instance().startActivity(i);

View file

@ -482,16 +482,16 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
} }
public void addSuccessToHistory(long requestTime, PodHistoryEntryType entryType, Object data) { public long addSuccessToHistory(long requestTime, PodHistoryEntryType entryType, Object data) {
addToHistory(requestTime, entryType, data, true); return addToHistory(requestTime, entryType, data, true);
} }
public void addFailureToHistory(long requestTime, PodHistoryEntryType entryType, Object data) { public long addFailureToHistory(long requestTime, PodHistoryEntryType entryType, Object data) {
addToHistory(requestTime, entryType, data, false); return addToHistory(requestTime, entryType, data, false);
} }
public void addToHistory(long requestTime, PodHistoryEntryType entryType, Object data, boolean success) { public long addToHistory(long requestTime, PodHistoryEntryType entryType, Object data, boolean success) {
PodHistory podHistory = new PodHistory(requestTime, entryType); PodHistory podHistory = new PodHistory(requestTime, entryType);
@ -508,6 +508,8 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
MainApp.getDbHelper().createOrUpdate(podHistory); MainApp.getDbHelper().createOrUpdate(podHistory);
return podHistory.getPumpId();
} }
private void handleSetupActionResult(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, SetupActionResult res, long time) { private void handleSetupActionResult(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, SetupActionResult res, long time) {