Skip to content

Commit

Permalink
feat: Make the schedule option bottom sheet title customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Feb 21, 2025
1 parent 9cd9af2 commit 3780a50
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class ScheduleSendBottomSheetDialog @Inject constructor() : SelectScheduleOption
// as a replacement (corresponding to Thursday 1 January 1970 00:00:00 UT).
override val lastSelectedEpoch: Long? by lazy { navigationArgs.lastSelectedScheduleEpoch.takeIf { it != 0L } }

override val titleRes: Int = R.string.scheduleSendingTitle

override fun onLastScheduleOptionClicked() {
if (lastSelectedEpoch != null) {
trackScheduleSendEvent("lastSelectedSchedule")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ abstract class SelectScheduleOptionBottomSheet : BottomSheetDialogFragment() {

abstract val lastSelectedEpoch: Long?

@get:StringRes
abstract val titleRes: Int

abstract fun onLastScheduleOptionClicked()
abstract fun onScheduleOptionClicked(dateItem: ScheduleOption)
abstract fun onCustomScheduleOptionClicked()
Expand All @@ -54,6 +57,8 @@ abstract class SelectScheduleOptionBottomSheet : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?): Unit = with(binding) {
super.onViewCreated(view, savedInstanceState)

title.text = getString(titleRes)

computeLastScheduleOption()

setLastScheduleOptionClickListener()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/bottom_sheet_schedule_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
android:layout_marginHorizontal="@dimen/marginStandardMedium"
android:layout_marginBottom="@dimen/marginStandardMedium"
android:gravity="center_horizontal"
android:text="@string/scheduleSendingTitle" />
tools:text="@string/scheduleSendingTitle" />

<com.infomaniak.mail.ui.main.thread.actions.ActionItemView
android:id="@+id/lastScheduleOption"
Expand Down

0 comments on commit 3780a50

Please sign in to comment.