diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinManager.java b/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinManager.java index bc7d23b02b..6da30ed90b 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinManager.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinManager.java @@ -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; @@ -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; } } 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 92789b895e..b215bf4c42 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinProfileEditor.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/insulin/InsulinProfileEditor.java @@ -1,6 +1,7 @@ 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; @@ -8,6 +9,7 @@ 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; @@ -31,6 +33,8 @@ public class InsulinProfileEditor extends BaseAppCompatActivity { private Spinner basalSpinner, bolusSpinner; private HashMap checkboxes; private HashMap profiles; + private ScrollView parentScrollView; + private ScrollView childScrollView; //private Context mContext; @@ -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); diff --git a/app/src/main/res/layout/activity_insulinprofile_editor.xml b/app/src/main/res/layout/activity_insulinprofile_editor.xml index e4c7e894a8..14448ddd7c 100644 --- a/app/src/main/res/layout/activity_insulinprofile_editor.xml +++ b/app/src/main/res/layout/activity_insulinprofile_editor.xml @@ -8,6 +8,7 @@ android:fitsSystemWindows="true"> - + 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"> + + + +