Skip to content

Commit

Permalink
Merge pull request #3157 from TheConen/master
Browse files Browse the repository at this point in the history
Add Afrezza, Apidra, Levemir, Basaglar and Tresiba profiles
  • Loading branch information
jamorham authored Nov 4, 2023
2 parents e34ebac + b16e972 commit a080e36
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.eveningoutpost.dexdrip.insulin;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.ScrollView;

import com.eveningoutpost.dexdrip.BaseAppCompatActivity;
import com.eveningoutpost.dexdrip.R;
Expand All @@ -31,6 +33,8 @@ public class InsulinProfileEditor extends BaseAppCompatActivity {
private Spinner basalSpinner, bolusSpinner;
private HashMap<Insulin, CheckBox> checkboxes;
private HashMap<String, Insulin> profiles;
private ScrollView parentScrollView;
private ScrollView childScrollView;

//private Context mContext;

Expand All @@ -49,6 +53,19 @@ protected void onCreate(Bundle savedInstanceState) {
linearLayout = (LinearLayout) findViewById(R.id.profile_layout_view);
basalSpinner = (Spinner) findViewById(R.id.basalSpinner);
bolusSpinner = (Spinner) findViewById(R.id.bolusSpinner);
parentScrollView = (ScrollView) findViewById(R.id.parent_scroll_view);
childScrollView = (ScrollView) findViewById(R.id.child_scroll_view);

parentScrollView.setOnTouchListener((v, event) -> {
findViewById(R.id.parent_scroll_view).getParent().requestDisallowInterceptTouchEvent(false);
return false;
});

childScrollView.setOnTouchListener((v, event) -> {
// Disallow the touch request for parent scroll on touch of child view
v.getParent().getParent().requestDisallowInterceptTouchEvent(true);
return false;
});

for (Insulin i : InsulinManager.getAllProfiles()) {
LinearLayout v = new LinearLayout(this);
Expand Down
29 changes: 20 additions & 9 deletions app/src/main/res/layout/activity_insulinprofile_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:fitsSystemWindows="true">

<ScrollView
android:id="@+id/parent_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
Expand All @@ -30,19 +31,29 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="@string/pref_enable_insulinprofiles"
android:textSize="18sp" />

<LinearLayout
android:id="@+id/profile_layout_view"
<ScrollView
android:id="@+id/child_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_weight="1"
android:fadeScrollbars="false"
android:orientation="vertical"
android:scrollbars="vertical"></LinearLayout>
android:layout_height="440dp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin">

<LinearLayout
android:id="@+id/profile_layout_view"
android:layout_width="wrap_content"
android:layout_height="440dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:fadeScrollbars="false"
android:orientation="vertical"
android:scrollbars="vertical"></LinearLayout>

</ScrollView>

<TextView
android:id="@+id/Text2"
Expand Down
97 changes: 96 additions & 1 deletion app/src/main/res/raw/insulin_profiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,44 @@
}
}
},
{
"name": "Afrezza",
"displayName": "Afrezza (inhaled, ultra-fast acting)",
"concentration": "U100",
"PPN":
[
"Afrezza-U100"
],
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "5",
"peak": "50",
"duration": "150"
}
}
},
{
"name": "Apidra",
"displayName": "Apidra (ultra-fast acting)",
"concentration": "U100",
"PPN":
[
"Apidra-U100"
],
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "10",
"peak": "60-180",
"duration": "300"
}
}
},
{
"name": "Novorapid",
"displayName": "Novorapid (rapid acting)",
Expand Down Expand Up @@ -155,6 +193,63 @@
"duration": "2160"
}
}
},
{
"name": "Levemir",
"displayName": "Levemir (long acting)",
"PPN":
[
"LevemirU100"
],
"concentration": "U100",
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "60",
"peak": "180-840",
"duration": "1500"
}
}
},
{
"name": "Basaglar",
"displayName": "Basaglar (long acting)",
"PPN":
[
"BasaglarU100"
],
"concentration": "U100",
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "60",
"peak": "480-1140",
"duration": "1440"
}
}
},
{
"name": "Tresiba",
"displayName": "Tresiba (ultra-long acting)",
"PPN":
[
"TresibaU100"
],
"concentration": "U100",
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "90",
"peak": "120-2460",
"duration": "2520"
}
}
}
]
}
}

0 comments on commit a080e36

Please sign in to comment.