Add Omnipod Dash overview
This commit is contained in:
parent
af629739fe
commit
c2c9f391dd
6 changed files with 219 additions and 29 deletions
|
@ -2,24 +2,56 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
||||||
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
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.pump.common.defs.PumpType;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.OmnipodDashOverviewFragment;
|
||||||
import info.nightscout.androidaps.queue.commands.CustomCommand;
|
import info.nightscout.androidaps.queue.commands.CustomCommand;
|
||||||
import info.nightscout.androidaps.utils.TimeChangeType;
|
import info.nightscout.androidaps.utils.TimeChangeType;
|
||||||
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterface {
|
||||||
|
private final AAPSLogger aapsLogger;
|
||||||
|
private final ResourceHelper resourceHelper;
|
||||||
|
private final CommandQueueProvider commandQueue;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public OmnipodDashPumpPlugin(HasAndroidInjector injector, AAPSLogger aapsLogger, ResourceHelper resourceHelper, CommandQueueProvider commandQueue) {
|
||||||
|
super(new PluginDescription() //
|
||||||
|
.mainType(PluginType.PUMP) //
|
||||||
|
.fragmentClass(OmnipodDashOverviewFragment.class.getName()) //
|
||||||
|
.pluginIcon(R.drawable.ic_pod_128)
|
||||||
|
.pluginName(R.string.omnipod_dash_name) //
|
||||||
|
.shortName(R.string.omnipod_dash_name_short) //
|
||||||
|
.preferencesId(R.xml.omnipod_dash_preferences) //
|
||||||
|
.description(R.string.omnipod_dash_pump_description), injector, aapsLogger, resourceHelper, commandQueue);
|
||||||
|
this.aapsLogger = aapsLogger;
|
||||||
|
this.resourceHelper = resourceHelper;
|
||||||
|
this.commandQueue = commandQueue;
|
||||||
|
}
|
||||||
|
|
||||||
public class OmnipodDashPumpPlugin implements PumpInterface {
|
|
||||||
@Override public boolean isInitialized() {
|
@Override public boolean isInitialized() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +96,7 @@ public class OmnipodDashPumpPlugin implements PumpInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setNewBasalProfile(Profile profile) {
|
@Override public PumpEnactResult setNewBasalProfile(Profile profile) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +120,7 @@ public class OmnipodDashPumpPlugin implements PumpInterface {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
@Override public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,47 +128,47 @@ public class OmnipodDashPumpPlugin implements PumpInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
@Override public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
@Override public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
@Override public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult cancelTempBasal(boolean enforceNew) {
|
@Override public PumpEnactResult cancelTempBasal(boolean enforceNew) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult cancelExtendedBolus() {
|
@Override public PumpEnactResult cancelExtendedBolus() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public JSONObject getJSONStatus(Profile profile, String profileName, String version) {
|
@Override public JSONObject getJSONStatus(Profile profile, String profileName, String version) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public ManufacturerType manufacturer() {
|
@Override public ManufacturerType manufacturer() {
|
||||||
|
return getPumpDescription().pumpType.getManufacturer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public PumpType model() {
|
||||||
|
return getPumpDescription().pumpType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public String serialNumber() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpType model() {
|
@Override public PumpDescription getPumpDescription() {
|
||||||
return null;
|
return getPumpDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public String serialNumber() {
|
@Override public String shortStatus(boolean veryShort) {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpDescription getPumpDescription() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public String shortStatus(boolean veryShort) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +176,7 @@ public class OmnipodDashPumpPlugin implements PumpInterface {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult loadTDDs() {
|
@Override public PumpEnactResult loadTDDs() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,12 +184,14 @@ public class OmnipodDashPumpPlugin implements PumpInterface {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable @Override public List<CustomAction> getCustomActions() {
|
@Override
|
||||||
return null;
|
public List<CustomAction> getCustomActions() {
|
||||||
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void executeCustomAction(CustomActionType customActionType) {
|
@Override
|
||||||
|
public void executeCustomAction(CustomActionType customActionType) {
|
||||||
|
aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + customActionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable @Override public PumpEnactResult executeCustomCommand(CustomCommand customCommand) {
|
@Nullable @Override public PumpEnactResult executeCustomCommand(CustomCommand customCommand) {
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger
|
||||||
|
|
||||||
|
import dagger.Module
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@Suppress("unused")
|
||||||
|
abstract class OmnipodDashModule {
|
||||||
|
}
|
|
@ -5,15 +5,16 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBinding
|
||||||
|
|
||||||
class OmnipodDashOverviewFragment : DaggerFragment() {
|
class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
private var _binding: OmnipodOverviewBinding? = null
|
private var _binding: OmnipodDashOverviewBinding? = null
|
||||||
|
|
||||||
// This property is only valid between onCreateView and
|
// This property is only valid between onCreateView and
|
||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
||||||
OmnipodOverviewBinding.inflate(inflater, container, false).also { _binding = it }.root
|
OmnipodDashOverviewBinding.inflate(inflater, container!!).also { _binding = it }.root
|
||||||
}
|
}
|
52
omnipod-dash/src/main/res/layout/omnipod_dash_overview.xml
Normal file
52
omnipod-dash/src/main/res/layout/omnipod_dash_overview.xml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<merge 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"
|
||||||
|
tools:context=".ui.OmnipodDashOverviewFragment">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_above="@+id/buttons_layout"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="2dip"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:background="@color/list_delimiter" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/bluetooth_status"
|
||||||
|
layout="@layout/omnipod_dash_overview_bluetooth_status" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/pod_info"
|
||||||
|
layout="@layout/omnipod_common_overview_pod_info" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/buttons_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/buttons"
|
||||||
|
layout="@layout/omnipod_common_overview_buttons" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</merge>
|
|
@ -0,0 +1,91 @@
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.5"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="@string/omnipod_dash_bluetooth_address"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingStart="2dp"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
|
android:text=":"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/omnipod_dash_bluetooth_status"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="start"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.5"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="@string/omnipod_dash_bluetooth_status"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingStart="2dp"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
|
android:text=":"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<com.joanzapata.iconify.widget.IconTextView
|
||||||
|
android:id="@+id/omnipod_dash_bluetooth_address"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="start"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="{fa-bluetooth-b} "
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="2dip"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:background="@color/list_delimiter" />
|
||||||
|
</merge>
|
|
@ -7,4 +7,8 @@
|
||||||
|
|
||||||
<!-- Omnipod Dash - Keys -->
|
<!-- Omnipod Dash - Keys -->
|
||||||
<string name="key_omnipod_dash_pod_state" translatable="false">AAPS.OmnipodDash.pod_state</string>
|
<string name="key_omnipod_dash_pod_state" translatable="false">AAPS.OmnipodDash.pod_state</string>
|
||||||
|
|
||||||
|
<!-- Omnipod Dash - Overview -->
|
||||||
|
<string name="omnipod_dash_bluetooth_status">Bluetooth Status</string>
|
||||||
|
<string name="omnipod_dash_bluetooth_address">Bluetooth Address</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue