From fded515ac16ac4e98ee7d5a51b72a6720269a3e6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 1 Jan 2017 20:22:23 +0100 Subject: [PATCH 1/2] fix TimeListEdit when fragment is restored --- app/src/main/java/info/nightscout/utils/TimeListEdit.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/info/nightscout/utils/TimeListEdit.java b/app/src/main/java/info/nightscout/utils/TimeListEdit.java index b1abfb6849..f3975e3e7a 100644 --- a/app/src/main/java/info/nightscout/utils/TimeListEdit.java +++ b/app/src/main/java/info/nightscout/utils/TimeListEdit.java @@ -84,23 +84,29 @@ public class TimeListEdit { for (int i = 0; i < itemsCount(); i++) { View childview = inflater.inflate(R.layout.timelistedit_element, layout, false); + childview.setId(View.generateViewId()); final Spinner timeSpinner = (Spinner) childview.findViewById(R.id.timelistedit_time); + timeSpinner.setId(View.generateViewId()); int previous = i == 0 ? -1 * ONEHOURINSECONDS : secondFromMidnight(i - 1); int next = i == itemsCount() - 1 ? 24 * ONEHOURINSECONDS : secondFromMidnight(i + 1); if (i == 0) next = ONEHOURINSECONDS; fillSpinner(timeSpinner, secondFromMidnight(i), previous, next); final EditText editText1 = (EditText) childview.findViewById(R.id.timelistedit_edit1); + editText1.setId(View.generateViewId()); fillNumber(editText1, value1(i)); final EditText editText2 = ((EditText) childview.findViewById(R.id.timelistedit_edit2)); fillNumber(editText2, value2(i)); + editText2.setId(View.generateViewId()); if (data2 == null) { editText2.setVisibility(View.GONE); } ImageView addbutton = (ImageView) childview.findViewById(R.id.timelistedit_add); + addbutton.setId(View.generateViewId()); ImageView removebutton = (ImageView) childview.findViewById(R.id.timelistedit_remove); + removebutton.setId(View.generateViewId()); if (itemsCount() == 1 && i == 0) { removebutton.setVisibility(View.GONE); From 9c40e4af34cadc421818a626d658e88493e9521a Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sun, 1 Jan 2017 21:46:25 +0100 Subject: [PATCH 2/2] Dismiss editing when fragment is paused --- .../CircadianPercentageProfileFragment.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfileFragment.java index 0bf490abb6..a9afb13bbb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfileFragment.java @@ -344,6 +344,12 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag @Override public void onPause() { super.onPause(); + + if (basalEditDialog != null && basalEditDialog.isVisible()) { + basalEditDialog.dismiss(); + } + basalEditDialog = null; + MainApp.bus().unregister(this); }