diff options
author | stefan-niedermann <info@niedermann.it> | 2019-10-19 16:18:31 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2019-10-19 16:18:31 +0300 |
commit | f70a606b2ef0ba62cdf8baee132649f1ce7a1356 (patch) | |
tree | b93a396b769f970bc1135c275d50b6f3d4558f84 | |
parent | e5458b63815a3e08d2eefc3b688d55a92f3c9569 (diff) |
Fix clearDueDate button behavior
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardDetailsFragment.java | 15 | ||||
-rw-r--r-- | app/src/main/res/layout/fragment_card_edit_tab_details.xml | 6 |
2 files changed, 16 insertions, 5 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardDetailsFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardDetailsFragment.java index de6db9861..0d730557f 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardDetailsFragment.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardDetailsFragment.java @@ -297,6 +297,7 @@ public class CardDetailsFragment extends Fragment implements DatePickerDialog.On dueDate.setText(null); dueDateTime.setText(null); fullCard.getCard().setDueDate(null); + clearDueDate.setVisibility(View.GONE); }); } else { dueDate.setEnabled(false); @@ -453,17 +454,14 @@ public class CardDetailsFragment extends Fragment implements DatePickerDialog.On @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { - Calendar c = Calendar.getInstance(); int hourOfDay; int minute; if (dueDateTime.getText() != null && dueDateTime.length() > 0) { - clearDueDate.setVisibility(View.VISIBLE); hourOfDay = this.fullCard.getCard().getDueDate().getHours(); minute = this.fullCard.getCard().getDueDate().getMinutes(); } else { - clearDueDate.setVisibility(View.GONE); hourOfDay = 0; minute = 0; } @@ -472,6 +470,12 @@ public class CardDetailsFragment extends Fragment implements DatePickerDialog.On this.fullCard.getCard().setDueDate(c.getTime()); dueDate.setText(dateFormat.format(c.getTime())); activity.setDueDate(fullCard.card.getDueDate()); + + if(this.fullCard.getCard().getDueDate() == null || this.fullCard.getCard().getDueDate().getTime() == 0) { + clearDueDate.setVisibility(View.GONE); + } else { + clearDueDate.setVisibility(View.VISIBLE); + } } @Override @@ -483,5 +487,10 @@ public class CardDetailsFragment extends Fragment implements DatePickerDialog.On this.fullCard.getCard().getDueDate().setMinutes(minute); dueDateTime.setText(dueTime.format(this.fullCard.getCard().getDueDate().getTime())); activity.setDueDate(fullCard.card.getDueDate()); + if(this.fullCard.getCard().getDueDate() == null || this.fullCard.getCard().getDueDate().getTime() == 0) { + clearDueDate.setVisibility(View.GONE); + } else { + clearDueDate.setVisibility(View.VISIBLE); + } } } diff --git a/app/src/main/res/layout/fragment_card_edit_tab_details.xml b/app/src/main/res/layout/fragment_card_edit_tab_details.xml index 56ba802f2..d6b630298 100644 --- a/app/src/main/res/layout/fragment_card_edit_tab_details.xml +++ b/app/src/main/res/layout/fragment_card_edit_tab_details.xml @@ -61,26 +61,28 @@ android:id="@+id/dueDateDate" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_weight="2" android:enabled="true" android:focusable="false" android:hint="@string/hint_due_date_date" android:importantForAutofill="no" + android:inputType="date" android:maxLines="1" - android:layout_weight="2" tools:text="01/07/2020" /> <EditText android:id="@+id/dueDateTime" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_weight="1" android:enabled="true" android:focusable="false" android:hint="@string/hint_due_date_time" android:importantForAutofill="no" + android:inputType="datetime" android:maxLines="1" android:minLines="0" android:textAlignment="center" - android:layout_weight="1" tools:text="11:45" /> <ImageView |