commit
f0cc3d4ab2
8 changed files with 26 additions and 177 deletions
|
@ -289,9 +289,6 @@
|
||||||
android:name=".plugins.pump.medtronic.service.RileyLinkMedtronicService"
|
android:name=".plugins.pump.medtronic.service.RileyLinkMedtronicService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
<activity
|
|
||||||
android:name=".plugins.general.overview.dialogs.MessageHelperActivity"
|
|
||||||
android:theme="@style/Theme.AppCompat.Translucent" />
|
|
||||||
<activity android:name=".plugins.pump.common.dialog.RileyLinkBLEScanActivity">
|
<activity android:name=".plugins.pump.common.dialog.RileyLinkBLEScanActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
|
<action android:name="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -151,7 +151,7 @@ public class MedtronicFragment extends SubscriberFragment {
|
||||||
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
||||||
startActivity(new Intent(getContext(), MedtronicHistoryActivity.class));
|
startActivity(new Intent(getContext(), MedtronicHistoryActivity.class));
|
||||||
} else {
|
} else {
|
||||||
MedtronicUtil.displayNotConfiguredDialog();
|
MedtronicUtil.displayNotConfiguredDialog(getContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class MedtronicFragment extends SubscriberFragment {
|
||||||
void onRefreshClick() {
|
void onRefreshClick() {
|
||||||
|
|
||||||
if (!MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
if (!MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
||||||
MedtronicUtil.displayNotConfiguredDialog();
|
MedtronicUtil.displayNotConfiguredDialog(getContext());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ public class MedtronicFragment extends SubscriberFragment {
|
||||||
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
||||||
startActivity(new Intent(getContext(), RileyLinkStatusActivity.class));
|
startActivity(new Intent(getContext(), RileyLinkStatusActivity.class));
|
||||||
} else {
|
} else {
|
||||||
MedtronicUtil.displayNotConfiguredDialog();
|
MedtronicUtil.displayNotConfiguredDialog(getContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.os.IBinder;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
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.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
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: "
|
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Show dialog. Context: "
|
||||||
// + MainApp.instance().getApplicationContext());
|
// + 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("status", MainApp.gs(R.string.medtronic_cmd_cancel_bolus_not_supported));
|
||||||
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);
|
||||||
|
@ -1507,7 +1508,11 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
|
||||||
ServiceTaskExecutor.startTask(new WakeAndTuneTask());
|
ServiceTaskExecutor.startTask(new WakeAndTuneTask());
|
||||||
} else {
|
} 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;
|
break;
|
||||||
|
|
|
@ -1,26 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.util;
|
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.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
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.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
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.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
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.driver.MedtronicPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
|
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
|
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.
|
* Created by andy on 5/9/18.
|
||||||
|
@ -529,16 +525,9 @@ public class MedtronicUtil extends RileyLinkUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void displayNotConfiguredDialog() {
|
public static void displayNotConfiguredDialog(Context context) {
|
||||||
new Thread(() -> {
|
OKDialog.show(context, MainApp.gs(R.string.combo_warning),
|
||||||
|
MainApp.gs(R.string.medtronic_error_operation_not_possible_no_configuration), null);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class OKDialog {
|
||||||
|
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.debug("show_dialog exception: " + e);
|
log.debug("show_dialog exception: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context="info.nightscout.androidaps.plugins.general.overview.dialogs.MessageDialog"
|
|
||||||
android:paddingTop="15dp"
|
|
||||||
android:paddingBottom="15dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/overview_message_status"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="30dp"
|
|
||||||
android:paddingRight="30dp"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:layout_gravity="center_horizontal" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/overview_message_ok"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:text="@string/ok" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
Loading…
Reference in a new issue