Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Afrezza, Apidra, Levemir, Basaglar and Tresiba profiles, and correct Lantus, Toujeo and Novo Rapid profiles based on more recent data. #1388

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.eveningoutpost.dexdrip.xdrip;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -53,10 +52,10 @@ private Boolean checkUniquenessPPN() {
for (insulinData d : profiles)
for (String ppn : d.PPN)
if (PPNs.contains(ppn)) {
Log.d(TAG, "pharmacy product number dupplicated " + ppn + ". that's not allowed!");
Log.d(TAG, "Pharmacy product number " + ppn + " is duplicated. That's not allowed!");
return false;
} else PPNs.add(ppn);
Log.d(TAG, "pharmacy product numbers uniquee");
Log.d(TAG, "All pharmacy product numbers (PNN) are unique.");
return true;
}
}
Expand Down
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="230dp"
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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the layout_gravity now "bottom" and did you check the increased height on smaller devices?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nexus One 480x800 AVD

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to reproduce what is posted by @gruoner in #1388 (comment)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I was unable to reproduce, there is only one slider and everything seems ok. AVD 3" 240 x 320 pixels, which is (more or less) equivalent of @gruoner galaxy star.

android:layout_weight="1"
android:fadeScrollbars="false"
android:orientation="vertical"
android:scrollbars="vertical"></LinearLayout>

</ScrollView>

<TextView
android:id="@+id/Text2"
Expand Down
109 changes: 102 additions & 7 deletions app/src/main/res/raw/insulin_profiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[
{
"name": "FIASP",
"displayName": "FIASP (ultra fast acting)",
"displayName": "FIASP (ultra-fast acting)",
"concentration": "U100",
"PPN":
[
Expand All @@ -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 @@ -97,21 +135,21 @@
}
},
{
"name": "Toujeo",
"displayName": "Toujeo (long acting)",
"name": "Levemir",
"displayName": "Levemir (long acting)",
"PPN":
[
"ToujeoU100"
"LevemirU100"
],
"concentration": "U100",
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "180",
"peak": "480",
"duration": "2160"
"onset": "60",
"peak": "180-840",
"duration": "1500"
}
}
},
Expand All @@ -130,9 +168,66 @@
{
"onset": "60",
"peak": "420-1200",
"duration": "1440"
}
}
},
{
"name": "Basaglar",
"displayName": "Basaglar (long acting)",
"PPN":
[
"BasaglarU100"
],
"concentration": "U100",
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "60",
"peak": "480-1140",
"duration": "1440"
}
}
},
{
"name": "Toujeo",
"displayName": "Toujeo (ultra-long acting)",
"PPN":
[
"ToujeoU100"
],
"concentration": "U100",
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "180",
"peak": "480-1560",
"duration": "2160"
}
}
},
{
"name": "Tresiba",
"displayName": "Tresiba (ultra-long acting)",
"PPN":
[
"TresibaU100"
],
"concentration": "U100",
"Curve":
{
"type": "linear trapezoid",
"data":
{
"onset": "90",
"peak": "120-2460",
"duration": "2520"
}
}
}
]
}