diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9d51b49c86..d44c35b0b3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -289,9 +289,6 @@
android:name=".plugins.pump.medtronic.service.RileyLinkMedtronicService"
android:enabled="true"
android:exported="true" />
-
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/MessageDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/MessageDialog.java
deleted file mode 100644
index a42fd137b9..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/MessageDialog.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.TextView;
-
-import info.nightscout.androidaps.R;
-
-public class MessageDialog extends DialogFragment implements View.OnClickListener {
-
- private static Logger log = LoggerFactory.getLogger(MessageDialog.class);
-
- Button okButton;
- TextView statusView;
- MessageHelperActivity helperActivity;
-
- static String status;
- static String title;
-
-
- public MessageDialog() {
- super();
- }
-
-
- public void setStatus(String status) {
- this.status = status;
- }
-
-
- public void setTitle(String title) {
- this.title = title;
- }
-
-
- public void setHelperActivity(MessageHelperActivity activity) {
- this.helperActivity = activity;
- }
-
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- getDialog().setTitle(title);
- View view = inflater.inflate(R.layout.overview_message_dialog, container, false);
- okButton = (Button)view.findViewById(R.id.overview_message_ok);
- statusView = (TextView)view.findViewById(R.id.overview_message_status);
- okButton.setOnClickListener(this);
- setCancelable(false);
-
- return view;
- }
-
-
- @Override
- public void onResume() {
- super.onResume();
- if (getDialog() != null)
- getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- statusView.setText(status);
- }
-
-
- @Override
- public void dismiss() {
- super.dismissAllowingStateLoss();
- if (helperActivity != null) {
- helperActivity.finish();
- }
- }
-
-
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
-
- case R.id.overview_message_ok:
- log.debug("Message dialog ok button pressed");
- dismiss();
- break;
- }
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/MessageHelperActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/MessageHelperActivity.java
deleted file mode 100644
index 9b105c679d..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/MessageHelperActivity.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-import android.os.Bundle;
-import androidx.appcompat.app.AppCompatActivity;
-
-public class MessageHelperActivity extends AppCompatActivity {
-
- public MessageHelperActivity() {
- super();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- MessageDialog messageDialog = new MessageDialog();
- messageDialog.setHelperActivity(this);
- messageDialog.setStatus(getIntent().getStringExtra("status"));
-
- messageDialog.setTitle(getIntent().getStringExtra("title"));
- messageDialog.show(this.getSupportFragmentManager(), "Message");
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.java
index 940f7d606c..9bb7b09601 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.java
@@ -151,7 +151,7 @@ public class MedtronicFragment extends SubscriberFragment {
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
startActivity(new Intent(getContext(), MedtronicHistoryActivity.class));
} else {
- MedtronicUtil.displayNotConfiguredDialog();
+ MedtronicUtil.displayNotConfiguredDialog(getContext());
}
}
@@ -160,7 +160,7 @@ public class MedtronicFragment extends SubscriberFragment {
void onRefreshClick() {
if (!MedtronicUtil.getPumpStatus().verifyConfiguration()) {
- MedtronicUtil.displayNotConfiguredDialog();
+ MedtronicUtil.displayNotConfiguredDialog(getContext());
return;
}
@@ -191,7 +191,7 @@ public class MedtronicFragment extends SubscriberFragment {
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
startActivity(new Intent(getContext(), RileyLinkStatusActivity.class));
} else {
- MedtronicUtil.displayNotConfiguredDialog();
+ MedtronicUtil.displayNotConfiguredDialog(getContext());
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
index c72fe49d21..1c0612d357 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
@@ -8,6 +8,7 @@ import android.os.IBinder;
import android.os.SystemClock;
import androidx.annotation.NonNull;
+import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
import org.joda.time.LocalDateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,7 +42,6 @@ import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.MessageHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
@@ -828,7 +828,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Show dialog. Context: "
// + MainApp.instance().getApplicationContext());
- Intent i = new Intent(MainApp.instance(), MessageHelperActivity.class);
+ Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
+ i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", MainApp.gs(R.string.medtronic_cmd_cancel_bolus_not_supported));
i.putExtra("title", MainApp.gs(R.string.combo_warning));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -1507,7 +1508,11 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
ServiceTaskExecutor.startTask(new WakeAndTuneTask());
} else {
- MedtronicUtil.displayNotConfiguredDialog();
+ Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
+ i.putExtra("status", MainApp.gs(R.string.medtronic_error_operation_not_possible_no_configuration));
+ i.putExtra("title", MainApp.gs(R.string.combo_warning));
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ MainApp.instance().startActivity(i);
}
}
break;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
index ae4230b19d..9833885b8c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
@@ -1,26 +1,12 @@
package info.nightscout.androidaps.plugins.pump.medtronic.util;
-import android.content.Intent;
-
+import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-
-import org.joda.time.LocalTime;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.MessageHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
@@ -40,6 +26,16 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
+import info.nightscout.androidaps.utils.OKDialog;
+import org.joda.time.LocalTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
/**
* Created by andy on 5/9/18.
@@ -529,16 +525,9 @@ public class MedtronicUtil extends RileyLinkUtil {
}
- public static void displayNotConfiguredDialog() {
- new Thread(() -> {
-
- Intent i = new Intent(MainApp.instance(), MessageHelperActivity.class);
- i.putExtra("status", MainApp.gs(R.string.medtronic_error_operation_not_possible_no_configuration));
- i.putExtra("title", MainApp.gs(R.string.combo_warning));
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- MainApp.instance().startActivity(i);
-
- }).start();
+ public static void displayNotConfiguredDialog(Context context) {
+ OKDialog.show(context, MainApp.gs(R.string.combo_warning),
+ MainApp.gs(R.string.medtronic_error_operation_not_possible_no_configuration), null);
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java b/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java
index 98d8845ff8..a45d329d63 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java
@@ -39,7 +39,7 @@ public class OKDialog {
builder.create().show();
} catch (Exception e) {
- log.debug("show_dialog exception: " + e);
+ log.debug("show_dialog exception: ", e);
}
}
diff --git a/app/src/main/res/layout/overview_message_dialog.xml b/app/src/main/res/layout/overview_message_dialog.xml
deleted file mode 100644
index 6fec6694be..0000000000
--- a/app/src/main/res/layout/overview_message_dialog.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-