Compare commits

..
30 Commits
Author SHA1 Message Date
dbd5ce6700 Release v2.23.0 (#433)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 9s
Renovate / renovate (push) Successful in 1m28s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Successful in 18m17s
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Successful in 1m31s
Beta — Codeberg pre-release / detect (push) Successful in 5s
Beta — Codeberg pre-release / beta (push) Skipped
Stable 2.23.0 after four betas. It adds long-press select, move, resize and drafting in the timeline, tap-to-call phone numbers, formatted HTML descriptions, scrolling back in the agenda, events from shared text, the option to open the editor on tap, the black theme, Liberapay and more haptics. It also fixes the daylight saving and recurring-move bugs. CHANGELOG.md has the full list, and every store locale has its own What's New.

I merged main into the release branch to pick up Liberapay (#430) and Weblate #421. The Czech and Japanese string conflicts were lines added at the end of each file on both sides, so I kept main's.

Closes #116, closes #141, closes #153, closes #178, closes #181, closes #271, closes #306, closes #339, closes #367, closes #387, closes #413

Co-authored-by: Jean-Luc Makiola <business@jeanlucmakiola.de>
Co-authored-by: Tritra002 <tritratrulala002@outlook.com>
Reviewed-on: https://codeberg.org/jlmakiola/calendula/pulls/433
2026-10-21 14:10:22 +02:00
Jean-Luc Makiola 068a96b228 Translations update from Weblate (#421)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 8s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Skipped
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Skipped
Renovate / renovate (push) Successful in 1m56s
Reviewed-on: https://codeberg.org/jlmakiola/calendula/pulls/421
2026-10-21 13:46:56 +02:00
James Trivette 7c522c5903 Translated using Weblate (Czech)
Currently translated at 100.0% (656 of 656 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/cs/
2026-10-21 08:16:14 +00:00
Sup99999 6ef516fe4d Translated using Weblate (Arabic)
Currently translated at 100.0% (651 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ar/
2026-10-21 02:38:13 +00:00
mirai yamada 9a7d65be6b Translated using Weblate (Japanese)
Currently translated at 17.6% (115 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ja/
2026-10-21 02:38:13 +00:00
mirai yamada c2aae1629f Translated using Weblate (Japanese)
Currently translated at 17.3% (113 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ja/
2026-10-21 02:38:13 +00:00
Weblate a697803e29 Translated using Weblate (Japanese)
Currently translated at 17.3% (113 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ja/
2026-10-21 02:38:13 +00:00
Weblate f4b6cb3acb Translated using Weblate (Japanese)
Currently translated at 16.4% (107 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ja/
2026-10-21 02:38:13 +00:00
mirai yamada c3f3eb83f2 Translated using Weblate (Japanese)
Currently translated at 16.4% (107 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ja/
2026-10-21 02:38:13 +00:00
Jean-Luc Makiolaandmakiolaj 5d10f773ca Add Liberapay alongside Ko-fi for donations (#430)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 10s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Skipped
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Skipped
Renovate / renovate (push) Successful in 2m1s
Adds Liberapay as a second donation option next to Ko-fi.

- Settings: "Support development" now opens a full-screen picker with Ko-fi (one-off tips) and Liberapay (recurring donations) instead of linking straight to Ko-fi.
- README: Liberapay badge next to the Ko-fi badge, plus a short Support section.

No issue for this one.

Co-authored-by: Jean-Luc Makiola <business@jeanlucmakiola.de>
Reviewed-on: https://codeberg.org/jlmakiola/calendula/pulls/430
2026-10-20 11:09:52 +02:00
Jean-Luc Makiola b2fcc55018 Translations update from Weblate (#391)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 8s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Skipped
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Skipped
Renovate / renovate (push) Successful in 1m33s
Reviewed-on: https://codeberg.org/jlmakiola/calendula/pulls/391
2026-10-15 16:22:27 +02:00
mirai yamada 10414fcf05 Translated using Weblate (Japanese)
Currently translated at 13.2% (86 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ja/
2026-10-15 12:55:25 +00:00
Dmitri Gabinski 49f604bdc2 Translated using Weblate (Belarusian)
Currently translated at 92.6% (603 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/be/
2026-10-13 12:41:03 +00:00
Dmitri Gabinski 56763f58da Translated using Weblate (Russian)
Currently translated at 39.1% (255 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ru/
2026-10-13 12:41:02 +00:00
Dmitri Gabinski af34f014a7 Translated using Weblate (Belarusian)
Currently translated at 90.6% (590 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/be/
2026-10-13 10:01:47 +00:00
Dmitri Gabinski 3280191309 Translated using Weblate (Belarusian)
Currently translated at 90.3% (588 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/be/
2026-10-13 09:50:18 +00:00
Jean-Luc Makiola 76cdc1c535 Translations update from Weblate (#356)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 36s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Skipped
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Skipped
Renovate / renovate (push) Successful in 2m5s
Reviewed-on: https://codeberg.org/jlmakiola/calendula/pulls/356
2026-10-12 21:51:27 +02:00
Sup99999 68c0a262fa Translated using Weblate (Arabic)
Currently translated at 100.0% (651 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ar/
2026-10-10 21:10:40 +00:00
makiolaj 39e13e86d2 Translated using Weblate (French)
Currently translated at 90.4% (589 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/fr/
2026-10-10 21:10:40 +00:00
James Trivette 1cc7f40f7e Translated using Weblate (Czech)
Currently translated at 98.7% (643 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/cs/
2026-10-10 21:10:40 +00:00
Dmitri Gabinski 8a15325fdc Translated using Weblate (Belarusian)
Currently translated at 87.0% (567 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/be/
2026-10-10 21:10:40 +00:00
MaxrregMustermann 7f977971ed Translated using Weblate (German)
Currently translated at 98.0% (638 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/de/
2026-10-10 21:10:40 +00:00
N Donkersloot 632155c016 Translated using Weblate (Dutch)
Currently translated at 100.0% (651 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/nl/
2026-10-10 21:10:40 +00:00
N Donkersloot 8834884d4e Translated using Weblate (Dutch)
Currently translated at 97.0% (632 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/nl/
2026-10-10 21:10:40 +00:00
VinCap 236372d740 Translated using Weblate (Italian)
Currently translated at 99.5% (648 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/it/
2026-10-10 21:10:40 +00:00
Sup99999 678a526cb9 Translated using Weblate (Arabic)
Currently translated at 100.0% (651 of 651 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ar/
2026-10-10 21:10:40 +00:00
Weblate 84fd51baf6 Translated using Weblate (Arabic)
Currently translated at 100.0% (649 of 649 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ar/
2026-10-10 21:10:40 +00:00
Sup99999 450b8b0107 Translated using Weblate (Arabic)
Currently translated at 100.0% (649 of 649 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/ar/
2026-10-10 21:10:40 +00:00
Weblate 8078fb4f10 Translated using Weblate (Czech)
Currently translated at 100.0% (633 of 633 strings)

Translation: Calendula/Strings
Translate-URL: https://weblate.dev.jeanlucmakiola.de/projects/calendula/strings/cs/
2026-10-10 21:10:40 +00:00
Jean-Luc Makiolaandmakiolaj 46b88cc03e ci: route jobs to the gradle and light runners (#385)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 8s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Skipped
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Skipped
Renovate / renovate (push) Successful in 1m34s
Moves Gradle jobs to the dedicated `gradle` runner (capacity 1, 8g per job) and the cheap gate/lint jobs to `light`. Two runners used to share the `docker` label, so two Gradle builds could run at once and the VPS ran out of memory. Only `runs-on` lines change.

Co-authored-by: Jean-Luc Makiola <business@jeanlucmakiola.de>
Reviewed-on: https://codeberg.org/jlmakiola/calendula/pulls/385
2026-10-10 12:02:34 +02:00
72 changed files with 1380 additions and 463 deletions
+16 -1
View File
@@ -7,8 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [2.23.0] — 2026-10-21
### Added
- **Long press an event to select it.** In the day, 3-day and week views, a long press lifts the event and selects it. Keep your finger down and move to drag it straight away. A selected event has handles at its top and bottom: drag them to change when it starts or ends, in 15-minute steps and across midnight if you want. The bar at the top edits, duplicates, shares or deletes it, and tapping elsewhere or going back deselects it. Read-only events can be selected but not moved or resized ([#141]).
- **Long press an event to select it.** In the day, 3-day and week views, a long press lifts the event and selects it. Keep your finger down and move to drag it straight away. A selected event has handles at its top and bottom: drag them to change when it starts or ends, in 15-minute steps and across midnight if you want. The bar at the top edits, duplicates, shares or deletes it, and tapping elsewhere or going back deselects it. The bar shows the new times while you move or resize. Read-only events can be selected but not moved or resized ([#141]).
- **Long press an empty slot to draft an event.** In the day, 3-day and week views, a long press on free time drops a block of your default event length there. Move it while still holding, or let go and drag it or its handles into place, then tap the tick to open a new event at that time. The ✕, a tap elsewhere or going back throws the draft away ([#153]).
- **Tap a phone number in an event to call it.** Phone numbers in an event's title, location and description are now links. Tapping one opens your phone app with the number filled in, ready to call. A conference dial-in like "+1 646 558 8656,,850123#" brings its meeting ID along. Meeting IDs and PINs on their own, dates, times and amounts stay plain text. Long-pressing a field copies it, even when you press on a link ([#339]).
- **Formatted event descriptions read properly.** Descriptions from Outlook, Exchange and Google Calendar are often stored as HTML, which used to show up as a wall of tags. The event view now shows them as formatted text: bold, italics, lists and links work, table rows sit on one line each, and the fonts and colours the sender picked are left out so the text matches the app. Search matches the text you see. The edit form still shows the original, so saving an event never changes its formatting ([#271]).
@@ -16,12 +18,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Create an event from shared or selected text.** Share text to Calendula, or select text in another app and pick Create event from the selection menu, and the new-event form opens with it filled in. A shared subject becomes the title, otherwise the first line does, and the rest goes into the description. The event starts at the next full hour with your default length; Calendula doesn't try to read a date out of the text. If Calendula was opened just for this, saving or closing the form takes you back to the app you came from ([#306]).
- **Tapping an event can open the edit form.** Settings → Views → Events → Tapping an event opens can now be set to Edit form instead of Details. Taps in the views and in search then go straight to the editor for events you can edit; read-only events, reminder notifications and widgets still open the details. The editor has Duplicate, Share and Delete in its menu, and going back with unsaved changes asks whether to save, discard or keep editing ([#178]).
- **A black theme for AMOLED screens.** Settings → Appearance → Theme now has Black next to System, Light and Dark. It's the dark theme with pure black backgrounds, which saves battery on AMOLED screens and makes event colours stand out more. Day cells and the hour grid stay a shade above black so the grid lines still show, and sheets and menus still stand out from the page. It works with Material You colours too. The home-screen widgets aren't affected ([#181]).
- **Donate through Liberapay.** Settings → Support development now offers Liberapay for recurring donations next to Ko-fi for one-off tips.
- **More haptic feedback.** Swiping between days in the split month pane ticks, and dropping a moved or resized event gives a short buzz ([#116]).
### Changed
- **The editor says Create for a new event.** New events, duplicates, shared text, imported .ics files and long-press drafts show Create instead of Save, so a duplicate no longer looks like you're editing the original ([#141]).
### Fixed
- **Event colours follow the theme you picked in Calendula.** With the app set to Dark on a phone in light mode, or the other way round, events took their colours from the phone's setting, so they could come out too pale or too dark. They now match the app's theme. Starting the app with a theme set in Calendula also no longer flashes the phone's light or dark background first ([#181]).
- **Events on the day the clocks change show at their real time.** In the day, 3-day and week views, events later on the day of a daylight saving change were drawn an hour off, so a 14:45 event showed at 15:45. They now sit at their own time. When the clocks go back, 02:00 to 03:00 happens twice: an event in that hour now stays in the right one when you move, resize or edit it, and the editor and event details add the zone, like CEST or CET, so you can tell the two apart ([#387]).
- **The agenda always starts today.** Coming from the month or day view, the agenda used to start at the day you had open there, so "Next 30 days" could show the 1st to the 30th of the month. It now opens on today with your chosen range. Backing out of a day you opened from the agenda still returns you to where you were ([#367]).
- **Multi-day events dim on the days already behind you.** With past events dimmed, an event running over several days stayed at full strength on its earlier days until it ended. Those days now dim in the agenda, month, week and day views ([#367]).
- **Moving a recurring event to another calendar keeps the occurrences you changed.** Deleted occurrences used to come back after the move, and edited ones showed up twice. They now stay deleted or edited, and keep their colour.
- **Sharing an .ics file to Calendula opens the import,** even when the email app adds a subject line as text.
- **Rotating the phone no longer throws away an open import, duplicate or picker.**
- **The repeat-until date picker opens on today.** Near midnight it used to open on yesterday or tomorrow.
- **Tap ripples on week numbers, split-view day cells and the split-view handle stay inside their rounded shape** ([#413]).
- **The export calendar picker previews the back gesture** like the other full-screen pickers.
## [2.22.5] — 2026-10-07
@@ -1874,3 +1887,5 @@ automatically, with zero telemetry and no internet permission.
[#181]: https://codeberg.org/jlmakiola/calendula/issues/181
[#306]: https://codeberg.org/jlmakiola/calendula/issues/306
[#178]: https://codeberg.org/jlmakiola/calendula/issues/178
[#116]: https://codeberg.org/jlmakiola/calendula/issues/116
[#413]: https://codeberg.org/jlmakiola/calendula/issues/413
+9
View File
@@ -23,6 +23,8 @@ It works on top of the system calendar and has no network access.</p>
<a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://codeberg.org/jlmakiola/calendula"><img src="https://github.com/ImranR98/Obtainium/blob/main/assets/graphics/badge_obtainium.png?raw=true" alt="Get it on Obtainium" height="56"></a>
&nbsp;
<a href="https://ko-fi.com/jeanlucmakiola"><img src="https://storage.ko-fi.com/cdn/brandasset/v2/support_me_on_kofi_badge_beige.png" alt="Support me on Ko-fi" height="56"></a>
&nbsp;
<a href="https://liberapay.com/Jean-Luc_Makiola/donate"><img src="https://liberapay.com/assets/widgets/donate.svg" alt="Donate using Liberapay" height="56"></a>
</p>
<p>
@@ -203,6 +205,13 @@ anywhere. Your events stay in Android's own calendar store.
[Privacy policy](https://jeanlucmakiola.de/calendula/privacy), written in
[`docs/PRIVACY.md`](docs/PRIVACY.md), which is what that page renders.
## Support
Calendula is free and has no ads. If you'd like to support its development,
you can tip once on [Ko-fi](https://ko-fi.com/jeanlucmakiola) or donate
regularly on [Liberapay](https://liberapay.com/Jean-Luc_Makiola/donate). Both
are linked in the app under *Settings → Support development*.
## License
[MIT](LICENSE), Jean-Luc Makiola, 2026
+2 -2
View File
@@ -32,8 +32,8 @@ android {
// (up to 2.22.3: 2.22.3 -> 22203; from 2.22.4: 2.23.0-beta.1 -> 2230001,
// 2.22.4 -> 2220499), and CI fails if the committed one doesn't match.
// See docs/RELEASING.md.
versionCode = 2230004
versionName = "2.23.0-beta.4"
versionCode = 2230099
versionName = "2.23.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
+1 -1
View File
@@ -152,7 +152,7 @@
</intent-filter>
<!-- Text shared or selected in another app opens a prefilled new
event (MainActivity.sharedTextExtrasOrNull, issue #306). -->
event (MainActivity.sharedTextRequestOrNull, issue #306). -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
@@ -6,6 +6,7 @@ import android.content.res.Configuration
import android.net.Uri
import android.os.Bundle
import android.provider.CalendarContract
import android.provider.OpenableColumns
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
@@ -61,6 +62,8 @@ import de.jeanlucmakiola.calendula.ui.theme.WindowThemeCache
import de.jeanlucmakiola.calendula.ui.theme.windowBackgroundRes
import de.jeanlucmakiola.calendula.ui.theme.calendulaTypography
import de.jeanlucmakiola.calendula.ui.theme.resolveFontFamily
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch
import kotlinx.datetime.LocalDate
import kotlinx.datetime.TimeZone
@@ -124,10 +127,17 @@ class MainActivity : AppCompatActivity() {
cachedTheme?.windowBackgroundRes()?.let { window.setBackgroundDrawableResource(it) }
systemBarsDark = (cachedTheme ?: ThemeMode.SYSTEM).isDark(systemDark)
applyEdgeToEdge()
val appearance = MutableStateFlow(
Appearance(
themeMode = cachedTheme ?: ThemeMode.SYSTEM,
dynamicColor = WindowThemeCache.readDynamicColor(this),
),
)
lifecycleScope.launch {
settingsPrefs.themeMode.collect { mode ->
WindowThemeCache.write(this@MainActivity, mode)
window.setBackgroundDrawableResource(mode.windowBackgroundRes() ?: R.color.window_background)
combine(settingsPrefs.themeMode, settingsPrefs.dynamicColor, ::Appearance).collect { stored ->
WindowThemeCache.write(this@MainActivity, stored.themeMode, stored.dynamicColor ?: true)
window.setBackgroundDrawableResource(stored.themeMode.windowBackgroundRes() ?: R.color.window_background)
appearance.value = stored
}
}
// Android hands the intent that started the task back to onCreate every
@@ -143,6 +153,7 @@ class MainActivity : AppCompatActivity() {
// is what carries one through a recreation — the create form only while
// it's still open.
val replaying = savedInstanceState != null || intent.isRelaunch()
requests.replayed = savedInstanceState != null
if (!replaying) {
requests.detailKey = intent.detailKeyOrNull() ?: intent.viewEventKeyOrNull()
requests.editKey = intent.editEventKeyOrNull()
@@ -161,7 +172,11 @@ class MainActivity : AppCompatActivity() {
// and the Settings screen, so a theme change applies app-wide at once.
val settingsViewModel: SettingsViewModel = hiltViewModel()
val settings by settingsViewModel.state.collectAsStateWithLifecycle()
val darkTheme = settings.themeMode.isDark(isSystemInDarkTheme())
// Seeded from the cache, so the first frame doesn't draw the default
// theme and palette before the stored choices arrive.
val shownAppearance by appearance.collectAsStateWithLifecycle()
val themeMode = shownAppearance.themeMode
val darkTheme = themeMode.isDark(isSystemInDarkTheme())
// onCreate can only see the night resource qualifier, not the in-app
// override — re-apply from the resolved theme so the bar icons follow
// the app's light/dark choice.
@@ -199,8 +214,8 @@ class MainActivity : AppCompatActivity() {
}
CalendulaTheme(
darkTheme = darkTheme,
dynamicColor = settings.dynamicColor,
pureBlack = settings.themeMode.isPureBlack,
dynamicColor = shownAppearance.dynamicColor ?: settings.dynamicColor,
pureBlack = themeMode.isPureBlack,
typography = typography,
) {
Box(modifier = Modifier.fillMaxSize()) {
@@ -273,6 +288,7 @@ class MainActivity : AppCompatActivity() {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
requests.replayed = false
(intent.detailKeyOrNull() ?: intent.viewEventKeyOrNull())?.let { requests.detailKey = it }
intent.navRequestOrNull()?.let { requests.nav = it }
intent.importUriOrNull()?.let { requests.importUri = it }
@@ -281,6 +297,13 @@ class MainActivity : AppCompatActivity() {
insertFormOpen = true
}
intent.editEventKeyOrNull()?.let { requests.editKey = it }
// The user moved on into the app, so closing the create form no longer
// hands control back to the app that started it.
if (requests.detailKey != null || requests.nav != null || requests.importUri != null ||
requests.editKey != null
) {
launchedForInsert = false
}
}
/**
@@ -301,9 +324,10 @@ class MainActivity : AppCompatActivity() {
private fun Intent.importUriOrNull(): Uri? {
val uri = when (action) {
Intent.ACTION_VIEW -> data
// Plain text is a create (#306), never a file to import.
Intent.ACTION_SEND -> IntentCompat.getParcelableExtra(this, Intent.EXTRA_STREAM, Uri::class.java)
.takeUnless { type == SHARED_TEXT_TYPE }
// Shared text is a create (#306); a text/plain file is imported only
// when it is calendar data, e.g. an .ics attachment labelled text/plain.
Intent.ACTION_SEND -> sharedStreamOrNull()
?.takeUnless { type == SHARED_TEXT_TYPE && !it.isCalendarFile() }
else -> null
} ?: return null
// The calendar "view time" Uri (a date tap) is also ACTION_VIEW/content;
@@ -357,7 +381,7 @@ class MainActivity : AppCompatActivity() {
*/
private fun Intent.sharedTextRequestOrNull(): InsertRequest? {
val shared = when (action) {
Intent.ACTION_SEND -> if (type == SHARED_TEXT_TYPE) {
Intent.ACTION_SEND -> if (type == SHARED_TEXT_TYPE && sharedStreamOrNull()?.isCalendarFile() != true) {
sharedTextOrNull(
subject = getCharSequenceExtra(Intent.EXTRA_SUBJECT)?.toString(),
text = getCharSequenceExtra(Intent.EXTRA_TEXT)?.toString(),
@@ -378,6 +402,23 @@ class MainActivity : AppCompatActivity() {
return InsertRequest(form, ImportSource.InsertOpenEnded)
}
private fun Intent.sharedStreamOrNull(): Uri? =
IntentCompat.getParcelableExtra(this, Intent.EXTRA_STREAM, Uri::class.java)
/** Whether a shared file is iCalendar/vCalendar data, by its resolved type or its name. */
private fun Uri.isCalendarFile(): Boolean {
val resolvedType = runCatching { contentResolver.getType(this) }.getOrNull()
if (resolvedType in CALENDAR_TYPES) return true
val name = when (scheme) {
"content" -> runCatching {
contentResolver.query(this, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)
?.use { c -> if (c.moveToFirst()) c.getString(0) else null }
}.getOrNull()
else -> lastPathSegment
} ?: return false
return CALENDAR_EXTENSIONS.any { name.endsWith(it, ignoreCase = true) }
}
/** A Long extra's value, or null when the extra is absent. */
private fun Intent.longExtraOrNull(key: String): Long? =
if (hasExtra(key)) getLongExtra(key, 0L) else null
@@ -504,6 +545,8 @@ class MainActivity : AppCompatActivity() {
// ACTION_VIEW on content://com.android.calendar/time/<epochMillis>.
private const val CALENDAR_PROVIDER_HOST = "com.android.calendar"
private const val SHARED_TEXT_TYPE = "text/plain"
private val CALENDAR_TYPES = setOf("text/calendar", "text/x-vcalendar", "application/ics")
private val CALENDAR_EXTENSIONS = listOf(".ics", ".vcs")
private const val KEY_INSERT_FORM_OPEN = "insert_form_open"
private const val KEY_LAUNCHED_FOR_INSERT = "launched_for_insert"
@@ -596,3 +639,6 @@ class MainActivity : AppCompatActivity() {
}
}
}
/** The theme choices the window needs before the settings screen's state loads. */
private data class Appearance(val themeMode: ThemeMode, val dynamicColor: Boolean?)
@@ -725,7 +725,7 @@ class AndroidCalendarDataSource @Inject constructor(
),
null,
)?.use { c ->
c.mapAll { EventColorOption(key = it.getString(0).orEmpty(), argb = it.getInt(1)) }
c.mapRows { EventColorOption(key = getString(0).orEmpty(), argb = getInt(1)) }
}
?.filter { it.key.isNotEmpty() }
?: emptyList()
@@ -1116,7 +1116,7 @@ class AndroidCalendarDataSource @Inject constructor(
?: throw WriteFailedException("read modified occurrence id=${ex.exceptionEventId}")
val endMillis = ex.dtEndMillis ?: (ex.dtStartMillis + parseRfc2445DurationMillis(ex.duration))
val form = detail.toEditForm(ex.dtStartMillis, endMillis, zone)
.copy(calendarId = targetCalendarId)
.copy(calendarId = targetCalendarId, colorKey = null)
.toDetachedOccurrence()
detached += insertEvent(form, allDayReminderTimeMinutes)
}
@@ -1691,11 +1691,6 @@ class AndroidCalendarDataSource @Inject constructor(
null,
)?.use { c -> c.mapRows { toReminder() } } ?: emptyList()
/** Iterate every row and map; skips nothing. */
private inline fun <T> Cursor.mapAll(mapper: (Cursor) -> T): List<T> = buildList {
while (moveToNext()) add(mapper(this@mapAll))
}
/** A fresh globally-unique `UID_2445`, for an event that carries none of its own. */
private fun mintUid(): String = "${UUID.randomUUID()}@calendula"
@@ -0,0 +1,8 @@
package de.jeanlucmakiola.calendula.data.di
import javax.inject.Qualifier
/** The process-wide `CoroutineScope` that app-lifetime singletons share their flows in. */
@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class ApplicationScope
@@ -24,6 +24,9 @@ import de.jeanlucmakiola.calendula.data.time.AndroidTodaySource
import de.jeanlucmakiola.calendula.data.time.AndroidZoneSource
import de.jeanlucmakiola.calendula.data.time.TodaySource
import de.jeanlucmakiola.calendula.data.time.ZoneSource
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import javax.inject.Singleton
private val Context.calendulaDataStore: DataStore<Preferences> by preferencesDataStore(
@@ -85,4 +88,9 @@ object DataProvideModule {
@Singleton
fun provideDataStore(@ApplicationContext context: Context): DataStore<Preferences> =
context.calendulaDataStore
@Provides
@Singleton
@ApplicationScope
fun provideApplicationScope(): CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
}
@@ -3,12 +3,15 @@ package de.jeanlucmakiola.calendula.data.time
import android.content.Context
import android.content.Intent
import dagger.hilt.android.qualifiers.ApplicationContext
import de.jeanlucmakiola.calendula.data.di.ApplicationScope
import de.jeanlucmakiola.floret.android.broadcastTicks
import de.jeanlucmakiola.floret.android.stateWhileSubscribed
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.shareIn
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.onEach
@@ -27,10 +30,12 @@ interface TodaySource {
/**
* Re-reads the date on every minute boundary while collected, and at once on the
* system's date, time and zone broadcasts, which can arrive late or not at all.
* One receiver and tick loop is shared by every collector.
*/
@OptIn(ExperimentalCoroutinesApi::class)
class AndroidTodaySource @Inject constructor(
@ApplicationContext private val context: Context,
@ApplicationScope scope: CoroutineScope,
) : TodaySource {
override val today: Flow<LocalDate> = context
@@ -42,6 +47,7 @@ class AndroidTodaySource @Inject constructor(
}
}
.distinctUntilChanged()
.shareIn(scope, SharingStarted.WhileSubscribed(replayExpirationMillis = 0), replay = 1)
}
private const val MINUTE_MILLIS = 60_000L
@@ -3,10 +3,14 @@ package de.jeanlucmakiola.calendula.data.time
import android.content.Context
import android.content.Intent
import dagger.hilt.android.qualifiers.ApplicationContext
import de.jeanlucmakiola.calendula.data.di.ApplicationScope
import de.jeanlucmakiola.floret.android.broadcastTicks
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.shareIn
import kotlinx.datetime.TimeZone
import javax.inject.Inject
@@ -23,14 +27,16 @@ interface ZoneSource {
fun current(): TimeZone
}
/** Follows the system's zone broadcast. */
/** Follows the system's zone broadcast, one receiver shared by every collector. */
class AndroidZoneSource @Inject constructor(
@ApplicationContext private val context: Context,
@ApplicationScope scope: CoroutineScope,
) : ZoneSource {
override val zone: Flow<TimeZone> = context.broadcastTicks(Intent.ACTION_TIMEZONE_CHANGED)
.map { current() }
.distinctUntilChanged()
.shareIn(scope, SharingStarted.WhileSubscribed(replayExpirationMillis = 0), replay = 1)
override fun current(): TimeZone = TimeZone.currentSystemDefault()
}
@@ -131,6 +131,10 @@ private class HtmlRenderer(private val html: String) {
text("<")
return lt + 1
}
if (!closing && isAutolink(html.substring(nameStart, end))) {
text(html.substring(lt, end + 1))
return end + 1
}
var nameEnd = nameStart
while (nameEnd < end && (html[nameEnd].isLetterOrDigit() || html[nameEnd] == ':')) nameEnd++
val name = html.substring(nameStart, nameEnd).lowercase()
@@ -149,6 +153,11 @@ private class HtmlRenderer(private val html: String) {
return end + 1
}
/** An angle-bracketed URL or address (`<https://…>`, `<a@b.c>`), kept as text. */
private fun isAutolink(inner: String): Boolean =
LINK_SCHEMES.any { inner.startsWith(it, ignoreCase = true) } ||
('@' in inner && inner.none { it.isWhitespace() || it == '=' })
/** The `>` closing the tag at [lt], skipping any inside quoted attributes. */
private fun tagEnd(lt: Int): Int {
var quote: Char? = null
@@ -66,7 +66,9 @@ data class SanitizedRrule(val rule: String?, val repaired: Boolean)
* rule at all — gives up entirely.
*/
fun sanitizeRrule(raw: String?): SanitizedRrule {
val rule = raw?.trim()?.removePrefix("RRULE:")?.trim().orEmpty()
val rule = raw?.trim()
?.let { if (it.startsWith("RRULE:", ignoreCase = true)) it.drop("RRULE:".length) else it }
?.trim().orEmpty()
if (rule.isEmpty()) return SanitizedRrule(rule = null, repaired = false)
var freqSeen = false
@@ -84,8 +86,8 @@ fun sanitizeRrule(raw: String?): SanitizedRrule {
// A stray separator ("FREQ=DAILY;") normalises away; nothing was lost.
// A part that carries text but no '=' ("FREQ=WEEKLY;BYDAY") is a part
// being dropped, so it falls through and marks the rule repaired.
for (part in rruleParts(raw.orEmpty().trim())) {
val key = part.key?.trim().orEmpty()
for (part in rruleParts(rule)) {
val key = part.key?.trim()?.uppercase().orEmpty()
val value = part.value.trim()
val kept = when {
key.isEmpty() || value.isEmpty() -> null
@@ -7,6 +7,7 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.animation.SharedTransitionLayout
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.SeekableTransitionState
import androidx.compose.animation.core.rememberTransition
import androidx.compose.animation.fadeIn
@@ -34,6 +35,7 @@ import androidx.compose.runtime.saveable.listSaver
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.Modifier
import de.jeanlucmakiola.calendula.ui.common.rememberHeld
import de.jeanlucmakiola.calendula.ui.common.screen
import de.jeanlucmakiola.calendula.ui.common.ViewScreen
import androidx.compose.ui.layout.onGloballyPositioned
@@ -66,7 +68,7 @@ import de.jeanlucmakiola.calendula.ui.common.EventSelectionHost
import de.jeanlucmakiola.calendula.ui.common.eventActionFailureMessage
import de.jeanlucmakiola.calendula.ui.common.rememberFabSelection
import de.jeanlucmakiola.calendula.ui.common.canWriteCalendar
import de.jeanlucmakiola.calendula.ui.common.rememberWriteGateOr
import de.jeanlucmakiola.calendula.ui.common.rememberWriteAction
import de.jeanlucmakiola.calendula.ui.common.EventMoveScope
import de.jeanlucmakiola.calendula.ui.common.LocalEventMove
import de.jeanlucmakiola.calendula.ui.common.LocalManageCalendars
@@ -243,20 +245,29 @@ fun CalendarHost(
// An opened/received .ics file. [ImportScreen] parses it and either opens
// the prefilled create form (one event → [importForm]) or its own bulk
// picker (many). A plain conditional overlay (no slide) — it's transient.
var importUri by remember { mutableStateOf<android.net.Uri?>(null) }
var importForm by remember { mutableStateOf<EventForm?>(null) }
var importUri by rememberSaveable { mutableStateOf<android.net.Uri?>(null) }
val importViewModel: EventEditViewModel = hiltViewModel(key = "import")
// Saved as "open"; a recreation takes the form back from the ViewModel, which
// still holds the user's edits.
var importForm by rememberSaveable(
stateSaver = Saver<EventForm?, Boolean>(
save = { it != null },
restore = { open -> if (open) importViewModel.currentForm() else null },
),
) { mutableStateOf<EventForm?>(null) }
// Which channel filled [importForm]: an .ics file (prompt to apply the default
// reminder) or an ACTION_INSERT intent (apply it automatically) — #49.
var importFormSource by remember { mutableStateOf(ImportSource.File) }
var importFormSource by rememberSaveable { mutableStateOf(ImportSource.File) }
// Bumped per open, so even an equal prefill starts a fresh form.
var importFormId by remember { mutableIntStateOf(0) }
var importFormId by rememberSaveable { mutableIntStateOf(0) }
// Whether [importForm] came from an external create request (#30, #306);
// closing it then hands control back to whoever asked.
var importFromRequest by rememberSaveable { mutableStateOf(false) }
// A second external request that arrived while a prefilled form was open:
// it waits behind that form's unsaved-changes prompt, then opens.
var pendingInsert by remember { mutableStateOf<Pair<EventForm, ImportSource>?>(null) }
val importViewModel: EventEditViewModel = hiltViewModel(key = "import")
val createViewModel: EventEditViewModel = hiltViewModel(key = "create")
val editViewModel: EventEditViewModel = hiltViewModel(key = "edit")
fun openImportForm(form: EventForm, source: ImportSource, fromRequest: Boolean = false) {
importFormSource = source
importForm = form
@@ -280,7 +291,7 @@ fun CalendarHost(
// flow — picker + summary — even for a single-event file, because the intent
// is "restore a backup", not "add this one event". An externally opened .ics
// keeps routing a single event straight into the prefilled create form.
var importForceMany by remember { mutableStateOf(false) }
var importForceMany by rememberSaveable { mutableStateOf(false) }
// Where a restore came from, so closing the import puts it back: the import
// overlays are declared under Backup & restore and the manager, so starting
// one has to close them — without this, finishing a restore drops you on the
@@ -291,9 +302,20 @@ fun CalendarHost(
// what tells it a *re-import of the same file* is new work and not the run
// it already finished; a rotation keeps the number and keeps the result.
var importSession by rememberSaveable { mutableStateOf(0) }
// A recreation re-reads the launch intent; when the import it carries came
// back with the saved state, that replay is the same work, not a new one.
fun isReplayOfRestoredImport(): Boolean {
val replay = requests.replayed && (importUri != null || importForm != null)
requests.replayed = false
return replay
}
val requestedImportUri = requests.importUri
LaunchedEffect(requestedImportUri) {
if (requestedImportUri != null) {
if (isReplayOfRestoredImport()) {
requests.importUri = null
return@LaunchedEffect
}
importUri = requestedImportUri
importForceMany = false
importSession++
@@ -307,6 +329,10 @@ fun CalendarHost(
val requestedInsert = requests.insert
LaunchedEffect(requestedInsert) {
if (requestedInsert != null) {
if (isReplayOfRestoredImport()) {
requests.insert = null
return@LaunchedEffect
}
if (importForm == null) {
openImportForm(requestedInsert.form, requestedInsert.source, fromRequest = true)
} else {
@@ -318,16 +344,22 @@ fun CalendarHost(
// Close every overlay that can sit over the calendar, so an externally
// requested destination (a widget/shortcut/QS-tile launch) is revealed on
// top instead of underneath whatever the user had open.
fun dismissCoveringOverlays() {
// top instead of underneath whatever the user had open. The create form,
// declared under the edit form, can stay for an edit to open over it.
fun dismissCoveringOverlays(keepCreate: Boolean = false) {
showSettings = false
showSearch = false
showCalendars = false
showBackup = false
detailKey = null
editKey = null
if (!keepCreate) createRequest = null
importUri = null
importForm = null
importFromRequest = false
if (importFromRequest) {
importFromRequest = false
requests.onExternalFormClosed()
}
pendingInsert = null
importViewModel.reset()
}
@@ -340,7 +372,10 @@ fun CalendarHost(
val requestedEditKey = requests.editKey
LaunchedEffect(requestedEditKey) {
if (requestedEditKey != null) {
dismissCoveringOverlays()
// An open edit form stays on screen, so it starts over here rather
// than once it has slid away.
if (editKey != null) editViewModel.reset()
dismissCoveringOverlays(keepCreate = true)
editKey = requestedEditKey
requests.editKey = null
}
@@ -361,7 +396,6 @@ fun CalendarHost(
// Drill the day view in over the widget's view: drop any overlay
// that would cover it, so the open doesn't land under Settings/form.
dismissCoveringOverlays()
createRequest = null
focus.navigateTo(LocalDate.parse(req.dateIso))
// No widget source (an external date tap) roots over the default
// home view, so backing out of the day returns home then exits.
@@ -372,7 +406,6 @@ fun CalendarHost(
// Root the stack in the widget's view, then open the occurrence
// detail over it (same key shape as a tapped event / reminder).
dismissCoveringOverlays()
createRequest = null
viewStack = viewBaseStack(defaultView, req.source)
detailKey = longArrayOf(req.eventId, req.beginMillis, req.endMillis)
requests.nav = null
@@ -383,7 +416,6 @@ fun CalendarHost(
// the stack on the target (null → the default home) over the
// default home — so backing out returns to the default, then exits.
dismissCoveringOverlays()
createRequest = null
focus.navigateTo(currentDate())
viewStack = viewBaseStack(defaultView, req.view ?: defaultView)
requests.nav = null
@@ -393,6 +425,7 @@ fun CalendarHost(
// widget) must land on top of whatever is open — the form overlay
// sits below Settings/calendars in the Box, so without this it
// would open hidden underneath them.
if (createRequest != null) createViewModel.reset()
dismissCoveringOverlays()
openCreate(req.dateIso ?: currentDate().toString())
requests.nav = null
@@ -414,9 +447,22 @@ fun CalendarHost(
// tap time, so a tap before they've loaded still routes right.
val tapScope = rememberCoroutineScope()
val tapContext = LocalContext.current
val requireWriteOr = rememberWriteGateOr()
// A refused write upgrade is asked once; later taps just open the details.
var tapWriteRefused by rememberSaveable { mutableStateOf(false) }
// The tap waiting on the WRITE_CALENDAR prompt, saved so a rotation keeps it.
var tapAwaitingWrite by rememberSaveable { mutableStateOf<LongArray?>(null) }
val editAwaitingTap = rememberWriteAction(
onDenied = {
tapAwaitingWrite?.let { key ->
tapWriteRefused = true
detailKey = key
}
tapAwaitingWrite = null
},
) {
tapAwaitingWrite?.let { editKey = it }
tapAwaitingWrite = null
}
val onEventClick: (EventInstance) -> Unit = { event ->
tapScope.launch {
val toEditor = viewModel.tapOpensEditor() && eventActions.canModify(event.calendarId)
@@ -424,9 +470,9 @@ fun CalendarHost(
!toEditor -> onOpenDetail(event)
tapContext.canWriteCalendar() -> onEditEvent(event)
tapWriteRefused -> onOpenDetail(event)
else -> requireWriteOr({ onEditEvent(event) }) {
tapWriteRefused = true
onOpenDetail(event)
else -> {
tapAwaitingWrite = event.occurrenceKey()
editAwaitingTap()
}
}
}
@@ -674,24 +720,26 @@ fun CalendarHost(
// Event form (v1.2) — full-screen destination, slides over the calendar.
val shownCreate = rememberHeld(createRequest)
SlideOverlay(visible = createRequest != null) {
SlideOverlay(visible = createRequest != null, onHidden = createViewModel::reset) {
shownCreate?.let { create ->
EventEditScreen(
initialDateIso = create.dateIso,
initialStartMinutes = create.startMinutes,
initialDraft = create.draftMillis,
onClose = { createRequest = null },
onSaved = { createRequest = null },
onManageCalendars = { showCalendars = true },
visible = createRequest != null,
viewModel = hiltViewModel(key = "create"),
)
key(create) {
EventEditScreen(
initialDateIso = create.dateIso,
initialStartMinutes = create.startMinutes,
initialDraft = create.draftMillis,
onClose = { createRequest = null },
onSaved = { createRequest = null },
onManageCalendars = { showCalendars = true },
visible = createRequest != null,
viewModel = createViewModel,
)
}
}
}
// Edit form (v1.3) — slides over the detail screen.
val shownEditKey = rememberHeld(editKey)
SlideOverlay(visible = editKey != null) {
SlideOverlay(visible = editKey != null, onHidden = editViewModel::reset) {
shownEditKey?.let { key ->
EventEditScreen(
initialDateIso = null,
@@ -712,7 +760,7 @@ fun CalendarHost(
if (detailKey == null) detailKey = key
},
visible = editKey != null,
viewModel = hiltViewModel(key = "edit"),
viewModel = editViewModel,
)
}
}
@@ -830,33 +878,25 @@ private val viewStackSaver = listSaver<List<CalendarView>, Int>(
* snapping back and sliding off.
*/
@Composable
private fun SlideOverlay(visible: Boolean, content: @Composable AnimatedVisibilityScope.() -> Unit) {
private fun SlideOverlay(
visible: Boolean,
onHidden: () -> Unit = {},
content: @Composable AnimatedVisibilityScope.() -> Unit,
) {
val state = remember { MutableTransitionState(visible) }
state.targetState = visible
val hidden = state.isIdle && !state.currentState
LaunchedEffect(hidden) {
if (hidden) onHidden()
}
AnimatedVisibility(
visible = visible,
visibleState = state,
enter = slideInHorizontally(rememberCalendarSlideSpec()) { it } + fadeIn(),
exit = predictiveBackExit(),
content = content,
)
}
/**
* [live], or after it goes null the last value it had, so an overlay keeps
* drawing what it showed through its slide-out instead of flashing empty. Never
* a placeholder: until [live] is first set this is null, so a destination never
* loads a bogus key on its first frame. Not saved — after a recreation the
* saveable [live] is the value again.
*/
@Composable
private fun <T : Any> rememberHeld(live: T?): T? {
val held = remember { HeldValue<T>() }
if (live != null) held.value = live
return live ?: held.value
}
private class HeldValue<T : Any> {
var value: T? = null
}
/** The detail and edit overlays' key for one occurrence: eventId, begin, end. */
private fun EventInstance.occurrenceKey(): LongArray =
longArrayOf(eventId, start.toEpochMilliseconds(), end.toEpochMilliseconds())
@@ -36,6 +36,9 @@ class ExternalRequests(val onExternalFormClosed: () -> Unit = {}) {
/** An external "edit this event" (ACTION_EDIT), in the detail key's shape. */
var editKey by mutableStateOf<LongArray?>(null)
/** Whether these came from re-reading the launch intent on a recreation. */
var replayed = false
}
/** A prefilled create form from an external launch, with the source it came from. */
@@ -393,11 +393,8 @@ private fun AgendaList(
val itemDates = agendaItemDates(days)
val anchorRow = itemDates.indexOfFirst { it >= anchor }.coerceAtLeast(0)
SideEffect { anchorIndex.intValue = anchorRow }
// A new anchor opens the list on its row from the first frame, with past
// days above. Keyed on the anchor the days arrived with, not the one just
// requested: scrolling before the new rows compose leaves the list keyed to
// a row that reappears further down, and it follows it there. The first run
// may restore a remembered day instead.
// A new anchor opens on its row from the first frame; keyed on the anchor
// the days arrived with, not the one requested. The first run may restore.
val pendingRestore = remember { arrayOf(initialTopDate) }
DisposableEffect(anchor) {
val target = pendingRestore[0]
@@ -163,15 +163,17 @@ class AgendaViewModel @Inject constructor(
}
/**
* Extend the window [PAST_CHUNK_DAYS] further back (#367). Ignored while the
* previous extension is still loading, so a scroll that keeps asking only
* moves one chunk at a time.
* Extend the window further back (#367), doubling what's loaded (at least
* [PAST_CHUNK_DAYS], at most [MAX_PAST_STEP_DAYS]) so a long scroll back
* re-queries only a few times. Ignored while the previous extension is
* still loading.
*/
fun loadEarlier() {
val loaded = (state.value as? AgendaUiState.Success)?.windowStart ?: return
val window = _window.value
if (loaded != window.start) return
_window.value = window.copy(pastDays = window.pastDays + PAST_CHUNK_DAYS)
val step = window.pastDays.coerceIn(PAST_CHUNK_DAYS, MAX_PAST_STEP_DAYS)
_window.value = window.copy(pastDays = window.pastDays + step)
}
fun rememberTopDay(date: LocalDate) {
@@ -233,6 +235,9 @@ class AgendaViewModel @Inject constructor(
/** How many days each scroll back into the past loads (#367). */
internal const val PAST_CHUNK_DAYS = 30
/** The most one scroll back adds, so an empty past grows the window by years, not exponentially. */
internal const val MAX_PAST_STEP_DAYS = 365
/** Inclusive instant range from the start of [anchor] through [days] days ahead. */
internal fun agendaRange(anchor: LocalDate, days: Int, zone: TimeZone): ClosedRange<Instant> =
dayRange(anchor, anchor.plus(days, DateTimeUnit.DAY), zone)
@@ -26,8 +26,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
@@ -82,8 +80,7 @@ fun CalendarFabColumn(
)
}
// Held past the selection clearing, so the bar has something to fold away.
val heldBar = remember { mutableStateOf<(@Composable () -> Unit)?>(null) }
if (selection != null && heldBar.value !== selection.bar) heldBar.value = selection.bar
val heldBar = rememberHeld(selection?.bar)
// Held at the FAB's height so the taller bar can't shift the FAB.
Row(
modifier = Modifier.height(FabSize),
@@ -101,7 +98,7 @@ fun CalendarFabColumn(
shrinkTowards = Alignment.End,
) + fadeOut(),
) {
heldBar.value?.invoke()
heldBar?.invoke()
}
val label = stringResource(
when {
@@ -17,6 +17,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
@@ -100,33 +101,28 @@ suspend fun CalendarRepository.tryDeleteEvent(
}
/**
* Runs an action that writes to the calendar, asking for `WRITE_CALENDAR` first
* where the install only holds read access (v1.0 installs). A grant continues
* straight into the action that asked for it.
* [action], which writes to the calendar, as a handler that asks for
* `WRITE_CALENDAR` first where the install only holds read access (v1.0
* installs). A grant continues into [action], also when it returns after a
* rotation; a refusal runs [onDenied].
*/
@Composable
fun rememberWriteGate(): (() -> Unit) -> Unit {
val gate = rememberWriteGateOr()
return { action -> gate(action) {} }
}
/** [rememberWriteGate], running the fallback instead when the user refuses. */
@Composable
fun rememberWriteGateOr(): (action: () -> Unit, fallback: () -> Unit) -> Unit {
fun rememberWriteAction(onDenied: () -> Unit = {}, action: () -> Unit): () -> Unit {
val context = LocalContext.current
var pending by remember { mutableStateOf<Pair<() -> Unit, () -> Unit>?>(null) }
val currentAction by rememberUpdatedState(action)
val currentDenied by rememberUpdatedState(onDenied)
val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission(),
) { granted ->
pending?.let { (action, fallback) -> if (granted) action() else fallback() }
pending = null
if (granted) currentAction() else currentDenied()
}
return { action, fallback ->
if (context.canWriteCalendar()) {
action()
} else {
pending = action to fallback
launcher.launch(Manifest.permission.WRITE_CALENDAR)
return remember(context, launcher) {
{
if (context.canWriteCalendar()) {
currentAction()
} else {
launcher.launch(Manifest.permission.WRITE_CALENDAR)
}
}
}
}
@@ -7,6 +7,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import de.jeanlucmakiola.calendula.data.calendar.CalendarRepository
import de.jeanlucmakiola.calendula.data.calendar.NoSuchEventException
import de.jeanlucmakiola.calendula.data.ics.IcsExporter
import de.jeanlucmakiola.calendula.data.time.ZoneSource
import de.jeanlucmakiola.calendula.domain.CalendarSource
import de.jeanlucmakiola.calendula.domain.EventDetail
import de.jeanlucmakiola.calendula.domain.EventForm
@@ -26,7 +27,6 @@ import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.datetime.TimeZone
import kotlin.coroutines.cancellation.CancellationException
import javax.inject.Inject
@@ -42,6 +42,7 @@ class EventActionsViewModel @Inject constructor(
private val repository: CalendarRepository,
private val icsExporter: IcsExporter,
@IoDispatcher private val io: CoroutineDispatcher,
private val zoneSource: ZoneSource,
) : ViewModel() {
/** Every calendar by id, for what a selected event's bar may offer. */
@@ -64,7 +65,7 @@ class EventActionsViewModel @Inject constructor(
suspend fun duplicateForm(event: EventInstance): EventForm? {
val detail = load(event) ?: return null
val canModify = calendars.value[event.calendarId]?.canModifyContents == true
return detail.toDuplicateForm(canModify, TimeZone.currentSystemDefault())
return detail.toDuplicateForm(canModify, zoneSource.current())
}
/** A staged `.ics` for [event], or null — reported — when it can't be built. */
@@ -32,7 +32,6 @@ fun rememberFabSelection(
val calendars by viewModel.calendars.collectAsStateWithLifecycle()
val context = LocalContext.current
val scope = rememberCoroutineScope()
val requireWrite = rememberWriteGate()
val chooserTitle = stringResource(R.string.event_share_chooser_title)
// What the FAB has been told for this selection, over what the coverage says.
@@ -43,10 +42,28 @@ fun rememberFabSelection(
val currentEdit by rememberUpdatedState(onEdit)
val currentDuplicate by rememberUpdatedState(onDuplicate)
val currentDismissChip by rememberUpdatedState(onDismissChip)
val currentWrite by rememberUpdatedState(requireWrite)
// Each reads the selection at grant time, which may come after a rotation.
val onCreate = rememberWriteAction { host.selection?.create?.invoke() }
val onEditSelected = rememberWriteAction {
host.selection?.takeIf { it.create == null }?.let { selected ->
selected.dismiss()
currentEdit(selected.event)
}
}
val onDuplicateSelected = rememberWriteAction {
val selected = host.selection?.takeIf { it.create == null } ?: return@rememberWriteAction
scope.launch {
val form = viewModel.duplicateForm(selected.event) ?: return@launch
selected.dismiss()
currentDuplicate(form)
}
}
val onDeleteSelected = rememberWriteAction {
host.selection?.takeIf { it.create == null }?.let { viewModel.requestDelete(it.event) }
}
val selection = host.selection ?: return null
selection.create?.let { create ->
if (selection.create != null) {
return remember(selection, expanded, chipShown) {
FabSelection(
expanded = expanded,
@@ -56,7 +73,7 @@ fun rememberFabSelection(
},
bar = {
DraftSelectionBar(
onCreate = { currentWrite { create() } },
onCreate = onCreate,
onDiscard = selection.dismiss,
)
},
@@ -78,28 +95,15 @@ fun rememberFabSelection(
EventSelectionBar(
canEdit = canEdit,
canDelete = canDelete,
onEdit = {
currentWrite {
selection.dismiss()
currentEdit(event)
}
},
onDuplicate = {
currentWrite {
scope.launch {
val form = viewModel.duplicateForm(event) ?: return@launch
selection.dismiss()
currentDuplicate(form)
}
}
},
onEdit = onEditSelected,
onDuplicate = onDuplicateSelected,
onShare = {
scope.launch {
val uri = viewModel.shareUri(event) ?: return@launch
if (!context.sendEventShare(uri, chooserTitle)) viewModel.reportShareFailed()
}
},
onDelete = { currentWrite { viewModel.requestDelete(event) } },
onDelete = onDeleteSelected,
)
},
)
@@ -20,7 +20,6 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalDensity
@@ -111,14 +110,13 @@ fun HourGutter(
}
}
// Held while it fades, so it goes out where it was rather than blinking off.
val badgeMin = remember { mutableStateOf<Int?>(null) }
dragStartMin?.let { badgeMin.value = it }
val badgeMin = rememberHeld(dragStartMin)
val badgeIn by animateFloatAsState(
targetValue = if (dragStartMin != null) 1f else 0f,
animationSpec = MaterialTheme.motionScheme.fastEffectsSpec(),
label = "gutterBadge",
)
badgeMin.value?.takeIf { badgeIn > 0f }?.let { startMin ->
badgeMin?.takeIf { badgeIn > 0f }?.let { startMin ->
val top = (hourHeight * (startMin / 60f) - BADGE_HEIGHT / 2).coerceAtLeast(0.dp)
Box(
modifier = Modifier
@@ -0,0 +1,22 @@
package de.jeanlucmakiola.calendula.ui.common
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
/**
* [live], or after it goes null the last value it had, so an overlay keeps
* drawing what it showed through its slide-out instead of flashing empty. Never
* a placeholder: until [live] is first set this is null, so a destination never
* loads a bogus key on its first frame. Not saved — after a recreation the
* saveable [live] is the value again.
*/
@Composable
fun <T : Any> rememberHeld(live: T?): T? {
val held = remember { HeldValue<T>() }
if (live != null) held.value = live
return live ?: held.value
}
private class HeldValue<T : Any> {
var value: T? = null
}
@@ -626,25 +626,8 @@ class TimelineDragController {
*/
private var originSlot: Triple<LocalDate, Int, Int>? = null
/** The edge a resize is dragging, or null for a plain drag (#141). */
private var resizeEdge: ResizeEdge? = null
/** The day the resized event starts on; its edges are minutes from that midnight. */
private var resizeDay: LocalDate? = null
private var resizeStartMin = 0
private var resizeEndMin = 0
/** How far the finger sits past the edge it grabbed, so the edge doesn't jump to it. */
private var resizeGrabMin = 0f
/** The column the resized edge is in, held until the finger is well into another. */
private var resizeColumn: Int? = null
/** The slot the resized edge sits on, held against a finger trembling between two. */
private var resizeSlot: Int? = null
/** The day, counted from the event's start day, the finger is resizing in. */
private var resizeEdgeDay = 0
/** The resize in progress, or null for a plain drag (#141). */
private var resize: ResizeSession? = null
fun begin(
block: TimedBlock,
@@ -691,10 +674,7 @@ class TimelineDragController {
}
fun cancel() {
resizeEdge = null
resizeDay = null
resizeColumn = null
resizeSlot = null
resize = null
source = null
clipOffsetMin = 0
dragZone = null
@@ -800,11 +780,9 @@ class TimelineDragController {
pointerInRoot: Offset,
) {
val span = wallClockSpan(block.event, zone)
val session = ResizeSession(edge, span.day, span.startMin, span.endMin)
source = block
resizeEdge = edge
resizeDay = span.day
resizeStartMin = span.startMin
resizeEndMin = span.endMin
resize = session
clipOffsetMin = 0
this.titleLines = titleLines
settling = null
@@ -813,12 +791,12 @@ class TimelineDragController {
liftedInstanceId = block.event.instanceId
pointer = pointerInRoot
// Measured from the edge's own column: the handle overhangs into the next.
val edgeDay = if (edge == ResizeEdge.Top) 0 else (resizeEndMin - 1).floorDiv(MINUTES_PER_DAY).coerceAtLeast(0)
val edgeDay = if (edge == ResizeEdge.Top) 0 else (session.endMin - 1).floorDiv(MINUTES_PER_DAY).coerceAtLeast(0)
val edgeIndex = geometry.days.indexOf(span.day.plus(edgeDay, DateTimeUnit.DAY))
resizeColumn = edgeIndex.takeIf { it >= 0 }
session.column = edgeIndex.takeIf { it >= 0 }
?.let { column(it) }
resizeGrabMin = (pointerResizeMinutes() ?: 0f) -
if (edge == ResizeEdge.Top) resizeStartMin else resizeEndMin
session.grabMin = (pointerResizeMinutes(session) ?: 0f) -
if (edge == ResizeEdge.Top) session.startMin else session.endMin
originSlot = null
recompute()
originSlot = drag?.slot
@@ -834,7 +812,7 @@ class TimelineDragController {
fun preview(zone: TimeZone): EventInstance? {
val (date, startMin, spanMin) = landingSlot?.takeIf { it != originSlot } ?: return null
val event = source?.event ?: return null
val edge = resizeEdge
val edge = resize?.edge
if (edge != null) {
val drop = resizedDrop(event, edge, date, startMin, spanMin, zone)
return event.copy(start = drop.start, end = drop.end)
@@ -850,7 +828,7 @@ class TimelineDragController {
fun finishResize(zone: TimeZone): TimelineResizeDrop? {
val landed = drag
val origin = originSlot
val edge = resizeEdge
val edge = resize?.edge
cancel()
if (landed == null || landed.slot == origin) return null
val drop = resizedDrop(landed.event, edge, landed.date, landed.eventStartMin, landed.eventSpanMin, zone)
@@ -862,9 +840,8 @@ class TimelineDragController {
* Where the finger is, in minutes from the resized event's start day —
* past 1440 in a later column, negative in an earlier one.
*/
private fun pointerResizeMinutes(): Float? {
private fun pointerResizeMinutes(session: ResizeSession): Float? {
val grid = geometry.grid?.takeIf { it.isAttached } ?: return null
val day = resizeDay ?: return null
val hourPx = geometry.hourPx
val columnPx = geometry.columnWidthPx
val days = geometry.days
@@ -872,22 +849,23 @@ class TimelineDragController {
val origin = grid.positionInRoot()
val held = stickyColumn(
position = (pointer.x - origin.x) / columnPx,
held = resizeColumn,
held = session.column,
lastIndex = days.lastIndex,
)
resizeColumn = held
val dayOffset = (days[column(held)].toEpochDays() - day.toEpochDays()).toInt()
resizeEdgeDay = dayOffset
session.column = held
val dayOffset = (days[column(held)].toEpochDays() - session.day.toEpochDays()).toInt()
session.edgeDay = dayOffset
return dayOffset * MINUTES_PER_DAY + (pointer.y - origin.y) / hourPx * 60f
}
private fun recomputeResize(edge: ResizeEdge) {
private fun recomputeResize(session: ResizeSession) {
val block = source ?: return
val day = resizeDay ?: return
val raw = pointerResizeMinutes() ?: return
val slot = stickySnap(raw - resizeGrabMin, resizeSlot)
resizeSlot = slot
val (start, end) = resizedSpan(edge, resizeStartMin, resizeEndMin, slot.toFloat(), resizeEdgeDay)
val edge = session.edge
val day = session.day
val raw = pointerResizeMinutes(session) ?: return
val slot = stickySnap(raw - session.grabMin, session.slot)
session.slot = slot
val (start, end) = resizedSpan(edge, session.startMin, session.endMin, slot.toFloat(), session.edgeDay)
val days = geometry.days
val origin = geometry.grid?.takeIf { it.isAttached }?.positionInRoot() ?: return
// Which column the start day sits in, possibly off either end of the view.
@@ -946,7 +924,7 @@ class TimelineDragController {
* no move events while auto-scroll walks the content underneath it.
*/
fun recompute() {
resizeEdge?.let {
resize?.let {
recomputeResize(it)
return
}
@@ -1049,6 +1027,27 @@ class TimelineDragController {
}
}
/** One resize gesture (#141): the edge it drags, and the edges as minutes from [day]'s midnight. */
private class ResizeSession(
val edge: ResizeEdge,
/** The day the resized event starts on. */
val day: LocalDate,
val startMin: Int,
val endMin: Int,
) {
/** How far the finger sits past the edge it grabbed, so the edge doesn't jump to it. */
var grabMin = 0f
/** The column the resized edge is in, held until the finger is well into another. */
var column: Int? = null
/** The slot the resized edge sits on, held against a finger trembling between two. */
var slot: Int? = null
/** The day, counted from the event's start day, the finger is resizing in. */
var edgeDay = 0
}
@Composable
fun rememberTimelineDragController(): TimelineDragController {
val controller = remember { TimelineDragController() }
@@ -95,7 +95,7 @@ import de.jeanlucmakiola.floret.identity.LocalFloretDarkTheme
import de.jeanlucmakiola.floret.identity.predictiveBack
import de.jeanlucmakiola.calendula.ui.common.CalendarFailure
import de.jeanlucmakiola.calendula.ui.common.DeleteEventDialog
import de.jeanlucmakiola.calendula.ui.common.rememberWriteGate
import de.jeanlucmakiola.calendula.ui.common.rememberWriteAction
import de.jeanlucmakiola.calendula.ui.common.sendEventShare
import de.jeanlucmakiola.calendula.ui.common.FieldCopier
import de.jeanlucmakiola.calendula.ui.common.copyOnLongPress
@@ -169,14 +169,11 @@ fun EventDetailScreen(
// v1.0 installs only hold READ_CALENDAR; the first write asks for the
// upgrade in place and continues straight into the tapped action.
val requireWrite = rememberWriteGate()
val onDeleteClick = { requireWrite { showDeleteDialog = true } }
val onEditClick = { requireWrite(onEdit) }
val onDeleteClick = rememberWriteAction { showDeleteDialog = true }
val onEditClick = rememberWriteAction(action = onEdit)
// Duplicate reads the loaded detail into a create form and hands it up; the
// create still needs WRITE_CALENDAR even when the source is read-only.
val onDuplicateClick = {
requireWrite { viewModel.duplicateForm()?.let(onDuplicate) }
}
val onDuplicateClick = rememberWriteAction { viewModel.duplicateForm()?.let(onDuplicate) }
val deleteFailedMessage = stringResource(R.string.event_delete_failed)
val writeDeniedMessage = stringResource(R.string.event_delete_write_denied)
@@ -7,6 +7,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import de.jeanlucmakiola.calendula.data.calendar.CalendarRepository
import de.jeanlucmakiola.calendula.data.calendar.NoSuchEventException
import de.jeanlucmakiola.calendula.data.ics.IcsExporter
import de.jeanlucmakiola.calendula.data.time.ZoneSource
import de.jeanlucmakiola.calendula.domain.EventForm
import de.jeanlucmakiola.calendula.domain.FailureReason
import de.jeanlucmakiola.calendula.domain.RecurringWriteScope
@@ -31,7 +32,6 @@ import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.launch
import kotlinx.datetime.TimeZone
import kotlin.coroutines.cancellation.CancellationException
import javax.inject.Inject
@@ -45,6 +45,7 @@ class EventDetailViewModel @Inject constructor(
private val repository: CalendarRepository,
private val icsExporter: IcsExporter,
@IoDispatcher private val io: CoroutineDispatcher,
private val zoneSource: ZoneSource,
) : ViewModel() {
private val _target = MutableStateFlow<Target?>(null)
@@ -141,7 +142,7 @@ class EventDetailViewModel @Inject constructor(
*/
fun duplicateForm(): EventForm? {
val loaded = state.value as? EventDetailUiState.Success ?: return null
return loaded.detail.toDuplicateForm(loaded.canModify, TimeZone.currentSystemDefault())
return loaded.detail.toDuplicateForm(loaded.canModify, zoneSource.current())
}
private suspend fun loadDetail(target: Target): EventDetailUiState = try {
@@ -41,7 +41,7 @@ import de.jeanlucmakiola.floret.identity.LocalFloretDarkTheme
import kotlinx.coroutines.launch
import de.jeanlucmakiola.calendula.ui.common.sendEventShare
import de.jeanlucmakiola.calendula.ui.common.canWriteCalendar
import de.jeanlucmakiola.calendula.ui.common.rememberWriteGate
import de.jeanlucmakiola.calendula.ui.common.rememberWriteAction
import de.jeanlucmakiola.calendula.ui.common.DeleteEventDialog
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.material.icons.filled.Share
@@ -168,6 +168,7 @@ import de.jeanlucmakiola.calendula.ui.common.TimePickerAlert
import de.jeanlucmakiola.floret.reminders.ReminderUnit
import de.jeanlucmakiola.floret.locale.currentLocale
import de.jeanlucmakiola.calendula.ui.common.LocalUse24HourFormat
import de.jeanlucmakiola.calendula.ui.common.formatTimeOfDay
import de.jeanlucmakiola.calendula.ui.common.timeOfDayFormatter
import de.jeanlucmakiola.calendula.ui.common.withRepeatedHourZone
import de.jeanlucmakiola.calendula.ui.common.reminderLeadTimeLabel
@@ -288,7 +289,6 @@ fun EventEditScreen(
val snackbarHostState = remember { SnackbarHostState() }
val scope = rememberCoroutineScope()
val requireWrite = rememberWriteGate()
// Save keeps its own launcher: its result calls straight into the ViewModel,
// so a save waiting on the permission dialog survives a rotation.
val savePermissionLauncher = rememberLauncherForActivityResult(
@@ -313,14 +313,13 @@ fun EventEditScreen(
}
}
// The copy opens over this form; a form with nothing to lose steps aside.
val onDuplicateClick: () -> Unit = {
requireWrite {
viewModel.duplicateForm()?.let { form ->
onDuplicate?.invoke(form)
if (!hasUnsavedChanges) close()
}
val onDuplicateClick = rememberWriteAction {
viewModel.duplicateForm()?.let { form ->
onDuplicate?.invoke(form)
if (!hasUnsavedChanges) close()
}
}
val onDeleteClick = rememberWriteAction { showDeleteDialog = true }
val saveFailedMessage = stringResource(R.string.event_edit_save_failed)
val writeDeniedMessage = stringResource(R.string.event_edit_write_denied)
@@ -386,7 +385,7 @@ fun EventEditScreen(
canDuplicate = onDuplicate != null,
onDuplicate = onDuplicateClick,
onShare = onShareClick,
onDelete = { requireWrite { showDeleteDialog = true } },
onDelete = onDeleteClick,
)
}
Button(
@@ -1128,13 +1127,7 @@ private fun WhenCard(
color = MaterialTheme.colorScheme.error,
)
}
// The rows above edit a pinned event in *its own* zone, which is the
// time it was set at — but that says nothing about when it lands for
// whoever is reading it. Spell the local equivalent out rather than
// leaving the user to do the offset arithmetic. Absent unless the
// event is pinned somewhere other than here.
// Keyed rather than recomputed: the form recomposes on every title
// keystroke, and this would otherwise re-parse the zone each time.
// A pinned event's local equivalent, shown only when pinned elsewhere.
val pinnedAway = remember(form.timezone, form.isAllDay, deviceZone) {
form.isPinnedAwayFrom(deviceZone)
}
@@ -2421,9 +2414,8 @@ private fun accessLevelSummary(level: AccessLevel): Int = when (level) {
private fun formatTimeRange(start: Instant, end: Instant, zone: TimeZone, locale: Locale): String {
val use24Hour = LocalUse24HourFormat.current
return remember(start, end, zone, locale, use24Hour) {
val timeFormat = timeOfDayFormatter(use24Hour, locale)
fun format(at: Instant) = withRepeatedHourZone(
timeFormat.format(at.toLocalDateTime(zone).time.toJavaLocalTime()),
formatTimeOfDay(at, zone, use24Hour, locale),
at,
zone,
locale,
@@ -590,6 +590,9 @@ class EventEditViewModel @Inject constructor(
}
}
/** The form as the user has it now, or null when none is open. */
fun currentForm(): EventForm? = _form.value
/** Forget the open form; the next [openNew]/[openForEdit] starts clean. */
fun reset() {
session++
@@ -90,8 +90,10 @@ fun ImportScreen(
val state by viewModel.state.collectAsStateWithLifecycle()
// A single event isn't shown here — it opens the create form for review.
// Read live: the state composed with may be the previous import's result,
// which the load above has already replaced.
LaunchedEffect(state) {
(state as? ImportUiState.Single)?.let { onOpenSingle(it.form); onClose() }
(viewModel.state.value as? ImportUiState.Single)?.let { onOpenSingle(it.form); onClose() }
}
// Hoisted target calendar so the always-visible top-bar Import action can
@@ -78,6 +78,7 @@ import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.Icon
import androidx.compose.material3.InputChip
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ripple
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -841,7 +842,7 @@ internal fun monthBandHeight(rowHeight: Dp): Dp =
/** Whether any day in this week holds more than [lanes] lanes can seat. */
private fun MonthWeek.overflowsAt(lanes: Int): Boolean =
days.withIndex().any { (col, day) -> overflowEvents(col, day, lanes).isNotEmpty() }
days.indices.any { col -> overflowEvents(col, lanes).isNotEmpty() }
/**
* Row height in the continuous grid. The paged grid divides the viewport between
@@ -1529,18 +1530,30 @@ private fun SplitExpandHandle(
modifier = modifier
.fillMaxWidth()
.height(SPLIT_HANDLE_ROW_HEIGHT)
.clickable(onClick = onToggle)
.semantics { contentDescription = label },
contentAlignment = Alignment.Center,
) {
Box(
Modifier
.size(width = SPLIT_HANDLE_WIDTH, height = SPLIT_HANDLE_HEIGHT)
// Tagged too, so it slides from the pane's seam down to the foot
// of the grid rather than blinking out at one and in at the other.
.morphElement(MonthMorphKey.Handle)
.background(MaterialTheme.colorScheme.outlineVariant, CircleShape),
)
.size(width = SPLIT_HANDLE_RIPPLE_WIDTH, height = SPLIT_HANDLE_ROW_HEIGHT)
.clip(RoundedCornerShape(percent = 50))
.clickable(
interactionSource = null,
indication = ripple(),
onClick = onToggle,
)
.clearAndSetSemantics { },
contentAlignment = Alignment.Center,
) {
Box(
Modifier
.size(width = SPLIT_HANDLE_WIDTH, height = SPLIT_HANDLE_HEIGHT)
// Tagged too, so it slides from the pane's seam down to the foot
// of the grid rather than blinking out at one and in at the other.
.morphElement(MonthMorphKey.Handle)
.background(MaterialTheme.colorScheme.outlineVariant, CircleShape),
)
}
}
}
@@ -1573,6 +1586,7 @@ private val SPLIT_DOT_SIZE = 5.dp
private val SPLIT_HANDLE_WIDTH = 32.dp
private val SPLIT_HANDLE_HEIGHT = 4.dp
private val SPLIT_HANDLE_ROW_HEIGHT = 24.dp
private val SPLIT_HANDLE_RIPPLE_WIDTH = SPLIT_HANDLE_WIDTH + 24.dp
/** The pane below the split grid fades in once the grid's morph has mostly landed. */
private const val SPLIT_PANE_FADE_IN_DELAY_MILLIS = 300
@@ -1627,11 +1641,11 @@ internal fun SplitMonthGrid(
val inMonth = day.month == month.month && day.year == month.year
// Seated by lane rather than gathered by colour, so each dot
// is the event the expanded grid draws in that same lane.
val seated = week.laneEvents(col, day, SPLIT_DOT_LANES)
val seated = week.laneEvents(col, SPLIT_DOT_LANES)
SplitDayCell(
date = day,
events = seated,
hidden = week.overflowEvents(col, day, SPLIT_DOT_LANES),
hidden = week.overflowEvents(col, SPLIT_DOT_LANES),
isToday = day == state.today,
// A page marks only the days its own month owns. Paging
// moves the selection before this month's replacement
@@ -1716,6 +1730,7 @@ private fun SplitDayCell(
modifier = modifier
.padding(horizontal = CELL_GAP, vertical = 1.dp)
.todayRipple(relativeToToday, rippleProgress)
.clip(CELL_SHAPE)
.selectable(selected = isSelected, onClick = onClick),
contentAlignment = Alignment.TopCenter,
) {
@@ -2098,8 +2113,8 @@ private fun MonthWeekRow(
val ripple = rememberTodayRipple(active = todayCol != null)
val overflowRow = rememberOverflowRowHeight()
val laneCap = week.laneCapFor(rowHeight, overflowRow)
val laneCount = (week.spans.maxOfOrNull { it.lane } ?: -1) + 1
val shownLanes = laneCount.coerceAtMost(laneCap)
// Once per row rather than per frame: a drag recomposes every frame.
val seatings = remember(week, laneCap) { week.days.indices.map { week.seating(it, laneCap) } }
val morphing = morphInFlight()
// Every chip's start time for this row at once, and only when the row's own
// inputs change: formatting is a parsed pattern per call, and the dim cutoff
@@ -2283,7 +2298,7 @@ private fun MonthWeekRow(
.then(if (morphing || dragging) Modifier else Modifier.clipToBounds()),
) {
// Spanning bars on their shared lanes.
week.spans.filter { it.lane < shownLanes }.forEach { span ->
week.spans.filter { it.lane < laneCap }.forEach { span ->
val cols = span.endCol - span.startCol + 1
MonthBar(
event = span.event,
@@ -2355,19 +2370,13 @@ private fun MonthWeekRow(
)
}
}
// Single-day timed pills + overflow, per column. Pills fill the
// lane slots no bar occupies on THIS day (top-most first), so a
// bar-free day isn't pushed down by a multi-day event that only
// sits on other days of the week.
// Single-day timed pills + overflow, per column, in the lanes
// [seating] gave them.
week.days.forEachIndexed { col, d ->
val timed = week.timedByDay[d].orEmpty()
val occupied = week.spans
.filter { it.lane < shownLanes && col in it.startCol..it.endCol }
.map { it.lane }
.toSet()
val freeSlots = (0 until laneCap).filter { it !in occupied }
val pillsShown = timed.take(freeSlots.size)
pillsShown.forEachIndexed { i, ev ->
val seating = seatings[col]
seating.seated.forEach { seat ->
if (seat.bar) return@forEach
val ev = seat.event
MonthBar(
event = ev,
dark = dark,
@@ -2379,7 +2388,7 @@ private fun MonthWeekRow(
modifier = Modifier
.offset(
x = colW * col,
y = EVENT_ROW_HEIGHT * freeSlots[i],
y = EVENT_ROW_HEIGHT * seat.lane,
)
.morphBounds(MonthMorphKey.Event(d, ev.instanceId))
.then(
@@ -2395,18 +2404,10 @@ private fun MonthWeekRow(
.padding(horizontal = MONTH_CHIP_INSET, vertical = 1.dp),
)
}
val hidden = (week.countByDay[d] ?: 0) - occupied.size - pillsShown.size
if (hidden > 0) {
val hiddenEvents = buildList {
week.spans
.filter { it.lane >= shownLanes && col in it.startCol..it.endCol }
.forEach { add(it.event) }
addAll(timed.drop(pillsShown.size))
}
if (seating.hidden.isNotEmpty()) {
OverflowDots(
events = hiddenEvents,
events = seating.hidden,
day = d,
total = hidden,
dark = dark,
rowHeight = overflowRow,
modifier = Modifier
@@ -2630,11 +2631,12 @@ private fun WeekNumberGutter(weekStart: LocalDate, modifier: Modifier = Modifier
val onOpenWeek = LocalOpenWeek.current
Box(
modifier = modifier
.padding(horizontal = CELL_GAP, vertical = 1.dp)
.clip(CELL_SHAPE)
.background(MaterialTheme.colorScheme.secondaryContainer)
.then(if (onOpenWeek != null) Modifier.clickable(onClickLabel = openLabel) {
onOpenWeek(weekStart)
} else Modifier)
.padding(horizontal = CELL_GAP, vertical = 1.dp)
.background(MaterialTheme.colorScheme.secondaryContainer, CELL_SHAPE)
.semantics { contentDescription = "$label $weekNumber" },
contentAlignment = Alignment.Center,
) {
@@ -2786,7 +2788,6 @@ private fun MonthBar(
private fun OverflowDots(
events: List<EventInstance>,
day: LocalDate,
total: Int,
dark: Boolean,
rowHeight: Dp,
modifier: Modifier = Modifier,
@@ -2808,7 +2809,7 @@ private fun OverflowDots(
.background(eventAccent(argb, dark, soften), CircleShape),
)
}
val extra = total - dots.size
val extra = events.size - dots.size
if (extra > 0) {
Text(
text = "+$extra",
@@ -39,33 +39,55 @@ data class MonthWeek(
val countByDay: Map<LocalDate, Int>,
)
/** One event seated in [lane] of a day; [bar] is a spanning bar rather than that day's own pill. */
data class Seat(val lane: Int, val event: EventInstance, val bar: Boolean)
/**
* The events occupying each lane of [day] — column [col] of this week — in lane
* order, capped at [laneCap] lanes.
* How one day of a week row is seated with [laneCap] lanes: what sits in each
* lane, top-most first with empty lanes left out, and what had no lane left.
*/
data class DaySeating(val seated: List<Seat>, val hidden: List<EventInstance>)
/**
* The seating of column [col] with [laneCap] lanes — the one every reader of a
* row builds on: the bars and pills the paged grid draws, the split style's dots
* ([laneEvents]), the hit test ([chipAt]) and the overflow ([overflowEvents]).
*
* This is the same seating [spans]/[timedByDay] get when the paged grid draws a
* week: bars keep the lane the row layout gave them, and the day's timed events
* fill whatever slots are left, top-most first. Reading it here means the split
* style's dots and the paged style's bars describe a day in the *same order*, so
* dot _i_ and lane _i_ are the same event and one can morph into the other (#53).
* Bars keep the lane the row layout gave them, and the day's timed events fill
* whatever slots are left, top-most first, so a bar-free day isn't pushed down by
* a multi-day event that only sits on other days of the week. Overflow is the
* exact complement, bars before pills.
*/
fun MonthWeek.seating(col: Int, laneCap: Int): DaySeating {
val covering = spans.filter { col in it.startCol..it.endCol }
val byLane = arrayOfNulls<Seat>(laneCap.coerceAtLeast(0))
covering.forEach { span ->
if (span.lane < laneCap) byLane[span.lane] = Seat(span.lane, span.event, bar = true)
}
val timed = timedByDay[days[col]].orEmpty()
var pills = 0
for (lane in byLane.indices) {
if (byLane[lane] == null && pills < timed.size) byLane[lane] = Seat(lane, timed[pills++], bar = false)
}
return DaySeating(
seated = byLane.filterNotNull(),
hidden = covering.filter { it.lane >= laneCap }.map { it.event } + timed.drop(pills),
)
}
/**
* The events occupying each lane of column [col], in lane order, capped at
* [laneCap] lanes — the same [seating] the paged grid draws a week with. Reading
* it here means the split style's dots and the paged style's bars describe a day
* in the *same order*, so dot _i_ and lane _i_ are the same event and one can
* morph into the other (#53).
*
* Deriving the dots independently — by distinct colour, as they first were —
* left dot _i_ standing for no particular event, and quietly merged two events
* that shared a calendar into a single dot.
*/
fun MonthWeek.laneEvents(col: Int, day: LocalDate, laneCap: Int): List<EventInstance> {
val byLane = arrayOfNulls<EventInstance>(laneCap)
spans.forEach { span ->
if (span.lane < laneCap && col in span.startCol..span.endCol) {
byLane[span.lane] = span.event
}
}
val free = (0 until laneCap).filter { byLane[it] == null }
timedByDay[day].orEmpty().take(free.size).forEachIndexed { i, event ->
byLane[free[i]] = event
}
return byLane.filterNotNull()
}
fun MonthWeek.laneEvents(col: Int, laneCap: Int): List<EventInstance> =
seating(col, laneCap).seated.map { it.event }
/**
* The event drawn in lane [lane] of column [col], or null for an empty slot.
@@ -74,14 +96,7 @@ fun MonthWeek.laneEvents(col: Int, day: LocalDate, laneCap: Int): List<EventInst
*/
fun MonthWeek.chipAt(col: Int, lane: Int, laneCap: Int): EventInstance? {
if (col !in days.indices || lane !in 0 until laneCap) return null
spanAt(col, lane)?.let { return it.event }
val occupied = spans
.filter { it.lane < laneCap && col in it.startCol..it.endCol }
.map { it.lane }
.toSet()
val free = (0 until laneCap).filter { it !in occupied }
val index = free.indexOf(lane).takeIf { it >= 0 } ?: return null
return timedByDay[days[col]].orEmpty().take(free.size).getOrNull(index)
return seating(col, laneCap).seated.firstOrNull { it.lane == lane }?.event
}
/**
@@ -98,19 +113,11 @@ fun MonthWeek.spanAt(col: Int, lane: Int): MonthSpan? =
spans.firstOrNull { it.lane == lane && col in it.startCol..it.endCol }
/**
* The events on [day] that [laneEvents] had no lane left for — its exact
* The events in column [col] that [laneEvents] had no lane left for — its exact
* complement, in the same bars-then-pills order. Returned as events rather than
* a count because dimming is a per-event question (#79).
*/
fun MonthWeek.overflowEvents(col: Int, day: LocalDate, laneCap: Int): List<EventInstance> {
val seatedLanes = spans.count { it.lane < laneCap && col in it.startCol..it.endCol }
return buildList {
spans.forEach { span ->
if (span.lane >= laneCap && col in span.startCol..span.endCol) add(span.event)
}
addAll(timedByDay[day].orEmpty().drop(laneCap - seatedLanes))
}
}
fun MonthWeek.overflowEvents(col: Int, laneCap: Int): List<EventInstance> = seating(col, laneCap).hidden
/**
* State for the continuous style (#38): a vertical stream of *self-contained*
@@ -1,9 +1,6 @@
package de.jeanlucmakiola.calendula.ui.search
import android.Manifest
import androidx.activity.compose.BackHandler
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.background
@@ -59,7 +56,6 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
@@ -80,11 +76,11 @@ import de.jeanlucmakiola.calendula.domain.RecurringWriteScope
import de.jeanlucmakiola.calendula.domain.SearchHit
import de.jeanlucmakiola.calendula.domain.SearchMonth
import de.jeanlucmakiola.calendula.domain.isDeclined
import de.jeanlucmakiola.floret.android.hasPermission
import de.jeanlucmakiola.floret.identity.LocalFloretDarkTheme
import de.jeanlucmakiola.floret.identity.animateItemMotion
import de.jeanlucmakiola.floret.identity.fadeThrough
import de.jeanlucmakiola.floret.identity.predictiveBack
import de.jeanlucmakiola.calendula.ui.common.rememberWriteAction
import de.jeanlucmakiola.calendula.ui.common.declinedTitle
import de.jeanlucmakiola.floret.components.GroupedRow
import de.jeanlucmakiola.floret.components.InlineTextField
@@ -133,7 +129,6 @@ fun SearchScreen(
val deleteState by viewModel.deleteState.collectAsStateWithLifecycle()
val focusRequester = remember { FocusRequester() }
val keyboard = LocalSoftwareKeyboardController.current
val context = LocalContext.current
val inSelection = selection.isNotEmpty()
var showDeleteDialog by remember { mutableStateOf(false) }
@@ -155,24 +150,8 @@ fun SearchScreen(
keyboard?.show()
}
// Same in-place WRITE_CALENDAR upgrade the detail screen does: a v1.0 install
// holds only READ_CALENDAR, and granting continues into the held delete.
var pendingWrite by remember { mutableStateOf<(() -> Unit)?>(null) }
val writePermissionLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission(),
) { granted ->
if (granted) pendingWrite?.invoke()
pendingWrite = null
}
val requireWrite: (() -> Unit) -> Unit = { action ->
val granted = context.hasPermission(Manifest.permission.WRITE_CALENDAR)
if (granted) {
action()
} else {
pendingWrite = action
writePermissionLauncher.launch(Manifest.permission.WRITE_CALENDAR)
}
}
// A v1.0 install holds only READ_CALENDAR; granting continues into the held delete.
val onDeleteClick = rememberWriteAction { showDeleteDialog = true }
// Back leaves selection mode before it leaves the screen, and without the
// predictive-back scale-out — that would read as search closing and snapping
@@ -193,7 +172,7 @@ fun SearchScreen(
onBack = onBack,
onCloseSelection = viewModel::clearSelection,
onSelectAll = viewModel::selectAll,
onDelete = { requireWrite { showDeleteDialog = true } },
onDelete = onDeleteClick,
)
},
) { padding ->
@@ -7,6 +7,7 @@ import de.jeanlucmakiola.calendula.data.calendar.CalendarRepository
import de.jeanlucmakiola.calendula.domain.EventInstance
import de.jeanlucmakiola.calendula.domain.EventSearch
import de.jeanlucmakiola.calendula.domain.RecurringWriteScope
import de.jeanlucmakiola.calendula.ui.common.deleteEvent
import de.jeanlucmakiola.calendula.domain.SearchResults
import de.jeanlucmakiola.floret.android.stateWhileSubscribed
import de.jeanlucmakiola.floret.di.IoDispatcher
@@ -196,15 +197,11 @@ class SearchViewModel @Inject constructor(
}
private suspend fun deleteOne(event: EventInstance, scope: RecurringWriteScope) {
val begin = event.start.toEpochMilliseconds()
when {
!event.isRecurring -> repository.deleteEvent(event.eventId)
scope == RecurringWriteScope.ThisEvent ->
repository.deleteOccurrence(event.eventId, begin)
scope == RecurringWriteScope.ThisAndFollowing ->
repository.deleteEventFromOccurrence(event.eventId, begin)
else -> repository.deleteEvent(event.eventId)
}
repository.deleteEvent(
eventId = event.eventId,
beginMillis = event.start.toEpochMilliseconds(),
scope = if (event.isRecurring) scope else RecurringWriteScope.AllEvents,
)
}
private suspend fun readOnlyCalendarIds(): Set<Long> =
@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Autorenew
import androidx.compose.material.icons.filled.Backup
import androidx.compose.material.icons.filled.BugReport
import androidx.compose.material.icons.filled.Cake
@@ -23,6 +24,7 @@ import androidx.compose.material.icons.filled.Code
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Gavel
import androidx.compose.material.icons.filled.Language
import androidx.compose.material.icons.filled.LocalCafe
import androidx.compose.material.icons.filled.Notifications
import androidx.compose.material.icons.filled.Palette
import androidx.compose.material.icons.filled.PrivacyTip
@@ -56,6 +58,7 @@ import de.jeanlucmakiola.calendula.ui.common.rememberCalendarSlideSpec
import de.jeanlucmakiola.calendula.ui.licences.LicencesScreen
import de.jeanlucmakiola.floret.components.AboutCard
import de.jeanlucmakiola.floret.components.CollapsingScaffold
import de.jeanlucmakiola.floret.components.FullScreenPicker
import de.jeanlucmakiola.floret.components.GroupedListInset
import de.jeanlucmakiola.floret.components.GroupedRow
import de.jeanlucmakiola.floret.components.GroupedSectionHeader
@@ -360,17 +363,46 @@ private fun AboutCard() {
)
}
/** "Support development", as the closing row of the About card's group. */
/**
* "Support development", as the closing row of the About card's group. Opens a
* picker of the donation platforms.
*/
@Composable
private fun SupportRow() {
val context = LocalContext.current
val url = stringResource(R.string.about_support_url)
var showPicker by rememberSaveable { mutableStateOf(false) }
GroupedRow(
title = stringResource(R.string.settings_about_support),
position = Position.Bottom,
leading = { CategoryIcon(Icons.Default.Favorite, ChipAccent.Primary) },
onClick = { openUrl(context, url) },
onClick = { showPicker = true },
)
if (showPicker) {
val kofiUrl = stringResource(R.string.about_support_kofi_url)
val liberapayUrl = stringResource(R.string.about_support_liberapay_url)
FullScreenPicker(
title = stringResource(R.string.settings_about_support),
onDismiss = { showPicker = false },
predictiveBack = true,
) {
GroupedRow(
title = stringResource(R.string.settings_support_kofi),
summary = stringResource(R.string.settings_support_kofi_hint),
position = Position.Top,
leading = { CategoryIcon(Icons.Default.LocalCafe, ChipAccent.Primary) },
onClick = { openUrl(context, kofiUrl) },
)
GroupedRow(
title = stringResource(R.string.settings_support_liberapay),
summary = stringResource(R.string.settings_support_liberapay_hint),
position = Position.Bottom,
leading = { CategoryIcon(Icons.Default.Autorenew, ChipAccent.Primary) },
onClick = { openUrl(context, liberapayUrl) },
)
}
}
}
/**
@@ -7,8 +7,8 @@ import de.jeanlucmakiola.calendula.R
import de.jeanlucmakiola.floret.prefs.ThemeMode
/**
* A synchronous copy of the theme choice, for the window backdrop drawn before
* the first Compose frame. The real setting lives in DataStore, which only
* A synchronous copy of the theme and dynamic-colour choices, for the window
* backdrop and the first Compose frame. The real setting lives in DataStore, which only
* answers asynchronously — too late for onCreate, so a Light, Dark or Black
* override flashed the night-qualifier backdrop on a cold start or a
* recreation (#181). MainActivity mirrors every stored value here and reads it
@@ -18,6 +18,7 @@ internal object WindowThemeCache {
private const val FILE = "window_theme"
private const val KEY_THEME_MODE = "theme_mode"
private const val KEY_DYNAMIC_COLOR = "dynamic_color"
/** The last mirrored theme choice, or null before the first mirror. */
fun read(context: Context): ThemeMode? =
@@ -25,10 +26,23 @@ internal object WindowThemeCache {
.getString(KEY_THEME_MODE, null)
?.let { name -> ThemeMode.entries.firstOrNull { it.name == name } }
fun write(context: Context, mode: ThemeMode) {
/** The last mirrored dynamic-colour choice, or null before the first mirror. */
fun readDynamicColor(context: Context): Boolean? {
val prefs = context.getSharedPreferences(FILE, Context.MODE_PRIVATE)
if (prefs.getString(KEY_THEME_MODE, null) == mode.name) return
prefs.edit { putString(KEY_THEME_MODE, mode.name) }
return if (prefs.contains(KEY_DYNAMIC_COLOR)) prefs.getBoolean(KEY_DYNAMIC_COLOR, true) else null
}
fun write(context: Context, mode: ThemeMode, dynamicColor: Boolean) {
val prefs = context.getSharedPreferences(FILE, Context.MODE_PRIVATE)
if (prefs.getString(KEY_THEME_MODE, null) == mode.name &&
prefs.contains(KEY_DYNAMIC_COLOR) && prefs.getBoolean(KEY_DYNAMIC_COLOR, true) == dynamicColor
) {
return
}
prefs.edit {
putString(KEY_THEME_MODE, mode.name)
putBoolean(KEY_DYNAMIC_COLOR, dynamicColor)
}
}
}
@@ -7,100 +7,63 @@ import kotlinx.datetime.LocalDate
import kotlinx.datetime.daysUntil
import kotlinx.datetime.plus
/** Pages the week pager spans — a little under four centuries, centred on [PAGE_EPOCH]. */
/** Pages the week pager spans — a little under four centuries. */
internal const val WEEK_PAGE_COUNT: Int = 20_000
private const val EPOCH_PAGE = WEEK_PAGE_COUNT / 2
/** The week at [EPOCH_PAGE]; any date works, it only has to stay fixed. */
private val PAGE_EPOCH = LocalDate(2000, 1, 3)
/** First day of the week shown on pager [page], with weeks starting on [firstDay]. */
internal fun weekStartForPage(page: Int, firstDay: DayOfWeek): LocalDate =
PAGE_EPOCH.startOfWeek(firstDay).plus((page - EPOCH_PAGE) * 7, DateTimeUnit.DAY)
/** The pager page whose week contains [date], with weeks starting on [firstDay]. */
internal fun weekPageFor(date: LocalDate, firstDay: DayOfWeek): Int {
val days = PAGE_EPOCH.startOfWeek(firstDay).daysUntil(date.startOfWeek(firstDay))
return (EPOCH_PAGE + days / 7).coerceIn(0, WEEK_PAGE_COUNT - 1)
}
/** How a timeline pager cuts the calendar into pages of [dayCount] days. */
sealed interface PageGrid {
val dayCount: Int
val pageCount: Int
/** First day shown on pager [page]. */
fun startForPage(page: Int): LocalDate
/** The pager page showing [date]. */
fun pageFor(date: LocalDate): Int
}
/** Whole weeks, starting on [firstDay]. */
data class WeekGrid(val firstDay: DayOfWeek) : PageGrid {
override val dayCount: Int get() = 7
override val pageCount: Int get() = WEEK_PAGE_COUNT
override fun startForPage(page: Int): LocalDate = weekStartForPage(page, firstDay)
override fun pageFor(date: LocalDate): Int = weekPageFor(date, firstDay)
}
/** Pages the multi-day pager spans — over three centuries at the widest page. */
internal const val DAYS_PAGE_COUNT: Int = 40_000
private const val DAYS_EPOCH_PAGE = DAYS_PAGE_COUNT / 2
/** Pages the day pager spans — a little under four centuries. */
internal const val DAY_PAGE_COUNT: Int = 140_000
/** A fixed day the multi-day pages are counted from. */
/** A fixed day every grid's pages are counted from, at its middle page. */
private val DAYS_EPOCH = LocalDate(2000, 1, 1)
/** The week the week pager's middle page shows; any date works, it only has to stay fixed. */
private val WEEK_EPOCH = LocalDate(2000, 1, 3)
/**
* Runs of [dayCount] days (#193), offset [phase] days from a fixed epoch so any
* date can start a page. The phase stays put while paging and only changes when
* a jump moves another date to the first column.
* How a timeline pager cuts the calendar: runs of [dayCount] days, offset
* [phase] days from a fixed epoch, over [pageCount] pages centred on it. The
* multi-day view's phase (#193) stays put while paging and only changes when a
* jump moves another date to the first column.
*/
data class DaysGrid(override val dayCount: Int, val phase: Int) : PageGrid {
override val pageCount: Int get() = DAYS_PAGE_COUNT
data class DaysGrid(val dayCount: Int, val phase: Int, val pageCount: Int = DAYS_PAGE_COUNT) {
override fun startForPage(page: Int): LocalDate =
DAYS_EPOCH.plus(phase + (page - DAYS_EPOCH_PAGE) * dayCount, DateTimeUnit.DAY)
private val epochPage: Int get() = pageCount / 2
override fun pageFor(date: LocalDate): Int =
(DAYS_EPOCH_PAGE + Math.floorDiv(DAYS_EPOCH.daysUntil(date) - phase, dayCount))
.coerceIn(0, DAYS_PAGE_COUNT - 1)
/** First day shown on pager [page]. */
fun startForPage(page: Int): LocalDate =
DAYS_EPOCH.plus(phase + (page - epochPage) * dayCount, DateTimeUnit.DAY)
/** The pager page showing [date]. */
fun pageFor(date: LocalDate): Int =
(epochPage + Math.floorDiv(DAYS_EPOCH.daysUntil(date) - phase, dayCount))
.coerceIn(0, pageCount - 1)
companion object {
/** Single days: every date starts a page of its own. */
val days: DaysGrid = DaysGrid(dayCount = 1, phase = 0, pageCount = DAY_PAGE_COUNT)
/** Whole weeks, starting on [firstDay]. */
fun weeks(firstDay: DayOfWeek): DaysGrid = DaysGrid(
dayCount = 7,
phase = DAYS_EPOCH.daysUntil(WEEK_EPOCH.startOfWeek(firstDay)),
pageCount = WEEK_PAGE_COUNT,
)
/** The grid of [dayCount]-day pages on which [date] is a page's first day. */
fun startingAt(date: LocalDate, dayCount: Int): DaysGrid =
DaysGrid(dayCount, Math.floorMod(DAYS_EPOCH.daysUntil(date), dayCount))
}
}
/** Pages the day pager spans — a little under four centuries, centred on [DAY_EPOCH]. */
internal const val DAY_PAGE_COUNT: Int = 140_000
private const val DAY_EPOCH_PAGE = DAY_PAGE_COUNT / 2
/** The day at [DAY_EPOCH_PAGE]; any date works, it only has to stay fixed. */
private val DAY_EPOCH = LocalDate(2000, 1, 1)
/** Single days: every date starts a page of its own. */
data object DayGrid : PageGrid {
override val dayCount: Int get() = 1
override val pageCount: Int get() = DAY_PAGE_COUNT
override fun startForPage(page: Int): LocalDate =
DAY_EPOCH.plus(page - DAY_EPOCH_PAGE, DateTimeUnit.DAY)
override fun pageFor(date: LocalDate): Int =
(DAY_EPOCH_PAGE + DAY_EPOCH.daysUntil(date)).coerceIn(0, DAY_PAGE_COUNT - 1)
}
/**
* Where the focused date goes when the pager settles on [page] (#184): kept if
* the page still shows it, otherwise moved by the pages travelled, so it keeps
* its place in the page — the same weekday a week on.
*/
internal fun PageGrid.focusOnPage(focus: LocalDate, page: Int): LocalDate {
internal fun DaysGrid.focusOnPage(focus: LocalDate, page: Int): LocalDate {
val start = startForPage(page)
val end = start.plus(dayCount - 1, DateTimeUnit.DAY)
if (focus in start..end) return focus
@@ -70,7 +70,7 @@ import de.jeanlucmakiola.calendula.ui.common.draftEvent
import de.jeanlucmakiola.calendula.ui.common.draftStartMin
import de.jeanlucmakiola.calendula.ui.common.isDraft
import de.jeanlucmakiola.calendula.ui.common.rememberDragSurface
import de.jeanlucmakiola.calendula.ui.common.rememberWriteGate
import de.jeanlucmakiola.calendula.ui.common.rememberWriteAction
import de.jeanlucmakiola.calendula.ui.common.OutOfViewEdges
import de.jeanlucmakiola.calendula.ui.common.wallClockInstant
import de.jeanlucmakiola.calendula.ui.common.PickUp
@@ -464,11 +464,12 @@ private fun PagedTimelineScreen(
// Straight to the pager: a tap mid-fling must still land, and the anchor
// hasn't caught up with the fling yet to tell the difference. A date that
// would open mid-page on this grid re-frames the pages around it instead.
// would open mid-page on this grid, in a view that frames its pages from the
// date (multi-day), re-frames the pages around it instead.
val jumpToDate: (LocalDate) -> Unit = { target ->
focus?.date = target
val page = grid.pageFor(target)
if (grid is DaysGrid && grid.startForPage(page) != target) {
if (grid.startForPage(page) != target && viewModel.rule.value(target) != grid) {
viewModel.jumpTo(target)
} else {
scope.launch { pagerState.jumpToPage(page, reduceMotion, pageSpec) }
@@ -531,7 +532,7 @@ private fun WeekContent(
state: WeekUiState,
today: LocalDate,
pagerState: PagerState,
grid: PageGrid,
grid: DaysGrid,
kind: TimelineKind,
morph: TimelineMorph?,
handoffStrip: Dp?,
@@ -637,10 +638,15 @@ private fun WeekContent(
delay(SELECTION_ORPHAN_GRACE_MILLIS)
dragController.deselect()
}
val requireWrite = rememberWriteGate()
var pendingDraft by remember { mutableStateOf<EventInstance?>(null) }
val createPendingDraft = rememberWriteAction {
pendingDraft?.let(createDraft)
pendingDraft = null
}
val openEvent: (EventInstance) -> Unit = { event ->
if (event.isDraft) {
requireWrite { createDraft(event) }
pendingDraft = event
createPendingDraft()
} else {
dragController.deselect()
onEventClick(event)
@@ -696,7 +702,7 @@ private fun WeekContent(
@Composable
private fun WeekPager(
pagerState: PagerState,
grid: PageGrid,
grid: DaysGrid,
kind: TimelineKind,
span: (DaySpan) -> StateFlow<WeekUiState>,
today: LocalDate,
@@ -62,10 +62,10 @@ private const val SPAN_CACHE_DAYS = 28
data class DaySpan(val start: LocalDate, val count: Int)
/** How the pager cuts the calendar, and the page the anchor sits on. */
data class PagerPosition(val grid: PageGrid, val page: Int)
data class PagerPosition(val grid: DaysGrid, val page: Int)
/** Where [anchor] sits under [rule]. */
fun positionOf(anchor: LocalDate, rule: (LocalDate) -> PageGrid): PagerPosition =
fun positionOf(anchor: LocalDate, rule: (LocalDate) -> DaysGrid): PagerPosition =
rule(anchor).let { PagerPosition(it, it.pageFor(anchor)) }
/**
@@ -84,8 +84,8 @@ abstract class PagedTimelineViewModel(
todaySource: TodaySource,
zoneSource: ZoneSource,
private val io: CoroutineDispatcher,
gridRule: Flow<(LocalDate) -> PageGrid>,
initialRule: (LocalDate) -> PageGrid,
gridRule: Flow<(LocalDate) -> DaysGrid>,
initialRule: (LocalDate) -> DaysGrid,
) : ViewModel() {
/**
@@ -121,7 +121,7 @@ abstract class PagedTimelineViewModel(
* The grid for a given anchor, held eagerly so a screen can place its pager
* on its very first frame rather than a frame after the anchor moved.
*/
val rule: StateFlow<(LocalDate) -> PageGrid> =
val rule: StateFlow<(LocalDate) -> DaysGrid> =
gridRule.stateIn(viewModelScope, SharingStarted.Eagerly, initialRule)
/** Today, kept current across midnight so a page left open doesn't mark yesterday (#373). */
@@ -233,11 +233,11 @@ class WeekViewModel @Inject constructor(
zoneSource = zoneSource,
io = io,
gridRule = settingsPrefs.weekStart.map { pref ->
val grid = WeekGrid(pref.resolveFirstDay(Locale.getDefault()))
val rule: (LocalDate) -> PageGrid = { grid }
val grid = DaysGrid.weeks(pref.resolveFirstDay(Locale.getDefault()))
val rule: (LocalDate) -> DaysGrid = { grid }
rule
},
initialRule = { WeekGrid(DayOfWeek.MONDAY) },
initialRule = { DaysGrid.weeks(DayOfWeek.MONDAY) },
)
/**
@@ -278,8 +278,8 @@ class DayViewModel @Inject constructor(
todaySource = todaySource,
zoneSource = zoneSource,
io = io,
gridRule = flowOf { _: LocalDate -> DayGrid },
initialRule = { DayGrid },
gridRule = flowOf { _: LocalDate -> DaysGrid.days },
initialRule = { DaysGrid.days },
)
/**
+30 -4
View File
@@ -302,7 +302,7 @@
<string name="agenda_range_month">٣٠ يومًا القادمة</string>
<string name="settings_month_view_style">نمط عرض الشهر</string>
<string name="month_style_paged">صفحات</string>
<string name="month_style_paged_summary">الشهر الواحد يملأ الشاشة. اسحب لليسار أو لليمين لتغيير الشهر.</string>
<string name="month_style_paged_summary">الشهر الواحد يملأ الشاشة. اسحب لليسار أو لليمين لتغيير الشهر، أو اسحب للأعلى لعرض جدول الشهر.</string>
<string name="month_style_split">تقسيم</string>
<string name="settings_color_unsupported">السماح بالألوان في التقويمات غير المدعومة</string>
<string name="settings_color_unsupported_hint">بعض التقويمات (مثل البعض من CalDAV) لا تنشر أي مجموعة ألوان؛ لون حدث مخصص قد يزال أو يستبدل في مزامنته التالية. هذا قيد على تلك التقويمات، وليس شيئًا يمكن لـ Calendula إصلاحه.</string>
@@ -450,7 +450,7 @@
<string name="settings_special_dates_grant">منح الوصول</string>
<string name="calendars_backup_action">تصدير كملف ‎.ics</string>
<string name="calendars_export_title">تصدير التقويمات</string>
<string name="calendars_export_hint">اختر التقويمات التي تريد تضمينها في ملف ‎.ics.</string>
<string name="calendars_export_hint">اختر التقويمات التي تريد تضمينها في الملف ‎.ics</string>
<string name="calendars_export_action">تصدير</string>
<string name="calendars_restore_header">استعادة</string>
<string name="calendars_restore_action">استعادة من ملف ‎.ics</string>
@@ -514,7 +514,7 @@
<string name="settings_default_view_hint">طريقة العرض التي يفتحها Calendula عندما تقوم ببدءه.</string>
<string name="settings_week_start_hint">اليوم الذي يبدأ به كل أسبوع، في جميع طُرق العرض والأدوات المصغّرة.</string>
<string name="settings_time_format_hint">كيف الأوقات تُكتب في جميع أنحاء التطبيق. تلقائيًا يتبع إعداد نظامك.</string>
<string name="settings_past_events_hint">ما الذي يفعله جدول بالأحداث التي انتهت بالفعل.</string>
<string name="settings_past_events_hint">ما الذي يفعله الجدول بالأحداث التي انتهت بالفعل.</string>
<string name="calendars_visibility_a11y">إظهار \"%1$s\"</string>
<string name="calendars_visibility_notice_title">بعض التقويمات متوقفة</string>
<string name="calendars_visibility_notice_message">Calendula يعرض التقويمات التي تم تشغيلها لهذا الجهاز، وبعض من خاصتك متوقفة. لرؤية أحداثهم، قم بتشغيلهم ضمن الإعدادات ← التقويمات.</string>
@@ -732,7 +732,7 @@
<string name="event_detail_title">العنوان</string>
<string name="settings_licences">تراخيص مفتوحة المصدر</string>
<string name="settings_licences_subtitle">المشاريع التي بنيت ‌‌Calendula عليها</string>
<string name="licences_title">تراخيص مفتوحة المصدر</string>
<string name="licences_title">التراخيص مفتوحة المصدر</string>
<string name="licences_intro">يتضمن Calendula العمل أدناه. اضغط على أي إدخال للحصول على شفرة المصدر الخاصة به.</string>
<string name="licences_footer">يتم تضمين كل مشروع هنا دون تعديل، بموجب الترخيص الموضح.</string>
<string name="state_failure_permission_body">يقرأ Calendula أحداثك مباشرةً من تقويم النظام، لذلك فأنه يحتاج للوصول إلى التقويم لعرض أي شيء.</string>
@@ -778,4 +778,30 @@
<string name="color_name_amber">أصفر كهرماني</string>
<string name="calendars_restore_unavailable">لا تقويم يمكنه استيعاب الأحداث المستوردة بعد.</string>
<string name="calendars_description_label">الوصف</string>
<string name="app_name_calendar_alias">التقويم</string>
<plurals name="view_multi_day">
<item quantity="zero">%d يوم</item>
<item quantity="one">%d يوم</item>
<item quantity="two">%d يومان</item>
<item quantity="few">%d أيام</item>
<item quantity="many">%d يوم</item>
<item quantity="other">%d يوم</item>
</plurals>
<string name="settings_visible_hours_start">من</string>
<string name="settings_visible_hours_end">حتى</string>
<string name="settings_multi_day_count">عرض الأيام المتعدّدة</string>
<string name="settings_multi_day_count_hint">كم عدد الأيام التي يعرضها طريقة العرض متعدد الأيام جنبًا إلى جنب. اليوم يُفتح في العمود الأول.</string>
<string name="settings_visible_hours">الساعات الظاهرة</string>
<string name="settings_visible_hours_summary">حدّد مدى من الساعات للشاشة عند فتح طريقة عرض الأسبوع، متعددة الأيام أو اليوم</string>
<string name="settings_visible_hours_on_summary">%1$s – %2$s يملأ الشاشة عند فتح طريقة عرض</string>
<string name="settings_visible_hours_start_hint">الساعة في أعلى الشاشة عند فتح طريقة عرض الأسبوع، متعددة الأيام أو اليوم. لا تزال الساعات السابقة على بُعد تمرير.</string>
<string name="settings_visible_hours_end_hint">الساعة في أسفل الشاشة عند فتح طريقة عرض. لا تزال الساعات اللاحقة على بُعد تمرير، و عمليات التكبير بالضّم حتى يتم فتح طريقة العرض مرة أخرى.</string>
<string name="month_open_week">فتح الأسبوع %1$d</string>
<string name="settings_timeline_scale_by_visible_hours">ضبط بواسطة الساعات الظاهرة</string>
<string name="month_split_clear_filter">إظهار جدول الشهر كامل</string>
<string name="timeline_earlier_events">أحداث سابقة</string>
<string name="timeline_later_events">أحداث لاحقة</string>
<string name="reminder_day_today">اليوم</string>
<string name="event_detail_open_in_maps">فتح في الخرائط</string>
<string name="link_open_failed">لا تطبيق يمكنه فتح هذا الرابط</string>
</resources>
+37
View File
@@ -671,4 +671,41 @@
<string name="state_failure_all_hidden_action">Кіраваньне календарамі</string>
<string name="state_failure_no_import_target">Ніводны з календароў ня можа прымаць новыя падзеі.</string>
<string name="state_failure_no_import_target_body">Календары адключаныя, у рэжыме «толькі чытаньне», знаходзяцца пад кіраваньнем іншай праграмы, або не сынхранізуюцца на гэтай прыладзе. Уключэце каляндар, які можа прымаць падзеі, або дадайце лякальны.</string>
<string name="app_name_calendar_alias">Каляндар</string>
<string name="state_failure_event_not_found">Гэтай падзеі больш тут няма.</string>
<string name="state_failure_event_not_found_body">Магчыма яна выдалена ці перамешчана ў адключаны каляндар.</string>
<string name="state_failure_provider_body">Сыстэмны каляндар не адказвае. Паўтарэце спробу празь нейкі час.</string>
<string name="field_copy_action">Капіяваць</string>
<string name="field_copied">Скапіявана ў буфэр абмену</string>
<string name="field_copy_failed">Не атрымалася скапіяваць</string>
<string name="month_open_week">Адкрыць тыдзень %1$d</string>
<string name="month_split_clear_filter">Паказваць расклад на цэлы месяц</string>
<string name="timeline_earlier_events">Ранейшыя падзеі</string>
<string name="timeline_later_events">Пазьнейшыя падзеі</string>
<string name="event_detail_title">Загаловак</string>
<string name="event_detail_open_in_maps">Адкрыць на картах</string>
<string name="link_open_failed">Гэтую спасылку ня можа адкрыць ніводны дадатак</string>
<string name="reminder_after">праз %1$s</string>
<string name="calendar_unnamed">(Бяз назвы)</string>
<string name="onboarding_calendars_title">Месца для запісу вашых падзеяў</string>
<string name="onboarding_calendars_body">На гэтай прыладзе пакуль няма календара. Calendula выконвае запіс у календары, якія ўжо ёсьць на тэлефоне, і патрабуецца прынамсі адзін.</string>
<string name="onboarding_calendars_local_button">Стварыць каляндар на гэтай прыладзе</string>
<string name="onboarding_calendars_caldav_button">Сынхранізацыя з сэрвэрам CalDAV</string>
<string name="onboarding_calendars_skip_button">Ня зараз</string>
<string name="onboarding_calendars_benefit_local_title">Застаецца на гэтым тэлефоне</string>
<string name="onboarding_calendars_benefit_local_body">Каляндар на прыладзе ні з чым не сынхранізуецца, таму рабеце рэзэрвовыя копіі, каб захоўваць важныя падзеі.</string>
<string name="onboarding_calendars_benefit_sync_title">Або наладзьце сынхранізацыю з уліковым запісам</string>
<string name="onboarding_calendars_created_more_title">Прастора для іншых</string>
<string name="onboarding_calendars_created_title">«%1$s» гатовы</string>
<string name="onboarding_calendars_benefit_sync_body">Calendula паказвае ўліковыя запісы, якія ўжо сынхранізуюцца. Для выкананьня сынхранізацыі сэрвэры CalDAV патрабуець DAVx\\u2075.</string>
<string name="onboarding_calendars_created_body">Ён застаецца на гэтай прыладзе. У ім будуць запісвацца новыя падзеі, пакуль ня будзе выбраны іншы каляндар.</string>
<string name="onboarding_calendars_created_more_body">Праз мэню Налады → Календары можна задаць колькасьць, назвы і колеры наяўных календароў.</string>
<string name="onboarding_calendars_created_continue">Далей</string>
<string name="onboarding_hidden_title">Вашыя календары адключаныя</string>
<string name="onboarding_hidden_body">Calendula паказвае календары, уключаныя на гэтай прыладзе, але цяпер няма ніводнага ўключанага. Уключэце тыя, якія вы хочаце бачыць, і яны зноў зьявяцца і ў іншых дадатках календароў.</string>
<string name="onboarding_hidden_switch_all_button">Уключыць усе</string>
<string name="onboarding_hidden_skip_button">Ня зараз</string>
<string name="onboarding_hidden_failed">Гэты не атрымалася ўключыць. У мэню Налады → Календары знаходзяцца такія самыя перамыкачы.</string>
<string name="onboarding_calendars_create_failed">Не атрымалася стварыць каляндар з-за адмовы сховішча вашай прылады.</string>
<string name="reminder_day_today">Сёньня</string>
</resources>
+30 -2
View File
@@ -439,7 +439,7 @@
<string name="settings_month_header">Měsíční zobrazení</string>
<string name="settings_month_view_style">Styl měsíčního zobrazení</string>
<string name="month_style_paged">Stránky</string>
<string name="month_style_paged_summary">Na obrazovce se zobrazuje jeden měsíc. Přejetím prstem doleva nebo doprava můžete změnit měsíc.</string>
<string name="month_style_paged_summary">Na obrazovce se zobrazuje jeden měsíc. Přejetím prstem doleva nebo doprava můžete změnit měsíc, přejetím prstem nahoru zobrazíte měsíční přehled.</string>
<string name="month_style_continuous">Posouvání měsíců</string>
<string name="month_style_continuous_summary">Každý měsíc je zobrazen pod vlastním nadpisem, od následujícího je oddělen malou mezerou.</string>
<string name="month_style_dense">Nepřerušené týdny</string>
@@ -719,7 +719,7 @@
<string name="onboarding_hidden_title">Vaše kalendáře jsou vypnuté</string>
<string name="onboarding_hidden_body">Calendula zobrazuje kalendáře, které má tento telefon zapnuté, což není momentálně žádný. Zapněte si kalendáře, které chcete vidět – vaše ostatní aplikace kalendáře je pak také zobrazí.</string>
<string name="onboarding_hidden_switch_all_button">Zapnout všechny kalendáře</string>
<string name="onboarding_hidden_skip_button">Teď ne</string>
<string name="onboarding_hidden_skip_button">Později</string>
<string name="onboarding_hidden_failed">To se nepodařilo zapnout. V Nastavení → Kalendáře jsou stejné přepínače.</string>
<string name="onboarding_calendars_create_failed">Kalendář se nepodařilo vytvořit. Úložiště kalendáře ve vašem telefonu jej odmítlo vytvořit.</string>
<string name="calendars_description_label">Popis</string>
@@ -736,4 +736,32 @@
<string name="color_name_purple">Purpurová</string>
<string name="color_name_pink">Růžová</string>
<string name="calendars_restore_unavailable">Žádný z kalendářů zatím nedokáže importované události přijmout.</string>
<string name="app_name_calendar_alias">Kalendář</string>
<string name="month_open_week">Otevřít týden %1$d</string>
<string name="month_split_clear_filter">Zobrazit celou měsíční agendu</string>
<string name="timeline_earlier_events">Dřívější události</string>
<string name="timeline_later_events">Pozdější události</string>
<string name="event_detail_open_in_maps">Otevřít na mapě</string>
<string name="link_open_failed">Žádná aplikace nemůže tento odkaz otevřít</string>
<string name="reminder_day_today">Dnes</string>
<plurals name="view_multi_day">
<item quantity="one">%d den</item>
<item quantity="few">%d dny</item>
<item quantity="many">%d dnů</item>
<item quantity="other">%d dnů</item>
</plurals>
<string name="settings_multi_day_count">Vícedenní zobrazení</string>
<string name="settings_multi_day_count_hint">Počet dní zobrazujících se ve vícedenním přehledu vedle sebe. Dnešek se otevírá v prvním sloupci.</string>
<string name="settings_timeline_scale_by_visible_hours">Nastaveno v části Viditelné hodiny</string>
<string name="settings_visible_hours">Viditelné hodiny</string>
<string name="settings_visible_hours_summary">Při otevření týdenního, vícedenního nebo denního zobrazení se rozsah hodin přizpůsobí obrazovce</string>
<string name="settings_visible_hours_on_summary">%1$s – %2$s vyplní obrazovku při otevření zobrazení</string>
<string name="settings_visible_hours_start">Od</string>
<string name="settings_visible_hours_end">Do</string>
<string name="settings_visible_hours_start_hint">Čas zobrazený v horní části obrazovky při otevření týdenního, vícedenního nebo denního přehledu. Předchozí časy lze zobrazit posunutím obrazovky.</string>
<string name="settings_visible_hours_end_hint">Hodina v dolní části obrazovky v okamžiku, kdy se otevře zobrazení. Další hodiny se zobrazí skrolováním, přiblížením prstů se obraz dočasně zvětší.</string>
<string name="settings_support_kofi">Ko-fi</string>
<string name="settings_support_kofi_hint">Jednorázové příspěvky</string>
<string name="settings_support_liberapay">Liberapay</string>
<string name="settings_support_liberapay_hint">Pravidelné příspěvky</string>
</resources>
+12
View File
@@ -715,4 +715,16 @@
<item quantity="one">%d Termin konnte nicht hinzugefügt werden.</item>
<item quantity="other">%d Termine konnten nicht hinzugefügt werden.</item>
</plurals>
<string name="app_name_calendar_alias">Kalender</string>
<string name="timeline_earlier_events">Frühere Termine</string>
<string name="timeline_later_events">Spätere Termine</string>
<string name="link_open_failed">Keine App kann diesen Link öffnen</string>
<string name="reminder_day_today">Heute</string>
<plurals name="view_multi_day">
<item quantity="one">%d Tag</item>
<item quantity="other">%d Tage</item>
</plurals>
<string name="settings_visible_hours">Sichtbare Stunden</string>
<string name="settings_visible_hours_start">Von</string>
<string name="settings_visible_hours_end">Bis</string>
</resources>
+1
View File
@@ -672,4 +672,5 @@
<item quantity="many">Les événements %d n\'ont pas pu être ajoutés.</item>
<item quantity="other">Les événements %d n\'ont pas pu être ajoutés.</item>
</plurals>
<string name="app_name_calendar_alias">Calendrier</string>
</resources>
+82 -3
View File
@@ -243,7 +243,7 @@
<string name="settings_time_format_auto">Automatico</string>
<string name="settings_time_format_12h">12 ore</string>
<string name="settings_time_format_24h">24 ore</string>
<string name="settings_hour_lines">Righe per le ore</string>
<string name="settings_hour_lines">Grglia oraria</string>
<string name="settings_hour_lines_summary">Mostra una riga separatrice per ogni ora nella vista Settimana e Giorno</string>
<string name="settings_dim_completed">Attenua gli eventi completati</string>
<string name="settings_dim_completed_summary">Attenua gli eventi conclusi nella vista Mese e Settimana</string>
@@ -413,7 +413,7 @@
<string name="settings_default_reminder">Promemoria per eventi standard</string>
<string name="settings_notifications_subtitle">Promemoria</string>
<string name="shortcut_new_event_short">Nuovo evento</string>
<string name="event_edit_managed_hint">Gestito da “%1$s” - titolo, data e ripetizioni sono sincronizzate dai tuoi contatti. Promemoria e note sono modificabili dall\'utente.</string>
<string name="event_edit_managed_hint">Gestito da “%1$s” — titolo, data e ripetizioni sono sincronizzate dai tuoi contatti. Promemoria e note sono modificabili dall\'utente.</string>
<string name="settings_font_headings">Carattere del titolo</string>
<string name="settings_font_body">Carattere del corpo</string>
<string name="settings_font_system">Lingua di sistema</string>
@@ -503,7 +503,7 @@
<string name="event_move_undone">Ripianificazione annullata</string>
<string name="event_move_failed">Impossibile ripianificare l\'evento</string>
<string name="event_move_write_denied">Calendula ha bisogno dei permessi di scrittura per ripianificare gli eventi</string>
<string name="event_move_gone">Questo evento è stato eliminato.</string>
<string name="event_move_gone">Questo evento è stato eliminato</string>
<string name="event_move_blocked_series_end">Non è possibile ripianificare un evento oltre la data di fine della sua serie</string>
<string name="event_edit_timezone_device">Fuso orario del dispositivo</string>
<string name="event_edit_timezone_device_summary">Segue il fuso orario in cui ti trovi</string>
@@ -657,4 +657,83 @@
<string name="import_done_failed_label">Non aggiunto</string>
<string name="import_done_failed_note">Alcuni eventi non possono essere aggiunti e sono stati esclusi.</string>
<string name="import_done_stopped_title">Importazione interrotta</string>
<string name="app_name_calendar_alias">Calendario</string>
<string name="state_failure_permission_body">Calendula legge i tuoi eventi direttamente dal calendario di sistema, per questo ha bisogno dell\'accesso al calendario per poterli visualizzare.</string>
<string name="state_failure_no_calendars_body">Aggiungi un account a questo dispositivo e i relativi calendari verranno visualizzati qui.</string>
<string name="state_failure_all_hidden">Tutti i tuoi calendari sono disattivati.</string>
<string name="state_failure_all_hidden_body">Riattiva almeno un calendario per visualizzarne gli eventi.</string>
<string name="state_failure_no_import_target">Nessun calendario può accettare nuovi eventi.</string>
<string name="state_failure_no_import_target_body">I calendari attivi sono di sola lettura, gestiti da un\'altra app o non sincronizzati con questo dispositivo. Attiva un calendario in cui è possibile inserire eventi oppure aggiungine uno locale.</string>
<string name="state_failure_event_not_found">Questo evento non è più disponibile.</string>
<string name="state_failure_event_not_found_body">Potrebbe essere stato cancellato oppure spostato in un calendario disattivato.</string>
<string name="state_failure_provider_body">Il calendario di sistema non ha risposto. Riprova a breve.</string>
<string name="timeline_earlier_events">Eventi precedenti</string>
<string name="timeline_later_events">Eventi successivi</string>
<string name="month_open_week">Settimana aperta %1$d</string>
<string name="month_split_clear_filter">Visualizza il calendario completo del mese</string>
<string name="event_detail_open_in_maps">Apri su Maps</string>
<string name="link_open_failed">Nessuna app è in grado di aprire questo link</string>
<string name="calendar_unnamed">(Senza nome)</string>
<string name="onboarding_calendars_title">Un posto dove inserire i tuoi eventi</string>
<string name="onboarding_calendars_body">Questo dispositivo non ha ancora un calendario. Calendula scrive sui calendari già presenti sul telefono — ne serve almeno uno.</string>
<string name="onboarding_calendars_local_button">Crea un calendario su questo dispositivo</string>
<string name="onboarding_calendars_caldav_button">Sincronizzazione con un server CalDAV</string>
<string name="onboarding_calendars_skip_button">Non ora</string>
<string name="onboarding_calendars_benefit_local_title">Rimane su questo telefono</string>
<string name="onboarding_calendars_benefit_local_body">Il calendario del dispositivo non si sincronizza con nessun altro dispositivo, quindi esegui un backup se gli eventi sono importanti.</string>
<string name="onboarding_calendars_benefit_sync_title">Oppure sincronizza da un account</string>
<string name="onboarding_calendars_benefit_sync_body">Calendula mostra quali account sono già sincronizzati. I server CalDAV necessitano di DAVx⁵ per eseguire la sincronizzazione.</string>
<string name="onboarding_calendars_created_title">“%1$s” è pronto</string>
<string name="onboarding_calendars_created_body">Si trova su questo dispositivo e gli eventi nuovi vengono inseriti lì, a meno che non si scelga un altro calendario.</string>
<string name="onboarding_calendars_created_more_title">C\'è spazio per altro</string>
<string name="onboarding_calendars_created_more_body">Da Impostazioni → Calendari puoi crearne quanti ne vuoi e rinominare o cambiare il colore di quelli già presenti.</string>
<string name="onboarding_calendars_created_continue">Continua</string>
<string name="onboarding_hidden_title">I vostri calendari sono disattivati</string>
<string name="onboarding_hidden_body">Calendula mostra i calendari attivi su questo telefono e, al momento, non ce n’è nessuno. Attiva quelli che desideri visualizzare: anche le altre app di calendario li mostreranno nuovamente.</string>
<string name="onboarding_hidden_switch_all_button">Attivali tutti</string>
<string name="onboarding_hidden_skip_button">Non ora</string>
<string name="onboarding_hidden_failed">Non sono riuscito ad attivarlo. In Impostazioni → Calendari ci sono gli stessi pulsanti di attivazione.</string>
<string name="onboarding_calendars_create_failed">Impossibile creare il calendario. La memoria del calendario del tuo telefono non lo ha accettato.</string>
<string name="reminder_day_today">Oggi</string>
<plurals name="view_multi_day">
<item quantity="one">Giorno</item>
<item quantity="many">Giorni</item>
<item quantity="other">Giorno</item>
</plurals>
<string name="settings_multi_day_count">Visualizzazione su più giorni</string>
<string name="settings_multi_day_count_hint">La vista più giorni mostra, affiancati, i giorni. La data odierna è visualizzata nella prima colonna.</string>
<string name="settings_timeline_scale_by_visible_hours">Imposta in base alle ore di visibilità</string>
<string name="settings_visible_hours">Orari di apertura</string>
<string name="settings_visible_hours_summary">Adatta la gamma di ore alla schermata all\'apertura della visualizzazione settimanale, plurigiornaliera o giornaliera</string>
<string name="settings_visible_hours_on_summary">%1$s – %2$s riempie lo schermo all’apertura di una vista</string>
<string name="settings_visible_hours_start">Da</string>
<string name="settings_visible_hours_end">Fino a</string>
<string name="settings_visible_hours_start_hint">L\'ora visualizzata nella parte superiore dello schermo quando si apre la vista settimanale, plurigiornaliera o giornaliera. Le ore precedenti sono comunque accessibili scorrendo la schermata.</string>
<string name="settings_visible_hours_end_hint">L\'ora visualizzata nella parte inferiore dello schermo quando si apre una schermata. Le ore successive sono ancora raggiungibili scorrendo lo schermo, mentre pizzicando lo schermo si esegue lo zoom fino a quando la schermata non viene riaperta.</string>
<string name="settings_licences">Licenze open source</string>
<string name="settings_licences_subtitle">I progetti su cui si basa Calendula</string>
<string name="calendars_description_label">Descrizione</string>
<string name="color_name_mauve">Rosa malva</string>
<string name="color_name_red">Rosso</string>
<string name="color_name_orange">Arancione</string>
<string name="color_name_amber">Ambra</string>
<string name="color_name_olive">Oliva</string>
<string name="color_name_green">Verde</string>
<string name="color_name_teal">Verde acqua</string>
<string name="color_name_cyan">Ciano</string>
<string name="color_name_blue">Blu</string>
<string name="color_name_indigo">Indaco</string>
<string name="color_name_purple">Viola</string>
<string name="color_name_pink">Rosa</string>
<string name="calendars_restore_unavailable">Al momento nessun calendario è in grado di gestire gli eventi importati.</string>
<plurals name="import_done_stopped">
<item quantity="one">Il calendario ha smesso di accettare eventi a metà dell\'operazione. L\'evento %d presente nel file non è stato aggiunto.</item>
<item quantity="many">Il calendari hanno smesso di accettare eventi a metà dell\'operazione. Gli eventi %d presenti nel file non sono stati aggiunti.</item>
<item quantity="other">Il calendario ha smesso di accettare eventi a metà dell\'operazione. L\'evento %d presente nel file non è stato aggiunto.</item>
</plurals>
<plurals name="import_done_failed">
<item quantity="one">Non è stato possibile aggiungere l\'evento %d.</item>
<item quantity="many">Non è stato possibile aggiungere gli eventi %d.</item>
<item quantity="other">Non è stato possibile aggiungere l\'evento %d.</item>
</plurals>
</resources>
+39 -2
View File
@@ -25,10 +25,10 @@
<string name="settings_section_notifications">通知</string>
<string name="drawer_jump_to_date">日付に移動</string>
<string name="state_failure_permission">カレンダーへのアクセス権限が必要です。</string>
<string name="permission_rationale_body">Calendulaで予定を表示・管理するには、カレンダーへのアクセス許可が必要です。</string>
<string name="permission_rationale_body">Calendula で予定を表示・管理するには、カレンダーへのアクセス許可が必要です。</string>
<string name="permission_request_button">カレンダーへのアクセスを許可</string>
<string name="permission_denied_title">カレンダーへのアクセスが拒否されました</string>
<string name="permission_denied_body">Calendulaはカレンダーへのアクセス権がないと予定を表示できません。システム設定から再度許可をお願いします。</string>
<string name="permission_denied_body">Calendula はカレンダーへのアクセス権がないと予定を表示できません。システム設定から再度許可をしてください。</string>
<string name="permission_open_settings_button">システム設定を開く</string>
<string name="permission_retry_button">再試行</string>
<string name="permission_benefit_private_title">プライバシーを重視した設計</string>
@@ -79,4 +79,41 @@
<string name="settings_theme">テーマ</string>
<string name="settings_theme_system">システム</string>
<string name="settings_dynamic_color">ダイナミックカラー</string>
<string name="view_agenda">予定リスト</string>
<string name="agenda_header_today">今日</string>
<string name="agenda_header_tomorrow">明日</string>
<string name="widget_agenda_label">Calendula 予定リスト</string>
<string name="settings_agenda_header">予定リスト</string>
<string name="settings_agenda_range">予定リストの範囲</string>
<string name="settings_section_appearance">外観</string>
<string name="state_failure_unknown">問題が発生しました。</string>
<string name="state_failure_permission_body">Calendula はシステムのカレンダーから直接予定を読み取るため、予定を表示するにはカレンダーへのアクセスが必要です。</string>
<string name="state_failure_permission_action">アクセスを許可</string>
<string name="state_failure_no_calendars">カレンダーが設定されていません。</string>
<string name="state_failure_no_calendars_body">このデバイスにカレンダーアカウントを追加すると、そのカレンダーがここに表示されます。</string>
<string name="state_failure_no_calendars_action">システムのカレンダー設定を開く</string>
<string name="state_failure_all_hidden">すべてのカレンダーがオフになっています。</string>
<string name="state_failure_all_hidden_body">予定を表示するには、少なくとも 1 つのカレンダーを再度有効にしてください。</string>
<string name="state_failure_all_hidden_action">カレンダーの管理</string>
<string name="state_failure_no_import_target">新しい予定を追加できるカレンダーがありません。</string>
<string name="state_failure_provider">カレンダーを読み込めませんでした。</string>
<string name="event_move_failed">予定を移動できませんでした</string>
<string name="event_edit_save_failed">予定を保存できませんでした</string>
<string name="month_a11y_today_prefix">今日</string>
<string name="day_today_action">今日</string>
<string name="settings_time_format_auto">自動</string>
<string name="agenda_range_day">今日</string>
<string name="agenda_range_custom_hint">日</string>
<string name="dialog_save">保存</string>
<string name="calendars_description_label">説明</string>
<string name="special_dates_calendar_birthday">誕生日</string>
<string name="reminder_day_today">今日</string>
<string name="agenda_today_action">今日</string>
<string name="widget_today">今日</string>
<plurals name="duration_minutes">
<item quantity="other">%d分</item>
</plurals>
<string name="reminder_day_tomorrow">明日</string>
<string name="state_failure_no_import_target_body">有効になっているカレンダーが読み取り専用であるか、別のアプリによって管理されているか、またはこのデバイスに同期されていません。予定を追加できるカレンダーを有効にするか、ローカルのカレンダーを追加してください。</string>
<string name="state_failure_event_not_found">この予定はすでに存在しません。</string>
</resources>
+24 -2
View File
@@ -377,7 +377,7 @@
<string name="settings_today_toolbar">Knop Vandaag in werkbalk</string>
<string name="settings_today_toolbar_summary">Een knop om naar vandaag te gaan tonen in de werkbalk, in plaats van een zwevende knop</string>
<string name="settings_app_name">Appnaam</string>
<string name="settings_app_name_summary">Calendula als “Calendar” tonen in je launcher. Alleen de naam in de launcher verandert; het pictogram kan na het wisselen op een andere plek komen te staan.</string>
<string name="settings_app_name_summary">Calendula als “Agenda” tonen in je launcher. Alleen de naam in de launcher verandert; het pictogram kan na het wisselen op een andere plek komen te staan.</string>
<string name="settings_time_format">Tijdnotatie</string>
<string name="settings_time_format_auto">Automatisch</string>
<string name="settings_time_format_12h">12-uursnotatie (2:00 PM)</string>
@@ -441,7 +441,7 @@
<string name="settings_month_header">Maandweergave</string>
<string name="settings_month_view_style">Stijl van maandweergave</string>
<string name="month_style_paged">Pagina\'s</string>
<string name="month_style_paged_summary">Eén maand vult het scherm. Veeg naar links of rechts om van maand te wisselen.</string>
<string name="month_style_paged_summary">Eén maand vult het scherm. Veeg naar links of rechts om van maand te wisselen, of veeg omhoog om de agenda van deze maand te tonen.</string>
<string name="month_style_continuous">Doorlopende maanden</string>
<string name="month_style_continuous_summary">Elke maand staat onder een eigen kop, met wat ruimte tot de volgende maand.</string>
<string name="month_style_dense">Naadloze weken</string>
@@ -694,4 +694,26 @@
<string name="special_dates_default_title_birthday">Verjaardag van {name} ({year})</string>
<string name="special_dates_default_title_anniversary">Jubileum van {name} ({year})</string>
<string name="special_dates_default_title_custom">{name}</string>
<string name="app_name_calendar_alias">Agenda</string>
<string name="month_open_week">Week %1$d openen</string>
<string name="month_split_clear_filter">Agenda van de hele maand tonen</string>
<string name="timeline_earlier_events">Eerdere gebeurtenissen</string>
<string name="timeline_later_events">Latere gebeurtenissen</string>
<string name="event_detail_open_in_maps">Op kaart tonen</string>
<string name="link_open_failed">Er is geen app die deze link kan openen</string>
<string name="reminder_day_today">Vandaag</string>
<plurals name="view_multi_day">
<item quantity="one">%d dag</item>
<item quantity="other">%d dagen</item>
</plurals>
<string name="settings_multi_day_count">Meerdaagse weergave</string>
<string name="settings_multi_day_count_hint">Hoeveel dagen de meerdaagse weergave naast elkaar toont. Vandaag staat in de eerste kolom.</string>
<string name="settings_timeline_scale_by_visible_hours">Ingesteld via Zichtbare uren</string>
<string name="settings_visible_hours">Zichtbare uren</string>
<string name="settings_visible_hours_summary">Een reeks uren passend op het scherm tonen bij het openen van de week-, meerdaagse of dagweergave</string>
<string name="settings_visible_hours_on_summary">%1$s – %2$s vult het scherm bij het openen van een weergave</string>
<string name="settings_visible_hours_start">Van</string>
<string name="settings_visible_hours_end">Tot</string>
<string name="settings_visible_hours_start_hint">Het uur bovenaan het scherm bij het openen van de week-, meerdaagse of dagweergave. Eerdere uren blijven bereikbaar door te scrollen.</string>
<string name="settings_visible_hours_end_hint">Het uur onderaan het scherm bij het openen van een weergave. Latere uren blijven bereikbaar door te scrollen, en in- of uitzoomen met twee vingers geldt totdat de weergave opnieuw wordt geopend.</string>
</resources>
+4
View File
@@ -355,4 +355,8 @@
<string name="settings_time_format_auto">Автоматически</string>
<string name="settings_time_format_12h">12-часовой формат времени</string>
<string name="settings_time_format_24h">24-часовой формат времени</string>
<string name="onboarding_calendars_benefit_sync_body">Calendula отображает учетные записи, которые уже синхронизируются. Для синхронизации серверам CalDAV требуется DAVx⁵.</string>
<string name="onboarding_calendars_created_title">«%1$s» готов</string>
<string name="onboarding_calendars_created_body">Он остаётся на данном устройстве. В него будут записываться новые события, пока не будет выбран иной календарь.</string>
<string name="onboarding_calendars_created_more_title">Место для других</string>
</resources>
+6 -1
View File
@@ -702,6 +702,10 @@
<string name="settings_licences_subtitle">The projects Calendula is built on</string>
<string name="settings_about_privacy">Privacy policy</string>
<string name="settings_about_support">Support development</string>
<string name="settings_support_kofi">Ko-fi</string>
<string name="settings_support_kofi_hint">One-off tips</string>
<string name="settings_support_liberapay">Liberapay</string>
<string name="settings_support_liberapay_hint">Recurring donations</string>
<string name="settings_about_version">Version %1$s</string>
<string name="settings_about_logo_desc">Calendula app icon</string>
<string name="settings_report_problem">Report a problem</string>
@@ -858,7 +862,8 @@
<string name="about_source_url" translatable="false">https://codeberg.org/jlmakiola/calendula</string>
<string name="about_license_url" translatable="false">https://codeberg.org/jlmakiola/calendula/src/branch/main/LICENSE</string>
<string name="about_privacy_url" translatable="false">https://jeanlucmakiola.de/calendula/privacy</string>
<string name="about_support_url" translatable="false">https://ko-fi.com/jeanlucmakiola</string>
<string name="about_support_kofi_url" translatable="false">https://ko-fi.com/jeanlucmakiola</string>
<string name="about_support_liberapay_url" translatable="false">https://liberapay.com/Jean-Luc_Makiola/donate</string>
<string name="about_translate_url" translatable="false">https://weblate.dev.jeanlucmakiola.de/engage/calendula/</string>
<!-- Crash reporting: a captured report the user can submit, by hand, as a
@@ -19,6 +19,12 @@ class HtmlTextTest {
assertThat(looksLikeHtml("See <a href=\"https://x.y\">here</a>")).isTrue()
}
@Test
fun `angle-bracketed links and addresses stay text`() {
val html = "Join<br>here <https://teams.microsoft.com/l/x> or <a@b.c>"
assertThat(parseHtml(html).text).isEqualTo("Join\nhere <https://teams.microsoft.com/l/x> or <a@b.c>")
}
@Test
fun `plain text passes through untouched`() {
val text = " Agenda:\n\n\n- one \n- two"
@@ -18,6 +18,14 @@ class IcsRecurrenceTest {
assertThat(sanitizeRrule("RRULE:FREQ=DAILY").rule).isEqualTo("FREQ=DAILY")
}
@Test
fun `part names and the prefix are matched case-insensitively`() {
val result = sanitizeRrule("rrule:freq=weekly;byday=mo")
assertThat(result.rule).isEqualTo("FREQ=WEEKLY;BYDAY=MO")
assertThat(result.repaired).isFalse()
}
@Test
fun `an empty list part is dropped`() {
val bareByDay = sanitizeRrule("FREQ=WEEKLY;INTERVAL=1;BYDAY=")
@@ -5,6 +5,7 @@ import com.google.common.truth.Truth.assertThat
import de.jeanlucmakiola.calendula.MainDispatcherExtension
import de.jeanlucmakiola.calendula.data.calendar.FakeCalendarDataSource
import de.jeanlucmakiola.calendula.data.ics.IcsExporter
import de.jeanlucmakiola.calendula.data.time.FakeZoneSource
import de.jeanlucmakiola.calendula.domain.CalendarSource
import de.jeanlucmakiola.calendula.testDetail
import de.jeanlucmakiola.calendula.testEvent
@@ -56,7 +57,7 @@ class EventDetailViewModelTest {
settings = testSettings(tempDir, CoroutineScope(dispatcher)),
)
// Only `shareUri()` touches the exporter, and nothing here shares.
return EventDetailViewModel(repo, IcsExporter(ContextWrapper(null)), dispatcher)
return EventDetailViewModel(repo, IcsExporter(ContextWrapper(null)), dispatcher, FakeZoneSource())
}
private fun fakeSource(description: () -> String?) = FakeCalendarDataSource().apply {
@@ -37,7 +37,7 @@ class LaneEventsTest {
val week = rowOfJuly6(listOf(bar, meeting))
// Jul 7 is column 1 of a Monday-anchored row starting Jul 6.
assertThat(week.laneEvents(col = 1, day = LocalDate(2026, 7, 7), laneCap = 3))
assertThat(week.laneEvents(col = 1, laneCap = 3))
.containsExactly(bar, meeting)
.inOrder()
}
@@ -48,7 +48,7 @@ class LaneEventsTest {
val monday = timed(LocalDate(2026, 7, 6), hour = 9, id = 2L)
val week = rowOfJuly6(listOf(bar, monday))
assertThat(week.laneEvents(col = 0, day = LocalDate(2026, 7, 6), laneCap = 3))
assertThat(week.laneEvents(col = 0, laneCap = 3))
.containsExactly(monday)
}
@@ -58,10 +58,9 @@ class LaneEventsTest {
val week = rowOfJuly6(listOf(bar))
(1..3).forEach { col ->
val day = LocalDate(2026, 7, 6 + col)
assertThat(week.laneEvents(col, day, laneCap = 3)).containsExactly(bar)
assertThat(week.laneEvents(col, laneCap = 3)).containsExactly(bar)
}
assertThat(week.laneEvents(col = 4, day = LocalDate(2026, 7, 10), laneCap = 3)).isEmpty()
assertThat(week.laneEvents(col = 4, laneCap = 3)).isEmpty()
}
/** The bug the colour-gathered dots had: one dot for two events on one calendar. */
@@ -71,7 +70,7 @@ class LaneEventsTest {
val second = timed(LocalDate(2026, 7, 6), hour = 14, id = 2L, color = RED)
val week = rowOfJuly6(listOf(first, second))
assertThat(week.laneEvents(col = 0, day = LocalDate(2026, 7, 6), laneCap = 3))
assertThat(week.laneEvents(col = 0, laneCap = 3))
.containsExactly(first, second)
.inOrder()
}
@@ -81,7 +80,7 @@ class LaneEventsTest {
val events = (0 until 5).map { timed(LocalDate(2026, 7, 6), hour = 8 + it, id = it + 1L) }
val week = rowOfJuly6(events)
val seated = week.laneEvents(col = 0, day = LocalDate(2026, 7, 6), laneCap = 3)
val seated = week.laneEvents(col = 0, laneCap = 3)
assertThat(seated).hasSize(3)
assertThat(seated).containsExactlyElementsIn(events.take(3)).inOrder()
assertThat(week.countByDay[LocalDate(2026, 7, 6)]!! - seated.size).isEqualTo(2)
@@ -95,7 +94,7 @@ class LaneEventsTest {
}
val week = rowOfJuly6(bars)
val seated = week.laneEvents(col = 0, day = LocalDate(2026, 7, 6), laneCap = 3)
val seated = week.laneEvents(col = 0, laneCap = 3)
assertThat(seated).hasSize(3)
assertThat(week.spans.filter { it.lane >= 3 }.map { it.event })
.containsNoneIn(seated)
@@ -105,14 +104,13 @@ class LaneEventsTest {
fun `overflow is exactly what seating left behind`() {
val events = (0 until 5).map { timed(LocalDate(2026, 7, 6), hour = 8 + it, id = it + 1L) }
val week = rowOfJuly6(events)
val day = LocalDate(2026, 7, 6)
val seated = week.laneEvents(col = 0, day = day, laneCap = 3)
val overflow = week.overflowEvents(col = 0, day = day, laneCap = 3)
val seated = week.laneEvents(col = 0, laneCap = 3)
val overflow = week.overflowEvents(col = 0, laneCap = 3)
assertThat(overflow).containsExactlyElementsIn(events.drop(3)).inOrder()
assertThat(seated + overflow).containsExactlyElementsIn(events)
assertThat(seated.size + overflow.size).isEqualTo(week.countByDay[day])
assertThat(seated.size + overflow.size).isEqualTo(week.countByDay[LocalDate(2026, 7, 6)])
}
@Test
@@ -124,8 +122,7 @@ class LaneEventsTest {
val parked = week.spans.filter { it.lane >= 3 }.map { it.event }
(0..2).forEach { col ->
val day = LocalDate(2026, 7, 6 + col)
assertThat(week.overflowEvents(col, day, laneCap = 3))
assertThat(week.overflowEvents(col, laneCap = 3))
.containsExactlyElementsIn(parked)
}
}
@@ -134,7 +131,7 @@ class LaneEventsTest {
fun `a day that fits has no overflow`() {
val week = rowOfJuly6(listOf(timed(LocalDate(2026, 7, 6), hour = 9, id = 1L)))
assertThat(week.overflowEvents(col = 0, day = LocalDate(2026, 7, 6), laneCap = 3)).isEmpty()
assertThat(week.overflowEvents(col = 0, laneCap = 3)).isEmpty()
}
private companion object {
@@ -0,0 +1,170 @@
package de.jeanlucmakiola.calendula.ui.month
import com.google.common.truth.Truth.assertWithMessage
import de.jeanlucmakiola.calendula.domain.EventInstance
import de.jeanlucmakiola.calendula.domain.EventResponse
import de.jeanlucmakiola.calendula.testEvent
import kotlinx.datetime.DateTimeUnit
import kotlinx.datetime.LocalDate
import kotlinx.datetime.TimeZone
import kotlinx.datetime.YearMonth
import kotlinx.datetime.atTime
import kotlinx.datetime.plus
import kotlinx.datetime.toInstant
import org.junit.jupiter.api.Test
import kotlin.random.Random
import kotlin.time.Duration.Companion.minutes
/**
* The month row's seating — which event sits in which lane of a day, and which
* fall to the overflow — is read in four places: the bars and pills a row draws,
* the split style's dots ([laneEvents]), the hit test ([chipAt]) and the overflow
* ([overflowEvents]). They must agree for dot _i_ to morph into lane _i_ (#53).
*
* The references below are the four copies as they were before they shared one
* implementation, the row's taken from its composable; this pins the shared one
* to all of them across a spread of generated weeks.
*/
class MonthSeatingTest {
private val zone = TimeZone.of("Europe/Berlin")
private val firstMonday = LocalDate(2026, 3, 23)
private var overflowed = 0
private var stackedBars = 0
@Test
fun `every reader of a week sees the same seating`() {
val random = Random(53)
repeat(400) { round ->
val start = firstMonday.plus(round % 9, DateTimeUnit.WEEK)
val days = (0 until 7).map { start.plus(it, DateTimeUnit.DAY) }
val events = randomEvents(random, start, count = random.nextInt(0, 14))
val laid = layoutCalendarWeek(days, events, zone)
val weeks = listOf(laid, clipWeekToMonth(laid, YearMonth(days[3].year, days[3].month)))
weeks.forEach { week ->
for (laneCap in 0..6) checkWeek(week, laneCap, "round $round, laneCap $laneCap")
if (week.spans.any { it.lane > 0 }) stackedBars++
}
}
assertWithMessage("generated days with overflow").that(overflowed).isGreaterThan(500)
assertWithMessage("generated weeks with stacked bars").that(stackedBars).isGreaterThan(100)
}
private fun checkWeek(week: MonthWeek, laneCap: Int, label: String) {
week.days.forEachIndexed { col, day ->
val where = "$label, col $col"
val row = rowSeating(week, col, day, laneCap)
val dots = refLaneEvents(week, col, day, laneCap)
val hits = (0 until laneCap).mapNotNull { lane -> refChipAt(week, col, lane, laneCap)?.let { lane to it } }
val overflow = refOverflowEvents(week, col, day, laneCap)
if (overflow.isNotEmpty()) overflowed++
assertWithMessage("$where: hit test vs row").that(hits).isEqualTo(row.seated)
assertWithMessage("$where: dots vs row").that(dots).isEqualTo(row.seated.map { it.second })
assertWithMessage("$where: overflow vs row").that(overflow).isEqualTo(row.hiddenEvents)
assertWithMessage("$where: dot count vs hidden list")
.that(row.hiddenCount.coerceAtLeast(0)).isEqualTo(row.hiddenEvents.size)
assertWithMessage("$where: laneEvents").that(week.laneEvents(col, laneCap)).isEqualTo(dots)
assertWithMessage("$where: overflowEvents").that(week.overflowEvents(col, laneCap)).isEqualTo(overflow)
(-1..laneCap).forEach { lane ->
assertWithMessage("$where: chipAt lane $lane")
.that(week.chipAt(col, lane, laneCap))
.isEqualTo(refChipAt(week, col, lane, laneCap))
}
val seating = week.seating(col, laneCap)
assertWithMessage("$where: seating lanes")
.that(seating.seated.map { it.lane to it.event }).isEqualTo(row.seated)
assertWithMessage("$where: seating hidden").that(seating.hidden).isEqualTo(row.hiddenEvents)
}
}
private fun randomEvents(random: Random, weekStart: LocalDate, count: Int): List<EventInstance> =
(1..count).map { n ->
val id = n.toLong()
val day = weekStart.plus(random.nextInt(-4, 10), DateTimeUnit.DAY)
val response = if (random.nextInt(6) == 0) EventResponse.Declined else EventResponse.Going
when (random.nextInt(5)) {
0, 1 -> {
val from = day.atTime(0, 0).toInstant(TimeZone.UTC)
val to = day.plus(random.nextInt(1, 10), DateTimeUnit.DAY).atTime(0, 0).toInstant(TimeZone.UTC)
testEvent(id = id, title = "A$id", start = from, end = to, isAllDay = true, response = response)
}
2 -> {
// Crosses midnight, sometimes ending on it exactly.
val from = day.atTime(random.nextInt(18, 24), 0).toInstant(zone)
val to = from + (random.nextInt(1, 60) * 30).minutes
testEvent(id = id, title = "M$id", start = from, end = to, response = response)
}
else -> {
val from = day.atTime(random.nextInt(0, 23), random.nextInt(0, 4) * 15).toInstant(zone)
val length = if (random.nextInt(8) == 0) 0 else random.nextInt(1, 8) * 15
testEvent(id = id, title = "T$id", start = from, end = from + length.minutes, response = response)
}
}
}
private class RowSeating(
val seated: List<Pair<Int, EventInstance>>,
val hiddenEvents: List<EventInstance>,
val hiddenCount: Int,
)
/** MonthWeekRow's bars, pills and overflow dots, as the composable worked them out. */
private fun rowSeating(week: MonthWeek, col: Int, d: LocalDate, laneCap: Int): RowSeating {
val laneCount = (week.spans.maxOfOrNull { it.lane } ?: -1) + 1
val shownLanes = laneCount.coerceAtMost(laneCap)
val bars = week.spans
.filter { it.lane < shownLanes && col in it.startCol..it.endCol }
.map { it.lane to it.event }
val timed = week.timedByDay[d].orEmpty()
val occupied = week.spans
.filter { it.lane < shownLanes && col in it.startCol..it.endCol }
.map { it.lane }
.toSet()
val freeSlots = (0 until laneCap).filter { it !in occupied }
val pillsShown = timed.take(freeSlots.size)
val pills = pillsShown.mapIndexed { i, ev -> freeSlots[i] to ev }
val hidden = (week.countByDay[d] ?: 0) - occupied.size - pillsShown.size
val hiddenEvents = buildList {
week.spans
.filter { it.lane >= shownLanes && col in it.startCol..it.endCol }
.forEach { add(it.event) }
addAll(timed.drop(pillsShown.size))
}
return RowSeating((bars + pills).sortedBy { it.first }, hiddenEvents, hidden)
}
private fun refLaneEvents(week: MonthWeek, col: Int, day: LocalDate, laneCap: Int): List<EventInstance> {
val byLane = arrayOfNulls<EventInstance>(laneCap)
week.spans.forEach { span ->
if (span.lane < laneCap && col in span.startCol..span.endCol) byLane[span.lane] = span.event
}
val free = (0 until laneCap).filter { byLane[it] == null }
week.timedByDay[day].orEmpty().take(free.size).forEachIndexed { i, event -> byLane[free[i]] = event }
return byLane.filterNotNull()
}
private fun refChipAt(week: MonthWeek, col: Int, lane: Int, laneCap: Int): EventInstance? {
if (col !in week.days.indices || lane !in 0 until laneCap) return null
week.spans.firstOrNull { it.lane == lane && col in it.startCol..it.endCol }?.let { return it.event }
val occupied = week.spans
.filter { it.lane < laneCap && col in it.startCol..it.endCol }
.map { it.lane }
.toSet()
val free = (0 until laneCap).filter { it !in occupied }
val index = free.indexOf(lane).takeIf { it >= 0 } ?: return null
return week.timedByDay[week.days[col]].orEmpty().take(free.size).getOrNull(index)
}
private fun refOverflowEvents(week: MonthWeek, col: Int, day: LocalDate, laneCap: Int): List<EventInstance> {
val seatedLanes = week.spans.count { it.lane < laneCap && col in it.startCol..it.endCol }
return buildList {
week.spans.forEach { span ->
if (span.lane >= laneCap && col in span.startCol..span.endCol) add(span.event)
}
addAll(week.timedByDay[day].orEmpty().drop(laneCap - seatedLanes))
}
}
}
@@ -13,13 +13,13 @@ class FocusOnPageTest {
@Test
fun `a page that still shows the focus keeps it`() {
val grid = WeekGrid(DayOfWeek.MONDAY)
val grid = DaysGrid.weeks(DayOfWeek.MONDAY)
assertThat(grid.focusOnPage(wednesday, grid.pageFor(wednesday))).isEqualTo(wednesday)
}
@Test
fun `a week on keeps the weekday`() {
val grid = WeekGrid(DayOfWeek.MONDAY)
val grid = DaysGrid.weeks(DayOfWeek.MONDAY)
val page = grid.pageFor(wednesday)
assertThat(grid.focusOnPage(wednesday, page + 1)).isEqualTo(LocalDate(2026, 10, 7))
assertThat(grid.focusOnPage(wednesday, page - 2)).isEqualTo(LocalDate(2026, 9, 16))
@@ -34,7 +34,7 @@ class FocusOnPageTest {
@Test
fun `a day page is the focus`() {
val page = DayGrid.pageFor(wednesday)
assertThat(DayGrid.focusOnPage(wednesday, page + 5)).isEqualTo(LocalDate(2026, 10, 5))
val page = DaysGrid.days.pageFor(wednesday)
assertThat(DaysGrid.days.focusOnPage(wednesday, page + 5)).isEqualTo(LocalDate(2026, 10, 5))
}
}
@@ -0,0 +1,137 @@
package de.jeanlucmakiola.calendula.ui.week
import com.google.common.truth.Truth.assertThat
import kotlinx.datetime.DateTimeUnit
import kotlinx.datetime.DayOfWeek
import kotlinx.datetime.LocalDate
import kotlinx.datetime.daysUntil
import kotlinx.datetime.minus
import kotlinx.datetime.plus
import org.junit.jupiter.api.Test
/**
* Pins each grid's page numbering to the formulas it shipped with: a pager
* restores its page by number, so a change here moves the user to another date.
*/
class PageNumberingTest {
private val dates: List<LocalDate> = buildList {
var d = LocalDate(1500, 1, 1)
while (d < LocalDate(2500, 1, 1)) {
add(d)
d = d.plus(37, DateTimeUnit.DAY)
}
var e = LocalDate(1999, 12, 1)
while (e < LocalDate(2000, 2, 1)) {
add(e)
e = e.plus(1, DateTimeUnit.DAY)
}
}
private fun pages(count: Int): List<Int> =
listOf(-7, -1, 0, 1, count / 2 - 3, count / 2 - 1, count / 2, count / 2 + 1, count - 2, count - 1, count, count + 5) +
(0 until count step 997)
@Test
fun `week pages keep their numbering for every first day`() {
DayOfWeek.entries.forEach { firstDay ->
val grid = DaysGrid.weeks(firstDay)
assertThat(grid.dayCount).isEqualTo(7)
assertThat(grid.pageCount).isEqualTo(LEGACY_WEEK_COUNT)
pages(LEGACY_WEEK_COUNT).forEach { page ->
assertThat(grid.startForPage(page)).isEqualTo(legacyWeekStart(page, firstDay))
}
dates.forEach { date ->
assertThat(grid.pageFor(date)).isEqualTo(legacyWeekPage(date, firstDay))
}
}
}
@Test
fun `multi-day pages keep their numbering for every count and phase`() {
(1..7).forEach { count ->
(-count..count * 2).forEach { phase ->
val grid = DaysGrid(count, phase)
assertThat(grid.pageCount).isEqualTo(LEGACY_DAYS_COUNT)
pages(LEGACY_DAYS_COUNT).forEach { page ->
assertThat(grid.startForPage(page)).isEqualTo(legacyDaysStart(page, count, phase))
}
dates.forEach { date ->
assertThat(grid.pageFor(date)).isEqualTo(legacyDaysPage(date, count, phase))
}
}
dates.filter { it.year in 1950..2050 }.forEach { date ->
val grid = DaysGrid.startingAt(date, count)
assertThat(grid.startForPage(grid.pageFor(date))).isEqualTo(date)
}
}
}
@Test
fun `day pages keep their numbering`() {
val grid = DaysGrid.days
assertThat(grid.dayCount).isEqualTo(1)
assertThat(grid.pageCount).isEqualTo(LEGACY_DAY_COUNT)
pages(LEGACY_DAY_COUNT).forEach { page ->
assertThat(grid.startForPage(page)).isEqualTo(legacyDayStart(page))
}
dates.forEach { date ->
assertThat(grid.pageFor(date)).isEqualTo(legacyDayPage(date))
}
}
@Test
fun `a multi-day jump re-frames exactly when the date would open mid-page`() {
val inRange = dates.filter { it.year in 1950..2050 }
(3..6).forEach { count ->
val grid = DaysGrid.startingAt(LocalDate(2026, 10, 16), count)
inRange.forEach { target ->
val midPage = grid.startForPage(grid.pageFor(target)) != target
assertThat(DaysGrid.startingAt(target, count) != grid).isEqualTo(midPage)
}
}
}
@Test
fun `grids are equal exactly when they page the same way`() {
assertThat(DaysGrid.weeks(DayOfWeek.MONDAY)).isEqualTo(DaysGrid.weeks(DayOfWeek.MONDAY))
assertThat(DaysGrid.weeks(DayOfWeek.MONDAY)).isNotEqualTo(DaysGrid.weeks(DayOfWeek.SUNDAY))
assertThat(DaysGrid(3, 1)).isEqualTo(DaysGrid(3, 1))
assertThat(DaysGrid(3, 1)).isNotEqualTo(DaysGrid(3, 2))
assertThat(DaysGrid(3, 1)).isNotEqualTo(DaysGrid(4, 1))
assertThat(DaysGrid.days).isEqualTo(DaysGrid.days)
assertThat(DaysGrid.days.hashCode()).isEqualTo(DaysGrid.days.hashCode())
}
private companion object {
const val LEGACY_WEEK_COUNT = 20_000
const val LEGACY_DAYS_COUNT = 40_000
const val LEGACY_DAY_COUNT = 140_000
val WEEK_EPOCH = LocalDate(2000, 1, 3)
val DAYS_EPOCH = LocalDate(2000, 1, 1)
fun LocalDate.weekStart(firstDay: DayOfWeek): LocalDate =
minus(((dayOfWeek.ordinal - firstDay.ordinal) + 7) % 7, DateTimeUnit.DAY)
fun legacyWeekStart(page: Int, firstDay: DayOfWeek): LocalDate =
WEEK_EPOCH.weekStart(firstDay).plus((page - LEGACY_WEEK_COUNT / 2) * 7, DateTimeUnit.DAY)
fun legacyWeekPage(date: LocalDate, firstDay: DayOfWeek): Int {
val days = WEEK_EPOCH.weekStart(firstDay).daysUntil(date.weekStart(firstDay))
return (LEGACY_WEEK_COUNT / 2 + days / 7).coerceIn(0, LEGACY_WEEK_COUNT - 1)
}
fun legacyDaysStart(page: Int, count: Int, phase: Int): LocalDate =
DAYS_EPOCH.plus(phase + (page - LEGACY_DAYS_COUNT / 2) * count, DateTimeUnit.DAY)
fun legacyDaysPage(date: LocalDate, count: Int, phase: Int): Int =
(LEGACY_DAYS_COUNT / 2 + Math.floorDiv(DAYS_EPOCH.daysUntil(date) - phase, count))
.coerceIn(0, LEGACY_DAYS_COUNT - 1)
fun legacyDayStart(page: Int): LocalDate =
DAYS_EPOCH.plus(page - LEGACY_DAY_COUNT / 2, DateTimeUnit.DAY)
fun legacyDayPage(date: LocalDate): Int =
(LEGACY_DAY_COUNT / 2 + DAYS_EPOCH.daysUntil(date)).coerceIn(0, LEGACY_DAY_COUNT - 1)
}
}
@@ -16,34 +16,34 @@ class WeekPagingTest {
@Test
fun `a page and its week round-trip for every first day`() {
DayOfWeek.entries.forEach { firstDay ->
val page = weekPageFor(sunday, firstDay)
val start = weekStartForPage(page, firstDay)
val page = DaysGrid.weeks(firstDay).pageFor(sunday)
val start = DaysGrid.weeks(firstDay).startForPage(page)
assertThat(start).isEqualTo(sunday.startOfWeek(firstDay))
assertThat(weekPageFor(start, firstDay)).isEqualTo(page)
assertThat(DaysGrid.weeks(firstDay).pageFor(start)).isEqualTo(page)
}
}
@Test
fun `every day of a week maps to the same page`() {
val start = sunday.startOfWeek(DayOfWeek.MONDAY)
val pages = (0..6).map { weekPageFor(start.plus(it, DateTimeUnit.DAY), DayOfWeek.MONDAY) }
val pages = (0..6).map { DaysGrid.weeks(DayOfWeek.MONDAY).pageFor(start.plus(it, DateTimeUnit.DAY)) }
assertThat(pages.toSet()).hasSize(1)
}
@Test
fun `adjacent pages are adjacent weeks`() {
val page = weekPageFor(sunday, DayOfWeek.SUNDAY)
assertThat(weekStartForPage(page + 1, DayOfWeek.SUNDAY))
val page = DaysGrid.weeks(DayOfWeek.SUNDAY).pageFor(sunday)
assertThat(DaysGrid.weeks(DayOfWeek.SUNDAY).startForPage(page + 1))
.isEqualTo(LocalDate(2026, 10, 4))
assertThat(weekStartForPage(page - 1, DayOfWeek.SUNDAY))
assertThat(DaysGrid.weeks(DayOfWeek.SUNDAY).startForPage(page - 1))
.isEqualTo(LocalDate(2026, 9, 20))
}
@Test
fun `dates before the epoch page resolve too`() {
val old = LocalDate(1990, 5, 16)
val page = weekPageFor(old, DayOfWeek.MONDAY)
assertThat(weekStartForPage(page, DayOfWeek.MONDAY)).isEqualTo(LocalDate(1990, 5, 14))
val page = DaysGrid.weeks(DayOfWeek.MONDAY).pageFor(old)
assertThat(DaysGrid.weeks(DayOfWeek.MONDAY).startForPage(page)).isEqualTo(LocalDate(1990, 5, 14))
}
@Test
@@ -69,14 +69,14 @@ class WeekPagingTest {
@Test
fun `a day page and its day round-trip`() {
listOf(LocalDate(2026, 9, 27), LocalDate(1990, 5, 16), LocalDate(2100, 2, 28)).forEach { day ->
assertThat(DayGrid.startForPage(DayGrid.pageFor(day))).isEqualTo(day)
assertThat(DaysGrid.days.startForPage(DaysGrid.days.pageFor(day))).isEqualTo(day)
}
}
@Test
fun `adjacent day pages are adjacent days across a month end`() {
val page = DayGrid.pageFor(LocalDate(2026, 2, 28))
assertThat(DayGrid.startForPage(page + 1)).isEqualTo(LocalDate(2026, 3, 1))
assertThat(DayGrid.startForPage(page - 1)).isEqualTo(LocalDate(2026, 2, 27))
val page = DaysGrid.days.pageFor(LocalDate(2026, 2, 28))
assertThat(DaysGrid.days.startForPage(page + 1)).isEqualTo(LocalDate(2026, 3, 1))
assertThat(DaysGrid.days.startForPage(page - 1)).isEqualTo(LocalDate(2026, 2, 27))
}
}
@@ -0,0 +1,11 @@
جديد
• اضغط مطولًا على موعد لتحديده أو نقله أو تغيير مدته، أو على فترة فارغة لإنشاء مسودة موعد جديد.
• انقر على رقم هاتف في الموعد للاتصال به.
• تظهر أوصاف HTML من Outlook وGoogle كنص منسق.
• مرّر للخلف إلى الأيام السابقة في قائمة المواعيد.
• أنشئ مواعيد من نص تمت مشاركته أو تحديده.
• سمة سوداء لشاشات AMOLED.
إصلاحات
• تظهر المواعيد في أيام التوقيت الصيفي في وقتها الصحيح.
• نقل موعد متكرر يحتفظ بالتكرارات المحذوفة والمعدّلة.
@@ -0,0 +1,11 @@
Новае
• Доўгае націсканне вылучае падзею для перамяшчэння ці змены даўжыні, а на пустым слоце стварае новую.
• Націсніце на нумар тэлефона, каб патэлефанаваць.
• HTML-апісанні паказваюцца адфарматаванымі.
• Пракручвайце спіс падзей да ранейшых дзён.
• Стварайце падзеі з тэксту, якім падзяліліся або які вылучылі.
• Чорная тэма для экранаў AMOLED.
Выпраўлена
• Падзеі ў дні пераводу гадзінніка паказваюцца ў правільны час.
• Перамяшчэнне паўторнай падзеі захоўвае выдаленыя і змененыя паўторы.
@@ -0,0 +1,11 @@
Novinky
• Dlouhým stiskem událost vyberete, přesunete nebo změníte její délku, na volném místě navrhnete novou.
• Klepnutím na telefonní číslo v události zavoláte.
• Popisy v HTML se zobrazují formátovaně.
• V přehledu událostí se lze posunout zpět k dřívějším dnům.
• Události z textu, který sdílíte nebo označíte.
• Černý motiv pro displeje AMOLED.
Opraveno
• Události ve dnech změny času se zobrazují ve správný čas.
• Přesun opakované události zachová smazané a upravené výskyty.
@@ -0,0 +1,11 @@
Neu
• Lange auf einen Termin drücken: auswählen, verschieben, Dauer ändern. Auf freier Stelle: neuen Termin entwerfen.
• Telefonnummern antippen, um anzurufen.
• HTML-Beschreibungen erscheinen formatiert.
• In der Terminliste zu früheren Tagen zurückscrollen.
• Termine aus geteiltem oder markiertem Text erstellen.
• Schwarzes Design für AMOLED-Displays.
Behoben
• Termine am Tag der Zeitumstellung stehen zur richtigen Uhrzeit.
• Verschobene Serien behalten gelöschte und bearbeitete Termine.
@@ -0,0 +1,11 @@
New
• Long press an event to select, move or resize it, or an empty slot to draft a new one.
• Tap a phone number in an event to call it.
• HTML descriptions from Outlook and Google show as formatted text.
• Scroll back to earlier days in the agenda.
• Create events from shared or selected text.
• Black theme for AMOLED screens.
Fixed
• Events on daylight saving days show at their real time.
• Moving a recurring event keeps its deleted and edited occurrences.
@@ -0,0 +1,11 @@
Novedades
• Mantén pulsado un evento para seleccionarlo, moverlo o cambiar su duración, o un hueco libre para crear uno.
• Toca un número de teléfono para llamar.
• Las descripciones HTML se muestran con formato.
• Desplázate hacia días anteriores en la agenda.
• Crea eventos a partir de texto compartido o seleccionado.
• Tema negro para pantallas AMOLED.
Corregido
• Los eventos en días de cambio de hora aparecen a su hora real.
• Mover una serie conserva las repeticiones borradas y editadas.
@@ -0,0 +1,11 @@
Nouveautés
• Appui long sur un événement pour le sélectionner, déplacer ou redimensionner, ou sur un créneau libre pour en créer un.
• Touchez un numéro de téléphone pour appeler.
• Les descriptions HTML s’affichent mises en forme.
• Remontez aux jours passés dans l’agenda.
• Créez un événement depuis un texte partagé.
• Thème noir pour écrans AMOLED.
Corrigé
• Événements à la bonne heure les jours de changement d’heure.
• Une série déplacée garde ses occurrences supprimées ou modifiées.
@@ -0,0 +1,11 @@
Új
• Hosszan nyomva egy eseményt kijelölhetsz, áthelyezhetsz vagy átméretezhetsz, üres helyen újat vázolhatsz.
• Koppints egy telefonszámra a híváshoz.
• A HTML-leírások formázva jelennek meg.
• A napirendben visszagörgethetsz a korábbi napokra.
• Esemény létrehozása megosztott vagy kijelölt szövegből.
• Fekete téma AMOLED kijelzőkhöz.
Javítva
• Óraátállítás napján az események a valós idejükben látszanak.
• Áthelyezett ismétlődő esemény megtartja a törölt és szerkesztett alkalmakat.
@@ -0,0 +1,11 @@
Novità
• Tieni premuto un evento per selezionarlo, spostarlo o ridimensionarlo, o uno spazio libero per crearne uno.
• Tocca un numero di telefono per chiamarlo.
• Le descrizioni HTML appaiono formattate.
• Scorri indietro ai giorni precedenti nell’agenda.
• Crea eventi da testo condiviso o selezionato.
• Tema nero per schermi AMOLED.
Corretto
• Gli eventi nei giorni del cambio d’ora appaiono all’orario corretto.
• Un evento ricorrente spostato mantiene le occorrenze eliminate e modificate.
@@ -0,0 +1,11 @@
新機能
• 予定を長押しして選択・移動・長さの変更、空き時間を長押しして新しい予定の下書きができます。
• 予定内の電話番号をタップして発信できます。
• Outlook や Google の HTML 説明が書式付きで表示されます。
• 予定リストで過去の日にさかのぼってスクロールできます。
• 共有・選択したテキストから予定を作成できます。
• AMOLED 画面向けのブラックテーマ。
修正
• 夏時間の切り替え日の予定が正しい時刻に表示されます。
• 繰り返し予定を移動しても、削除・編集した回が保持されます。
@@ -0,0 +1,11 @@
Nieuw
• Houd een afspraak ingedrukt om hem te selecteren, verplaatsen of de duur te wijzigen, of een leeg vak voor een nieuwe.
• Tik op een telefoonnummer om te bellen.
• HTML-beschrijvingen worden opgemaakt getoond.
• Scroll in de agenda terug naar eerdere dagen.
• Maak afspraken van gedeelde of geselecteerde tekst.
• Zwart thema voor AMOLED-schermen.
Opgelost
• Afspraken op dagen met tijdwijziging staan op de juiste tijd.
• Een verplaatste reeks behoudt verwijderde en bewerkte afspraken.
@@ -0,0 +1,11 @@
Nowości
• Przytrzymaj wydarzenie, aby je zaznaczyć, przenieść lub zmienić długość, albo wolne miejsce, by dodać nowe.
• Dotknij numeru telefonu, aby zadzwonić.
• Opisy HTML wyświetlają się sformatowane.
• Przewijaj agendę wstecz do wcześniejszych dni.
• Twórz wydarzenia z udostępnionego lub zaznaczonego tekstu.
• Czarny motyw dla ekranów AMOLED.
Poprawki
• Wydarzenia w dni zmiany czasu są pokazywane o właściwej godzinie.
• Przeniesiona seria zachowuje usunięte i edytowane wystąpienia.
@@ -0,0 +1,11 @@
Novidades
• Toque e segure um evento para selecionar, mover ou mudar a duração, ou um horário livre para criar um rascunho.
• Toque em um número de telefone para ligar.
• Descrições HTML aparecem formatadas.
• Role a agenda de volta para dias anteriores.
• Crie eventos a partir de texto compartilhado ou selecionado.
• Tema preto para telas AMOLED.
Corrigido
• Eventos em dias de mudança de horário aparecem na hora certa.
• Mover um evento recorrente mantém as ocorrências excluídas e editadas.
@@ -0,0 +1,11 @@
Novidades
• Mantenha premido um evento para selecionar, mover ou alterar a duração, ou um espaço livre para esboçar um novo.
• Toque num número de telefone para ligar.
• Descrições HTML aparecem formatadas.
• Deslize a agenda para trás até dias anteriores.
• Crie eventos a partir de texto partilhado ou selecionado.
• Tema preto para ecrãs AMOLED.
Corrigido
• Eventos em dias de mudança de hora aparecem à hora certa.
• Mover um evento recorrente mantém as ocorrências eliminadas e editadas.
@@ -0,0 +1,11 @@
Новое
• Долгое нажатие выделяет событие для перемещения или смены длительности, а на пустом слоте создаёт новое.
• Нажмите на номер телефона, чтобы позвонить.
• HTML-описания показываются с форматированием.
• Прокручивайте список событий назад к прошлым дням.
• Создавайте события из общего или выделенного текста.
• Чёрная тема для экранов AMOLED.
Исправлено
• События в дни перевода часов показываются в правильное время.
• Перемещённая серия сохраняет удалённые и изменённые повторы.
@@ -0,0 +1,11 @@
Novinky
• Dlhým stlačením udalosť vyberiete, presuniete alebo zmeníte jej dĺžku, na voľnom mieste navrhnete novú.
• Ťuknutím na telefónne číslo v udalosti zavoláte.
• Popisy v HTML sa zobrazujú formátovane.
• V prehľade udalostí sa dá posunúť späť k skorším dňom.
• Udalosti z textu, ktorý zdieľate alebo označíte.
• Čierny motív pre displeje AMOLED.
Opravené
• Udalosti v dňoch zmeny času sa zobrazujú v správny čas.
• Presun opakovanej udalosti zachová vymazané a upravené výskyty.
@@ -0,0 +1,11 @@
新增
• 长按日程可选中、移动或调整时长,长按空白时段可起草新日程。
• 点按日程中的电话号码即可拨打。
• 来自 Outlook 和 Google 的 HTML 描述以格式化文本显示。
• 在日程列表中向前滚动查看过去的日子。
• 从分享或选中的文本创建日程。
• 适用于 AMOLED 屏幕的纯黑主题。
修复
• 夏令时切换当天的日程显示在正确时间。
• 移动重复日程时保留已删除和已编辑的单次日程。