From 4eab9471fd93461cadaa22bf3b04f7cac99cef30 Mon Sep 17 00:00:00 2001 From: TheConen Date: Tue, 7 Nov 2023 21:12:11 +0100 Subject: [PATCH 1/6] fix(ui): Fix insulin profile list having a fixed size and therefore not showing all insulin profiles. --- .../dexdrip/insulin/InsulinProfileEditor.java | 16 ---------- .../layout/activity_insulinprofile_editor.xml | 31 +++++++------------ 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinProfileEditor.java b/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinProfileEditor.java index b215bf4c42..4cb2476621 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinProfileEditor.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinProfileEditor.java @@ -1,7 +1,6 @@ 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; @@ -9,7 +8,6 @@ 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; @@ -33,8 +31,6 @@ public class InsulinProfileEditor extends BaseAppCompatActivity { private Spinner basalSpinner, bolusSpinner; private HashMap checkboxes; private HashMap profiles; - private ScrollView parentScrollView; - private ScrollView childScrollView; //private Context mContext; @@ -53,19 +49,7 @@ 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); diff --git a/app/src/main/res/layout/activity_insulinprofile_editor.xml b/app/src/main/res/layout/activity_insulinprofile_editor.xml index 14448ddd7c..eac4b9834b 100644 --- a/app/src/main/res/layout/activity_insulinprofile_editor.xml +++ b/app/src/main/res/layout/activity_insulinprofile_editor.xml @@ -8,7 +8,6 @@ android:fitsSystemWindows="true"> + android:layout_height="wrap_content" + android:weightSum="1"> - - - - + android:scrollbars="vertical"> + Date: Tue, 7 Nov 2023 21:31:01 +0100 Subject: [PATCH 2/6] refactor: Rename files that contain JSON content, but have the file ending .txt to have the file ending .json --- app/src/main/res/raw/{initiallexicon.txt => initiallexicon.json} | 0 .../main/res/raw/{insulin_profiles.txt => insulin_profiles.json} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename app/src/main/res/raw/{initiallexicon.txt => initiallexicon.json} (100%) rename app/src/main/res/raw/{insulin_profiles.txt => insulin_profiles.json} (100%) diff --git a/app/src/main/res/raw/initiallexicon.txt b/app/src/main/res/raw/initiallexicon.json similarity index 100% rename from app/src/main/res/raw/initiallexicon.txt rename to app/src/main/res/raw/initiallexicon.json diff --git a/app/src/main/res/raw/insulin_profiles.txt b/app/src/main/res/raw/insulin_profiles.json similarity index 100% rename from app/src/main/res/raw/insulin_profiles.txt rename to app/src/main/res/raw/insulin_profiles.json From ac56f0791167c5d73a0a64ab2a1a696c9822be11 Mon Sep 17 00:00:00 2001 From: TheConen Date: Tue, 7 Nov 2023 21:32:12 +0100 Subject: [PATCH 3/6] style: Reformat json files --- app/src/main/res/raw/initiallexicon.json | 109 ++++++++++--------- app/src/main/res/raw/insulin_profiles.json | 120 +++++++-------------- 2 files changed, 100 insertions(+), 129 deletions(-) diff --git a/app/src/main/res/raw/initiallexicon.json b/app/src/main/res/raw/initiallexicon.json index ea0e174a92..8bb98bbd0c 100644 --- a/app/src/main/res/raw/initiallexicon.json +++ b/app/src/main/res/raw/initiallexicon.json @@ -1,6 +1,8 @@ -{"entries":[ -{"lexicon": "stop", - "matchWords":[ +{ + "entries": [ + { + "lexicon": "stop", + "matchWords": [ "stop", "cancel", "done", @@ -10,10 +12,11 @@ "finished", "finish", "quit" - ]}, - -{"lexicon": "rapid", - "matchWords":[ + ] + }, + { + "lexicon": "rapid", + "matchWords": [ "rapid", "rapid acting", "rapid-acting", @@ -28,16 +31,18 @@ "unit", "u", "you" - ]}, - -{"lexicon": "long", - "matchWords":[ + ] + }, + { + "lexicon": "long", + "matchWords": [ "long", "long acting" - ]}, - -{"lexicon": "carbs", - "matchWords":[ + ] + }, + { + "lexicon": "carbs", + "matchWords": [ "carbs", "cards", "carbohydrate", @@ -49,41 +54,43 @@ "car", "g", "gee" - ]}, - -{"lexicon": "time", - "matchWords":[ + ] + }, + { + "lexicon": "time", + "matchWords": [ "time", "times", "clock", - "o'clock", + "o'clock", "oclock", "hour", "hours", "at" - ]}, - -{"lexicon": "ago", - "matchWords":[ + ] + }, + { + "lexicon": "ago", + "matchWords": [ "ago" - ]}, - - -{"lexicon": "blood", - "matchWords":[ + ] + }, + { + "lexicon": "blood", + "matchWords": [ "mmol", "mmols", - "animal", + "animal", "miles", "mile", "memo", - "mobile", - "month", + "mobile", + "month", "mm", "mg", "bg", - "milligram", - "milligrams", + "milligram", + "milligrams", "normal", "mole", "moles", @@ -93,21 +100,25 @@ "blood sugar", "hottest", "obsessed" - ]}, - -{"lexicon": "grams", - "matchWords":[ - ]}, - -{"lexicon": "units", - "matchWords":[ - ]}, - -{"lexicon": "note", - "matchWords":[ + ] + }, + { + "lexicon": "grams", + "matchWords": [ + ] + }, + { + "lexicon": "units", + "matchWords": [ + ] + }, + { + "lexicon": "note", + "matchWords": [ "note", "notes", "night" - ]} - -]} + ] + } + ] +} diff --git a/app/src/main/res/raw/insulin_profiles.json b/app/src/main/res/raw/insulin_profiles.json index 85db7c9eec..023c387fb2 100644 --- a/app/src/main/res/raw/insulin_profiles.json +++ b/app/src/main/res/raw/insulin_profiles.json @@ -1,19 +1,15 @@ { - "profiles": - [ + "profiles": [ { "name": "FIASP", "displayName": "FIASP (ultra fast acting)", "concentration": "U100", - "PPN": - [ + "PPN": [ "FIASP-U100" ], - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "2", "peak": "45", "duration": "300" @@ -24,15 +20,12 @@ "name": "Afrezza", "displayName": "Afrezza (inhaled, ultra-fast acting)", "concentration": "U100", - "PPN": - [ + "PPN": [ "Afrezza-U100" ], - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "5", "peak": "50", "duration": "150" @@ -43,15 +36,12 @@ "name": "Apidra", "displayName": "Apidra (ultra-fast acting)", "concentration": "U100", - "PPN": - [ + "PPN": [ "Apidra-U100" ], - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "10", "peak": "60-180", "duration": "300" @@ -62,15 +52,12 @@ "name": "Novorapid", "displayName": "Novorapid (rapid acting)", "concentration": "U100", - "PPN": - [ + "PPN": [ "1100558736" ], - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "10", "peak": "75", "duration": "180" @@ -81,15 +68,12 @@ "name": "Humalog", "displayName": "Humalog (rapid acting)", "concentration": "U100", - "PPN": - [ + "PPN": [ "Humalog-U100" ], - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "10", "peak": "75", "duration": "180" @@ -100,18 +84,15 @@ "name": "Lispro", "displayName": "Lispro (rapid acting)", "concentration": "U100", - "PPN": - [ + "PPN": [ "111291061285", "111291059828", "111291064107", "111291063541" ], - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "15", "peak": "90", "duration": "210" @@ -122,15 +103,12 @@ "name": "Actrapid", "displayName": "Actrapid (short acting)", "concentration": "U100", - "PPN": - [ + "PPN": [ "1102949004" ], - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "30", "peak": "60-240", "duration": "480" @@ -140,16 +118,13 @@ { "name": "Insulatard", "displayName": "Insulatard (NPH)", - "PPN": - [ + "PPN": [ "1105039656" ], "concentration": "U100", - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "60", "peak": "120-720", "duration": "1440" @@ -159,16 +134,13 @@ { "name": "Toujeo", "displayName": "Toujeo (long acting)", - "PPN": - [ + "PPN": [ "ToujeoU100" ], "concentration": "U100", - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "180", "peak": "480", "duration": "2160" @@ -178,16 +150,13 @@ { "name": "Lantus", "displayName": "Lantus (long acting)", - "PPN": - [ + "PPN": [ "LantusU100" ], "concentration": "U100", - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "60", "peak": "420-1200", "duration": "2160" @@ -197,16 +166,13 @@ { "name": "Levemir", "displayName": "Levemir (long acting)", - "PPN": - [ + "PPN": [ "LevemirU100" ], "concentration": "U100", - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "60", "peak": "180-840", "duration": "1500" @@ -216,16 +182,13 @@ { "name": "Basaglar", "displayName": "Basaglar (long acting)", - "PPN": - [ + "PPN": [ "BasaglarU100" ], "concentration": "U100", - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "60", "peak": "480-1140", "duration": "1440" @@ -235,16 +198,13 @@ { "name": "Tresiba", "displayName": "Tresiba (ultra-long acting)", - "PPN": - [ + "PPN": [ "TresibaU100" ], "concentration": "U100", - "Curve": - { + "Curve": { "type": "linear trapezoid", - "data": - { + "data": { "onset": "90", "peak": "120-2460", "duration": "2520" From 97bdc7bfe5208e667ad03ec1745336cd41251bf7 Mon Sep 17 00:00:00 2001 From: TheConen Date: Tue, 7 Nov 2023 21:53:40 +0100 Subject: [PATCH 4/6] feat(ui): Improve layout of insulin profile editor --- .../layout/activity_insulinprofile_editor.xml | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/src/main/res/layout/activity_insulinprofile_editor.xml b/app/src/main/res/layout/activity_insulinprofile_editor.xml index eac4b9834b..3397c7fe92 100644 --- a/app/src/main/res/layout/activity_insulinprofile_editor.xml +++ b/app/src/main/res/layout/activity_insulinprofile_editor.xml @@ -78,41 +78,42 @@