Skip to content

Commit

Permalink
Merge pull request #3177 from TheConen/master
Browse files Browse the repository at this point in the history
Fix insulin profile list not showing all insulin profiles
  • Loading branch information
jamorham authored Dec 15, 2023
2 parents 8253844 + cd59c78 commit 60d198e
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 180 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
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 @@ -36,8 +34,6 @@ 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 @@ -56,19 +52,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;
});
val iprofiles = InsulinManager.getAllProfiles();
if (iprofiles == null) {
JoH.static_toast_long("Can't initialize insulin profiles");
Expand Down
62 changes: 27 additions & 35 deletions app/src/main/res/layout/activity_insulinprofile_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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 @@ -21,10 +20,8 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true">
android:layout_height="wrap_content"
android:weightSum="1">

<TextView
android:id="@+id/Text"
Expand All @@ -34,26 +31,20 @@
android:text="@string/pref_enable_insulinprofiles"
android:textSize="18sp" />

<ScrollView
android:id="@+id/child_scroll_view"
android:layout_width="match_parent"
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_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_weight="1"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:fadeScrollbars="false"
android:orientation="vertical"
android:scrollbars="vertical"></LinearLayout>

</ScrollView>
android:scrollbars="vertical">
</LinearLayout>

<TextView
android:id="@+id/Text2"
Expand Down Expand Up @@ -87,41 +78,42 @@

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="94dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:paddingTop="@dimen/activity_vertical_margin"
android:gravity="bottom">

<Button
android:id="@+id/profileCancelbtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:text="@string/cancel"
android:id="@+id/profileCancelbtn"
android:onClick="profileCancelButton"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/profileUndoBtn"
android:layout_alignParentStart="true"
android:layout_alignTop="@+id/profileUndoBtn" />
android:layout_alignParentBottom="true"
android:onClick="profileCancelButton"
android:text="@string/cancel" />

<Button
android:id="@+id/profileSaveBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save"
android:id="@+id/profileSaveBtn"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/profileUndoBtn"
android:onClick="profileSaveButton" />
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:onClick="profileSaveButton"
android:text="@string/save" />

<Button
android:id="@+id/profileUndoBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:id="@+id/profileUndoBtn"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/profileCancelbtn"
android:onClick="profileUndoButton" />
android:onClick="profileUndoButton"
android:text="@string/reset" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{"entries":[
{"lexicon": "stop",
"matchWords":[
{
"entries": [
{
"lexicon": "stop",
"matchWords": [
"stop",
"cancel",
"done",
Expand All @@ -10,10 +12,11 @@
"finished",
"finish",
"quit"
]},

{"lexicon": "rapid",
"matchWords":[
]
},
{
"lexicon": "rapid",
"matchWords": [
"rapid",
"rapid acting",
"rapid-acting",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
]}

]}
]
}
]
}
Loading

0 comments on commit 60d198e

Please sign in to comment.