Skip to content

Commit add5990

Browse files
authored
feat: unify calendar picker in event/task editor (#943)
* feat: unify calendar picker in event/task editor Refs: #629 * docs: update changelog * fix: update calendar picker icon in task activity * fix: show offline label in task editor
1 parent 6415eda commit add5990

File tree

10 files changed

+182
-425
lines changed

10 files changed

+182
-425
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Unified the local and synchronized calendar pickers in event editor ([#629])
810

911
## [1.9.0] - 2025-12-16
1012
### Changed

app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt

Lines changed: 124 additions & 232 deletions
Large diffs are not rendered by default.

app/src/main/kotlin/org/fossify/calendar/activities/TaskActivity.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ class TaskActivity : SimpleActivity() {
368368

369369
taskDate.setOnClickListener { setupDate() }
370370
taskTime.setOnClickListener { setupTime() }
371-
taskTypeHolder.setOnClickListener { showCalendarDialog() }
371+
calendarHolder.setOnClickListener { showCalendarDialog() }
372372
taskRepetition.setOnClickListener { showRepeatIntervalDialog() }
373373
taskRepetitionRuleHolder.setOnClickListener { showRepetitionRuleDialog() }
374374
taskRepetitionLimitHolder.setOnClickListener { showRepetitionTypePicker() }
@@ -898,7 +898,7 @@ class TaskActivity : SimpleActivity() {
898898
activity = this,
899899
currCalendar = mCalendarId,
900900
showCalDAVCalendars = false,
901-
showNewCalendarOption = true,
901+
showNewCalendarOption = false,
902902
addLastUsedOneAsFirstOption = false,
903903
showOnlyWritable = true,
904904
showManageCalendars = true
@@ -913,7 +913,8 @@ class TaskActivity : SimpleActivity() {
913913
val calendar = calendarsDB.getCalendarWithId(mCalendarId)
914914
if (calendar != null) {
915915
runOnUiThread {
916-
binding.taskType.text = calendar.title
916+
binding.calendarTitle.text = calendar.title
917+
binding.calendarSubtitle.text = getString(R.string.offline_never_synced)
917918
updateTaskColorInfo(calendar.color)
918919
}
919920
}
@@ -965,7 +966,7 @@ class TaskActivity : SimpleActivity() {
965966
updateTextColors(taskNestedScrollview)
966967
val textColor = getProperTextColor()
967968
arrayOf(
968-
taskTimeImage, taskReminderImage, taskTypeImage, taskRepetitionImage, taskColorImage
969+
taskTimeImage, taskReminderImage, calendarImage, taskRepetitionImage, taskColorImage
969970
).forEach {
970971
it.applyColorFilter(textColor)
971972
}

app/src/main/kotlin/org/fossify/calendar/dialogs/SelectEventCalendarDialog.kt

Lines changed: 0 additions & 97 deletions
This file was deleted.

app/src/main/kotlin/org/fossify/calendar/helpers/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Config(context: Context) : BaseConfig(context) {
127127
var lastUsedCaldavCalendarId: Int
128128
get() = prefs.getInt(
129129
LAST_USED_CALDAV_CALENDAR,
130-
getSyncedCalendarIdsAsList().first().toInt()
130+
getSyncedCalendarIdsAsList().first()
131131
)
132132
set(calendarId) = prefs.edit().putInt(LAST_USED_CALDAV_CALENDAR, calendarId).apply()
133133

app/src/main/res/layout/activity_event.xml

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -581,102 +581,60 @@
581581
android:importantForAccessibility="no" />
582582

583583
<ImageView
584-
android:id="@+id/event_caldav_calendar_image"
584+
android:id="@+id/event_calendar_image"
585585
android:layout_width="@dimen/smaller_icon_size"
586586
android:layout_height="@dimen/smaller_icon_size"
587587
android:layout_below="@+id/event_availability_divider"
588-
android:layout_alignTop="@+id/event_caldav_calendar_holder"
588+
android:layout_alignTop="@+id/event_calendar_holder"
589589
android:layout_alignEnd="@+id/event_time_image"
590-
android:layout_alignBottom="@+id/event_caldav_calendar_holder"
590+
android:layout_alignBottom="@+id/event_calendar_holder"
591591
android:layout_marginStart="@dimen/normal_margin"
592592
android:padding="@dimen/medium_margin"
593-
android:src="@drawable/ic_calendar_vector"
594-
android:visibility="gone" />
593+
android:src="@drawable/ic_calendar_vector" />
595594

596595
<RelativeLayout
597-
android:id="@+id/event_caldav_calendar_holder"
596+
android:id="@+id/event_calendar_holder"
598597
android:layout_width="match_parent"
599598
android:layout_height="wrap_content"
600599
android:layout_below="@+id/event_availability_divider"
601-
android:layout_toEndOf="@+id/event_caldav_calendar_image"
602-
android:background="?attr/selectableItemBackground"
603-
android:visibility="gone">
600+
android:layout_toEndOf="@+id/event_calendar_image"
601+
android:background="?attr/selectableItemBackground">
604602

605603
<org.fossify.commons.views.MyTextView
606-
android:id="@+id/event_caldav_calendar_name"
604+
android:id="@+id/event_calendar_title"
607605
android:layout_width="match_parent"
608606
android:layout_height="wrap_content"
609607
android:layout_marginStart="@dimen/small_margin"
610608
android:ellipsize="end"
611609
android:maxLines="1"
610+
android:paddingStart="0dp"
612611
android:paddingTop="@dimen/medium_margin"
613612
android:paddingEnd="@dimen/activity_margin"
614613
android:paddingBottom="@dimen/tiny_margin"
615614
android:textSize="@dimen/day_text_size"
616-
tools:text="My calendar" />
615+
tools:text="@string/regular_event" />
617616

618617
<org.fossify.commons.views.MyTextView
619-
android:id="@+id/event_caldav_calendar_email"
618+
android:id="@+id/event_calendar_subtitle"
620619
android:layout_width="match_parent"
621620
android:layout_height="wrap_content"
622-
android:layout_below="@+id/event_caldav_calendar_name"
621+
android:layout_below="@+id/event_calendar_title"
623622
android:layout_marginStart="@dimen/small_margin"
624623
android:ellipsize="end"
625624
android:maxLines="1"
625+
android:paddingStart="0dp"
626626
android:paddingEnd="@dimen/medium_margin"
627627
android:paddingBottom="@dimen/medium_margin"
628628
android:textSize="@dimen/meta_text_size"
629-
tools:text="[email protected]" />
630-
631-
</RelativeLayout>
632-
633-
<ImageView
634-
android:id="@+id/event_caldav_calendar_divider"
635-
android:layout_width="match_parent"
636-
android:layout_height="@dimen/divider_height"
637-
android:layout_below="@+id/event_caldav_calendar_holder"
638-
android:background="@color/divider_grey"
639-
android:importantForAccessibility="no"
640-
android:visibility="gone" />
641-
642-
<ImageView
643-
android:id="@+id/calendar_image"
644-
android:layout_width="@dimen/smaller_icon_size"
645-
android:layout_height="@dimen/smaller_icon_size"
646-
android:layout_below="@+id/event_caldav_calendar_divider"
647-
android:layout_alignTop="@+id/calendar_holder"
648-
android:layout_alignBottom="@+id/calendar_holder"
649-
android:layout_marginStart="@dimen/normal_margin"
650-
android:padding="@dimen/medium_margin"
651-
android:src="@drawable/ic_category_outline_vector" />
652-
653-
<RelativeLayout
654-
android:id="@+id/calendar_holder"
655-
android:layout_width="match_parent"
656-
android:layout_height="wrap_content"
657-
android:layout_below="@+id/event_caldav_calendar_divider"
658-
android:layout_marginTop="@dimen/medium_margin"
659-
android:layout_marginBottom="@dimen/medium_margin"
660-
android:layout_toEndOf="@+id/calendar_image"
661-
android:background="?attr/selectableItemBackground">
662-
663-
<org.fossify.commons.views.MyTextView
664-
android:id="@+id/calendar"
665-
android:layout_width="match_parent"
666-
android:layout_height="wrap_content"
667-
android:layout_marginStart="@dimen/small_margin"
668-
android:layout_marginEnd="@dimen/medium_margin"
669-
android:paddingTop="@dimen/normal_margin"
670-
android:paddingBottom="@dimen/normal_margin"
671-
android:textSize="@dimen/day_text_size" />
629+
tools:text="@string/offline_never_synced" />
672630

673631
</RelativeLayout>
674632

675633
<ImageView
676634
android:id="@+id/calendar_divider"
677635
android:layout_width="match_parent"
678636
android:layout_height="@dimen/divider_height"
679-
android:layout_below="@+id/calendar_holder"
637+
android:layout_below="@+id/event_calendar_holder"
680638
android:background="@color/divider_grey"
681639
android:importantForAccessibility="no" />
682640

app/src/main/res/layout/activity_task.xml

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -322,51 +322,67 @@
322322
android:importantForAccessibility="no" />
323323

324324
<ImageView
325-
android:id="@+id/task_type_image"
325+
android:id="@+id/calendar_image"
326326
android:layout_width="@dimen/smaller_icon_size"
327327
android:layout_height="@dimen/smaller_icon_size"
328328
android:layout_below="@+id/task_repetition_divider"
329-
android:layout_alignTop="@+id/task_type_holder"
330-
android:layout_alignBottom="@+id/task_type_holder"
329+
android:layout_alignTop="@+id/calendar_holder"
330+
android:layout_alignBottom="@+id/calendar_holder"
331331
android:layout_marginStart="@dimen/normal_margin"
332332
android:padding="@dimen/medium_margin"
333-
android:src="@drawable/ic_category_outline_vector" />
333+
android:src="@drawable/ic_calendar_vector" />
334334

335335
<RelativeLayout
336-
android:id="@+id/task_type_holder"
336+
android:id="@+id/calendar_holder"
337337
android:layout_width="match_parent"
338338
android:layout_height="wrap_content"
339339
android:layout_below="@+id/task_repetition_divider"
340-
android:layout_marginTop="@dimen/medium_margin"
341-
android:layout_marginBottom="@dimen/medium_margin"
342-
android:layout_toEndOf="@+id/task_type_image"
340+
android:layout_toEndOf="@+id/calendar_image"
343341
android:background="?attr/selectableItemBackground">
344342

345343
<org.fossify.commons.views.MyTextView
346-
android:id="@+id/task_type"
344+
android:id="@+id/calendar_title"
347345
android:layout_width="match_parent"
348346
android:layout_height="wrap_content"
349347
android:layout_marginStart="@dimen/small_margin"
350-
android:layout_marginEnd="@dimen/medium_margin"
351-
android:paddingTop="@dimen/normal_margin"
352-
android:paddingBottom="@dimen/normal_margin"
353-
android:textSize="@dimen/day_text_size" />
348+
android:ellipsize="end"
349+
android:maxLines="1"
350+
android:paddingStart="0dp"
351+
android:paddingTop="@dimen/medium_margin"
352+
android:paddingEnd="@dimen/activity_margin"
353+
android:paddingBottom="@dimen/tiny_margin"
354+
android:textSize="@dimen/day_text_size"
355+
tools:text="@string/regular_event" />
356+
357+
<org.fossify.commons.views.MyTextView
358+
android:id="@+id/calendar_subtitle"
359+
android:layout_width="match_parent"
360+
android:layout_height="wrap_content"
361+
android:layout_below="@+id/calendar_title"
362+
android:layout_marginStart="@dimen/small_margin"
363+
android:ellipsize="end"
364+
android:maxLines="1"
365+
android:paddingStart="0dp"
366+
android:paddingEnd="@dimen/medium_margin"
367+
android:paddingBottom="@dimen/medium_margin"
368+
android:textSize="@dimen/meta_text_size"
369+
tools:text="@string/offline_never_synced" />
354370

355371
</RelativeLayout>
356372

357373
<ImageView
358-
android:id="@+id/task_type_divider"
374+
android:id="@+id/calendar_divider"
359375
android:layout_width="match_parent"
360376
android:layout_height="@dimen/divider_height"
361-
android:layout_below="@+id/task_type_holder"
377+
android:layout_below="@+id/calendar_holder"
362378
android:background="@color/divider_grey"
363379
android:importantForAccessibility="no" />
364380

365381
<ImageView
366382
android:id="@+id/task_color_image"
367383
android:layout_width="@dimen/smaller_icon_size"
368384
android:layout_height="@dimen/smaller_icon_size"
369-
android:layout_below="@+id/task_type_divider"
385+
android:layout_below="@+id/calendar_divider"
370386
android:layout_alignTop="@+id/task_color_holder"
371387
android:layout_alignBottom="@+id/task_color_holder"
372388
android:layout_marginStart="@dimen/normal_margin"
@@ -377,7 +393,7 @@
377393
android:id="@+id/task_color_holder"
378394
android:layout_width="match_parent"
379395
android:layout_height="wrap_content"
380-
android:layout_below="@+id/task_type_divider"
396+
android:layout_below="@+id/calendar_divider"
381397
android:layout_marginTop="@dimen/medium_margin"
382398
android:layout_marginBottom="@dimen/medium_margin"
383399
android:layout_toEndOf="@+id/task_color_image"

app/src/main/res/layout/dialog_select_radio_group.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/src/main/res/layout/item_calendar.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
android:layout_toStartOf="@+id/calendar_color"
2525
android:paddingStart="@dimen/medium_margin"
2626
android:paddingEnd="@dimen/medium_margin"
27-
tools:text="Event type" />
27+
tools:text="Calendar" />
2828

2929
<ImageView
3030
android:id="@+id/calendar_color"

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
<string name="type_already_exists">Calendar with this title already exists</string>
163163
<string name="color">Color</string>
164164
<string name="regular_event">Local calendar</string>
165+
<string name="offline_never_synced">Offline (never synced)</string>
165166
<string name="cannot_delete_default_type">Built-in calendar cannot be deleted</string>
166167
<string name="select_event_type">Select a calendar</string>
167168
<string name="move_events_into_default">Move affected events into the default calendar</string>

0 commit comments

Comments
 (0)