Make visibility of notes field a preference.

This commit is contained in:
Johannes Mockenhaupt 2018-04-12 21:43:55 +02:00
parent 05e07cf943
commit bf02edd871
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
5 changed files with 15 additions and 3 deletions

View file

@ -56,6 +56,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
private Button fav2Button; private Button fav2Button;
private Button fav3Button; private Button fav3Button;
private LinearLayout notesLayout;
private EditText notesEdit; private EditText notesEdit;
private static final int FAV1_DEFAULT = 5; private static final int FAV1_DEFAULT = 5;
@ -159,7 +160,9 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
fav3Button.setOnClickListener(this); fav3Button.setOnClickListener(this);
fav3Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))); fav3Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT)));
notesEdit = (EditText) view.findViewById(R.id.newcarbs_notes); notesLayout = view.findViewById(R.id.newcarbs_notes_layout);
notesLayout.setVisibility(SP.getBoolean(R.string.key_show_notes_entry_dialogs, false) ? View.VISIBLE : View.GONE);
notesEdit = view.findViewById(R.id.newcarbs_notes);
setCancelable(true); setCancelable(true);
getDialog().setCanceledOnTouchOutside(false); getDialog().setCanceledOnTouchOutside(false);

View file

@ -105,6 +105,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
NumberPicker editCorr; NumberPicker editCorr;
NumberPicker editCarbTime; NumberPicker editCarbTime;
LinearLayout notesLayout;
EditText notesEdit; EditText notesEdit;
Integer calculatedCarbs = 0; Integer calculatedCarbs = 0;
@ -209,6 +210,8 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
superbolus = (TextView) view.findViewById(R.id.treatments_wizard_sb); superbolus = (TextView) view.findViewById(R.id.treatments_wizard_sb);
superbolusInsulin = (TextView) view.findViewById(R.id.treatments_wizard_sbinsulin); superbolusInsulin = (TextView) view.findViewById(R.id.treatments_wizard_sbinsulin);
notesLayout = view.findViewById(R.id.treatments_wizard_notes_layout);
notesLayout.setVisibility(SP.getBoolean(R.string.key_show_notes_entry_dialogs, false) ? View.VISIBLE : View.GONE);
notesEdit = (EditText) view.findViewById(R.id.newcarbs_notes); notesEdit = (EditText) view.findViewById(R.id.newcarbs_notes);
bgTrend = (TextView) view.findViewById(R.id.treatments_wizard_bgtrend); bgTrend = (TextView) view.findViewById(R.id.treatments_wizard_bgtrend);

View file

@ -237,6 +237,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/newcarbs_notes_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
@ -255,8 +256,7 @@
<EditText <EditText
android:id="@+id/newcarbs_notes" android:id="@+id/newcarbs_notes"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>

View file

@ -998,4 +998,6 @@
<string name="openapssmb_maxiob_title">Maximum total IOB OpenAPS can\'t go over [U]</string> <string name="openapssmb_maxiob_title">Maximum total IOB OpenAPS can\'t go over [U]</string>
<string name="openapssmb_maxiob_summary">This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value</string> <string name="openapssmb_maxiob_summary">This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value</string>
<string name="time">Time</string> <string name="time">Time</string>
<string name="key_show_notes_entry_dialogs">show_notes_entry_dialogs</string>
<string name="overview_show_notes_field_in_dialogs_title">Show notes field in dialogs</string>
</resources> </resources>

View file

@ -112,5 +112,9 @@
android:summary="@string/show_calibration_button_summary"/> android:summary="@string/show_calibration_button_summary"/>
</PreferenceScreen> </PreferenceScreen>
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_show_notes_entry_dialogs"
android:title="@string/overview_show_notes_field_in_dialogs_title" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>