Removed 'all day' switch in meeting scheduling/edit

This commit is contained in:
Sylvain Berfini 2024-09-12 11:46:20 +02:00
parent 96d85027c3
commit 8fc3185278
4 changed files with 5 additions and 138 deletions

View file

@ -116,27 +116,6 @@ class EditMeetingFragment : SlidingPaneChildFragment() {
picker.show(parentFragmentManager, "Start date picker")
}
binding.setPickEndDateClickListener {
val constraintsBuilder =
CalendarConstraints.Builder()
.setValidator(
DateValidatorPointForward.from(viewModel.getCurrentlySelectedStartDate())
)
val picker =
MaterialDatePicker.Builder.datePicker()
.setCalendarConstraints(constraintsBuilder.build())
.setTitleText(R.string.meeting_schedule_pick_end_date_title)
.setSelection(viewModel.getCurrentlySelectedEndDate())
.build()
picker.addOnPositiveButtonClickListener {
val selection = picker.selection
if (selection != null) {
viewModel.setEndDate(selection)
}
}
picker.show(parentFragmentManager, "End date picker")
}
binding.setPickStartTimeClickListener {
val isSystem24Hour = DateFormat.is24HourFormat(requireContext())
val clockFormat = if (isSystem24Hour) TimeFormat.CLOCK_24H else TimeFormat.CLOCK_12H

View file

@ -107,6 +107,7 @@ class ScheduleMeetingFragment : GenericMainFragment() {
.setCalendarConstraints(constraintsBuilder.build())
.setTitleText(R.string.meeting_schedule_pick_start_date_title)
.setSelection(viewModel.getCurrentlySelectedStartDate())
.setInputMode(MaterialDatePicker.INPUT_MODE_CALENDAR)
.build()
picker.addOnPositiveButtonClickListener {
val selection = picker.selection
@ -117,27 +118,6 @@ class ScheduleMeetingFragment : GenericMainFragment() {
picker.show(parentFragmentManager, "Start date picker")
}
binding.setPickEndDateClickListener {
val constraintsBuilder =
CalendarConstraints.Builder()
.setValidator(
DateValidatorPointForward.from(viewModel.getCurrentlySelectedStartDate())
)
val picker =
MaterialDatePicker.Builder.datePicker()
.setCalendarConstraints(constraintsBuilder.build())
.setTitleText(R.string.meeting_schedule_pick_end_date_title)
.setSelection(viewModel.getCurrentlySelectedEndDate())
.build()
picker.addOnPositiveButtonClickListener {
val selection = picker.selection
if (selection != null) {
viewModel.setEndDate(selection)
}
}
picker.show(parentFragmentManager, "End date picker")
}
binding.setPickStartTimeClickListener {
val isSystem24Hour = DateFormat.is24HourFormat(requireContext())
val clockFormat = if (isSystem24Hour) TimeFormat.CLOCK_24H else TimeFormat.CLOCK_12H
@ -147,6 +127,7 @@ class ScheduleMeetingFragment : GenericMainFragment() {
.setTitleText(R.string.meeting_schedule_pick_start_time_title)
.setHour(viewModel.startHour)
.setMinute(viewModel.startMinutes)
.setInputMode(MaterialTimePicker.INPUT_MODE_CLOCK)
.build()
picker.addOnPositiveButtonClickListener {
viewModel.setStartTime(picker.hour, picker.minute)
@ -165,6 +146,7 @@ class ScheduleMeetingFragment : GenericMainFragment() {
.setTitleText(R.string.meeting_schedule_pick_end_time_title)
.setHour(viewModel.endHour)
.setMinute(viewModel.endMinutes)
.setInputMode(MaterialTimePicker.INPUT_MODE_CLOCK)
.build()
picker.addOnPositiveButtonClickListener {
viewModel.setEndTime(picker.hour, picker.minute)

View file

@ -11,9 +11,6 @@
<variable
name="pickStartDateClickListener"
type="View.OnClickListener" />
<variable
name="pickEndDateClickListener"
type="View.OnClickListener" />
<variable
name="pickStartTimeClickListener"
type="View.OnClickListener" />
@ -126,21 +123,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/separator" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/to_date"
android:onClick="@{pickEndDateClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="10dp"
android:text="@{viewModel.toDate, default=`Fri. October 11th, 2023`}"
android:textSize="14sp"
android:textColor="?attr/color_main2_600"
android:visibility="@{viewModel.allDayMeeting ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/from_date" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/from_time"
@ -170,35 +152,6 @@
app:layout_constraintStart_toEndOf="@id/from_time"
app:layout_constraintTop_toTopOf="@id/from_time" />
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/all_day_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="32dp"
android:checked="@={viewModel.allDayMeeting}"
app:layout_constraintStart_toStartOf="@id/from_date"
app:layout_constraintEnd_toStartOf="@id/all_day"
app:layout_constraintTop_toBottomOf="@id/to_time"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_500"
android:id="@+id/all_day"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="@string/meeting_schedule_date_all_day_title"
android:textColor="?attr/color_main2_600"
android:textSize="14sp"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintStart_toEndOf="@id/all_day_switch"
app:layout_constraintTop_toTopOf="@id/all_day_switch"
app:layout_constraintBottom_toBottomOf="@id/all_day_switch"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/timezone_label"
@ -217,7 +170,7 @@
android:drawableTint="?attr/color_main2_600"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/all_day_switch" />
app:layout_constraintTop_toBottomOf="@id/to_time" />
<androidx.appcompat.widget.AppCompatSpinner
style="@style/default_text_style"

View file

@ -11,9 +11,6 @@
<variable
name="pickStartDateClickListener"
type="View.OnClickListener" />
<variable
name="pickEndDateClickListener"
type="View.OnClickListener" />
<variable
name="pickStartTimeClickListener"
type="View.OnClickListener" />
@ -265,21 +262,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/separator" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/to_date"
android:onClick="@{pickEndDateClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="10dp"
android:text="@{viewModel.toDate, default=`Fri. October 11th, 2023`}"
android:textSize="14sp"
android:textColor="?attr/color_main2_600"
android:visibility="@{viewModel.allDayMeeting ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/from_date" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/from_time"
@ -309,35 +291,6 @@
app:layout_constraintStart_toEndOf="@id/from_time"
app:layout_constraintTop_toTopOf="@id/from_time" />
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/all_day_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="32dp"
android:checked="@={viewModel.allDayMeeting}"
app:layout_constraintStart_toStartOf="@id/from_date"
app:layout_constraintEnd_toStartOf="@id/all_day"
app:layout_constraintTop_toBottomOf="@id/to_time"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_500"
android:id="@+id/all_day"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="@string/meeting_schedule_date_all_day_title"
android:textColor="?attr/color_main2_600"
android:textSize="14sp"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintStart_toEndOf="@id/all_day_switch"
app:layout_constraintTop_toTopOf="@id/all_day_switch"
app:layout_constraintBottom_toBottomOf="@id/all_day_switch"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/timezone_label"
@ -356,7 +309,7 @@
android:drawableTint="?attr/color_main2_600"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/all_day_switch" />
app:layout_constraintTop_toBottomOf="@id/to_time" />
<androidx.appcompat.widget.AppCompatSpinner
style="@style/default_text_style"