Initial public release 1.0.0
Android / build (push) Canceled after 0s

This commit is contained in:
Oshicue committed 2026-11-14 11:47:44 +08:00
commit 8b89b80019
56 files changed
+5876

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
import java.util.Properties
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.kotlin.plugin.serialization")
}
// Release signing lives in an untracked keystore.properties, so the keystore and its
// passwords never reach version control. Without the file the release APK is built unsigned.
val keystoreProperties = Properties().apply {
val file = rootProject.file("keystore.properties")
if (file.exists()) file.inputStream().use { load(it) }
}
android {
namespace = "com.oshicue.lineup"
compileSdk = 37
defaultConfig {
applicationId = "com.oshicue.lineup"
minSdk = 26
targetSdk = 37
versionCode = 1
versionName = "1.0.0"
}
signingConfigs {
if (keystoreProperties.isNotEmpty()) {
create("release") {
storeFile = rootProject.file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
}
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
if (keystoreProperties.isNotEmpty()) signingConfig = signingConfigs.getByName("release")
}
}
buildFeatures {
compose = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
testOptions {
unitTests.isReturnDefaultValues = true
}
}
dependencies {
implementation(platform("androidx.compose:compose-bom:2026.09.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material-icons-extended")
implementation("androidx.activity:activity-compose:1.13.0")
implementation("androidx.core:core-ktx:1.19.1")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.9.4")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.9.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
testImplementation("junit:junit:4.13.2")
debugImplementation("androidx.compose.ui:ui-tooling")
}
+3
View File
@@ -0,0 +1,3 @@
# kotlinx.serialization ships its own keep rules. Compose and the bundled font need none.
# Keep JSON field names readable in crash reports for the model classes.
-keepclassmembers class com.oshicue.** { *** Companion; }
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.OshicueLineup">
<activity
android:name=".MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.OshicueLineup">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
@@ -0,0 +1,97 @@
// Oshicue Lineup — en
"schedule.title" = "Timetable";
"schedule.mine" = "My Timetable";
"schedule.allKinds" = "LIVE + Goods";
"schedule.events" = "Events";
"schedule.allEvents" = "All events";
"schedule.selectEvents" = "Select events";
"schedule.deleteEvent" = "Delete timetable";
"schedule.deleteEventTitle" = "Delete this timetable?";
"schedule.deleteEventMessage" = "%@ and all its sessions will be removed from Timetable.";
"schedule.now" = "Now";
"schedule.jumpNow" = "Jump to now";
"schedule.favoriteHint" = "Tap for details; double-tap to add to or remove from My Timetable.";
"schedule.noEvents" = "No timetables yet";
"schedule.noEventsHint" = "Close this page to import a timetable.";
"schedule.timeZone" = "Time zone";
"schedule.sessionDetails" = "Session details";
"schedule.notes" = "Notes";
"schedule.venue" = "Venue";
"schedule.event" = "Event";
"import.title" = "Import timetable";
"import.paste" = "Paste text";
"import.file" = "Choose file";
"import.placeholder" = "Paste your timetable JSON here…";
"import.validate" = "Validate";
"import.preview" = "Import preview";
"import.apply" = "Import";
"import.summary" = "%d events · %d sessions";
"import.empty" = "The timetable contains no events or sessions.";
"settings.title" = "Settings";
"settings.language" = "Language";
"settings.followSystem" = "Follow system";
"settings.about" = "About";
"settings.version" = "Version";
"settings.demoLabel" = "Demo timetable";
"settings.demoHint" = "Sample events help you explore the app. All demo dates are adjusted to today.";
"settings.loadDemo" = "Load demo";
"common.done" = "Done";
"common.cancel" = "Cancel";
"common.close" = "Close";
"common.selected" = "Selected";
"common.selectAll" = "Select all";
"common.deselectAll" = "Deselect all";
"settings.readError" = "Unable to read saved data.";
"settings.saveError" = "Unable to save changes.";
"settings.storageError" = "There was a problem with saved data.";
"schedule.conflictsCount" = "%d overlaps";
"schedule.zoom" = "Zoom";
"import.readError" = "Unable to read the file. Choose a UTF-8 JSON file.";
"import.timeZonesHint" = "Each event uses its own local time zone. Times are displayed in the selected event time zone.";
"settings.data" = "Data management";
"settings.scheduleImport" = "Import timetable";
"settings.localData" = "Your data is stored on this device. Export a backup whenever you need.";
"schedule.search.prompt" = "Search groups, venues, areas or notes";
"schedule.search.empty" = "No sessions match your search";
"schedule.search.emptyHint" = "Nothing matches on this day in the selected events. Try another word or day.";
"schedule.export" = "Export timetable JSON";
"schedule.exportHint" = "Exports every event and session for reimporting later or on another device. My timetable selections stay on this device.";
"common.clearSearch" = "Clear search";
"settings.export" = "Export timetable";
"settings.lineupAbout" = "Oshicue Lineup · Your live event timetable.";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "Timetable";
"schedule.live" = "LIVE";
"schedule.goods" = "Goods";
"schedule.favoriteAdded" = "Added to My Timetable";
"schedule.favoriteRemoved" = "Removed from My Timetable";
"schedule.empty" = "No sessions on this date";
"schedule.emptyHint" = "Choose another date or import a timetable.";
"schedule.noFavorites" = "Your timetable starts here";
"schedule.noFavoritesHint" = "Double-tap a session in the full timetable to add it here. Select LIVE and merchandise sessions separately.";
"schedule.favorite" = "Add to My Timetable";
"schedule.unfavorite" = "Remove from My Timetable";
"import.copyTemplate" = "Copy template";
"import.copied" = "Copied";
"import.updateHint" = "When importing updates, selections with the same event ID and session ID will be kept.";
"import.replacesDemo" = "Your first import will replace the demo timetable.";
"import.error.invalidJSON" = "The text is not valid JSON. Check commas, quotation marks, and brackets.";
"import.error.timestamp" = "Use an ISO 8601 date and time with seconds and a time zone offset, such as 2026-10-14T14:30:00+09:00.";
"import.error.missingField" = "A required field is missing. Add the field shown below.";
"import.error.fieldType" = "A field has the wrong type or contains null. Check the field shown below against the template.";
"import.error.schemaVersion" = "This format version is not supported. Set schemaVersion to 1.";
"import.error.timeZone" = "Use a valid IANA time zone, such as Asia/Tokyo.";
"import.error.color" = "Use a six-digit color in #RRGGBB format, such as #7AC9EC.";
"import.error.artistReference" = "This artistID is not listed in the event's artists. Add the artist or correct the ID.";
"import.error.venueReference" = "This venueID is not listed in the event's venues. Add the venue or correct the ID.";
"import.error.duration" = "The end time must be later than the start time.";
"import.error.emptyField" = "This field must not be empty.";
"import.error.duplicateID" = "An ID is duplicated. Each event, venue, artist, or session must have a unique ID in its list.";
"import.error.documentSize" = "The timetable file must not exceed 20 MB.";
"schedule.search" = "Search sessions";
"schedule.search.close" = "Close search";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — id
"schedule.title" = "Jadwal";
"schedule.mine" = "Jadwal saya";
"schedule.allKinds" = "LIVE + Merchandise";
"schedule.events" = "Acara";
"schedule.allEvents" = "Semua acara";
"schedule.selectEvents" = "Pilih acara";
"schedule.deleteEvent" = "Hapus jadwal";
"schedule.deleteEventTitle" = "Hapus jadwal ini?";
"schedule.deleteEventMessage" = "%@ dan semua sesinya akan dihapus dari Jadwal.";
"schedule.now" = "Sekarang";
"schedule.jumpNow" = "Ke waktu sekarang";
"schedule.favoriteHint" = "Ketuk untuk detail; ketuk dua kali untuk menambah atau menghapus dari Jadwal Saya.";
"schedule.noEvents" = "Belum ada jadwal";
"schedule.noEventsHint" = "Tutup halaman ini untuk mengimpor jadwal.";
"schedule.timeZone" = "Zona waktu";
"schedule.sessionDetails" = "Detail jadwal";
"schedule.notes" = "Catatan";
"schedule.venue" = "Tempat";
"schedule.event" = "Acara";
"import.title" = "Impor jadwal";
"import.paste" = "Tempel teks";
"import.file" = "Pilih file";
"import.placeholder" = "Tempel JSON jadwal Anda di sini…";
"import.validate" = "Periksa format";
"import.preview" = "Pratinjau impor";
"import.apply" = "Impor";
"import.summary" = "%d acara · %d jadwal";
"import.empty" = "Jadwal tidak berisi acara atau sesi.";
"settings.title" = "Pengaturan";
"settings.language" = "Bahasa";
"settings.followSystem" = "Ikuti sistem";
"settings.about" = "Tentang";
"settings.version" = "Versi";
"settings.demoLabel" = "Jadwal demo";
"settings.demoHint" = "Jelajahi aplikasi dengan acara contoh. Semua tanggal demo disesuaikan ke hari ini.";
"settings.loadDemo" = "Muat demo";
"common.done" = "Selesai";
"common.cancel" = "Batal";
"common.close" = "Tutup";
"common.selected" = "Dipilih";
"common.selectAll" = "Pilih semua";
"common.deselectAll" = "Batalkan semua pilihan";
"settings.readError" = "Tidak dapat membaca data tersimpan.";
"settings.saveError" = "Tidak dapat menyimpan perubahan.";
"settings.storageError" = "Terjadi masalah pada data tersimpan.";
"schedule.conflictsCount" = "%d jadwal bertumpang tindih";
"schedule.zoom" = "Zoom";
"import.readError" = "Tidak dapat membaca file. Pilih file JSON berformat UTF-8.";
"import.timeZonesHint" = "Setiap acara menggunakan zona waktu setempat. Waktu ditampilkan dalam zona waktu acara yang dipilih.";
"settings.data" = "Pengelolaan data";
"settings.scheduleImport" = "Impor jadwal";
"settings.localData" = "Data disimpan di perangkat ini. Ekspor cadangan kapan pun diperlukan.";
"schedule.search.prompt" = "Cari grup, venue, area atau catatan";
"schedule.search.empty" = "Tidak ada sesi yang cocok";
"schedule.search.emptyHint" = "Tidak ada yang cocok pada hari ini di acara terpilih. Coba kata atau hari lain.";
"schedule.export" = "Ekspor JSON jadwal";
"schedule.exportHint" = "Mengekspor semua acara dan sesi untuk diimpor lagi nanti atau di perangkat lain. Pilihan Jadwal saya tetap di perangkat ini.";
"common.clearSearch" = "Hapus pencarian";
"settings.export" = "Ekspor jadwal";
"settings.lineupAbout" = "Oshicue Lineup · Jadwal acara live Anda.";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "Semua jadwal";
"schedule.live" = "LIVE";
"schedule.goods" = "Penjualan merchandise";
"schedule.favoriteAdded" = "Ditambahkan ke jadwal saya";
"schedule.favoriteRemoved" = "Dihapus dari jadwal saya";
"schedule.empty" = "Belum ada jadwal pada tanggal ini";
"schedule.emptyHint" = "Pilih tanggal lain atau impor jadwal.";
"schedule.noFavorites" = "Mulai susun jadwal Anda";
"schedule.noFavoritesHint" = "Ketuk sesi dua kali di jadwal lengkap untuk menambahkannya di sini. Pilih sesi LIVE dan merchandise secara terpisah.";
"schedule.favorite" = "Tambahkan ke jadwal saya";
"schedule.unfavorite" = "Hapus dari jadwal saya";
"import.copyTemplate" = "Salin templat";
"import.copied" = "Disalin";
"import.updateHint" = "Saat mengimpor pembaruan, pilihan dengan ID acara dan ID sesi yang sama tetap tersimpan.";
"import.replacesDemo" = "Impor pertama akan menggantikan jadwal demo.";
"import.error.invalidJSON" = "Teks bukan JSON yang valid. Periksa koma, tanda kutip, dan tanda kurung.";
"import.error.timestamp" = "Gunakan tanggal dan waktu ISO 8601 dengan detik dan offset zona waktu, seperti 2026-10-14T14:30:00+09:00.";
"import.error.missingField" = "Kolom wajib belum diisi. Tambahkan kolom yang ditunjukkan di bawah.";
"import.error.fieldType" = "Tipe kolom salah atau berisi null. Bandingkan kolom di bawah dengan templat.";
"import.error.schemaVersion" = "Versi format ini tidak didukung. Atur schemaVersion ke 1.";
"import.error.timeZone" = "Gunakan zona waktu IANA yang valid, seperti Asia/Tokyo.";
"import.error.color" = "Gunakan warna enam digit dalam format #RRGGBB, seperti #7AC9EC.";
"import.error.artistReference" = "artistID ini tidak tercantum dalam artists acara. Tambahkan artis atau perbaiki ID.";
"import.error.venueReference" = "venueID ini tidak tercantum dalam venues acara. Tambahkan tempat atau perbaiki ID.";
"import.error.duration" = "Waktu selesai harus setelah waktu mulai.";
"import.error.emptyField" = "Kolom ini tidak boleh kosong.";
"import.error.duplicateID" = "Ada ID duplikat. Setiap acara, tempat, artis, atau sesi harus memiliki ID unik dalam daftarnya.";
"import.error.documentSize" = "File jadwal tidak boleh melebihi 20 MB.";
"schedule.search" = "Cari sesi";
"schedule.search.close" = "Tutup pencarian";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — ja
"schedule.title" = "タイムテーブル";
"schedule.mine" = "マイタイムテーブル";
"schedule.allKinds" = "LIVE + 物販";
"schedule.events" = "イベント";
"schedule.allEvents" = "すべてのイベント";
"schedule.selectEvents" = "イベントを選択";
"schedule.deleteEvent" = "タイムテーブルを削除";
"schedule.deleteEventTitle" = "このタイムテーブルを削除しますか?";
"schedule.deleteEventMessage" = "%@ とそのすべての予定をタイムテーブルから削除します。";
"schedule.now" = "現在";
"schedule.jumpNow" = "現在時刻へ";
"schedule.favoriteHint" = "タップで詳細、ダブルタップでマイタイムテーブルに追加・解除。";
"schedule.noEvents" = "タイムテーブルはありません";
"schedule.noEventsHint" = "この画面を閉じてタイムテーブルを読み込めます。";
"schedule.timeZone" = "タイムゾーン";
"schedule.sessionDetails" = "予定の詳細";
"schedule.notes" = "メモ";
"schedule.venue" = "会場";
"schedule.event" = "イベント";
"import.title" = "タイムテーブルを読み込む";
"import.paste" = "テキストを貼り付け";
"import.file" = "ファイルを選択";
"import.placeholder" = "タイムテーブルの JSON をここに貼り付け…";
"import.validate" = "形式を確認";
"import.preview" = "読み込みプレビュー";
"import.apply" = "読み込む";
"import.summary" = "%d イベント · %d 件の予定";
"import.empty" = "タイムテーブルにイベントまたは予定がありません。";
"settings.title" = "設定";
"settings.language" = "言語";
"settings.followSystem" = "システム設定に従う";
"settings.about" = "このアプリについて";
"settings.version" = "バージョン";
"settings.demoLabel" = "デモタイムテーブル";
"settings.demoHint" = "サンプルイベントで機能を試せます。デモの日付は今日に合わせて設定されます。";
"settings.loadDemo" = "デモを読み込む";
"common.done" = "完了";
"common.cancel" = "キャンセル";
"common.close" = "閉じる";
"common.selected" = "選択済み";
"common.selectAll" = "すべて選択";
"common.deselectAll" = "すべて解除";
"settings.readError" = "保存したデータを読み込めませんでした。";
"settings.saveError" = "変更を保存できませんでした。";
"settings.storageError" = "保存データに問題が発生しました。";
"schedule.conflictsCount" = "時間の重複 %d 件";
"schedule.zoom" = "拡大・縮小";
"import.readError" = "ファイルを読み込めません。UTF-8 の JSON ファイルを選んでください。";
"import.timeZonesHint" = "各イベントは現地のタイムゾーンを使用します。時刻は選択中のイベントのタイムゾーンで表示されます。";
"settings.data" = "データ管理";
"settings.scheduleImport" = "タイムテーブルを読み込む";
"settings.localData" = "データはこの端末に保存されます。いつでも書き出してバックアップできます。";
"schedule.search.prompt" = "グループ・会場・エリア・メモを検索";
"schedule.search.empty" = "検索に一致する出演はありません";
"schedule.search.emptyHint" = "この日と選択中のイベントに一致する出演はありません。別の語句や日付をお試しください。";
"schedule.export" = "タイムテーブルの JSON を書き出す";
"schedule.exportHint" = "すべてのイベントと出演を書き出し、あとで、または別の端末で読み込めます。「マイタイムテーブル」の選択はこの端末にのみ保存されます。";
"common.clearSearch" = "検索をクリア";
"settings.export" = "タイムテーブルを書き出す";
"settings.lineupAbout" = "Oshicue Lineup · ライブイベントのタイムテーブル。";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "全体";
"schedule.live" = "LIVE";
"schedule.goods" = "物販";
"schedule.favoriteAdded" = "マイタイムテーブルに追加しました";
"schedule.favoriteRemoved" = "マイタイムテーブルから削除しました";
"schedule.empty" = "この日の予定はありません";
"schedule.emptyHint" = "別の日付を選ぶか、タイムテーブルを読み込んでください。";
"schedule.noFavorites" = "自分だけのタイムテーブルを作ろう";
"schedule.noFavoritesHint" = "全体のタイムテーブルで枠をダブルタップすると、ここに追加されます。LIVE と物販は個別に選べます。";
"schedule.favorite" = "マイタイムテーブルに追加";
"schedule.unfavorite" = "マイタイムテーブルから削除";
"import.copyTemplate" = "テンプレートをコピー";
"import.copied" = "コピーしました";
"import.updateHint" = "更新の読み込み時は、イベント ID と枠 ID が同じ予定の選択を引き継ぎます。";
"import.replacesDemo" = "初回の読み込みでデモタイムテーブルが置き換わります。";
"import.error.invalidJSON" = "有効な JSON ではありません。カンマ、引用符、括弧を確認してください。";
"import.error.timestamp" = "秒とタイムゾーンのオフセットを含む ISO 8601 日時を使用してください。例:2026-10-14T14:30:00+09:00。";
"import.error.missingField" = "必須項目が不足しています。下に示された項目を追加してください。";
"import.error.fieldType" = "項目の型が違うか、null が含まれています。下に示された項目をテンプレートと照合してください。";
"import.error.schemaVersion" = "この形式のバージョンには対応していません。schemaVersion を 1 にしてください。";
"import.error.timeZone" = "有効な IANA タイムゾーンを使用してください。例:Asia/Tokyo。";
"import.error.color" = "#RRGGBB 形式の 6 桁の色コードを使用してください。例:#7AC9EC。";
"import.error.artistReference" = "この artistID はイベントの artists に登録されていません。出演者を追加するか ID を修正してください。";
"import.error.venueReference" = "この venueID はイベントの venues に登録されていません。会場を追加するか ID を修正してください。";
"import.error.duration" = "終了時刻は開始時刻より後にしてください。";
"import.error.emptyField" = "この項目は空欄にできません。";
"import.error.duplicateID" = "ID が重複しています。同じ一覧内のイベント、会場、出演者、予定にはそれぞれ異なる ID を設定してください。";
"import.error.documentSize" = "タイムテーブルのファイルは 20 MB 以下にしてください。";
"schedule.search" = "出演を検索";
"schedule.search.close" = "検索を閉じる";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — ko
"schedule.title" = "시간표";
"schedule.mine" = "내 시간표";
"schedule.allKinds" = "LIVE + 물판";
"schedule.events" = "이벤트";
"schedule.allEvents" = "모든 이벤트";
"schedule.selectEvents" = "이벤트 선택";
"schedule.deleteEvent" = "시간표 삭제";
"schedule.deleteEventTitle" = "이 시간표를 삭제할까요?";
"schedule.deleteEventMessage" = "%@ 및 모든 일정이 시간표에서 삭제돼요.";
"schedule.now" = "현재";
"schedule.jumpNow" = "현재 시간으로 이동";
"schedule.favoriteHint" = "탭하면 상세 정보, 두 번 탭하면 내 시간표에 추가하거나 제거해요.";
"schedule.noEvents" = "시간표가 없어요";
"schedule.noEventsHint" = "이 화면을 닫고 시간표를 가져올 수 있어요.";
"schedule.timeZone" = "시간대";
"schedule.sessionDetails" = "일정 상세";
"schedule.notes" = "메모";
"schedule.venue" = "장소";
"schedule.event" = "이벤트";
"import.title" = "시간표 가져오기";
"import.paste" = "텍스트 붙여넣기";
"import.file" = "파일 선택";
"import.placeholder" = "시간표 JSON을 여기에 붙여넣으세요…";
"import.validate" = "형식 확인";
"import.preview" = "가져오기 미리보기";
"import.apply" = "가져오기";
"import.summary" = "이벤트 %d개 · 일정 %d개";
"import.empty" = "시간표에 이벤트나 일정이 없어요.";
"settings.title" = "설정";
"settings.language" = "언어";
"settings.followSystem" = "시스템 설정 따르기";
"settings.about" = "앱 정보";
"settings.version" = "버전";
"settings.demoLabel" = "데모 시간표";
"settings.demoHint" = "샘플 이벤트로 앱을 체험할 수 있어요. 데모 날짜는 오늘로 맞춰져요.";
"settings.loadDemo" = "데모 불러오기";
"common.done" = "완료";
"common.cancel" = "취소";
"common.close" = "닫기";
"common.selected" = "선택됨";
"common.selectAll" = "모두 선택";
"common.deselectAll" = "모두 선택 해제";
"settings.readError" = "저장된 데이터를 읽을 수 없어요.";
"settings.saveError" = "변경 사항을 저장할 수 없어요.";
"settings.storageError" = "저장된 데이터에 문제가 발생했어요.";
"schedule.conflictsCount" = "겹치는 일정 %d개";
"schedule.zoom" = "확대/축소";
"import.readError" = "파일을 읽을 수 없어요. UTF-8 JSON 파일을 선택하세요.";
"import.timeZonesHint" = "각 이벤트는 현지 시간대를 사용해요. 시간은 선택한 이벤트의 시간대로 표시돼요.";
"settings.data" = "데이터 관리";
"settings.scheduleImport" = "시간표 가져오기";
"settings.localData" = "데이터는 이 기기에 저장돼요. 필요할 때 언제든 백업을 내보낼 수 있어요.";
"schedule.search.prompt" = "그룹, 공연장, 구역 또는 메모 검색";
"schedule.search.empty" = "검색과 일치하는 공연이 없어요";
"schedule.search.emptyHint" = "이 날짜와 선택한 행사에서 일치하는 결과가 없어요. 다른 단어나 날짜를 시도해 보세요.";
"schedule.export" = "시간표 JSON 내보내기";
"schedule.exportHint" = "모든 행사와 공연을 내보내 나중에 또는 다른 기기에서 다시 가져올 수 있어요. 내 시간표 선택은 이 기기에만 저장돼요.";
"common.clearSearch" = "검색 지우기";
"settings.export" = "시간표 내보내기";
"settings.lineupAbout" = "Oshicue Lineup · 라이브 이벤트 시간표.";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "전체 일정";
"schedule.live" = "LIVE 공연";
"schedule.goods" = "물판";
"schedule.favoriteAdded" = "내 시간표에 추가했어요";
"schedule.favoriteRemoved" = "내 시간표에서 삭제했어요";
"schedule.empty" = "이 날짜에는 일정이 없어요";
"schedule.emptyHint" = "다른 날짜를 선택하거나 시간표를 가져오세요.";
"schedule.noFavorites" = "나만의 시간표를 만들어 보세요";
"schedule.noFavoritesHint" = "전체 시간표에서 일정을 두 번 탭하면 여기에 추가돼요. LIVE와 굿즈 판매 일정은 각각 선택해요.";
"schedule.favorite" = "내 시간표에 추가";
"schedule.unfavorite" = "내 시간표에서 삭제";
"import.copyTemplate" = "템플릿 복사";
"import.copied" = "복사했어요";
"import.updateHint" = "업데이트를 가져올 때 이벤트 ID와 일정 ID가 같은 일정의 선택은 유지돼요.";
"import.replacesDemo" = "처음 가져오면 데모 시간표가 대체돼요.";
"import.error.invalidJSON" = "올바른 JSON이 아니에요. 쉼표, 따옴표, 괄호를 확인하세요.";
"import.error.timestamp" = "초와 시간대 오프셋이 포함된 ISO 8601 날짜와 시간을 사용하세요. 예: 2026-10-14T14:30:00+09:00.";
"import.error.missingField" = "필수 필드가 없어요. 아래에 표시된 필드를 추가하세요.";
"import.error.fieldType" = "필드의 자료형이 다르거나 null이에요. 아래 필드를 템플릿과 비교하세요.";
"import.error.schemaVersion" = "지원하지 않는 형식 버전이에요. schemaVersion을 1로 설정하세요.";
"import.error.timeZone" = "올바른 IANA 시간대를 사용하세요. 예: Asia/Tokyo.";
"import.error.color" = "#RRGGBB 형식의 6자리 색상 코드를 사용하세요. 예: #7AC9EC.";
"import.error.artistReference" = "이 artistID는 이벤트의 artists에 없어요. 아티스트를 추가하거나 ID를 수정하세요.";
"import.error.venueReference" = "이 venueID는 이벤트의 venues에 없어요. 장소를 추가하거나 ID를 수정하세요.";
"import.error.duration" = "종료 시간은 시작 시간보다 늦어야 해요.";
"import.error.emptyField" = "이 필드는 비워 둘 수 없어요.";
"import.error.duplicateID" = "ID가 중복돼요. 같은 목록의 이벤트, 장소, 아티스트, 일정은 각각 다른 ID를 사용해야 해요.";
"import.error.documentSize" = "시간표 파일은 20MB를 넘을 수 없어요.";
"schedule.search" = "공연 검색";
"schedule.search.close" = "검색 닫기";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — ms
"schedule.title" = "Jadual";
"schedule.mine" = "Jadual saya";
"schedule.allKinds" = "LIVE + Barangan";
"schedule.events" = "Acara";
"schedule.allEvents" = "Semua acara";
"schedule.selectEvents" = "Pilih acara";
"schedule.deleteEvent" = "Padam jadual";
"schedule.deleteEventTitle" = "Padam jadual ini?";
"schedule.deleteEventMessage" = "%@ dan semua sesinya akan dipadam daripada Jadual.";
"schedule.now" = "Sekarang";
"schedule.jumpNow" = "Ke waktu sekarang";
"schedule.favoriteHint" = "Ketik untuk butiran; ketik dua kali untuk menambah atau membuang daripada Jadual Saya.";
"schedule.noEvents" = "Belum ada jadual";
"schedule.noEventsHint" = "Tutup halaman ini untuk mengimport jadual.";
"schedule.timeZone" = "Zon waktu";
"schedule.sessionDetails" = "Butiran jadual";
"schedule.notes" = "Nota";
"schedule.venue" = "Tempat";
"schedule.event" = "Acara";
"import.title" = "Import jadual";
"import.paste" = "Tampal teks";
"import.file" = "Pilih fail";
"import.placeholder" = "Tampal JSON jadual anda di sini…";
"import.validate" = "Semak format";
"import.preview" = "Pratonton import";
"import.apply" = "Import";
"import.summary" = "%d acara · %d jadual";
"import.empty" = "Jadual tidak mengandungi acara atau sesi.";
"settings.title" = "Tetapan";
"settings.language" = "Bahasa";
"settings.followSystem" = "Ikut sistem";
"settings.about" = "Tentang";
"settings.version" = "Versi";
"settings.demoLabel" = "Jadual demo";
"settings.demoHint" = "Cuba aplikasi dengan acara contoh. Semua tarikh demo disesuaikan kepada hari ini.";
"settings.loadDemo" = "Muatkan demo";
"common.done" = "Selesai";
"common.cancel" = "Batal";
"common.close" = "Tutup";
"common.selected" = "Dipilih";
"common.selectAll" = "Pilih semua";
"common.deselectAll" = "Nyahpilih semua";
"settings.readError" = "Tidak dapat membaca data yang disimpan.";
"settings.saveError" = "Tidak dapat menyimpan perubahan.";
"settings.storageError" = "Terdapat masalah dengan data yang disimpan.";
"schedule.conflictsCount" = "%d jadual bertindih";
"schedule.zoom" = "Zum";
"import.readError" = "Tidak dapat membaca fail. Pilih fail JSON berformat UTF-8.";
"import.timeZonesHint" = "Setiap acara menggunakan zon waktu tempatan. Waktu dipaparkan dalam zon waktu acara yang dipilih.";
"settings.data" = "Pengurusan data";
"settings.scheduleImport" = "Import jadual";
"settings.localData" = "Data disimpan pada peranti ini. Eksport sandaran apabila diperlukan.";
"schedule.search.prompt" = "Cari kumpulan, venue, kawasan atau nota";
"schedule.search.empty" = "Tiada sesi yang sepadan";
"schedule.search.emptyHint" = "Tiada padanan pada hari ini dalam acara dipilih. Cuba perkataan atau hari lain.";
"schedule.export" = "Eksport JSON jadual";
"schedule.exportHint" = "Mengeksport semua acara dan sesi untuk diimport semula kemudian atau pada peranti lain. Pilihan Jadual saya kekal pada peranti ini.";
"common.clearSearch" = "Kosongkan carian";
"settings.export" = "Eksport jadual";
"settings.lineupAbout" = "Oshicue Lineup · Jadual acara langsung anda.";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "Semua jadual";
"schedule.live" = "LIVE";
"schedule.goods" = "Jualan barangan";
"schedule.favoriteAdded" = "Ditambah ke jadual saya";
"schedule.favoriteRemoved" = "Dibuang daripada jadual saya";
"schedule.empty" = "Tiada jadual pada tarikh ini";
"schedule.emptyHint" = "Pilih tarikh lain atau import jadual.";
"schedule.noFavorites" = "Mula susun jadual anda";
"schedule.noFavoritesHint" = "Ketik sesi dua kali dalam jadual penuh untuk menambahkannya di sini. Pilih sesi LIVE dan barangan secara berasingan.";
"schedule.favorite" = "Tambah ke jadual saya";
"schedule.unfavorite" = "Buang daripada jadual saya";
"import.copyTemplate" = "Salin templat";
"import.copied" = "Disalin";
"import.updateHint" = "Apabila mengimport kemas kini, pilihan dengan ID acara dan ID sesi yang sama akan dikekalkan.";
"import.replacesDemo" = "Import pertama akan menggantikan jadual demo.";
"import.error.invalidJSON" = "Teks bukan JSON yang sah. Semak koma, tanda petikan dan kurungan.";
"import.error.timestamp" = "Gunakan tarikh dan waktu ISO 8601 dengan saat dan ofset zon waktu, seperti 2026-10-14T14:30:00+09:00.";
"import.error.missingField" = "Medan wajib tiada. Tambah medan yang ditunjukkan di bawah.";
"import.error.fieldType" = "Jenis medan salah atau mengandungi null. Semak medan di bawah dengan templat.";
"import.error.schemaVersion" = "Versi format ini tidak disokong. Tetapkan schemaVersion kepada 1.";
"import.error.timeZone" = "Gunakan zon waktu IANA yang sah, seperti Asia/Tokyo.";
"import.error.color" = "Gunakan warna enam digit dalam format #RRGGBB, seperti #7AC9EC.";
"import.error.artistReference" = "artistID ini tidak disenaraikan dalam artists acara. Tambah artis atau betulkan ID.";
"import.error.venueReference" = "venueID ini tidak disenaraikan dalam venues acara. Tambah tempat atau betulkan ID.";
"import.error.duration" = "Waktu tamat mestilah selepas waktu mula.";
"import.error.emptyField" = "Medan ini tidak boleh kosong.";
"import.error.duplicateID" = "ID pendua ditemui. Setiap acara, tempat, artis atau sesi mesti mempunyai ID unik dalam senarainya.";
"import.error.documentSize" = "Fail jadual tidak boleh melebihi 20 MB.";
"schedule.search" = "Cari sesi";
"schedule.search.close" = "Tutup carian";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — th
"schedule.title" = "ตารางเวลา";
"schedule.mine" = "ตารางของฉัน";
"schedule.allKinds" = "LIVE + ขายสินค้า";
"schedule.events" = "งาน";
"schedule.allEvents" = "ทุกงาน";
"schedule.selectEvents" = "เลือกงาน";
"schedule.deleteEvent" = "ลบตารางเวลา";
"schedule.deleteEventTitle" = "ลบตารางเวลานี้หรือไม่?";
"schedule.deleteEventMessage" = "%@ และกำหนดการทั้งหมดของงานนี้จะถูกลบออกจากตารางเวลา";
"schedule.now" = "ตอนนี้";
"schedule.jumpNow" = "ไปยังเวลาปัจจุบัน";
"schedule.favoriteHint" = "แตะดูรายละเอียด แตะสองครั้งเพื่อเพิ่มหรือนำออกจากตารางของฉัน";
"schedule.noEvents" = "ยังไม่มีตารางเวลา";
"schedule.noEventsHint" = "ปิดหน้านี้เพื่อนำเข้าตารางเวลา";
"schedule.timeZone" = "เขตเวลา";
"schedule.sessionDetails" = "รายละเอียดรายการ";
"schedule.notes" = "หมายเหตุ";
"schedule.venue" = "สถานที่";
"schedule.event" = "งาน";
"import.title" = "นำเข้าตารางเวลา";
"import.paste" = "วางข้อความ";
"import.file" = "เลือกไฟล์";
"import.placeholder" = "วางข้อความ JSON ของตารางเวลาที่นี่…";
"import.validate" = "ตรวจสอบรูปแบบ";
"import.preview" = "ตัวอย่างก่อนนำเข้า";
"import.apply" = "นำเข้า";
"import.summary" = "%d งาน · %d รายการ";
"import.empty" = "ตารางเวลาไม่มีงานหรือรายการ";
"settings.title" = "การตั้งค่า";
"settings.language" = "ภาษา";
"settings.followSystem" = "ตามระบบ";
"settings.about" = "เกี่ยวกับ";
"settings.version" = "เวอร์ชัน";
"settings.demoLabel" = "ตารางเวลาตัวอย่าง";
"settings.demoHint" = "ลองใช้งานแอปด้วยงานตัวอย่าง วันที่ตัวอย่างทั้งหมดจะปรับเป็นวันนี้";
"settings.loadDemo" = "โหลดตัวอย่าง";
"common.done" = "เสร็จสิ้น";
"common.cancel" = "ยกเลิก";
"common.close" = "ปิด";
"common.selected" = "เลือกแล้ว";
"common.selectAll" = "เลือกทั้งหมด";
"common.deselectAll" = "ยกเลิกเลือกทั้งหมด";
"settings.readError" = "อ่านข้อมูลที่บันทึกไว้ไม่ได้";
"settings.saveError" = "บันทึกการเปลี่ยนแปลงไม่ได้";
"settings.storageError" = "เกิดปัญหากับข้อมูลที่บันทึกไว้";
"schedule.conflictsCount" = "เวลาทับซ้อน %d รายการ";
"schedule.zoom" = "ซูม";
"import.readError" = "อ่านไฟล์ไม่ได้ โปรดเลือกไฟล์ JSON ที่เข้ารหัส UTF-8";
"import.timeZonesHint" = "แต่ละงานใช้เขตเวลาท้องถิ่นของตนเอง และแสดงเวลาตามเขตเวลาของงานที่เลือก";
"settings.data" = "จัดการข้อมูล";
"settings.scheduleImport" = "นำเข้าตารางเวลา";
"settings.localData" = "ข้อมูลจะเก็บไว้ในอุปกรณ์นี้ คุณส่งออกไฟล์สำรองได้ทุกเมื่อ";
"schedule.search.prompt" = "ค้นหากลุ่ม สถานที่ โซน หรือหมายเหตุ";
"schedule.search.empty" = "ไม่มีรอบที่ตรงกับการค้นหา";
"schedule.search.emptyHint" = "ไม่มีผลลัพธ์ในวันนี้ของงานที่เลือก ลองใช้คำอื่นหรือเลือกวันอื่น";
"schedule.export" = "ส่งออกตารางเวลา JSON";
"schedule.exportHint" = "ส่งออกงานและรอบทั้งหมดเพื่อนำเข้าภายหลังหรือในอุปกรณ์อื่น ตัวเลือกในตารางของฉันจะเก็บไว้ในอุปกรณ์นี้เท่านั้น";
"common.clearSearch" = "ล้างการค้นหา";
"settings.export" = "ส่งออกตารางเวลา";
"settings.lineupAbout" = "Oshicue Lineup · ตารางเวลางานไลฟ์";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "ตารางทั้งหมด";
"schedule.live" = "LIVE";
"schedule.goods" = "ขายสินค้า";
"schedule.favoriteAdded" = "เพิ่มในตารางของฉันแล้ว";
"schedule.favoriteRemoved" = "ลบจากตารางของฉันแล้ว";
"schedule.empty" = "วันนี้ยังไม่มีรายการ";
"schedule.emptyHint" = "เลือกวันอื่นหรือนำเข้าตารางเวลา";
"schedule.noFavorites" = "เริ่มจัดตารางของคุณที่นี่";
"schedule.noFavoritesHint" = "แตะช่วงกิจกรรมในตารางทั้งหมดสองครั้งเพื่อเพิ่มที่นี่ เลือกช่วง LIVE และขายสินค้าแยกกันได้";
"schedule.favorite" = "เพิ่มในตารางของฉัน";
"schedule.unfavorite" = "ลบจากตารางของฉัน";
"import.copyTemplate" = "คัดลอกเทมเพลต";
"import.copied" = "คัดลอกแล้ว";
"import.updateHint" = "เมื่อนำเข้าการอัปเดต จะคงการเลือกที่มี ID งานและ ID ช่วงกิจกรรมเดิมไว้";
"import.replacesDemo" = "การนำเข้าครั้งแรกจะแทนที่ตารางเวลาตัวอย่าง";
"import.error.invalidJSON" = "ข้อความไม่ใช่ JSON ที่ถูกต้อง โปรดตรวจสอบเครื่องหมายจุลภาค อัญประกาศ และวงเล็บ";
"import.error.timestamp" = "ใช้วันและเวลา ISO 8601 ที่มีวินาทีและค่าออฟเซ็ตเขตเวลา เช่น 2026-10-14T14:30:00+09:00";
"import.error.missingField" = "ไม่มีช่องข้อมูลที่จำเป็น โปรดเพิ่มช่องที่ระบุด้านล่าง";
"import.error.fieldType" = "ชนิดข้อมูลไม่ถูกต้องหรือเป็น null โปรดตรวจสอบช่องที่ระบุด้านล่างกับเทมเพลต";
"import.error.schemaVersion" = "ไม่รองรับเวอร์ชันนี้ โปรดตั้งค่า schemaVersion เป็น 1";
"import.error.timeZone" = "ใช้เขตเวลา IANA ที่ถูกต้อง เช่น Asia/Tokyo";
"import.error.color" = "ใช้รหัสสีหกหลักในรูปแบบ #RRGGBB เช่น #7AC9EC";
"import.error.artistReference" = "artistID นี้ไม่มีใน artists ของงาน โปรดเพิ่มศิลปินหรือแก้ไข ID";
"import.error.venueReference" = "venueID นี้ไม่มีใน venues ของงาน โปรดเพิ่มสถานที่หรือแก้ไข ID";
"import.error.duration" = "เวลาสิ้นสุดต้องอยู่หลังเวลาเริ่ม";
"import.error.emptyField" = "ช่องข้อมูลนี้ต้องไม่ว่าง";
"import.error.duplicateID" = "ID ซ้ำกัน งาน สถานที่ ศิลปิน หรือรายการในแต่ละรายการต้องมี ID ที่ไม่ซ้ำกัน";
"import.error.documentSize" = "ไฟล์ตารางเวลาต้องไม่เกิน 20 MB";
"schedule.search" = "ค้นหารอบ";
"schedule.search.close" = "ปิดการค้นหา";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — zh-HK
"schedule.title" = "時間表";
"schedule.mine" = "我嘅日程";
"schedule.allKinds" = "LIVE + 物販";
"schedule.events" = "活動";
"schedule.allEvents" = "全部活動";
"schedule.selectEvents" = "揀選活動";
"schedule.deleteEvent" = "刪除日程表";
"schedule.deleteEventTitle" = "刪除呢個日程表?";
"schedule.deleteEventMessage" = "%@ 同所有場次會由時間表移除。";
"schedule.now" = "而家";
"schedule.jumpNow" = "跳到而家";
"schedule.favoriteHint" = "撳一下睇詳情,連撳兩下加入或移出我嘅行程。";
"schedule.noEvents" = "暫時未有日程表";
"schedule.noEventsHint" = "關閉呢頁後就可以匯入日程表。";
"schedule.timeZone" = "時區";
"schedule.sessionDetails" = "日程詳情";
"schedule.notes" = "備註";
"schedule.venue" = "場館";
"schedule.event" = "活動";
"import.title" = "匯入時間表";
"import.paste" = "貼上文字";
"import.file" = "揀選檔案";
"import.placeholder" = "喺呢度貼上時間表 JSON 文字…";
"import.validate" = "檢查格式";
"import.preview" = "匯入預覽";
"import.apply" = "確認匯入";
"import.summary" = "%d 個活動 · %d 項日程";
"import.empty" = "時間表入面冇活動或者日程。";
"settings.title" = "設定";
"settings.language" = "語言";
"settings.followSystem" = "跟隨系統";
"settings.about" = "關於";
"settings.version" = "版本";
"settings.demoLabel" = "示範時間表";
"settings.demoHint" = "可以用示範活動試下功能。示範日期會自動改做今日。";
"settings.loadDemo" = "載入示範";
"common.done" = "完成";
"common.cancel" = "取消";
"common.close" = "關閉";
"common.selected" = "已揀選";
"common.selectAll" = "全選";
"common.deselectAll" = "取消全選";
"settings.readError" = "讀取唔到已儲存嘅資料。";
"settings.saveError" = "儲存唔到變更。";
"settings.storageError" = "已儲存嘅資料出咗問題。";
"schedule.conflictsCount" = "%d 處時間重疊";
"schedule.zoom" = "縮放";
"import.readError" = "讀取唔到檔案,請揀 UTF-8 編碼嘅 JSON 檔案。";
"import.timeZonesHint" = "每個活動都用自己嘅當地時區,時間會按所選活動嘅時區顯示。";
"settings.data" = "資料管理";
"settings.scheduleImport" = "匯入時間表";
"settings.localData" = "資料儲存喺呢部裝置,可以隨時匯出備份。";
"schedule.search.prompt" = "搜尋團體、場館、區域或備註";
"schedule.search.empty" = "冇符合搜尋嘅場次";
"schedule.search.emptyHint" = "今日同所揀活動入面冇符合結果。試下換個關鍵字,或者揀第二日。";
"schedule.export" = "匯出時間表 JSON";
"schedule.exportHint" = "匯出全部活動同場次,之後或者喺第二部裝置都可以再匯入。「我的日程」嘅選擇只會儲存喺呢部裝置。";
"common.clearSearch" = "清除搜尋";
"settings.export" = "匯出時間表";
"settings.lineupAbout" = "Oshicue Lineup · 現場活動時間表。";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "全部日程";
"schedule.live" = "LIVE 演出";
"schedule.goods" = "物販";
"schedule.favoriteAdded" = "已加入我嘅日程";
"schedule.favoriteRemoved" = "已由我嘅日程移除";
"schedule.empty" = "呢日暫時冇日程";
"schedule.emptyHint" = "可以揀其他日期,或者匯入時間表。";
"schedule.noFavorites" = "由呢度開始安排你嘅日程";
"schedule.noFavoritesHint" = "喺全部日程入面連撳兩下場次就可以加到呢度,LIVE 同物販分開揀。";
"schedule.favorite" = "加入我嘅日程";
"schedule.unfavorite" = "由我嘅日程移除";
"import.copyTemplate" = "複製範本";
"import.copied" = "已複製";
"import.updateHint" = "更新匯入時,相同活動 ID 同場次 ID 嘅選擇會保留。";
"import.replacesDemo" = "第一次匯入會取代示範時間表。";
"import.error.invalidJSON" = "文字唔係有效嘅 JSON,請檢查逗號、引號同括號。";
"import.error.timestamp" = "請用包含秒數同時區偏移嘅 ISO 8601 日期時間,例如 2026-10-14T14:30:00+09:00。";
"import.error.missingField" = "缺少必填欄位,請補返下面標示嘅欄位。";
"import.error.fieldType" = "欄位類型錯誤或者值係 null,請對照範本檢查下面標示嘅欄位。";
"import.error.schemaVersion" = "未支援呢個格式版本,請將 schemaVersion 設為 1。";
"import.error.timeZone" = "請用有效嘅 IANA 時區,例如 Asia/Tokyo。";
"import.error.color" = "請用 #RRGGBB 格式嘅六位色碼,例如 #7AC9EC。";
"import.error.artistReference" = "呢個 artistID 唔喺活動嘅 artists 入面,請加返團體或者改正 ID。";
"import.error.venueReference" = "呢個 venueID 唔喺活動嘅 venues 入面,請加返場館或者改正 ID。";
"import.error.duration" = "結束時間必須遲過開始時間。";
"import.error.emptyField" = "呢個欄位唔可以留空。";
"import.error.duplicateID" = "ID 重複,同一個列表入面嘅活動、場館、團體或者日程必須用唔同 ID。";
"import.error.documentSize" = "時間表檔案唔可以超過 20 MB。";
"schedule.search" = "搜尋場次";
"schedule.search.close" = "關閉搜尋";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — zh-Hans
"schedule.title" = "时间表";
"schedule.mine" = "我的日程";
"schedule.allKinds" = "LIVE + 物贩";
"schedule.events" = "活动";
"schedule.allEvents" = "全部活动";
"schedule.selectEvents" = "选择活动";
"schedule.deleteEvent" = "删除日程表";
"schedule.deleteEventTitle" = "删除这个日程表?";
"schedule.deleteEventMessage" = "%@ 及其全部场次将从时间表移除。";
"schedule.now" = "现在";
"schedule.jumpNow" = "回到当前时间";
"schedule.favoriteHint" = "单击查看详情,双击加入或移出我的日程。";
"schedule.noEvents" = "暂无日程表";
"schedule.noEventsHint" = "可关闭此页面后导入日程表。";
"schedule.timeZone" = "时区";
"schedule.sessionDetails" = "日程详情";
"schedule.notes" = "备注";
"schedule.venue" = "场馆";
"schedule.event" = "活动";
"import.title" = "导入时间表";
"import.paste" = "粘贴文本";
"import.file" = "选择文件";
"import.placeholder" = "在这里粘贴时间表 JSON 文本…";
"import.validate" = "检查格式";
"import.preview" = "导入预览";
"import.apply" = "确认导入";
"import.summary" = "%d 个活动 · %d 项日程";
"import.empty" = "时间表中没有活动或日程。";
"settings.title" = "设置";
"settings.language" = "语言";
"settings.followSystem" = "跟随系统";
"settings.about" = "关于";
"settings.version" = "版本";
"settings.demoLabel" = "示例时间表";
"settings.demoHint" = "用示例活动体验功能。示例日期会自动调整到今天。";
"settings.loadDemo" = "载入示例";
"common.done" = "完成";
"common.cancel" = "取消";
"common.close" = "关闭";
"common.selected" = "已选择";
"common.selectAll" = "全选";
"common.deselectAll" = "取消全选";
"settings.readError" = "无法读取已保存的数据。";
"settings.saveError" = "无法保存更改。";
"settings.storageError" = "已保存的数据出现问题。";
"schedule.conflictsCount" = "%d 处时间重叠";
"schedule.zoom" = "缩放";
"import.readError" = "无法读取文件,请选择 UTF-8 编码的 JSON 文件。";
"import.timeZonesHint" = "每个活动使用自己的当地时区,时间按所选活动时区显示。";
"settings.data" = "数据管理";
"settings.scheduleImport" = "时间表导入";
"settings.localData" = "资料保存在本机,可随时导出备份。";
"schedule.search.prompt" = "搜索团体、场馆、区域或备注";
"schedule.search.empty" = "没有符合搜索的场次";
"schedule.search.emptyHint" = "当前日期和所选活动中没有匹配结果。请换个关键词,或选择其他日期。";
"schedule.export" = "导出时间表 JSON";
"schedule.exportHint" = "导出全部活动与场次,可在其他设备或之后重新导入。「我的日程」的选择只保存在本机。";
"common.clearSearch" = "清除搜索";
"settings.export" = "导出时间表";
"settings.lineupAbout" = "Oshicue Lineup · 现场活动时间表。";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "全部日程";
"schedule.live" = "LIVE 演出";
"schedule.goods" = "物贩";
"schedule.favoriteAdded" = "已加入我的日程";
"schedule.favoriteRemoved" = "已从我的日程移除";
"schedule.empty" = "这一天还没有日程";
"schedule.emptyHint" = "请选择其他日期,或导入时间表。";
"schedule.noFavorites" = "从这里开始安排你的日程";
"schedule.noFavoritesHint" = "在全部日程中双击场次即可加入这里,LIVE 与物贩分别选择。";
"schedule.favorite" = "加入我的日程";
"schedule.unfavorite" = "从我的日程移除";
"import.copyTemplate" = "复制模板";
"import.copied" = "已复制";
"import.updateHint" = "更新导入时,相同活动 ID 和场次 ID 的选择会保留。";
"import.replacesDemo" = "首次导入会替换示例时间表。";
"import.error.invalidJSON" = "文本不是有效的 JSON,请检查逗号、引号和括号。";
"import.error.timestamp" = "请使用包含秒数及时区偏移的 ISO 8601 日期时间,例如 2026-10-14T14:30:00+09:00。";
"import.error.missingField" = "缺少必填字段,请补全下方标示的字段。";
"import.error.fieldType" = "字段类型错误或值为 null,请对照模板检查下方标示的字段。";
"import.error.schemaVersion" = "不支持此格式版本,请将 schemaVersion 设为 1。";
"import.error.timeZone" = "请使用有效的 IANA 时区,例如 Asia/Tokyo。";
"import.error.color" = "请使用 #RRGGBB 格式的六位颜色值,例如 #7AC9EC。";
"import.error.artistReference" = "此 artistID 未列在该活动的 artists 中,请补充团体或修正 ID。";
"import.error.venueReference" = "此 venueID 未列在该活动的 venues 中,请补充场馆或修正 ID。";
"import.error.duration" = "结束时间必须晚于开始时间。";
"import.error.emptyField" = "此字段不能为空。";
"import.error.duplicateID" = "ID 重复,同一列表中的活动、场馆、团体或日程必须使用不同 ID。";
"import.error.documentSize" = "时间表文件不能超过 20 MB。";
"schedule.search" = "搜索场次";
"schedule.search.close" = "关闭搜索";
// Image export
@@ -0,0 +1,97 @@
// Oshicue Lineup — zh-Hant
"schedule.title" = "時間表";
"schedule.mine" = "我的行程";
"schedule.allKinds" = "LIVE + 物販";
"schedule.events" = "活動";
"schedule.allEvents" = "全部活動";
"schedule.selectEvents" = "選擇活動";
"schedule.deleteEvent" = "刪除日程表";
"schedule.deleteEventTitle" = "刪除這個日程表?";
"schedule.deleteEventMessage" = "%@ 及其全部場次將從時間表移除。";
"schedule.now" = "現在";
"schedule.jumpNow" = "回到目前時間";
"schedule.favoriteHint" = "點一下看詳情,點兩下加入或移出我的行程。";
"schedule.noEvents" = "目前沒有日程表";
"schedule.noEventsHint" = "可關閉此頁面後匯入日程表。";
"schedule.timeZone" = "時區";
"schedule.sessionDetails" = "行程詳細資訊";
"schedule.notes" = "備註";
"schedule.venue" = "場館";
"schedule.event" = "活動";
"import.title" = "匯入時間表";
"import.paste" = "貼上文字";
"import.file" = "選擇檔案";
"import.placeholder" = "在這裡貼上時間表 JSON 文字…";
"import.validate" = "檢查格式";
"import.preview" = "匯入預覽";
"import.apply" = "確認匯入";
"import.summary" = "%d 個活動 · %d 項行程";
"import.empty" = "時間表中沒有活動或行程。";
"settings.title" = "設定";
"settings.language" = "語言";
"settings.followSystem" = "跟隨系統";
"settings.about" = "關於";
"settings.version" = "版本";
"settings.demoLabel" = "範例時間表";
"settings.demoHint" = "使用範例活動體驗功能。範例日期會自動調整為今天。";
"settings.loadDemo" = "載入範例";
"common.done" = "完成";
"common.cancel" = "取消";
"common.close" = "關閉";
"common.selected" = "已選取";
"common.selectAll" = "全選";
"common.deselectAll" = "取消全選";
"settings.readError" = "無法讀取已儲存的資料。";
"settings.saveError" = "無法儲存變更。";
"settings.storageError" = "已儲存的資料發生問題。";
"schedule.conflictsCount" = "%d 處時間重疊";
"schedule.zoom" = "縮放";
"import.readError" = "無法讀取檔案,請選擇 UTF-8 編碼的 JSON 檔案。";
"import.timeZonesHint" = "每個活動使用自己的當地時區,時間依所選活動時區顯示。";
"settings.data" = "資料管理";
"settings.scheduleImport" = "匯入時間表";
"settings.localData" = "資料儲存在本機,可隨時匯出備份。";
"schedule.search.prompt" = "搜尋團體、場館、區域或備註";
"schedule.search.empty" = "沒有符合搜尋的場次";
"schedule.search.emptyHint" = "目前日期與所選活動中沒有符合結果。請換個關鍵字,或選擇其他日期。";
"schedule.export" = "匯出時間表 JSON";
"schedule.exportHint" = "匯出全部活動與場次,可在其他裝置或之後重新匯入。「我的日程」的選擇只儲存在本機。";
"common.clearSearch" = "清除搜尋";
"settings.export" = "匯出時間表";
"settings.lineupAbout" = "Oshicue Lineup · 現場活動時間表。";
// Keys passed through variables, ternaries and import errors
"schedule.all" = "全部行程";
"schedule.live" = "LIVE 演出";
"schedule.goods" = "物販";
"schedule.favoriteAdded" = "已加入我的行程";
"schedule.favoriteRemoved" = "已從我的行程移除";
"schedule.empty" = "這一天還沒有行程";
"schedule.emptyHint" = "請選擇其他日期,或匯入時間表。";
"schedule.noFavorites" = "從這裡開始安排你的行程";
"schedule.noFavoritesHint" = "在全部行程中點兩下場次即可加入這裡,LIVE 與物販分別選擇。";
"schedule.favorite" = "加入我的行程";
"schedule.unfavorite" = "從我的行程移除";
"import.copyTemplate" = "複製範本";
"import.copied" = "已複製";
"import.updateHint" = "更新匯入時,相同活動 ID 和場次 ID 的選擇會保留。";
"import.replacesDemo" = "首次匯入會取代範例時間表。";
"import.error.invalidJSON" = "文字不是有效的 JSON,請檢查逗號、引號和括號。";
"import.error.timestamp" = "請使用包含秒數及時區偏移的 ISO 8601 日期時間,例如 2026-10-14T14:30:00+09:00。";
"import.error.missingField" = "缺少必填欄位,請補上下方標示的欄位。";
"import.error.fieldType" = "欄位類型錯誤或值為 null,請對照範本檢查下方標示的欄位。";
"import.error.schemaVersion" = "不支援此格式版本,請將 schemaVersion 設為 1。";
"import.error.timeZone" = "請使用有效的 IANA 時區,例如 Asia/Tokyo。";
"import.error.color" = "請使用 #RRGGBB 格式的六位色碼,例如 #7AC9EC。";
"import.error.artistReference" = "此 artistID 未列在該活動的 artists 中,請補上團體或修正 ID。";
"import.error.venueReference" = "此 venueID 未列在該活動的 venues 中,請補上場館或修正 ID。";
"import.error.duration" = "結束時間必須晚於開始時間。";
"import.error.emptyField" = "此欄位不可空白。";
"import.error.duplicateID" = "ID 重複,同一清單中的活動、場館、團體或行程必須使用不同 ID。";
"import.error.documentSize" = "時間表檔案不能超過 20 MB。";
"schedule.search" = "搜尋場次";
"schedule.search.close" = "關閉搜尋";
// Image export
@@ -0,0 +1,334 @@
{
"schemaVersion": 1,
"events": [
{
"id": "demo-tokyo-idol-circuit",
"name": "TOKYO IDOL CIRCUIT",
"city": "Tokyo",
"timeZone": "Asia/Tokyo",
"venues": [
{
"id": "sky-hall",
"name": "SKY HALL",
"color": "#78C9EB"
},
{
"id": "orbit-stage",
"name": "ORBIT STAGE",
"color": "#F4A174"
},
{
"id": "mint-room",
"name": "MINT ROOM",
"color": "#94C988"
},
{
"id": "petal-club",
"name": "PETAL CLUB",
"color": "#C58EC4"
},
{
"id": "sunny-studio",
"name": "SUNNY STUDIO",
"color": "#EECF67"
}
],
"artists": [
{
"id": "hoshiiro-note",
"name": "星色ノート"
},
{
"id": "parallel-days",
"name": "PARALLEL DAYS"
},
{
"id": "mint-signal",
"name": "ミントシグナル"
},
{
"id": "luna-palette",
"name": "LUNA PALETTE"
},
{
"id": "sora-melody",
"name": "そらメロディ"
},
{
"id": "neon-ribbon",
"name": "NEON RIBBON"
},
{
"id": "little-compass",
"name": "リトルコンパス"
},
{
"id": "sugar-orbit",
"name": "SUGAR ORBIT"
}
],
"sessions": [
{
"id": "day1-live-0",
"artistID": "hoshiiro-note",
"venueID": "sky-hall",
"kind": "live",
"startsAt": "2026-10-14T12:00:00+09:00",
"endsAt": "2026-10-14T12:40:00+09:00"
},
{
"id": "day1-goods-0",
"artistID": "hoshiiro-note",
"venueID": "sky-hall",
"kind": "goods",
"startsAt": "2026-10-14T12:50:00+09:00",
"endsAt": "2026-10-14T13:45:00+09:00",
"area": "1"
},
{
"id": "day1-live-late-0",
"artistID": "luna-palette",
"venueID": "sky-hall",
"kind": "live",
"startsAt": "2026-10-14T13:25:00+09:00",
"endsAt": "2026-10-14T14:00:00+09:00"
},
{
"id": "day2-live-0",
"artistID": "hoshiiro-note",
"venueID": "sky-hall",
"kind": "live",
"startsAt": "2026-10-15T12:00:00+09:00",
"endsAt": "2026-10-15T12:35:00+09:00"
},
{
"id": "day2-goods-0",
"artistID": "hoshiiro-note",
"venueID": "sky-hall",
"kind": "goods",
"startsAt": "2026-10-15T12:45:00+09:00",
"endsAt": "2026-10-15T13:35:00+09:00",
"area": "1"
},
{
"id": "day1-live-1",
"artistID": "parallel-days",
"venueID": "orbit-stage",
"kind": "live",
"startsAt": "2026-10-14T12:10:00+09:00",
"endsAt": "2026-10-14T12:50:00+09:00"
},
{
"id": "day1-goods-1",
"artistID": "parallel-days",
"venueID": "orbit-stage",
"kind": "goods",
"startsAt": "2026-10-14T13:00:00+09:00",
"endsAt": "2026-10-14T13:55:00+09:00",
"area": "2"
},
{
"id": "day1-live-late-1",
"artistID": "sora-melody",
"venueID": "orbit-stage",
"kind": "live",
"startsAt": "2026-10-14T13:33:00+09:00",
"endsAt": "2026-10-14T14:08:00+09:00"
},
{
"id": "day2-live-1",
"artistID": "parallel-days",
"venueID": "orbit-stage",
"kind": "live",
"startsAt": "2026-10-15T12:12:00+09:00",
"endsAt": "2026-10-15T12:47:00+09:00"
},
{
"id": "day2-goods-1",
"artistID": "parallel-days",
"venueID": "orbit-stage",
"kind": "goods",
"startsAt": "2026-10-15T12:57:00+09:00",
"endsAt": "2026-10-15T13:47:00+09:00",
"area": "2"
},
{
"id": "day1-live-2",
"artistID": "mint-signal",
"venueID": "mint-room",
"kind": "live",
"startsAt": "2026-10-14T12:20:00+09:00",
"endsAt": "2026-10-14T13:00:00+09:00"
},
{
"id": "day1-goods-2",
"artistID": "mint-signal",
"venueID": "mint-room",
"kind": "goods",
"startsAt": "2026-10-14T13:10:00+09:00",
"endsAt": "2026-10-14T14:05:00+09:00",
"area": "3"
},
{
"id": "day1-live-late-2",
"artistID": "neon-ribbon",
"venueID": "mint-room",
"kind": "live",
"startsAt": "2026-10-14T13:41:00+09:00",
"endsAt": "2026-10-14T14:16:00+09:00"
},
{
"id": "day2-live-2",
"artistID": "mint-signal",
"venueID": "mint-room",
"kind": "live",
"startsAt": "2026-10-15T12:24:00+09:00",
"endsAt": "2026-10-15T12:59:00+09:00"
},
{
"id": "day2-goods-2",
"artistID": "mint-signal",
"venueID": "mint-room",
"kind": "goods",
"startsAt": "2026-10-15T13:09:00+09:00",
"endsAt": "2026-10-15T13:59:00+09:00",
"area": "3"
},
{
"id": "day1-live-3",
"artistID": "luna-palette",
"venueID": "petal-club",
"kind": "live",
"startsAt": "2026-10-14T12:30:00+09:00",
"endsAt": "2026-10-14T13:10:00+09:00"
},
{
"id": "day1-goods-3",
"artistID": "luna-palette",
"venueID": "petal-club",
"kind": "goods",
"startsAt": "2026-10-14T13:20:00+09:00",
"endsAt": "2026-10-14T14:15:00+09:00",
"area": "4"
},
{
"id": "day1-live-late-3",
"artistID": "little-compass",
"venueID": "petal-club",
"kind": "live",
"startsAt": "2026-10-14T13:49:00+09:00",
"endsAt": "2026-10-14T14:24:00+09:00"
},
{
"id": "day2-live-3",
"artistID": "luna-palette",
"venueID": "petal-club",
"kind": "live",
"startsAt": "2026-10-15T12:36:00+09:00",
"endsAt": "2026-10-15T13:11:00+09:00"
},
{
"id": "day2-goods-3",
"artistID": "luna-palette",
"venueID": "petal-club",
"kind": "goods",
"startsAt": "2026-10-15T13:21:00+09:00",
"endsAt": "2026-10-15T14:11:00+09:00",
"area": "4"
},
{
"id": "day1-live-4",
"artistID": "sora-melody",
"venueID": "sunny-studio",
"kind": "live",
"startsAt": "2026-10-14T12:40:00+09:00",
"endsAt": "2026-10-14T13:20:00+09:00"
},
{
"id": "day1-goods-4",
"artistID": "sora-melody",
"venueID": "sunny-studio",
"kind": "goods",
"startsAt": "2026-10-14T13:30:00+09:00",
"endsAt": "2026-10-14T14:25:00+09:00",
"area": "5"
},
{
"id": "day1-live-late-4",
"artistID": "sugar-orbit",
"venueID": "sunny-studio",
"kind": "live",
"startsAt": "2026-10-14T13:57:00+09:00",
"endsAt": "2026-10-14T14:32:00+09:00"
},
{
"id": "day2-live-4",
"artistID": "sora-melody",
"venueID": "sunny-studio",
"kind": "live",
"startsAt": "2026-10-15T12:48:00+09:00",
"endsAt": "2026-10-15T13:23:00+09:00"
},
{
"id": "day2-goods-4",
"artistID": "sora-melody",
"venueID": "sunny-studio",
"kind": "goods",
"startsAt": "2026-10-15T13:33:00+09:00",
"endsAt": "2026-10-15T14:23:00+09:00",
"area": "5"
}
]
},
{
"id": "demo-river-pop",
"name": "SHIBUYA NIGHT SESSION",
"city": "Tokyo",
"timeZone": "Asia/Tokyo",
"venues": [
{
"id": "river-loft",
"name": "RIVER LOFT",
"color": "#E789A5"
}
],
"artists": [
{
"id": "hoshiiro-note",
"name": "星色ノート"
},
{
"id": "neon-ribbon",
"name": "NEON RIBBON"
}
],
"sessions": [
{
"id": "river-live-1",
"artistID": "hoshiiro-note",
"venueID": "river-loft",
"kind": "live",
"startsAt": "2026-10-14T12:30:00+09:00",
"endsAt": "2026-10-14T13:05:00+09:00"
},
{
"id": "river-goods-1",
"artistID": "hoshiiro-note",
"venueID": "river-loft",
"kind": "goods",
"startsAt": "2026-10-14T13:15:00+09:00",
"endsAt": "2026-10-14T14:05:00+09:00",
"area": "A"
},
{
"id": "river-live-2",
"artistID": "neon-ribbon",
"venueID": "river-loft",
"kind": "live",
"startsAt": "2026-10-15T12:00:00+09:00",
"endsAt": "2026-10-15T12:40:00+09:00"
}
]
}
]
}
@@ -0,0 +1,30 @@
{
"schemaVersion": 1,
"events": [
{
"id": "readability-festival",
"name": "TIMETABLE READABILITY FEST",
"city": "Nagoya",
"timeZone": "Asia/Tokyo",
"venues": [
{ "id": "readability-hall", "name": "NAGOYA ReNY limited", "color": "#177DB4" }
],
"artists": [
{ "id": "artist-1", "name": "僕と契約してライブ信者になってよ。" },
{ "id": "artist-2", "name": "The Extremely Long Idol Orchestra Name" },
{ "id": "artist-3", "name": "ゼノシンフォニーと夜明けのパレード" },
{ "id": "artist-4", "name": "CENTRAL STAGE SUPER IDOL PROJECT" },
{ "id": "artist-5", "name": "LEIWAN" }
],
"sessions": [
{ "id": "live-5min", "artistID": "artist-1", "venueID": "readability-hall", "kind": "live", "startsAt": "2026-06-14T12:00:00+09:00", "endsAt": "2026-06-14T12:05:00+09:00" },
{ "id": "live-10min", "artistID": "artist-2", "venueID": "readability-hall", "kind": "live", "startsAt": "2026-06-14T12:05:00+09:00", "endsAt": "2026-06-14T12:15:00+09:00" },
{ "id": "live-short-name", "artistID": "artist-5", "venueID": "readability-hall", "kind": "live", "startsAt": "2026-06-14T12:15:00+09:00", "endsAt": "2026-06-14T12:20:00+09:00" },
{ "id": "goods-1", "artistID": "artist-1", "venueID": "readability-hall", "kind": "goods", "startsAt": "2026-06-14T12:00:00+09:00", "endsAt": "2026-06-14T13:10:00+09:00" },
{ "id": "goods-2", "artistID": "artist-2", "venueID": "readability-hall", "kind": "goods", "startsAt": "2026-06-14T12:00:00+09:00", "endsAt": "2026-06-14T13:10:00+09:00" },
{ "id": "goods-3", "artistID": "artist-3", "venueID": "readability-hall", "kind": "goods", "startsAt": "2026-06-14T12:00:00+09:00", "endsAt": "2026-06-14T13:10:00+09:00" },
{ "id": "goods-4", "artistID": "artist-4", "venueID": "readability-hall", "kind": "goods", "startsAt": "2026-06-14T12:00:00+09:00", "endsAt": "2026-06-14T13:10:00+09:00" }
]
}
]
}
@@ -0,0 +1,78 @@
{
"schemaVersion": 1,
"events": [
{
"id": "example-idol-festival-2026",
"name": "示例偶像音乐节",
"city": "Tokyo",
"timeZone": "Asia/Tokyo",
"venues": [
{ "id": "main-hall", "name": "MAIN HALL", "color": "#78C9EB" },
{ "id": "garden-stage", "name": "GARDEN STAGE", "color": "#94C988" }
],
"artists": [
{ "id": "neon-parade", "name": "NEON PARADE" },
{ "id": "tsuki-no-atelier", "name": "月のアトリエ" }
],
"sessions": [
{
"id": "neon-parade-live-day1",
"artistID": "neon-parade",
"venueID": "main-hall",
"kind": "live",
"startsAt": "2026-10-14T12:00:00+09:00",
"endsAt": "2026-10-14T12:30:00+09:00",
"notes": "此处填写入场或摄影规则。"
},
{
"id": "neon-parade-goods-day1",
"artistID": "neon-parade",
"venueID": "main-hall",
"kind": "goods",
"startsAt": "2026-10-14T12:45:00+09:00",
"endsAt": "2026-10-14T13:45:00+09:00",
"area": "物贩区 1"
},
{
"id": "tsuki-no-atelier-live-day1",
"artistID": "tsuki-no-atelier",
"venueID": "garden-stage",
"kind": "live",
"startsAt": "2026-10-14T12:15:00+09:00",
"endsAt": "2026-10-14T12:50:00+09:00"
},
{
"id": "tsuki-no-atelier-live-day2",
"artistID": "tsuki-no-atelier",
"venueID": "garden-stage",
"kind": "live",
"startsAt": "2026-10-15T12:00:00+09:00",
"endsAt": "2026-10-15T12:30:00+09:00"
}
]
},
{
"id": "example-night-session-2026",
"name": "示例夜场活动",
"city": "Tokyo",
"timeZone": "Asia/Tokyo",
"venues": [
{ "id": "night-club", "name": "NIGHT CLUB", "color": "#F4A174" }
],
"artists": [
{ "id": "neon-parade", "name": "NEON PARADE" }
],
"sessions": [
{
"id": "neon-parade-live-night",
"artistID": "neon-parade",
"venueID": "night-club",
"kind": "live",
"startsAt": "2026-10-14T23:40:00+09:00",
"endsAt": "2026-10-15T00:20:00+09:00",
"notes": "跨午夜场次:结束日期必须写成次日。"
}
]
}
]
}
@@ -0,0 +1,174 @@
package com.oshicue.lineup
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ViewList
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.GridView
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.Badge
import androidx.compose.material3.BadgedBox
import androidx.compose.material3.Icon
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.NavigationBarItemDefaults
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.compose.foundation.layout.padding
import com.oshicue.lineup.core.AppLanguage
import com.oshicue.lineup.core.L10n
import com.oshicue.lineup.core.configuration
import com.oshicue.lineup.ui.Kit
import com.oshicue.lineup.ui.KitTheme
import com.oshicue.lineup.ui.ScheduleImportScreen
import com.oshicue.lineup.ui.ScheduleScreen
import com.oshicue.lineup.ui.ScheduleStore
import com.oshicue.lineup.ui.SettingsScreen
import com.oshicue.lineup.ui.TimetableUiState
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent { LineupApp() }
}
}
/** The bottom tabs, left to right: 全部日程, 我的日程 and 设置. */
private enum class LineupTab { All, Mine, Settings }
@Composable
fun LineupApp() {
val systemConfiguration = androidx.compose.ui.platform.LocalConfiguration.current
val context = LocalContext.current
val preferences = remember {
context.getSharedPreferences("lineup", android.content.Context.MODE_PRIVATE)
}
var languageTag by remember { mutableStateOf(preferences.getString(AppLanguage.preferenceKey, null)) }
val language = remember(languageTag) {
val stored = AppLanguage.fromTag(languageTag)
if (stored == AppLanguage.System) {
val locales = systemConfiguration.locales
AppLanguage.resolveSystemLanguage(
(0 until locales.size()).map { locales[it].toLanguageTag() },
if (locales.size() > 0) locales[0].country else "",
)
} else stored
}
L10n.apply(context, languageTag)
val store: ScheduleStore = viewModel(factory = ScheduleStore.Factory(context))
val state by store.state.collectAsStateWithLifecycle()
val timetable = remember { TimetableUiState() }
var tab by remember { mutableStateOf(LineupTab.All) }
var showImport by remember { mutableStateOf(false) }
// A language change re-runs every string lookup; the switch keeps the same store and tab.
val configuration = remember(language, context) { language.configuration(systemConfiguration) }
val localizedContext = remember(configuration, context) { context.createConfigurationContext(configuration) }
androidx.compose.runtime.CompositionLocalProvider(
androidx.compose.ui.platform.LocalContext provides localizedContext,
) {
KitTheme {
if (showImport) {
ScheduleImportScreen(store) { showImport = false }
return@KitTheme
}
Scaffold(
containerColor = Kit.colors.background,
bottomBar = {
NavigationBar(containerColor = Kit.colors.surface) {
NavigationBarItem(
selected = tab == LineupTab.All,
onClick = { tab = LineupTab.All },
icon = { Icon(Icons.AutoMirrored.Filled.ViewList, contentDescription = null) },
label = { Text(L10n.text("schedule.all"), fontSize = 11.sp) },
colors = barColors(),
)
NavigationBarItem(
selected = tab == LineupTab.Mine,
onClick = { tab = LineupTab.Mine },
icon = {
BadgedBox(badge = {
if (state.favorites.isNotEmpty()) {
Badge(containerColor = Kit.colors.accentFill) {
Text(state.favorites.size.toString(), color = Kit.colors.onAccent, fontSize = 10.sp)
}
}
}) { Icon(Icons.Filled.Favorite, contentDescription = null) }
},
label = { Text(L10n.text("schedule.mine"), fontSize = 11.sp) },
colors = barColors(),
)
NavigationBarItem(
selected = tab == LineupTab.Settings,
onClick = { tab = LineupTab.Settings },
icon = { Icon(Icons.Filled.Settings, contentDescription = null) },
label = { Text(L10n.text("settings.title"), fontSize = 11.sp) },
colors = barColors(),
)
}
},
) { padding ->
Box(Modifier.fillMaxSize().background(Kit.colors.background).padding(padding)) {
when (tab) {
LineupTab.All -> ScheduleScreen(store, state, timetable, mine = false,
onOpenImport = { showImport = true }, onOpenSettings = { tab = LineupTab.Settings })
LineupTab.Mine -> ScheduleScreen(store, state, timetable, mine = true,
onOpenImport = { showImport = true }, onOpenSettings = { tab = LineupTab.Settings })
LineupTab.Settings -> SettingsScreen(
store = store,
language = AppLanguage.fromTag(languageTag),
onLanguageChange = { value ->
languageTag = value.tag
preferences.edit().putString(AppLanguage.preferenceKey, value.tag).apply()
},
onOpenImport = { showImport = true },
)
}
}
}
state.storageError?.let { message ->
androidx.compose.material3.AlertDialog(
onDismissRequest = { store.clearError() },
title = { Text(L10n.text("settings.storageError")) },
text = { Text(message) },
confirmButton = {
androidx.compose.material3.TextButton(onClick = { store.clearError() }) {
Text(L10n.text("common.done"))
}
},
containerColor = Kit.colors.surface,
)
}
}
}
}
@Composable
private fun barColors() = NavigationBarItemDefaults.colors(
selectedIconColor = Kit.colors.accentText,
selectedTextColor = Kit.colors.accentText,
unselectedIconColor = Kit.colors.muted,
unselectedTextColor = Kit.colors.muted,
indicatorColor = Color.Transparent,
)
@@ -0,0 +1,41 @@
package com.oshicue.lineup.core
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.Locale
/** Date and time labels. Formatters are cached because the timeline formats many labels per tick. */
object KitDate {
private val cache = mutableMapOf<String, DateTimeFormatter>()
private fun formatter(pattern: String, localeID: String, zone: ZoneId): DateTimeFormatter {
val key = localeID + "|" + zone.id + "|" + pattern
return cache.getOrPut(key) {
DateTimeFormatter.ofPattern(pattern, Locale.forLanguageTag(localeID)).withZone(zone)
}
}
fun string(date: Instant, pattern: String, zone: ZoneId): String =
formatter(pattern, L10n.current.localeID, zone).format(date)
fun time(date: Instant, zone: ZoneId): String = string(date, "HH:mm", zone)
/** The local civil day used in exported file names, such as 2026-11-12. */
fun civilDay(date: Instant): String = string(date, "yyyy-MM-dd", ZoneId.systemDefault())
}
/** Day and month titles for the calendar, resolved in the chosen app language. */
object KitDateLabels {
fun monthTitle(month: java.time.LocalDate, localeID: String): String {
val formatter = DateTimeFormatter.ofPattern("yyyy MMMM", Locale.forLanguageTag(localeID))
return formatter.format(month)
}
fun weekdayInitials(localeID: String): List<String> {
// A narrow weekday name is one character in every supported language except Thai.
val formatter = DateTimeFormatter.ofPattern("EEEEE", Locale.forLanguageTag(localeID))
val monday = java.time.LocalDate.of(2024, 1, 1) // a Monday
return (0..6).map { formatter.format(monday.plusDays(it.toLong())) }
}
}
@@ -0,0 +1,60 @@
package com.oshicue.lineup.core
import android.content.Context
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import java.io.File
/**
* Launch flags used only by isolated UI tests on Android. Release builds always read the user's own files.
* The Android port has no such tests, so the values are constants; keeping them named makes the store
* code read the same as the iOS one.
*/
object KitLaunch {
var isUITest: Boolean = false
var preservesUITestData: Boolean = false
val loadsSavedData: Boolean get() = !isUITest || preservesUITestData
}
/**
* One module's JSON file in the app's private storage. Writes are atomic, and an unreadable file is
* copied aside before anything replaces it, so a corrupt file never takes the user's data with it.
*/
class KitStorageFile(context: Context, name: String) {
val file: File
private var isUnreadable = false
init {
val directory = File(context.filesDir, AppBrand.storageFolder)
file = File(directory, if (KitLaunch.isUITest) "ui-test-$name" else name)
}
val hasSavedData: Boolean get() = KitLaunch.loadsSavedData && file.exists()
fun read(maximumBytes: Int? = null): ByteArray {
if (maximumBytes != null && file.length() > maximumBytes) throw SizeLimitError()
return file.readBytes()
}
fun markUnreadable() {
isUnreadable = true
}
fun write(data: ByteArray) {
file.parentFile?.mkdirs()
if (isUnreadable && file.exists()) {
val recovery = File(file.parentFile, file.nameWithoutExtension + ".recovery-" +
java.util.UUID.randomUUID() + ".json")
file.copyTo(recovery, overwrite = true)
isUnreadable = false
}
val temporary = File(file.parentFile, file.name + ".tmp")
temporary.writeBytes(data)
if (!temporary.renameTo(file)) {
file.writeBytes(data)
temporary.delete()
}
}
}
class SizeLimitError : Exception("The file is too large.")
@@ -0,0 +1,258 @@
package com.oshicue.lineup.core
import android.content.Context
import android.content.res.Configuration
import java.io.InputStream
import java.util.Locale
/**
* The nine bundled translations plus "follow the system". Translations live in
* assets/localization/<tag>.strings in the same `"key" = "value";` layout the iOS app uses,
* so a text change is one edit in one place and the two apps read the same strings.
*/
enum class AppLanguage(val tag: String) {
System("system"),
ZhHans("zh-Hans"),
ZhHant("zh-Hant"),
ZhHK("zh-HK"),
En("en"),
Ja("ja"),
Ko("ko"),
Th("th"),
Indonesian("id"),
Ms("ms");
val id: String get() = tag
val nativeName: String
get() = when (this) {
System -> L10n.text("settings.followSystem")
ZhHans -> "简体中文(中国)"
ZhHant -> "繁體中文(台灣)"
ZhHK -> "繁體粵語(香港)"
En -> "English (United States)"
Ja -> "日本語(日本)"
Ko -> "한국어(대한민국)"
Th -> "ไทย (ประเทศไทย)"
Indonesian -> "Bahasa Indonesia (Indonesia)"
Ms -> "Bahasa Melayu (Malaysia)"
}
val localeID: String
get() = when (this) {
System -> Locale.getDefault().toLanguageTag()
ZhHans -> "zh-Hans-CN"
ZhHant -> "zh-Hant-TW"
ZhHK -> "zh-Hant-HK"
En -> "en-US"
Ja -> "ja-JP"
Ko -> "ko-KR"
Th -> "th-TH"
Indonesian -> "id-ID"
Ms -> "ms-MY"
}
val locale: Locale get() = Locale.forLanguageTag(localeID)
companion object {
const val preferenceKey = "appLanguage"
private val bundled = listOf(ZhHans, ZhHant, ZhHK, En, Ja, Ko, Th, Indonesian, Ms)
fun fromTag(value: String?): AppLanguage = entries.firstOrNull { it.tag == value } ?: System
/**
* Resolves the system language without collapsing Hong Kong Cantonese into
* Taiwan Traditional Chinese, which Android's own matching would do.
*/
fun resolveSystemLanguage(tags: List<String>, regionCode: String?): AppLanguage {
for (identifier in tags) {
val normalized = identifier.replace('_', '-').lowercase(Locale.ROOT)
val components = normalized.split('-').filter { it.isNotEmpty() }
val code = components.firstOrNull() ?: continue
val region = regionCode?.uppercase(Locale.ROOT)
when (code) {
"yue" -> return ZhHK
"zh" -> {
if (components.any { it == "hk" || it == "mo" }) return ZhHK
if (components.any { it == "hans" || it == "cn" || it == "sg" }) return ZhHans
if (components.any { it == "tw" }) return ZhHant
if (components.any { it == "hant" }) {
return if (region == "HK" || region == "MO") ZhHK else ZhHant
}
if (region == "HK" || region == "MO") return ZhHK
if (region == "TW") return ZhHant
return ZhHans
}
"en" -> return En
"ja" -> return Ja
"ko" -> return Ko
"th" -> return Th
"id", "in" -> return Indonesian
"ms" -> return Ms
else -> continue
}
}
return En
}
}
}
/** Resolves and formats every visible string, mirroring the iOS L10n. */
object L10n {
private var tables: MutableMap<String, Map<String, String>> = mutableMapOf()
private var applicationContext: Context? = null
private var language: AppLanguage = AppLanguage.En
val current: AppLanguage get() = language
fun attach(context: Context) {
applicationContext = context.applicationContext
tables.clear()
}
/** Applies the saved preference, or the system language when the preference is "follow system". */
fun apply(context: Context, preference: String?) {
attach(context)
val stored = AppLanguage.fromTag(preference)
setLanguageInternal(
if (stored == AppLanguage.System) {
val configuration = context.resources.configuration
val locales = configuration.locales
val tags = (0 until locales.size()).map { locales[it].toLanguageTag() }
AppLanguage.resolveSystemLanguage(
tags.ifEmpty { listOf(Locale.getDefault().toLanguageTag()) },
if (locales.size() > 0) locales[0].country else Locale.getDefault().country,
)
} else stored,
)
}
/** Test and preview entry point: resolves a fixed language with no Context. */
fun setLanguage(value: AppLanguage) {
setLanguageInternal(if (value == AppLanguage.System) AppLanguage.En else value)
}
private fun setLanguageInternal(value: AppLanguage) {
language = value
}
fun text(key: String): String {
val value = table(language)[key]
if (value != null) return value
return table(AppLanguage.En)[key] ?: key
}
fun format(key: String, vararg arguments: Any?): String {
val pattern = javaFormat(text(key))
return try {
String.format(language.locale, pattern, *arguments)
} catch (_: IllegalArgumentException) {
text(key)
}
}
/**
* Translates the iOS format specifiers to the Java ones: `%@` becomes `%s` and keeps its
* width/position modifiers, `%d` and `%s` pass through unchanged.
*/
private fun javaFormat(pattern: String): String {
val builder = StringBuilder(pattern.length + 8)
var index = 0
while (index < pattern.length) {
val character = pattern[index]
if (character != '%') {
builder.append(character)
index++
continue
}
builder.append('%')
index++
if (index < pattern.length && pattern[index] == '%') {
builder.append('%')
index++
continue
}
while (index < pattern.length && pattern[index] in "0123456789$.+- #0") {
builder.append(pattern[index])
index++
}
if (index >= pattern.length) break
when (val conversion = pattern[index]) {
'@' -> builder.append('s')
'l' -> builder.append("d") // %ld is an Int64 argument
else -> builder.append(conversion)
}
index++
}
return builder.toString()
}
private fun table(value: AppLanguage): Map<String, String> {
tables[value.tag]?.let { return it }
val loaded = when {
value == AppLanguage.System -> table(AppLanguage.En)
value == AppLanguage.En -> load(value.tag) ?: emptyMap()
else -> load(value.tag) ?: table(AppLanguage.En)
}
tables[value.tag] = loaded
return loaded
}
private fun load(tag: String): Map<String, String>? {
val context = applicationContext ?: return bundledFallback(tag)
return try {
context.assets.open("localization/$tag.strings").use { parse(it) }
} catch (_: Exception) {
null
}
}
/** Used by unit tests and previews, where no Context exists. */
private fun bundledFallback(tag: String): Map<String, String>? {
val stream: InputStream = javaClass.getResourceAsStream("/localization/$tag.strings") ?: return null
return stream.use { parse(it) }
}
private fun parse(stream: InputStream): Map<String, String> {
val result = mutableMapOf<String, String>()
stream.bufferedReader(Charsets.UTF_8).forEachLine { line ->
val trimmed = line.trim()
if (!trimmed.startsWith("\"")) return@forEachLine
val separator = trimmed.indexOf("\" = \"")
if (separator < 0) return@forEachLine
val key = trimmed.substring(1, separator)
val end = trimmed.lastIndexOf("\";")
if (end <= separator) return@forEachLine
val value = trimmed.substring(separator + 5, end)
result[unescape(key)] = unescape(value)
}
return result
}
private fun unescape(value: String): String {
if (!value.contains('\\')) return value
val builder = StringBuilder(value.length)
var index = 0
while (index < value.length) {
val character = value[index]
if (character == '\\' && index + 1 < value.length) {
when (val next = value[index + 1]) {
'n' -> builder.append('\n')
't' -> builder.append('\t')
'"' -> builder.append('"')
'\\' -> builder.append('\\')
else -> builder.append(next)
}
index += 2
} else {
builder.append(character)
index++
}
}
return builder.toString()
}
}
/** The locale and configuration used when the chosen language differs from the system one. */
fun AppLanguage.configuration(base: Configuration): Configuration =
Configuration(base).apply { setLocale(locale) }
@@ -0,0 +1,131 @@
package com.oshicue.lineup.core
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
/** Local persistence helpers shared by the timetable store. */
object ScheduleDates {
fun zone(identifier: String): ZoneId =
runCatching { ZoneId.of(identifier) }.getOrElse { ZoneId.of("UTC") }
/** The local civil day as yyyy-MM-dd, unaffected by later time-zone changes. */
fun civilDay(date: Instant, zone: ZoneId = ZoneId.systemDefault()): String =
date.atZone(zone).toLocalDate().toString()
fun day(value: String): LocalDate? = runCatching { LocalDate.parse(value) }.getOrNull()
/** The start of the local civil day that contains [date]. */
fun startOfDay(date: Instant, zone: ZoneId): Instant =
date.atZone(zone).toLocalDate().atStartOfDay(zone).toInstant()
/** The end of the local civil day that contains [date]. */
fun endOfDay(date: Instant, zone: ZoneId): Instant =
date.atZone(zone).toLocalDate().plusDays(1).atStartOfDay(zone).toInstant()
}
/** Fictional data anchored to the current local hour so the actual system-time line is visible. */
object ScheduleDemo {
fun document(now: Instant = Instant.now()): ScheduleDocument {
val zone = ZoneId.of("Asia/Tokyo")
val today = now.atZone(zone).toLocalDate().atStartOfDay(zone).toInstant()
val hour = now.atZone(zone).hour
val anchor = today.plus(hour.toLong(), java.time.temporal.ChronoUnit.HOURS)
val tomorrow = today.plus(1, java.time.temporal.ChronoUnit.DAYS)
val nextAnchor = tomorrow.plus(12, java.time.temporal.ChronoUnit.HOURS)
val venues = listOf(
Venue("sky-hall", "SKY HALL", "#78C9EB"),
Venue("orbit-stage", "ORBIT STAGE", "#F4A174"),
Venue("mint-room", "MINT ROOM", "#94C988"),
Venue("petal-club", "PETAL CLUB", "#C58EC4"),
Venue("sunny-studio", "SUNNY STUDIO", "#EECF67"),
)
val artists = listOf(
Artist("hoshiiro-note", "星色ノート"),
Artist("parallel-days", "PARALLEL DAYS"),
Artist("mint-signal", "ミントシグナル"),
Artist("luna-palette", "LUNA PALETTE"),
Artist("sora-melody", "そらメロディ"),
Artist("neon-ribbon", "NEON RIBBON"),
Artist("little-compass", "リトルコンパス"),
Artist("sugar-orbit", "SUGAR ORBIT"),
)
fun session(
id: String,
artist: Int,
venue: Int,
kind: SessionKind,
offset: Int,
duration: Int,
base: Instant,
area: String? = null,
) = FestivalSession(
id = id,
artistID = artists[artist].id,
venueID = venues[venue].id,
kind = kind,
startsAt = base.plus(offset.toLong(), java.time.temporal.ChronoUnit.MINUTES),
endsAt = base.plus((offset + duration).toLong(), java.time.temporal.ChronoUnit.MINUTES),
area = area,
)
val sessions = mutableListOf<FestivalSession>()
for (index in venues.indices) {
sessions.add(session("today-live-$index", index, index, SessionKind.Live, index * 10, 40, anchor))
sessions.add(session("today-goods-$index", index, index, SessionKind.Goods, index * 10 + 50, 55, anchor, "${index + 1}"))
sessions.add(session("today-live-late-$index", (index + 3) % artists.size, index, SessionKind.Live, 85 + index * 8, 35, anchor))
sessions.add(session("today-goods-late-$index", (index + 3) % artists.size, index, SessionKind.Goods, 130 + index * 8, 55, anchor, "${index + 1}"))
sessions.add(session("today-live-evening-$index", (index + 5) % artists.size, index, SessionKind.Live, 210 + index * 8, 40, anchor))
sessions.add(session("tomorrow-live-$index", index, index, SessionKind.Live, index * 12, 35, nextAnchor))
sessions.add(session("tomorrow-goods-$index", index, index, SessionKind.Goods, index * 12 + 45, 50, nextAnchor, "${index + 1}"))
}
val first = FestivalEvent(
id = "demo-tokyo-idol-circuit",
name = "TOKYO IDOL CIRCUIT",
city = "Tokyo",
timeZone = "Asia/Tokyo",
venues = venues,
artists = artists,
sessions = sessions,
)
val secondVenue = Venue("river-loft", "RIVER LOFT", "#E789A5")
val secondSessions = listOf(
FestivalSession(
id = "river-live-1", artistID = artists[0].id, venueID = secondVenue.id, kind = SessionKind.Live,
startsAt = anchor.plus(30, java.time.temporal.ChronoUnit.MINUTES),
endsAt = anchor.plus(65, java.time.temporal.ChronoUnit.MINUTES),
),
FestivalSession(
id = "river-goods-1", artistID = artists[0].id, venueID = secondVenue.id, kind = SessionKind.Goods,
startsAt = anchor.plus(75, java.time.temporal.ChronoUnit.MINUTES),
endsAt = anchor.plus(125, java.time.temporal.ChronoUnit.MINUTES),
area = "A",
),
FestivalSession(
id = "river-live-2", artistID = artists[5].id, venueID = secondVenue.id, kind = SessionKind.Live,
startsAt = nextAnchor,
endsAt = nextAnchor.plus(40, java.time.temporal.ChronoUnit.MINUTES),
),
)
val second = FestivalEvent(
id = "demo-river-pop",
name = "SHIBUYA NIGHT SESSION",
city = "Tokyo",
timeZone = "Asia/Tokyo",
venues = listOf(secondVenue),
artists = listOf(artists[0], artists[5]),
sessions = secondSessions,
)
return ScheduleDocument(events = listOf(first, second))
}
/** Two groups preselected on first launch, as the iOS app does. */
fun defaultFavorites(document: ScheduleDocument): Set<String> {
val ids = document.events.firstOrNull()?.artists?.take(2)?.map { it.id }?.toSet() ?: emptySet()
return ScheduleFavorites.forArtistIDs(document, ids)
}
}
@@ -0,0 +1,238 @@
package com.oshicue.lineup.core
import kotlinx.serialization.SerializationException
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromJsonElement
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.JsonElement
/** A validation or decoding problem shown through a localization key and the faulty JSON location. */
class ImportError(val key: String, val detail: String, val path: String) : Exception("$path: $detail") {
override fun toString(): String = "$path: $detail"
}
object ScheduleImporter {
const val maximumDocumentBytes = 20 * 1024 * 1024
private val json = Json {
ignoreUnknownKeys = true
isLenient = false
explicitNulls = true
encodeDefaults = true
prettyPrint = true
}
/** Selected files are checked as bytes, so malformed UTF-8 is rejected rather than repaired. */
fun parse(data: ByteArray): ScheduleDocument {
if (data.size > maximumDocumentBytes) throw sizeError()
val text = try {
data.toString(Charsets.UTF_8)
} catch (_: Exception) {
throw ImportError("import.error.invalidJSON", "Text must use UTF-8.", "$")
}
if (!isValidUtf8(data)) throw ImportError("import.error.invalidJSON", "Text must use UTF-8.", "$")
return parse(text)
}
fun parse(text: String): ScheduleDocument {
if (text.toByteArray(Charsets.UTF_8).size > maximumDocumentBytes) throw sizeError()
val document = try {
decode(text)
} catch (error: ImportError) {
throw error
} catch (error: SerializationException) {
throw translate(error, text)
} catch (error: Exception) {
throw ImportError("import.error.invalidJSON", error.message ?: "", "$")
}
validate(document)
return document
}
/** One document for a batch of files. An event ID repeated between files is rejected. */
fun combining(documents: List<ScheduleDocument>): ScheduleDocument {
val result = ScheduleDocument(events = documents.flatMap { it.events })
validate(result)
return result
}
fun encode(document: ScheduleDocument): String {
validate(document)
val text = json.encodeToString(ScheduleDocument.serializer(), document)
if (text.toByteArray(Charsets.UTF_8).size > maximumDocumentBytes) throw sizeError()
return text
}
fun validate(document: ScheduleDocument) {
if (document.schemaVersion != 1) {
throw ImportError("import.error.schemaVersion",
"Supported schemaVersion is 1; received ${document.schemaVersion}.", "$.schemaVersion")
}
unique(document.events.map { it.id }, "$.events", "event")
document.events.forEachIndexed { eventIndex, event ->
val eventPath = "$.events[$eventIndex]"
nonempty(event.id, "$eventPath.id")
nonempty(event.name, "$eventPath.name")
nonempty(event.city, "$eventPath.city")
if (runCatching { java.time.ZoneId.of(event.timeZone) }.isFailure) {
throw ImportError("import.error.timeZone",
"Use a valid IANA time zone such as Asia/Tokyo.", "$eventPath.timeZone")
}
unique(event.venues.map { it.id }, "$eventPath.venues", "venue")
unique(event.artists.map { it.id }, "$eventPath.artists", "artist")
unique(event.sessions.map { it.id }, "$eventPath.sessions", "session")
event.venues.forEachIndexed { index, venue ->
val venuePath = "$eventPath.venues[$index]"
nonempty(venue.id, "$venuePath.id")
nonempty(venue.name, "$venuePath.name")
if (!hexColor.matches(venue.color)) {
throw ImportError("import.error.color",
"Use a six-digit RGB color, for example #7AC9EC.", "$venuePath.color")
}
}
event.artists.forEachIndexed { index, artist ->
nonempty(artist.id, "$eventPath.artists[$index].id")
nonempty(artist.name, "$eventPath.artists[$index].name")
}
val artistIDs = event.artists.map { it.id }.toSet()
val venueIDs = event.venues.map { it.id }.toSet()
event.sessions.forEachIndexed { index, session ->
val sessionPath = "$eventPath.sessions[$index]"
nonempty(session.id, "$sessionPath.id")
if (session.artistID !in artistIDs) {
throw ImportError("import.error.artistReference",
"Artist '${session.artistID}' is not declared in this event's artists.",
"$sessionPath.artistID")
}
if (session.venueID !in venueIDs) {
throw ImportError("import.error.venueReference",
"Venue '${session.venueID}' is not declared in this event's venues.",
"$sessionPath.venueID")
}
if (!(session.endsAt > session.startsAt)) {
throw ImportError("import.error.duration",
"endsAt must be later than startsAt.", "$sessionPath.endsAt")
}
}
}
}
fun sizeError() = ImportError("import.error.documentSize", "The timetable must not exceed 20 MB.", "$")
private val hexColor = Regex("^#[0-9a-fA-F]{6}$")
private fun decode(text: String): ScheduleDocument {
val element = json.parseToJsonElement(text)
val root = element.jsonObject
// Decoding field by field keeps the first faulty location, instead of failing on the whole object.
val schemaVersion = (root["schemaVersion"] as? kotlinx.serialization.json.JsonPrimitive)?.content?.toIntOrNull()
?: throw ImportError("import.error.missingField", "Required field 'schemaVersion' is missing.", "$.schemaVersion")
val eventsElement = root["events"] ?: throw ImportError("import.error.missingField",
"Required field 'events' is missing.", "$.events")
if (eventsElement !is kotlinx.serialization.json.JsonArray) {
throw ImportError("import.error.fieldType", "Expected an array.", "$.events")
}
val events = eventsElement.jsonArray.mapIndexed { index, item ->
try {
json.decodeFromJsonElement(FestivalEvent.serializer(), item)
} catch (error: Exception) {
throw translate(error, "$.events[$index]")
}
}
return ScheduleDocument(schemaVersion = schemaVersion, events = events)
}
/** Maps a serialization failure onto the missing/mistyped field the user has to fix. */
private fun translate(error: Throwable, fallbackPath: String): ImportError {
if (error is ImportError) return error
val message = generateSequence(error) { it.cause }.mapNotNull { it.message }.joinToString(" ").ifEmpty { "" }
val missing = Regex("""Field '([^']+)' is required for type""").find(message)
val element = Regex("""(?:Element|value) '([^']+)'""").find(message)
val location = Regex("""path: (?:\\\$)([\\w.\\[\\]]*)""").find(message)
val suffix = location?.groupValues?.get(1)?.let { path ->
path.split('.').joinToString("") { part ->
when {
part.isEmpty() -> ""
part.startsWith("[") -> part
else -> ".$part"
}
}
} ?: ""
val path = fallbackPath + suffix
return when {
missing != null -> ImportError("import.error.missingField",
"Required field '${missing.groupValues[1]}' is missing.", path)
Regex("""Unexpected JSON token|Expected|Illegal input|Unexpected""" ).containsMatchIn(message) ->
ImportError("import.error.fieldType", message, path)
element != null || error is kotlinx.serialization.descriptors.SerialDescriptor ->
ImportError("import.error.invalidJSON", message, path)
else -> ImportError("import.error.invalidJSON", message.ifEmpty { "The timetable could not be decoded." }, path)
}
}
private fun isValidUtf8(data: ByteArray): Boolean {
var index = 0
while (index < data.size) {
val byte = data[index].toInt() and 0xFF
val extra = when {
byte < 0x80 -> 0
byte in 0xC2..0xDF -> 1
byte in 0xE0..0xEF -> 2
byte in 0xF0..0xF4 -> 3
else -> return false
}
if (index + extra >= data.size + (if (extra == 0) 1 else 0) && extra > 0) return false
repeat(extra) { offset ->
val next = data.getOrNull(index + offset + 1)?.toInt()?.and(0xFF) ?: return false
if (next and 0xC0 != 0x80) return false
}
index += extra + 1
}
return true
}
private fun nonempty(value: String, path: String) {
if (value.isBlank()) throw ImportError("import.error.emptyField", "This field must not be empty.", path)
}
private fun unique(values: List<String>, path: String, label: String) {
val found = mutableSetOf<String>()
values.forEachIndexed { index, value ->
if (!found.add(value)) {
throw ImportError("import.error.duplicateID", "Duplicate $label ID '$value'.", "$path[$index].id")
}
}
}
}
/** A message that is already localized, for checks with no JSON location. */
class KitMessageError(val text: String) : Exception(text)
/** This module's error presentation: the localized category, then the JSON location. */
object KitPresentation {
fun error(value: Throwable): String = when (value) {
is ImportError -> L10n.text(value.key) + "\n" + value.path
is KitMessageError -> value.text
else -> value.message ?: value.toString()
}
fun fileError(value: Throwable): String = when (value) {
is ImportError, is KitMessageError -> error(value)
else -> L10n.text("import.readError") + "\n" + (value.message ?: value.toString())
}
}
/** Deletes one complete timetable and preserves selected sessions in other events. */
object ScheduleDeletion {
class Result(val document: ScheduleDocument, val favorites: Set<String>)
/** An unknown event returns null so callers do not change or persist any state. */
fun deleteEvent(document: ScheduleDocument, id: String, favorites: Set<String>): Result? {
if (document.events.none { it.id == id }) return null
val remaining = ScheduleDocument(schemaVersion = document.schemaVersion,
events = document.events.filter { it.id != id })
val allowed = ScheduleFavorites.ids(remaining)
return Result(remaining, favorites.intersect(allowed))
}
}
@@ -0,0 +1,177 @@
package com.oshicue.lineup.core
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import java.time.Instant
import java.time.ZoneId
import java.time.temporal.ChronoUnit
/** Values that differ between the Oshicue family apps but are shared by this one. */
object AppBrand {
const val storageFolder = "OshicueLineup"
const val exportPrefix = "OshicueLineup-"
const val productName = "LINEUP"
const val fullName = "Oshicue Lineup"
}
/**
* ISO 8601 instants must carry Z or an explicit numeric offset, exactly as the iOS importer
* requires. A value without an offset is rejected instead of being read as device-local time.
*/
object InstantSerializer : KSerializer<Instant> {
private val pattern = Regex("""^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$""")
override val descriptor = PrimitiveSerialDescriptor("Instant", PrimitiveKind.STRING)
override fun deserialize(decoder: Decoder): Instant = parse(decoder.decodeString())
override fun serialize(encoder: Encoder, value: Instant) {
encoder.encodeString(format(value))
}
fun parse(text: String): Instant {
if (!pattern.matches(text)) throw SerializationException("Invalid timestamp '$text'")
val instant = try {
Instant.parse(text)
} catch (_: Exception) {
try {
java.time.OffsetDateTime.parse(text).toInstant()
} catch (_: Exception) {
throw SerializationException("Invalid timestamp '$text'")
}
}
// The calendar fields must survive a round trip, so 2026-02-30 is rejected.
val offsetText = if (text.endsWith("Z")) null else text.takeLast(6)
val zone = if (offsetText == null) ZoneId.of("UTC") else ZoneId.of(offsetText)
val local = instant.atZone(zone)
val head = text.take(19)
val expected = "${local.year.toString().padStart(4, '0')}-${local.monthValue.toString().padStart(2, '0')}-" +
"${local.dayOfMonth.toString().padStart(2, '0')}T${local.hour.toString().padStart(2, '0')}:" +
"${local.minute.toString().padStart(2, '0')}:${local.second.toString().padStart(2, '0')}"
if (expected != head) throw SerializationException("Invalid timestamp '$text'")
return instant
}
/** Written with milliseconds, matching the iOS encoder that keeps reimports byte-stable. */
fun format(value: Instant): String {
val truncated = value.truncatedTo(ChronoUnit.MILLIS)
val text = truncated.toString()
return if (text.endsWith("Z")) text else text + "Z"
}
}
@Serializable
data class ScheduleDocument(
val schemaVersion: Int = 1,
val events: List<FestivalEvent> = emptyList(),
) {
/**
* A repeated event ID replaces its complete timetable. Other imported events remain available,
* so the order is every untouched event followed by the incoming ones.
*/
fun merging(incoming: ScheduleDocument): ScheduleDocument {
val newIDs = incoming.events.map { it.id }.toSet()
return ScheduleDocument(events = events.filter { it.id !in newIDs } + incoming.events)
}
}
@Serializable
data class FestivalEvent(
val id: String,
val name: String,
val city: String,
val timeZone: String,
val venues: List<Venue> = emptyList(),
val artists: List<Artist> = emptyList(),
val sessions: List<FestivalSession> = emptyList(),
) {
val zone: ZoneId
get() = runCatching { ZoneId.of(timeZone) }.getOrElse { ZoneId.of("UTC") }
fun artist(id: String): Artist? = artists.firstOrNull { it.id == id }
fun venue(id: String): Venue? = venues.firstOrNull { it.id == id }
/** Sessions overlapping the local civil day that contains [date]. */
fun sessionsOn(date: Instant): List<FestivalSession> {
val start = date.atZone(zone).toLocalDate().atStartOfDay(zone).toInstant()
val end = date.atZone(zone).toLocalDate().plusDays(1).atStartOfDay(zone).toInstant()
return sessions
.filter { it.startsAt < end && it.endsAt > start }
.sortedWith(compareBy({ it.startsAt }, { it.id }))
}
/** Every local civil day touched by a session, including sessions that cross midnight. */
fun days(): List<java.time.LocalDate> {
val result = sortedSetOf<java.time.LocalDate>()
for (session in sessions) {
var day = session.startsAt.atZone(zone).toLocalDate()
val last = session.endsAt.atZone(zone).toLocalDate()
while (day <= last) {
result.add(day)
day = day.plusDays(1)
}
}
return result.toList()
}
}
@Serializable
data class Venue(val id: String, val name: String, val color: String)
@Serializable
data class Artist(val id: String, val name: String)
@Serializable
enum class SessionKind {
@SerialName("live") Live,
@SerialName("goods") Goods,
}
@Serializable
data class FestivalSession(
val id: String,
val artistID: String,
val venueID: String,
val kind: SessionKind,
@Serializable(with = InstantSerializer::class) val startsAt: Instant,
@Serializable(with = InstantSerializer::class) val endsAt: Instant,
val area: String? = null,
val notes: String? = null,
)
/** Search compares case, diacritics and full-width forms as equal, as the iOS importer does. */
object TextNormalizer {
private fun fold(value: String): String =
java.text.Normalizer.normalize(value, java.text.Normalizer.Form.NFKD)
.lowercase(java.util.Locale.ROOT)
.replace(" ", " ")
fun contains(haystack: String, needle: String): Boolean = fold(haystack).contains(fold(needle))
fun equalsFolded(left: String, right: String): Boolean = fold(left) == fold(right)
}
/** Session keys are unique within one event, so both IDs identify a selection. */
object ScheduleFavorites {
/** The event's byte length keeps arbitrary IDs from producing ambiguous keys. */
fun id(eventID: String, sessionID: String): String =
eventID.toByteArray(Charsets.UTF_8).size.toString() + ":" + eventID + sessionID
fun ids(document: ScheduleDocument): Set<String> = document.events.flatMap { event ->
event.sessions.map { id(eventID = event.id, sessionID = it.id) }
}.toSet()
/** Expands a selection of whole artists to every session they perform. */
fun forArtistIDs(document: ScheduleDocument, artistIDs: Set<String>): Set<String> =
document.events.flatMap { event ->
event.sessions.filter { it.artistID in artistIDs }
.map { id(eventID = event.id, sessionID = it.id) }
}.toSet()
}
@@ -0,0 +1,96 @@
package com.oshicue.lineup.core
import android.content.Context
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.intOrNull
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.put
/**
* Local file layout: the imported timetable schema is unchanged, and the app-only preferences
* (selections and the demo flag) sit beside it.
*/
@Serializable
data class ScheduleSavedState(
val document: ScheduleDocument,
val favorites: Set<String>,
val isDemo: Boolean,
val favoritesVersion: Int = 2,
) {
/** A state built in the app keeps only selections that still exist. */
fun normalized(): ScheduleSavedState {
val allowed = ScheduleFavorites.ids(document)
return copy(favorites = favorites.intersect(allowed))
}
}
/** Saves and reads the whole timetable state; nothing changes when a write fails. */
class ScheduleRepository(context: Context) {
private val file = KitStorageFile(context, "schedule.json")
private val json = Json {
ignoreUnknownKeys = true
prettyPrint = true
encodeDefaults = true
}
val hasSavedData: Boolean get() = file.hasSavedData
class Loaded(val state: ScheduleSavedState, val migrated: Boolean)
fun load(): Loaded {
val text = file.read().toString(Charsets.UTF_8)
val root = json.parseToJsonElement(text).jsonObject
val document = ScheduleImporter.run {
// The saved document is validated exactly like an import, so a hand-edited file is caught.
val parsed = json.decodeFromJsonElement(ScheduleDocument.serializer(), root["document"]!!)
validate(parsed)
parsed
}
val version = root["favoritesVersion"]?.jsonPrimitive?.intOrNull ?: 1
val saved = root["favorites"]?.let {
json.decodeFromJsonElement(kotlinx.serialization.builtins.SetSerializer(String.serializer()), it)
} ?: emptySet()
val state = when (version) {
1 -> {
// Version 1 stored selected artists rather than sessions.
val expanded = ScheduleFavorites.forArtistIDs(document, saved)
ScheduleSavedState(document = document, favorites = expanded,
isDemo = root["isDemo"]?.jsonPrimitive?.contentOrNull?.toBoolean() ?: false)
}
2 -> ScheduleSavedState(
document = document,
favorites = saved.intersect(ScheduleFavorites.ids(document)),
isDemo = root["isDemo"]?.jsonPrimitive?.contentOrNull?.toBoolean() ?: false,
)
else -> throw ImportError("import.error.schemaVersion",
"Unsupported schedule favorites version $version.", "$.favoritesVersion")
}
return Loaded(state, migrated = version != 2 || state.favorites != saved)
}
fun save(state: ScheduleSavedState) {
val normalized = state.normalized()
val document = ScheduleImporter.encode(normalized.document)
val documentElement = json.parseToJsonElement(document)
val favoritesElement = json.encodeToJsonElement(
kotlinx.serialization.builtins.SetSerializer(String.serializer()), normalized.favorites)
val root = buildJsonObject {
put("document", documentElement)
put("favorites", favoritesElement)
put("isDemo", normalized.isDemo)
put("favoritesVersion", 2)
}
file.write(json.encodeToString(JsonElement.serializer(), root).toByteArray(Charsets.UTF_8))
}
fun markUnreadable() = file.markUnreadable()
}
@@ -0,0 +1,84 @@
package com.oshicue.lineup.core
import java.time.Instant
data class TimelineItem(val id: String, val start: Instant, val end: Instant)
data class TimelinePlacement(val id: String, val lane: Int, val laneCount: Int) {
val relativeX: Double get() = lane.toDouble() / laneCount.toDouble()
val relativeWidth: Double get() = 1.0 / laneCount.toDouble()
}
/**
* A horizontally scrollable venue column. Its busiest overlap cluster determines the column
* width; each cluster still divides that width using its own lane count.
*/
data class TimelineColumnLayout(
val placements: List<TimelinePlacement>,
val width: Double,
val maximumLaneCount: Int,
)
object TimelineLayout {
/**
* Keeps simultaneous sessions readable by expanding their venue column rather than
* squeezing all lanes into a fixed width. Widths include the card's insets.
*/
fun column(
sessions: List<TimelineItem>,
minimumColumnWidth: Double,
minimumLaneWidth: Double,
): TimelineColumnLayout {
require(minimumColumnWidth.isFinite() && minimumColumnWidth > 0)
require(minimumLaneWidth.isFinite() && minimumLaneWidth > 0)
val placements = place(sessions)
val maximum = maxOf(1, placements.maxOfOrNull { it.laneCount } ?: 1)
return TimelineColumnLayout(
placements = placements,
width = maxOf(minimumColumnWidth, maximum.toDouble() * minimumLaneWidth),
maximumLaneCount = maximum,
)
}
/** Sessions that just touch at an endpoint share a lane. Width resets for each connected overlap cluster. */
fun place(sessions: List<TimelineItem>): List<TimelinePlacement> {
val sorted = sessions.sortedWith(
compareBy({ it.start }, { it.end }, { it.id }),
)
val placements = mutableListOf<TimelinePlacement>()
var cluster = mutableListOf<TimelineItem>()
var clusterEnd: Instant? = null
fun placeCluster() {
val laneEnds = mutableListOf<Instant>()
val assigned = mutableListOf<Pair<String, Int>>()
for (item in cluster) {
val freeLane = laneEnds.indexOfFirst { !it.isAfter(item.start) }
val lane = if (freeLane >= 0) {
laneEnds[freeLane] = item.end
freeLane
} else {
laneEnds.add(item.end)
laneEnds.size - 1
}
assigned.add(item.id to lane)
}
assigned.forEach { (id, lane) ->
placements.add(TimelinePlacement(id = id, lane = lane, laneCount = laneEnds.size))
}
}
for (item in sorted) {
val end = clusterEnd
if (end != null && !item.start.isBefore(end)) {
placeCluster()
cluster = mutableListOf()
clusterEnd = null
}
cluster.add(item)
clusterEnd = if (clusterEnd == null || item.end.isAfter(clusterEnd)) item.end else clusterEnd
}
if (cluster.isNotEmpty()) placeCluster()
return placements
}
}
@@ -0,0 +1,69 @@
package com.oshicue.lineup.ui
import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
import androidx.core.content.FileProvider
import com.oshicue.lineup.core.ScheduleDocument
import com.oshicue.lineup.core.ScheduleImporter
import java.io.File
/**
* Picks JSON files and returns their bytes. The system picker hands back content URIs, so the
* bytes are read through the content resolver rather than a file path.
*/
@Composable
fun rememberDocumentPicker(onPicked: (List<ByteArray>) -> Unit): () -> Unit {
val context = androidx.compose.ui.platform.LocalContext.current
val launcher = rememberLauncherForActivityResult(
ActivityResultContracts.OpenMultipleDocuments(),
) { uris: List<Uri> ->
if (uris.isEmpty()) return@rememberLauncherForActivityResult
onPicked(uris.mapNotNull { uri ->
runCatching { context.contentResolver.openInputStream(uri)?.use { it.readBytes() } }.getOrNull()
})
}
return remember {
{ launcher.launch(arrayOf("application/json", "text/plain", "*/*")) }
}
}
/** One picker batch, parsed and combined through the module's importer. */
fun parsePickedDocuments(bytess: List<ByteArray>): ScheduleDocument =
ScheduleImporter.combining(bytess.map { ScheduleImporter.parse(it) })
/**
* Writes an export into the app's cache and opens the system share sheet. This is the Android
* equivalent of the iOS file exporter plus share link: the user chooses where the file goes.
*/
fun shareText(context: Context, text: String, filename: String, mimeType: String = "application/json") {
val directory = File(context.cacheDir, "exports").apply { mkdirs() }
val file = File(directory, filename)
file.writeText(text, Charsets.UTF_8)
val uri: Uri = FileProvider.getUriForFile(context, context.packageName + ".fileprovider", file)
val intent = Intent(Intent.ACTION_SEND).apply {
type = mimeType
putExtra(Intent.EXTRA_STREAM, uri)
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
context.startActivity(Intent.createChooser(intent, filename))
}
/** Remembers a create-document launcher whose written contents are set at share time. */
@Stable
class DocumentSaver internal constructor(private val launch: (String) -> Unit) {
fun save(filename: String) = launch(filename)
}
@Composable
fun rememberDocumentSaver(onWrite: (Uri) -> Unit): DocumentSaver {
val launcher = rememberLauncherForActivityResult(
ActivityResultContracts.CreateDocument("application/json"),
) { uri -> if (uri != null) onWrite(uri) }
return remember { DocumentSaver { filename -> launcher.launch(filename) } }
}
@@ -0,0 +1,195 @@
package com.oshicue.lineup.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.Icon
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontVariation
import com.oshicue.lineup.R
import com.oshicue.lineup.core.AppBrand
import com.oshicue.lineup.core.L10n
/**
* Unbounded at weight 900 — the same typeface and weight the iOS wordmark uses. The bundled file is
* a variable font (wght 200-900), so the axis is set explicitly instead of relying on the default
* 400 instance, which would look lighter than the iOS logo beside it.
*/
val BrandFont = FontFamily(
Font(
R.font.unbounded_regular,
weight = FontWeight.Black,
variationSettings = FontVariation.Settings(FontVariation.weight(900)),
),
)
/** The Oshicue family wordmark, with CUE in the family pink. */
@Composable
fun BrandWordmark(modifier: Modifier = Modifier) {
Row(modifier, verticalAlignment = Alignment.Bottom) {
Text("OSHI", color = Kit.colors.ink, fontFamily = BrandFont, fontSize = 18.sp, letterSpacing = 0.25.sp)
Text("CUE", color = Kit.colors.familyPink, fontFamily = BrandFont, fontSize = 18.sp, letterSpacing = 0.25.sp)
Spacer(Modifier.width(5.dp))
Text(AppBrand.productName, color = Kit.colors.ink, fontFamily = BrandFont, fontSize = 10.sp, letterSpacing = 0.6.sp)
}
}
/** The wordmark row at the top of every page, with that page's actions on the right. */
@Composable
fun KitTopBar(bottomPadding: Int = 8, actions: @Composable () -> Unit) {
Row(
modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp).padding(top = 2.dp, bottom = bottomPadding.dp),
verticalAlignment = Alignment.CenterVertically,
) {
BrandWordmark()
Spacer(Modifier.weight(1f))
actions()
}
}
@Composable
fun CircleIconButton(symbol: ImageVector, label: String, onClick: () -> Unit) {
Box(
modifier = Modifier
.size(42.dp)
.clip(CircleShape)
.background(Kit.colors.surface)
.border(1.dp, Kit.colors.line, CircleShape)
.clickable(onClick = onClick),
contentAlignment = Alignment.Center,
) {
Icon(symbol, contentDescription = label, tint = Kit.colors.ink, modifier = Modifier.size(19.dp))
}
}
@Composable
fun KitSearchField(text: String, prompt: String, onTextChange: (String) -> Unit, modifier: Modifier = Modifier) {
Row(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(14.dp))
.background(Kit.colors.surface)
.padding(13.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Filled.Search, contentDescription = null, tint = Kit.colors.muted, modifier = Modifier.size(18.dp))
Spacer(Modifier.width(10.dp))
Box(Modifier.weight(1f)) {
if (text.isEmpty()) {
Text(prompt, color = Kit.colors.muted, fontSize = 15.sp)
}
BasicTextField(
value = text,
onValueChange = onTextChange,
singleLine = true,
textStyle = LocalTextStyle.current.copy(color = Kit.colors.ink, fontSize = 15.sp),
cursorBrush = androidx.compose.ui.graphics.SolidColor(Kit.colors.accentText),
modifier = Modifier.fillMaxWidth(),
)
}
if (text.isNotEmpty()) {
Icon(
Icons.Filled.Close,
contentDescription = L10n.text("common.clearSearch"),
tint = Kit.colors.muted,
modifier = Modifier.size(18.dp).clickable { onTextChange("") },
)
}
}
}
@Composable
fun KitSheetHeader(symbol: ImageVector, title: String, subtitle: String) {
Row(verticalAlignment = Alignment.CenterVertically) {
Box(
modifier = Modifier
.size(56.dp)
.clip(RoundedCornerShape(16.dp))
.background(Kit.colors.surface),
contentAlignment = Alignment.Center,
) {
Icon(symbol, contentDescription = null, tint = Kit.colors.accentText, modifier = Modifier.size(25.dp))
}
Spacer(Modifier.width(12.dp))
Column(verticalArrangement = Arrangement.spacedBy(5.dp)) {
Text(title, fontSize = 19.sp, fontWeight = FontWeight.Bold, color = Kit.colors.ink)
Text(subtitle, fontSize = 12.sp, color = Kit.colors.muted)
}
}
}
@Composable
fun KitErrorBox(message: String, modifier: Modifier = Modifier) {
Text(
message,
color = Color(0xFFC62828),
fontSize = 12.sp,
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(Color(0xFFC62828).copy(alpha = 0.05f))
.padding(12.dp),
)
}
/** A grouped card on the page background. */
@Composable
fun KitCard(spacing: Int = 13, content: @Composable () -> Unit) {
Column(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(Kit.colors.surface)
.padding(18.dp),
verticalArrangement = Arrangement.spacedBy(spacing.dp),
) { content() }
}
@Composable
fun KitSectionLabel(text: String) {
Text(text, fontSize = 11.sp, fontWeight = FontWeight.Bold, letterSpacing = 1.2.sp, color = Kit.colors.muted)
}
fun toggle(set: Set<String>, value: String): Set<String> =
if (value in set) set - value else set + value
/** Ellipsis-truncated single-line text with the shared card typography. */
@Composable
fun KitLine(text: String, style: TextStyle, modifier: Modifier = Modifier, maxLines: Int = 1) {
Text(text, style = style, maxLines = maxLines, overflow = TextOverflow.Ellipsis, modifier = modifier)
}
@Composable
fun KitDivider(modifier: Modifier = Modifier) {
Box(modifier.fillMaxWidth().height(1.dp).background(Kit.colors.line))
}
@@ -0,0 +1,272 @@
package com.oshicue.lineup.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.FavoriteBorder
import androidx.compose.material.icons.filled.GraphicEq
import androidx.compose.material.icons.filled.RadioButtonUnchecked
import androidx.compose.material.icons.filled.ShoppingBag
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog
import com.oshicue.lineup.core.FestivalEvent
import com.oshicue.lineup.core.KitDate
import com.oshicue.lineup.core.KitPresentation
import com.oshicue.lineup.core.L10n
import com.oshicue.lineup.core.SessionKind
import java.time.ZoneId
/** Detail for one session: artist, kind, local time, venue, event and the selection toggle. */
@Composable
fun SessionDetailDialog(entry: SessionEntry, store: ScheduleStore, zone: ZoneId, onDismiss: () -> Unit) {
val state by store.state.collectAsStateWithLifecycle()
val favorite = state.favorites.contains(entry.id)
Dialog(onDismissRequest = onDismiss) {
Column(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(22.dp))
.background(Kit.colors.background)
.heightIn(max = 620.dp)
.verticalScroll(rememberScrollState())
.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(14.dp),
) {
Row(verticalAlignment = Alignment.Top) {
Box(
Modifier
.width(5.dp).height(56.dp)
.clip(RoundedCornerShape(5.dp))
.background(Kit.parse(entry.venue.color)),
)
Spacer(Modifier.width(13.dp))
Column(verticalArrangement = Arrangement.spacedBy(7.dp)) {
Text(entry.artist, fontSize = 23.sp, fontWeight = FontWeight.Bold, color = Kit.colors.ink)
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(
if (entry.session.kind == SessionKind.Live) Icons.Filled.GraphicEq else Icons.Filled.ShoppingBag,
contentDescription = null, tint = Kit.colors.muted, modifier = Modifier.size(14.dp),
)
Spacer(Modifier.width(5.dp))
Text(entry.kindName, fontSize = 14.sp, color = Kit.colors.muted)
}
}
}
DetailLine(L10n.text("schedule.event"), entry.event.name)
DetailLine(L10n.text("schedule.venue"), entry.venue.name)
DetailLine(L10n.text("schedule.timeZone"), zone.id)
Text(KitDate.string(entry.session.startsAt, "yyyy.MM.dd EEE", zone), fontSize = 14.sp, color = Kit.colors.ink)
Text(
KitDate.time(entry.session.startsAt, zone) + " — " + KitDate.time(entry.session.endsAt, zone),
fontSize = 19.sp, fontWeight = FontWeight.Bold, color = Kit.colors.ink,
)
entry.session.area?.let { Text(it, fontSize = 14.sp, color = Kit.colors.muted) }
// The event's own time zone is shown only when the timetable uses a different one.
if (zone != entry.event.zone) {
Text(
entry.event.timeZone + " · " +
KitDate.time(entry.session.startsAt, entry.event.zone) + " — " +
KitDate.time(entry.session.endsAt, entry.event.zone),
fontSize = 12.sp, color = Kit.colors.muted,
)
}
entry.session.notes?.takeIf { it.isNotBlank() }?.let { notes ->
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(L10n.text("schedule.notes"), fontSize = 12.sp, fontWeight = FontWeight.Bold, color = Kit.colors.muted)
Text(notes, fontSize = 14.sp, color = Kit.colors.ink)
}
}
Row(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(14.dp))
.background(Kit.colors.surface)
.clickable { store.toggleFavorite(entry.id) }
.padding(14.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
if (favorite) Icons.Filled.Favorite else Icons.Filled.FavoriteBorder,
contentDescription = null, tint = Kit.colors.accentText, modifier = Modifier.size(18.dp),
)
Spacer(Modifier.width(8.dp))
Text(L10n.text(if (favorite) "schedule.unfavorite" else "schedule.favorite"),
fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.accentText)
}
TextButton(onClick = onDismiss, modifier = Modifier.align(Alignment.End)) {
Text(L10n.text("common.done"), color = Kit.colors.accentText)
}
}
}
}
@Composable
private fun DetailLine(label: String, value: String) {
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.Top) {
Text(label, fontSize = 13.sp, color = Kit.colors.muted, modifier = Modifier.width(96.dp))
Text(value, fontSize = 13.sp, color = Kit.colors.ink, modifier = Modifier.weight(1f))
}
}
/** Chooses which timetables are visible, and deletes a whole timetable behind a confirmation. */
@Composable
fun EventSelectionDialog(
store: ScheduleStore,
selection: Set<String>,
onSelectionChange: (Set<String>) -> Unit,
onDismiss: () -> Unit,
onOpenImport: () -> Unit,
) {
val state by store.state.collectAsStateWithLifecycle()
val events = state.document.events
var pendingDeletion by remember { mutableStateOf<FestivalEvent?>(null) }
var error by remember { mutableStateOf<String?>(null) }
Dialog(onDismissRequest = onDismiss) {
Column(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(22.dp))
.background(Kit.colors.background)
.heightIn(max = 640.dp),
) {
Row(Modifier.fillMaxWidth().padding(horizontal = 20.dp).padding(top = 18.dp, bottom = 10.dp),
verticalAlignment = Alignment.CenterVertically) {
Text(L10n.text("schedule.selectEvents"), fontSize = 17.sp, fontWeight = FontWeight.Bold, color = Kit.colors.ink)
Spacer(Modifier.weight(1f))
Text(
L10n.text("common.done"), fontSize = 14.sp, fontWeight = FontWeight.SemiBold,
color = Kit.colors.accentText, modifier = Modifier.clickable(onClick = onDismiss).padding(6.dp),
)
}
error?.let {
KitErrorBox(it, Modifier.padding(horizontal = 20.dp).padding(bottom = 8.dp))
}
if (events.isEmpty()) {
Column(
Modifier.fillMaxWidth().padding(36.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
Text(L10n.text("schedule.noEvents"), fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.ink)
Text(L10n.text("schedule.noEventsHint"), fontSize = 12.sp, color = Kit.colors.muted)
Text(
L10n.text("import.title"), fontSize = 14.sp, fontWeight = FontWeight.SemiBold,
color = Kit.colors.accentText, modifier = Modifier.clickable(onClick = onOpenImport).padding(6.dp),
)
}
} else {
Row(Modifier.fillMaxWidth().padding(horizontal = 20.dp)) {
Text(
L10n.text("common.selectAll"), fontSize = 13.sp, color = Kit.colors.accentText,
modifier = Modifier.clickable { onSelectionChange(events.map { it.id }.toSet()) }.padding(6.dp),
)
Spacer(Modifier.width(14.dp))
Text(
L10n.text("common.deselectAll"), fontSize = 13.sp, color = Kit.colors.accentText,
modifier = Modifier.clickable { onSelectionChange(emptySet()) }.padding(6.dp),
)
}
LazyColumn(Modifier.fillMaxWidth().heightIn(max = 420.dp).padding(horizontal = 14.dp)) {
items(events, key = { it.id }) { event ->
val selected = event.id in selection
Row(
Modifier.fillMaxWidth().padding(vertical = 4.dp)
.clip(RoundedCornerShape(14.dp))
.background(Kit.colors.surface)
.padding(14.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Row(
Modifier.weight(1f).clickable {
onSelectionChange(if (selected) selection - event.id else selection + event.id)
},
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
if (selected) Icons.Filled.CheckCircle else Icons.Filled.RadioButtonUnchecked,
contentDescription = null,
tint = if (selected) Kit.colors.accentText else Kit.colors.muted,
modifier = Modifier.size(20.dp),
)
Spacer(Modifier.width(10.dp))
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(event.name, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.ink)
Text(event.city + " · " + event.timeZone, fontSize = 12.sp, color = Kit.colors.muted)
Text(L10n.format("import.summary", 1, event.sessions.size),
fontSize = 11.sp, color = Kit.colors.muted)
}
}
Spacer(Modifier.width(8.dp))
Text(
L10n.text("schedule.deleteEvent"), fontSize = 11.sp, fontWeight = FontWeight.SemiBold,
color = Color(0xFFC62828),
modifier = Modifier.clickable { pendingDeletion = event }.padding(6.dp),
)
}
}
}
}
}
}
pendingDeletion?.let { event ->
AlertDialog(
onDismissRequest = { pendingDeletion = null },
title = { Text(L10n.text("schedule.deleteEventTitle"), fontWeight = FontWeight.Bold) },
text = { Text(L10n.format("schedule.deleteEventMessage", event.name)) },
confirmButton = {
TextButton(onClick = {
if (store.deleteEvent(event.id)) {
onSelectionChange(selection - event.id)
error = null
} else {
error = store.takeError()
}
pendingDeletion = null
}) { Text(L10n.text("schedule.deleteEvent"), color = Color(0xFFC62828)) }
},
dismissButton = {
TextButton(onClick = { pendingDeletion = null }) { Text(L10n.text("common.cancel")) }
},
containerColor = Kit.colors.surface,
)
}
}
@@ -0,0 +1,282 @@
package com.oshicue.lineup.ui
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Description
import androidx.compose.material.icons.filled.FileOpen
import androidx.compose.material.icons.filled.PlayCircle
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.oshicue.lineup.core.KitMessageError
import com.oshicue.lineup.core.KitPresentation
import com.oshicue.lineup.core.L10n
import com.oshicue.lineup.core.ScheduleDocument
import com.oshicue.lineup.core.ScheduleImporter
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
/**
* Paste a timetable, validate it, preview what will be applied, then confirm — or load the
* example timetable. Picking a JSON file fills the same editor, so what is applied is what the
* editor shows.
*/
@Composable
fun ScheduleImportScreen(store: ScheduleStore, onClose: () -> Unit) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var text by remember { mutableStateOf("") }
var candidate by remember { mutableStateOf<ScheduleDocument?>(null) }
var pendingFile by remember { mutableStateOf<ScheduleDocument?>(null) }
var error by remember { mutableStateOf<String?>(null) }
var copied by remember { mutableStateOf(false) }
var demoError by remember { mutableStateOf<String?>(null) }
val isDemo = store.state.collectAsStateWithLifecycle().value.isDemo
val pickFiles = rememberDocumentPicker { bytess ->
runCatching { parsePickedDocuments(bytess) }
.onSuccess { document ->
if (document.events.none { it.sessions.isNotEmpty() }) {
candidate = null
error = L10n.text("import.empty")
return@rememberDocumentPicker
}
val encoded = ScheduleImporter.encode(document)
if (encoded == text) {
candidate = document
error = null
} else {
pendingFile = document
text = encoded
}
}
.onFailure { failure ->
candidate = null
error = KitPresentation.fileError(failure)
}
}
BackHandler(onBack = onClose)
Column(Modifier.fillMaxSize().background(Kit.colors.background)) {
SheetBar(L10n.text("import.title"), onClose)
Column(
Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(18.dp),
) {
KitSheetHeader(Icons.Filled.FileOpen, L10n.text("import.paste"), "JSON · UTF-8")
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
Row(
Modifier
.clip(RoundedCornerShape(10.dp))
.background(Kit.colors.surface)
.clickable { pickFiles() }
.padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Filled.FileOpen, contentDescription = null, tint = Kit.colors.accentText, modifier = Modifier.width(15.dp))
Spacer(Modifier.width(6.dp))
Text(L10n.text("import.file"), fontSize = 13.sp, color = Kit.colors.accentText)
}
Spacer(Modifier.weight(1f))
Row(
Modifier
.clip(RoundedCornerShape(10.dp))
.background(Kit.colors.surface)
.clickable {
scope.launch {
runCatching { readAsset(context, "templates/timetable-template.json") }
.onSuccess { copyToClipboard(context, it); copied = true }
.onFailure { error = KitPresentation.error(it) }
}
}
.padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Filled.Description, contentDescription = null, tint = Kit.colors.accentText, modifier = Modifier.width(15.dp))
Spacer(Modifier.width(6.dp))
Text(L10n.text(if (copied) "import.copied" else "import.copyTemplate"), fontSize = 13.sp, color = Kit.colors.accentText)
}
}
Column(
Modifier
.fillMaxWidth()
.height(230.dp)
.clip(RoundedCornerShape(14.dp))
.background(Kit.colors.surface)
.padding(10.dp),
) {
if (text.isEmpty()) {
Text(L10n.text("import.placeholder"), fontSize = 12.sp, color = Kit.colors.muted, modifier = Modifier.padding(8.dp))
}
BasicTextField(
value = text,
onValueChange = {
text = it
val fileCandidate = pendingFile
pendingFile = null
candidate = fileCandidate
error = null
},
textStyle = androidx.compose.ui.text.TextStyle(
fontFamily = FontFamily.Monospace, fontSize = 12.sp, color = Kit.colors.ink,
),
cursorBrush = androidx.compose.ui.graphics.SolidColor(Kit.colors.accentText),
modifier = Modifier.fillMaxSize(),
)
}
ProminentButton(L10n.text("import.validate"), enabled = text.isNotBlank()) {
runCatching { ScheduleImporter.parse(text) }
.onSuccess { document ->
if (document.events.none { it.sessions.isNotEmpty() }) {
error = L10n.text("import.empty")
candidate = null
} else {
candidate = document
error = null
}
}
.onFailure { failure ->
candidate = null
error = KitPresentation.error(failure)
}
}
error?.let { KitErrorBox(it) }
candidate?.let { preview ->
KitCard(spacing = 12) {
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(Icons.Filled.CheckCircle, contentDescription = null, tint = androidx.compose.ui.graphics.Color(0xFF2E9E5B), modifier = Modifier.width(17.dp))
Spacer(Modifier.width(7.dp))
Text(L10n.text("import.preview"), fontSize = 17.sp, fontWeight = FontWeight.Bold, color = Kit.colors.ink)
}
Text(L10n.format("import.summary", preview.events.size, preview.events.sumOf { it.sessions.size }), fontSize = 14.sp, color = Kit.colors.ink)
preview.events.forEach { event ->
Column(verticalArrangement = Arrangement.spacedBy(3.dp)) {
Text(event.name, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.ink)
Text(event.city + " · " + event.timeZone, fontSize = 12.sp, color = Kit.colors.muted)
}
}
Text(L10n.text(if (isDemo) "import.replacesDemo" else "import.updateHint"), fontSize = 12.sp, color = Kit.colors.muted)
ProminentButton(L10n.text("import.apply")) {
if (store.importDocument(preview)) {
onClose()
} else {
error = store.takeError()
}
}
}
}
Text(L10n.text("import.timeZonesHint"), fontSize = 12.sp, color = Kit.colors.muted)
KitDivider()
KitCard {
Text(L10n.text("settings.demoLabel"), fontSize = 17.sp, fontWeight = FontWeight.Bold, color = Kit.colors.ink)
Row(
Modifier
.clip(RoundedCornerShape(10.dp))
.background(Kit.colors.surfaceMuted)
.clickable {
if (store.loadDemo()) onClose() else demoError = store.takeError()
}
.padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Filled.PlayCircle, contentDescription = null, tint = Kit.colors.ink, modifier = Modifier.width(15.dp))
Spacer(Modifier.width(6.dp))
Text(L10n.text("settings.loadDemo"), fontSize = 13.sp, color = Kit.colors.ink)
}
Text(L10n.text("settings.demoHint"), fontSize = 12.sp, color = Kit.colors.muted)
demoError?.let { KitErrorBox(it) }
}
}
}
}
/** A full-width filled call to action, the Android form of `kitProminent()`. */
@Composable
fun ProminentButton(label: String, enabled: Boolean = true, onClick: () -> Unit) {
Text(
label,
fontSize = 15.sp,
fontWeight = FontWeight.SemiBold,
color = Kit.colors.onAccent,
textAlign = androidx.compose.ui.text.style.TextAlign.Center,
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(if (enabled) Kit.colors.accentFill else Kit.colors.accentFill.copy(alpha = 0.4f))
.clickable(enabled = enabled, onClick = onClick)
.padding(vertical = 13.dp),
)
}
/** The bar every full-page sheet uses: a close button on the left and the page title. */
@Composable
fun SheetBar(title: String, onClose: () -> Unit, action: (@Composable () -> Unit)? = null) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp).padding(top = 10.dp, bottom = 6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
Icons.Filled.Close, contentDescription = L10n.text("common.close"), tint = Kit.colors.ink,
modifier = Modifier.width(22.dp).clickable(onClick = onClose),
)
Spacer(Modifier.width(14.dp))
Text(title, fontSize = 17.sp, fontWeight = FontWeight.Bold, color = Kit.colors.ink)
Spacer(Modifier.weight(1f))
action?.invoke()
}
}
/** Reads a bundled asset as text; the timetable and example templates live in assets/templates. */
suspend fun readAsset(context: android.content.Context, path: String): String = withContext(Dispatchers.IO) {
context.assets.open(path).use { it.readBytes().toString(Charsets.UTF_8) }
}
private fun copyToClipboard(context: android.content.Context, text: String) {
val manager = context.getSystemService(android.content.ClipboardManager::class.java)
manager.setPrimaryClip(android.content.ClipData.newPlainText("JSON", text))
}
@@ -0,0 +1,340 @@
package com.oshicue.lineup.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.clickable
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowForward
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.filled.FileDownload
import androidx.compose.material.icons.filled.StackedLineChart
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.oshicue.lineup.core.FestivalEvent
import com.oshicue.lineup.core.KitDate
import com.oshicue.lineup.core.KitDateLabels
import com.oshicue.lineup.core.L10n
import com.oshicue.lineup.core.ScheduleFavorites
import com.oshicue.lineup.core.SessionKind
import kotlinx.coroutines.delay
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
/** The filter and search choices shared by 全部日程 and 我的日程, so switching tabs keeps them. */
class TimetableUiState {
var selectedEventIDs by mutableStateOf<Set<String>>(emptySet())
var selectedDay by mutableStateOf<LocalDate?>(null)
var kind by mutableStateOf<SessionKind?>(null)
var zoom by mutableStateOf(4f)
var query by mutableStateOf("")
var showSearch by mutableStateOf(false)
}
/** One timetable tab. 全部日程 shows every session; 我的日程 shows only the selected ones. */
@Composable
fun ScheduleScreen(
store: ScheduleStore,
stateLineup: LineupUiState,
state: TimetableUiState,
mine: Boolean,
onOpenImport: () -> Unit,
onOpenSettings: () -> Unit,
) {
val document = stateLineup.document
val favorites = stateLineup.favorites
val events = document.events.filter { it.id in state.selectedEventIDs }
val zone = events.firstOrNull()?.zone ?: document.events.firstOrNull()?.zone ?: ZoneId.systemDefault()
val days = remember(document, state.selectedEventIDs) {
events.flatMap { it.days() }.distinct().sorted()
}
val day = state.selectedDay ?: days.firstOrNull() ?: LocalDate.now(zone)
val allEntries = remember(document, day, zone, events) {
val start = day.atStartOfDay(zone).toInstant()
val end = day.plusDays(1).atStartOfDay(zone).toInstant()
events.flatMap { event ->
event.sessions.filter { it.startsAt < end && it.endsAt > start }.map { SessionEntry(event, it) }
}.sortedWith(compareBy({ it.session.startsAt }, { it.session.id }))
}
val visible = allEntries.filter { entry ->
(if (mine) favorites.contains(entry.id) else (state.kind == null || entry.session.kind == state.kind)) &&
matchesSearch(entry, state.query)
}
// A second-by-second tick keeps the "now" line honest without re-reading anything.
var now by remember { mutableStateOf(Instant.now()) }
LaunchedEffect(Unit) {
while (true) {
now = Instant.now()
delay(15_000)
}
}
LaunchedEffect(document) {
if (state.selectedEventIDs.isEmpty()) state.selectedEventIDs = document.events.map { it.id }.toSet()
}
var showEvents by remember { mutableStateOf(false) }
var detail by remember { mutableStateOf<SessionEntry?>(null) }
var jumpToken by remember { mutableIntStateOf(0) }
Column(Modifier.fillMaxSize().background(Kit.colors.background)) {
KitTopBar(bottomPadding = 10) {
CircleIconButton(if (state.showSearch) Icons.Filled.Close else Icons.Filled.Search,
L10n.text(if (state.showSearch) "schedule.search.close" else "schedule.search")) {
state.showSearch = !state.showSearch
if (!state.showSearch) state.query = ""
}
Spacer(Modifier.width(8.dp))
CircleIconButton(Icons.Filled.FileDownload, L10n.text("import.title"), onOpenImport)
}
Heading(state, mine, events, onOpenEvents = { showEvents = true })
DayPicker(days, day, zone) { selected ->
state.selectedDay = selected
}
if (state.showSearch) {
KitSearchField(state.query, L10n.text("schedule.search.prompt"), { state.query = it },
modifier = Modifier.padding(horizontal = 20.dp).padding(bottom = 12.dp))
}
FilterBar(state, mine, conflicts = if (mine) conflictCount(visible) else 0)
if (visible.isEmpty()) {
EmptyTimetable(searching = state.query.isNotEmpty() && allEntries.isNotEmpty(), mine = mine)
} else {
Box(Modifier.weight(1f).fillMaxWidth()) {
TimelineBoard(
entries = visible, allEntries = allEntries, mine = mine, zone = zone, day = day,
zoom = state.zoom, favorites = favorites, now = now, jumpToken = jumpToken,
onFavorite = { store.toggleFavorite(it.id) },
onDetail = { detail = it },
)
NowButton(Modifier.align(Alignment.BottomEnd).padding(16.dp)) { jumpToken++ }
}
}
}
if (showEvents) {
EventSelectionDialog(
store = store,
selection = state.selectedEventIDs,
onSelectionChange = { state.selectedEventIDs = it },
onDismiss = { showEvents = false },
onOpenImport = onOpenImport,
)
}
detail?.let { entry ->
SessionDetailDialog(entry, store, zone, onDismiss = { detail = null })
}
}
private fun matchesSearch(entry: SessionEntry, query: String): Boolean {
val words = query.split(Regex("\\s+")).filter { it.isNotEmpty() }
if (words.isEmpty()) return true
val fields = listOf(
entry.event.artist(entry.session.artistID)?.name ?: entry.session.artistID,
entry.venue.name,
entry.session.area ?: "",
entry.session.notes ?: "",
).joinToString("\n")
return words.all { com.oshicue.lineup.core.TextNormalizer.contains(fields, it) }
}
private fun conflictCount(items: List<SessionEntry>): Int = items.indices.count { i ->
items.indices.any { j ->
j > i && items[i].session.startsAt < items[j].session.endsAt && items[j].session.startsAt < items[i].session.endsAt
}
}
@Composable
private fun Heading(state: TimetableUiState, mine: Boolean, events: List<FestivalEvent>, onOpenEvents: () -> Unit) {
Row(Modifier.fillMaxWidth().padding(horizontal = 20.dp).padding(bottom = 10.dp)) {
Column(verticalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier.weight(1f)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Box(Modifier.clip(RoundedCornerShape(50)).background(Kit.colors.accent).height(5.dp).width(5.dp))
Spacer(Modifier.width(6.dp))
Text(
if (events.size > 1) L10n.text("schedule.allEvents")
else events.firstOrNull()?.city ?: L10n.text("schedule.title"),
fontSize = 10.sp, fontWeight = FontWeight.Bold, letterSpacing = 1.4.sp, color = Kit.colors.muted,
)
}
Text(
L10n.text(if (mine) "schedule.mine" else "schedule.title"),
style = KitTitleStyle, color = Kit.colors.ink, maxLines = 1, overflow = TextOverflow.Ellipsis,
)
}
Spacer(Modifier.width(12.dp))
Row(
Modifier
.clip(RoundedCornerShape(12.dp))
.background(Kit.colors.surface)
.clickable(onClick = onOpenEvents)
.padding(horizontal = 12.dp, vertical = 9.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Filled.StackedLineChart, contentDescription = null, tint = Kit.colors.ink, modifier = Modifier.width(13.dp))
Spacer(Modifier.width(6.dp))
Text(
if (events.size == 1) events[0].name else L10n.text("schedule.events") + " · " + events.size,
fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.ink,
maxLines = 1, overflow = TextOverflow.Ellipsis,
)
}
}
}
@Composable
private fun DayPicker(days: List<LocalDate>, selected: LocalDate, zone: ZoneId, onSelect: (LocalDate) -> Unit) {
if (days.isEmpty()) return
LazyRow(
Modifier.fillMaxWidth().padding(bottom = 8.dp),
contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 20.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
items(days) { day ->
val active = day == selected
val start = day.atStartOfDay(zone).toInstant()
Column(
Modifier
.clip(RoundedCornerShape(12.dp))
.background(if (active) Kit.colors.accentFill else Kit.colors.surface)
.clickable { onSelect(day) }
.padding(horizontal = 14.dp, vertical = 8.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
KitDate.string(start, "MMM d", zone),
fontSize = 13.sp, fontWeight = FontWeight.Bold,
color = if (active) Kit.colors.onAccent else Kit.colors.ink,
)
Text(
KitDate.string(start, "EEE", zone),
fontSize = 10.sp,
color = if (active) Kit.colors.onAccent else Kit.colors.muted,
)
}
}
}
}
@Composable
private fun FilterBar(state: TimetableUiState, mine: Boolean, conflicts: Int) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 20.dp).padding(bottom = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (!mine) {
FilterChipButton(L10n.text("schedule.allKinds"), state.kind == null) { state.kind = null }
Spacer(Modifier.width(8.dp))
FilterChipButton(L10n.text("schedule.live"), state.kind == SessionKind.Live) { state.kind = SessionKind.Live }
Spacer(Modifier.width(8.dp))
FilterChipButton(L10n.text("schedule.goods"), state.kind == SessionKind.Goods) { state.kind = SessionKind.Goods }
} else if (conflicts > 0) {
Text(
L10n.format("schedule.conflictsCount", conflicts),
fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.warningText,
)
}
Spacer(Modifier.weight(1f))
ZoomButton(state)
}
}
@Composable
private fun FilterChipButton(label: String, active: Boolean, onClick: () -> Unit) {
Text(
label,
fontSize = 11.sp,
fontWeight = FontWeight.SemiBold,
color = if (active) Kit.colors.onAccent else Kit.colors.ink,
modifier = Modifier
.clip(RoundedCornerShape(10.dp))
.background(if (active) Kit.colors.accentFill else Kit.colors.surface)
.clickable(onClick = onClick)
.padding(horizontal = 12.dp, vertical = 7.dp),
)
}
@Composable
private fun ZoomButton(state: TimetableUiState) {
val levels = listOf(2f, 2.8f, 4f, 6f)
Text(
L10n.text("schedule.zoom") + " · " + (state.zoom / 4f * 100).toInt() + "%",
fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.accentText,
modifier = Modifier
.clip(RoundedCornerShape(10.dp))
.background(Kit.colors.surface)
.clickable {
val index = levels.indexOfFirst { it > state.zoom + 0.01f }
state.zoom = if (index == -1) levels.first() else levels[index]
}
.padding(horizontal = 12.dp, vertical = 7.dp),
)
}
@Composable
private fun NowButton(modifier: Modifier = Modifier, onClick: () -> Unit) {
Text(
L10n.text("schedule.now"),
fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.onAccent,
modifier = modifier
.clip(RoundedCornerShape(50))
.background(Kit.colors.accentFill)
.clickable(onClick = onClick)
.padding(horizontal = 16.dp, vertical = 10.dp),
)
}
@Composable
private fun EmptyTimetable(searching: Boolean, mine: Boolean) {
Column(
Modifier.fillMaxSize().padding(30.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Text(
L10n.text(if (searching) "schedule.search.empty" else if (mine) "schedule.noFavorites" else "schedule.empty"),
fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.ink, textAlign = TextAlign.Center,
)
Spacer(Modifier.height(8.dp))
Text(
L10n.text(if (searching) "schedule.search.emptyHint" else if (mine) "schedule.noFavoritesHint" else "schedule.emptyHint"),
fontSize = 12.sp, color = Kit.colors.muted, textAlign = TextAlign.Center,
)
}
}
@@ -0,0 +1,138 @@
package com.oshicue.lineup.ui
import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewModelScope
import com.oshicue.lineup.core.ImportError
import com.oshicue.lineup.core.KitPresentation
import com.oshicue.lineup.core.L10n
import com.oshicue.lineup.core.ScheduleDeletion
import com.oshicue.lineup.core.ScheduleDemo
import com.oshicue.lineup.core.ScheduleDocument
import com.oshicue.lineup.core.ScheduleFavorites
import com.oshicue.lineup.core.ScheduleImporter
import com.oshicue.lineup.core.ScheduleRepository
import com.oshicue.lineup.core.ScheduleSavedState
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
data class LineupUiState(
val document: ScheduleDocument = ScheduleDocument(),
val favorites: Set<String> = emptySet(),
val isDemo: Boolean = true,
val storageError: String? = null,
)
/**
* Timetable storage. Each change is written before it is published, so a failed save leaves the
* timetable, the "My timetable" selections and the file unchanged, ready to retry.
*/
class ScheduleStore(context: Context) : ViewModel() {
private val repository = ScheduleRepository(context.applicationContext)
private val _state = MutableStateFlow(LineupUiState())
val state: StateFlow<LineupUiState> = _state.asStateFlow()
init {
if (!repository.hasSavedData) {
// First launch: a fictional festival around the current hour, with two groups preselected.
// It is shown even if this first write fails.
val demo = ScheduleDemo.document()
val initial = ScheduleSavedState(
document = demo,
favorites = ScheduleDemo.defaultFavorites(demo),
isDemo = true,
)
publish(initial)
runCatching { repository.save(initial) }
.onFailure { _state.value = _state.value.copy(storageError = L10n.text("settings.saveError") + "\n" + it.message) }
} else {
runCatching { repository.load() }
.onSuccess { loaded ->
publish(loaded.state)
if (loaded.migrated) runCatching { repository.save(loaded.state) }
}
.onFailure { error ->
repository.markUnreadable()
_state.value = _state.value.copy(
storageError = L10n.text("settings.readError") + "\n" + KitPresentation.error(error as Throwable),
)
}
}
}
fun isFavorite(sessionID: String): Boolean = _state.value.favorites.contains(sessionID)
fun toggleFavorite(sessionID: String): Boolean {
val current = _state.value
if (sessionID !in ScheduleFavorites.ids(current.document)) return false
val updated = current.favorites.toMutableSet().apply {
if (!add(sessionID)) remove(sessionID)
}
return commit(ScheduleSavedState(current.document, updated, current.isDemo))
}
/** The first real import replaces the example timetable. Later imports replace matching event IDs. */
fun importDocument(incoming: ScheduleDocument): Boolean {
val current = _state.value
val document = if (current.isDemo) incoming else current.document.merging(incoming)
val favorites = if (current.isDemo) emptySet() else current.favorites
return commit(ScheduleSavedState(document, favorites, isDemo = false))
}
/** An unknown event changes nothing. */
fun deleteEvent(id: String): Boolean {
val current = _state.value
val result = ScheduleDeletion.deleteEvent(current.document, id, current.favorites) ?: return false
return commit(ScheduleSavedState(result.document, result.favorites,
isDemo = current.isDemo && result.document.events.isNotEmpty()))
}
/** Demo loading appends only demo IDs so an imported festival is never discarded. */
fun loadDemo(): Boolean {
val current = _state.value
val demo = ScheduleDemo.document()
val merged = current.document.merging(demo)
return commit(ScheduleSavedState(merged, current.favorites,
isDemo = current.isDemo || merged.events.size == demo.events.size))
}
/** Events and sessions only; selections stay on this device. */
fun exportJSON(): String = ScheduleImporter.encode(_state.value.document)
/** Returns and clears the store's message, so a page can show it beside the action that failed. */
fun takeError(): String {
val message = _state.value.storageError ?: L10n.text("settings.saveError")
_state.value = _state.value.copy(storageError = null)
return message
}
fun clearError() {
_state.value = _state.value.copy(storageError = null)
}
private fun commit(state: ScheduleSavedState): Boolean = runCatching {
repository.save(state)
publish(state)
_state.value = _state.value.copy(storageError = null)
true
}.getOrElse { error ->
_state.value = _state.value.copy(storageError = L10n.text("settings.saveError") + "\n" + (error.message ?: ""))
false
}
private fun publish(state: ScheduleSavedState) {
_state.value = _state.value.copy(
document = state.document,
favorites = state.favorites,
isDemo = state.isDemo,
)
}
class Factory(private val context: Context) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T = ScheduleStore(context) as T
}
}
@@ -0,0 +1,163 @@
package com.oshicue.lineup.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.CalendarMonth
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Language
import androidx.compose.material.icons.filled.Share
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.oshicue.lineup.core.AppBrand
import com.oshicue.lineup.core.AppLanguage
import com.oshicue.lineup.core.KitDate
import com.oshicue.lineup.core.KitPresentation
import com.oshicue.lineup.core.L10n
import java.time.Instant
/**
* The 设置 tab: language, timetable import and export, and About. Android has no Info.plist, so
* the version comes from the package manager.
*/
@Composable
fun SettingsScreen(
store: ScheduleStore,
language: AppLanguage,
onLanguageChange: (AppLanguage) -> Unit,
onOpenImport: () -> Unit,
) {
val context = LocalContext.current
var error by remember { mutableStateOf<String?>(null) }
var languageOpen by remember { mutableStateOf(false) }
val state by store.state.collectAsStateWithLifecycle()
Column(Modifier.fillMaxSize().background(Kit.colors.background)) {
KitTopBar {
CircleIconButton(Icons.Filled.Language, L10n.text("settings.language")) { languageOpen = !languageOpen }
}
Column(
Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).padding(bottom = 35.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
Text(L10n.text("settings.title"), style = KitTitleStyle, color = Kit.colors.ink)
KitSectionLabel(L10n.text("settings.language"))
SettingRow(
icon = Icons.Filled.Language,
title = language.nativeName,
onClick = { languageOpen = !languageOpen },
)
if (languageOpen) {
Column(
Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Kit.colors.surface),
) {
AppLanguage.entries.forEach { value ->
Row(
Modifier.fillMaxWidth().clickable {
onLanguageChange(value)
languageOpen = false
}.padding(horizontal = 16.dp, vertical = 13.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(value.nativeName, fontSize = 14.sp, color = Kit.colors.ink, modifier = Modifier.weight(1f))
if (value == language) {
Icon(Icons.Filled.Check, contentDescription = null, tint = Kit.colors.accentText,
modifier = Modifier.width(16.dp))
}
}
}
}
}
KitSectionLabel(L10n.text("settings.data"))
SettingRow(Icons.Filled.CalendarMonth, L10n.text("settings.scheduleImport"), onClick = onOpenImport)
SettingRow(
icon = Icons.Filled.Share,
title = L10n.text("settings.export"),
enabled = state.document.events.isNotEmpty(),
onClick = {
runCatching { store.exportJSON() }
.onSuccess {
shareText(context, it, AppBrand.exportPrefix + "lineup-" + KitDate.civilDay(Instant.now()))
error = null
}
.onFailure { error = KitPresentation.error(it) }
},
)
Text(L10n.text("settings.localData"), fontSize = 12.sp, color = Kit.colors.muted)
error?.let { KitErrorBox(it) }
KitSectionLabel(L10n.text("settings.about"))
Column(
Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Kit.colors.surface).padding(18.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
BrandWordmark()
Row(Modifier.fillMaxWidth()) {
Text(L10n.text("settings.version"), fontSize = 13.sp, color = Kit.colors.muted)
Spacer(Modifier.weight(1f))
Text(appVersion(context), fontSize = 13.sp, color = Kit.colors.ink)
}
Text("Unbounded — SIL Open Font License 1.1", fontSize = 12.sp, color = Kit.colors.muted)
Text(L10n.text("settings.lineupAbout"), fontSize = 12.sp, color = Kit.colors.muted)
}
}
}
}
@Composable
private fun SettingRow(
icon: androidx.compose.ui.graphics.vector.ImageVector,
title: String,
enabled: Boolean = true,
onClick: () -> Unit,
) {
Row(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(Kit.colors.surface)
.clickable(enabled = enabled, onClick = onClick)
.padding(horizontal = 16.dp, vertical = 15.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(icon, contentDescription = null,
tint = if (enabled) Kit.colors.accentText else Kit.colors.muted, modifier = Modifier.width(18.dp))
Spacer(Modifier.width(12.dp))
Text(title, fontSize = 14.sp, color = if (enabled) Kit.colors.ink else Kit.colors.muted)
}
}
/** Android has no Info.plist; the package manager reports the version and version code. */
fun appVersion(context: android.content.Context): String = runCatching {
val info = context.packageManager.getPackageInfo(context.packageName, 0)
val version = info.versionName ?: "—"
val build = if (android.os.Build.VERSION.SDK_INT >= 28) info.longVersionCode.toString() else "—"
"$version · $build"
}.getOrDefault("—")
@@ -0,0 +1,142 @@
package com.oshicue.lineup.ui
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ProvidableCompositionLocal
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.luminance
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
/** The app's product colors, matching the iOS palette so both apps look like one family. */
data class KitColors(
val accent: Color,
val accentText: Color,
val accentFill: Color,
val onAccent: Color,
val familyPink: Color,
val ink: Color,
val onInk: Color,
val muted: Color,
val warningText: Color,
val background: Color,
val surface: Color,
val surfaceMuted: Color,
val surfaceSubtle: Color,
val line: Color,
)
private fun color(hex: String): Color =
Color(0xFF000000L.or((hex.removePrefix("#").toLongOrNull(16) ?: 0x8F8F9BL)).toInt())
private val lightColors = KitColors(
accent = color("375DFF"),
accentText = color("2A4BD8"),
accentFill = color("2E4FDB"),
onAccent = Color.White,
familyPink = color("FF3D6E"),
ink = color("20212B"),
onInk = Color.White,
muted = color("696873"),
warningText = color("945300"),
background = color("F8F7F5"),
surface = Color.White,
surfaceMuted = color("EDEBE8"),
surfaceSubtle = color("F1F0ED"),
line = color("EAE8E5"),
)
private val darkColors = KitColors(
accent = color("6E8BFF"),
accentText = color("8AA2FF"),
accentFill = color("3652D6"),
onAccent = Color.White,
familyPink = color("FF3D6E"),
ink = color("EDECF1"),
onInk = color("20212B"),
muted = color("AAA9B3"),
warningText = color("FFB45B"),
background = color("141519"),
surface = color("202127"),
surfaceMuted = color("2A2B33"),
surfaceSubtle = color("282930"),
line = color("44434B"),
)
val LocalKitColors: ProvidableCompositionLocal<KitColors> = staticCompositionLocalOf { lightColors }
/** `KitStyle.accent` and friends in Swift become `Kit.colors.accent` here. */
object Kit {
val colors: KitColors
@Composable get() = LocalKitColors.current
/**
* Large count labels keep their venue color whenever it is readable. A display-only tint
* protects black and white venue colors in either theme; stored colors are never changed.
*/
@Composable
fun readableDataColor(hex: String): Color {
val base = color(hex)
val background = colors.surface
val backgroundLuminance = background.luminance().toDouble()
val destination = if (isSystemInDarkTheme()) 1.0 else 0.0
var result = base
for (step in 0..20) {
val fraction = step / 20.0
result = Color(
red = (base.red * (1 - fraction) + destination * fraction).toFloat(),
green = (base.green * (1 - fraction) + destination * fraction).toFloat(),
blue = (base.blue * (1 - fraction) + destination * fraction).toFloat(),
)
val foreground = result.luminance().toDouble()
val ratio = (maxOf(foreground, backgroundLuminance) + 0.05) / (minOf(foreground, backgroundLuminance) + 0.05)
if (ratio >= 3) break
}
return result
}
@Composable
fun parse(hex: String): Color = color(hex)
}
val KitTitleStyle = TextStyle(fontSize = 29.sp, fontWeight = FontWeight.Bold, letterSpacing = (-1).sp)
@Composable
fun KitTheme(content: @Composable () -> Unit) {
val dark = isSystemInDarkTheme()
val palette = if (dark) darkColors else lightColors
val scheme = if (dark) {
darkColorScheme(
primary = palette.accentText,
onPrimary = palette.onAccent,
background = palette.background,
surface = palette.surface,
onSurface = palette.ink,
onBackground = palette.ink,
surfaceVariant = palette.surfaceMuted,
outline = palette.line,
error = Color(0xFFD93A3A),
)
} else {
lightColorScheme(
primary = palette.accentText,
onPrimary = palette.onAccent,
background = palette.background,
surface = palette.surface,
onSurface = palette.ink,
onBackground = palette.ink,
surfaceVariant = palette.surfaceMuted,
outline = palette.line,
error = Color(0xFFC62828),
)
}
CompositionLocalProvider(LocalKitColors provides palette) {
MaterialTheme(colorScheme = scheme, content = content)
}
}
@@ -0,0 +1,493 @@
package com.oshicue.lineup.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.ShoppingBag
import androidx.compose.material.icons.filled.GraphicEq
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.oshicue.lineup.core.FestivalEvent
import com.oshicue.lineup.core.KitDate
import com.oshicue.lineup.core.L10n
import com.oshicue.lineup.core.SessionKind
import com.oshicue.lineup.core.TimelineColumnLayout
import com.oshicue.lineup.core.TimelineItem
import com.oshicue.lineup.core.TimelineLayout
import com.oshicue.lineup.core.Venue
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
import java.time.temporal.ChronoUnit
/** One session with the event, artist and venue already resolved, so rows never re-scan the document. */
data class SessionEntry(
val event: FestivalEvent,
val session: com.oshicue.lineup.core.FestivalSession,
) {
val id: String get() = com.oshicue.lineup.core.ScheduleFavorites.id(event.id, session.id)
val artist: String get() = event.artist(session.artistID)?.name ?: session.artistID
val venue: Venue get() = event.venue(session.venueID)!!
val item: TimelineItem get() = TimelineItem(id, session.startsAt, session.endsAt)
val kindName: String
get() = L10n.text(if (session.kind == SessionKind.Live) "schedule.live" else "schedule.goods")
}
private data class VenueColumn(val event: FestivalEvent, val venue: Venue, val kind: SessionKind) {
val id: String
get() = event.id.toByteArray().size.toString() + ":" + event.id +
venue.id.toByteArray().size.toString() + ":" + venue.id + kind.name
}
private data class VenueTrack(
val column: VenueColumn,
val entries: List<SessionEntry>,
val layout: TimelineColumnLayout,
) {
val id: String get() = column.id
val width: Dp get() = layout.width.dp
}
private const val RAIL_WIDTH = 46f
private const val HEADER_HEIGHT = 82f
private const val MINIMUM_LANE_WIDTH = 180f
private const val ARTIST_SIZE = 12f
/**
* The timetable itself: a fixed time rail on the left and horizontally scrolling venue columns.
* 全部日程 groups sessions into a LIVE column and a goods column per venue; 我的日程 merges every
* selected session into one width that divides by the busiest overlap.
*/
@Composable
fun TimelineBoard(
entries: List<SessionEntry>,
allEntries: List<SessionEntry>,
mine: Boolean,
zone: ZoneId,
day: LocalDate,
zoom: Float,
favorites: Set<String>,
now: Instant,
/** Incremented by the "now" button; each change scrolls the board to the current time. */
jumpToken: Int = 0,
onFavorite: (SessionEntry) -> Unit,
onDetail: (SessionEntry) -> Unit,
modifier: Modifier = Modifier,
) {
val railWidth = RAIL_WIDTH.dp
val headerHeight = HEADER_HEIGHT.dp
val dayStart = day.atStartOfDay(zone).toInstant()
val dayEnd = day.plusDays(1).atStartOfDay(zone).toInstant()
val first = allEntries.minOfOrNull { it.session.startsAt } ?: dayStart
val start = maxOf(first, dayStart).let { clipToHour(it, zone, roundUp = false) }
val last = allEntries.maxOfOrNull { it.session.endsAt } ?: start.plus(1, ChronoUnit.HOURS)
val end = run {
val rounded = clipToHour(minOf(last, dayEnd), zone, roundUp = true)
minOf(maxOf(rounded, start.plus(1, ChronoUnit.HOURS)), dayEnd)
}
val height = ((end.epochSecond - start.epochSecond) / 60.0 * zoom).dp
fun y(date: Instant): Dp = ((date.epochSecond - start.epochSecond) / 60.0 * zoom).dp
val nowVisible = !now.isBefore(start) && !now.isAfter(end)
val ticks = remember(start, end) {
generateSequence(start) { it.plus(30, ChronoUnit.MINUTES) }
.takeWhile { !it.isAfter(end) }
.toList()
}
val columns = remember(entries, allEntries) {
listOf(SessionKind.Live, SessionKind.Goods).flatMap { kind ->
val uniqueEvents = allEntries.map { it.event }.distinctBy { it.id }
uniqueEvents.flatMap { event ->
event.venues.filter { venue ->
entries.any { it.event.id == event.id && it.session.venueID == venue.id && it.session.kind == kind }
}.map { VenueColumn(event, it, kind) }
}
}
}
fun blockHeight(entry: SessionEntry): Dp {
val from = maxOf(entry.session.startsAt, start)
val to = minOf(entry.session.endsAt, end)
val minutes = (to.epochSecond - from.epochSecond) / 60.0
return maxOf((minutes * zoom).dp.value - 3f, 1f).dp
}
fun readableLaneWidth(values: List<SessionEntry>): Float =
values.fold(MINIMUM_LANE_WIDTH) { width, entry ->
maxOf(width, laneWidth(entry.artist, blockHeight(entry).value))
}
val tracks = remember(columns, entries, start, end, zoom) {
columns.map { column ->
val values = entries.filter {
it.event.id == column.event.id && it.session.venueID == column.venue.id && it.session.kind == column.kind
}
val laneWidth = readableLaneWidth(values)
VenueTrack(column, values, TimelineLayout.column(values.map { it.item }, laneWidth.toDouble(), laneWidth.toDouble()))
}
}
val contentWidth = if (mine) {
// 我的日程 uses one column that fits the viewport and widens when lanes would be too narrow.
val laneWidth = readableLaneWidth(entries)
TimelineLayout.column(entries.map { it.item }, maxOf(MINIMUM_LANE_WIDTH, laneWidth).toDouble(), laneWidth.toDouble())
.width.toFloat()
} else {
tracks.sumOf { it.width.value.toDouble() }.toFloat()
}
val myLayout = remember(entries, mine) {
if (!mine) null else {
val laneWidth = readableLaneWidth(entries)
TimelineLayout.column(entries.map { it.item }, MINIMUM_LANE_WIDTH.toDouble(), laneWidth.toDouble())
}
}
val horizontal = rememberScrollState()
val vertical = rememberScrollState()
val density = androidx.compose.ui.platform.LocalDensity.current.density
// "Now" centres the live line; without one it returns to the top of the day.
LaunchedEffect(jumpToken) {
if (jumpToken == 0) return@LaunchedEffect
val target = if (nowVisible) {
(y(now).value * density).toInt() - vertical.viewportSize / 2
} else 0
vertical.animateScrollTo(target.coerceAtLeast(0))
}
LaunchedEffect(day) {
vertical.scrollTo(if (nowVisible) ((y(now).value * density).toInt() - vertical.viewportSize / 2).coerceAtLeast(0) else 0)
}
Row(modifier.fillMaxWidth()) {
// Time rail: hour labels and the live time marker, fixed while the board scrolls sideways.
Column(Modifier.width(railWidth)) {
Box(Modifier.fillMaxWidth().height(headerHeight), contentAlignment = Alignment.Center) {
Text(KitDate.string(dayStart, "MMM", zone), color = Kit.colors.muted, fontSize = 9.sp, fontWeight = FontWeight.Bold)
}
Box(Modifier.width(railWidth).height(height).background(Kit.colors.background)) {
ticks.forEach { tick ->
Text(
KitDate.time(tick, zone),
color = Kit.colors.muted,
fontSize = 9.sp,
modifier = Modifier
.width(railWidth - 5.dp)
.padding(top = y(tick) + 3.dp),
textAlign = androidx.compose.ui.text.style.TextAlign.End,
)
}
if (nowVisible) {
Box(
Modifier
.padding(top = y(now).let { if (it.value < 8f) 0.dp else it - 8.dp })
.clip(RoundedCornerShape(4.dp))
.background(Kit.colors.accentFill)
.padding(horizontal = 3.dp, vertical = 3.dp),
) {
Text(KitDate.time(now, zone), color = Kit.colors.onAccent, fontSize = 9.sp, fontWeight = FontWeight.Bold)
}
}
}
}
Column(Modifier.weight(1f).verticalScroll(vertical)) {
Row(Modifier.horizontalScroll(horizontal)) {
Column {
ColumnHeaders(mine, tracks, contentWidth.dp, headerHeight)
Box(Modifier.width(contentWidth.dp).height(height)) {
CanvasGrid(zoom, start, end, ticks) { tick -> y(tick) }
if (mine && myLayout != null) {
val placements = myLayout.placements.associateBy { it.id }
entries.forEach { entry ->
val position = placements[entry.id] ?: return@forEach
val laneX = contentWidth.dp * (position.lane.toFloat() / position.laneCount.toFloat())
SessionBlockPositioned(
entry, favorites.contains(entry.id), mine, zone,
width = contentWidth.dp / position.laneCount.toFloat(),
height = blockHeight(entry),
offsetX = laneX,
offsetY = y(maxOf(entry.session.startsAt, start)),
onFavorite = onFavorite, onDetail = onDetail,
)
}
} else {
var origin = 0f
tracks.forEach { track ->
val trackOrigin = origin
val positions = track.layout.placements.associateBy { it.id }
track.entries.forEach { entry ->
val position = positions[entry.id] ?: return@forEach
SessionBlockPositioned(
entry, favorites.contains(entry.id), mine, zone,
width = track.width * position.relativeWidth.toFloat(),
height = blockHeight(entry),
offsetX = trackOrigin.dp + track.width * position.relativeX.toFloat(),
offsetY = y(maxOf(entry.session.startsAt, start)),
onFavorite = onFavorite, onDetail = onDetail,
)
}
origin += track.width.value
Box(
Modifier
.padding(start = origin.dp)
.width(1.dp).height(height)
.background(Kit.colors.line.copy(alpha = 0.6f)),
)
}
}
if (nowVisible) {
Box(
Modifier
.fillMaxWidth()
.padding(top = y(now))
.height(1.5.dp)
.background(Kit.colors.accent),
)
}
}
}
}
}
}
}
/** Rounds an instant to the start of its hour, or to the next hour when [roundUp] is set. */
private fun clipToHour(date: Instant, zone: ZoneId, roundUp: Boolean): Instant {
val local = date.atZone(zone)
val hourStart = local.truncatedTo(ChronoUnit.HOURS).toInstant()
return if (!roundUp || hourStart == date) hourStart else hourStart.plus(1, ChronoUnit.HOURS)
}
@Composable
private fun ColumnHeaders(mine: Boolean, tracks: List<VenueTrack>, width: Dp, headerHeight: Dp) {
if (mine) {
Row(
Modifier.width(width).height(headerHeight).background(Kit.colors.background).padding(horizontal = 15.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Filled.Favorite, contentDescription = null, tint = Kit.colors.accentText, modifier = Modifier.size(14.dp))
Spacer(Modifier.width(6.dp))
Text(L10n.text("schedule.mine"), fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = Kit.colors.ink)
Spacer(Modifier.weight(1f))
Text(L10n.text("schedule.allKinds"), fontSize = 10.sp, color = Kit.colors.muted)
}
return
}
Row(Modifier.width(width).height(headerHeight)) {
tracks.forEach { track ->
Row(Modifier.width(track.width)) {
repeat(track.layout.maximumLaneCount) {
Column(
Modifier
.width(track.width / track.layout.maximumLaneCount.toFloat())
.height(headerHeight)
.background(Kit.colors.surface),
) {
Row(
Modifier
.fillMaxWidth().height(26.dp)
.background(if (track.column.kind == SessionKind.Live) Kit.colors.surfaceSubtle else Kit.colors.accent.copy(alpha = 0.07f))
.padding(horizontal = 10.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
if (track.column.kind == SessionKind.Live) Icons.Filled.GraphicEq else Icons.Filled.ShoppingBag,
contentDescription = null,
tint = if (track.column.kind == SessionKind.Live) Kit.colors.ink else Kit.colors.accentText,
modifier = Modifier.size(10.dp),
)
Spacer(Modifier.width(4.dp))
Text(
L10n.text(if (track.column.kind == SessionKind.Live) "schedule.live" else "schedule.goods"),
fontSize = 9.sp, fontWeight = FontWeight.Bold, letterSpacing = 0.7.sp,
color = if (track.column.kind == SessionKind.Live) Kit.colors.ink else Kit.colors.accentText,
)
}
Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 9.dp)) {
Box(
Modifier
.padding(top = 8.dp)
.width(4.dp).height(29.dp)
.clip(RoundedCornerShape(2.dp))
.background(Kit.parse(track.column.venue.color)),
)
Spacer(Modifier.width(6.dp))
Column(Modifier.padding(top = 8.dp), verticalArrangement = Arrangement.spacedBy(3.dp)) {
Text(track.column.venue.name, fontSize = 11.sp, fontWeight = FontWeight.Bold,
color = Kit.colors.ink, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(track.column.event.city, fontSize = 8.sp, color = Kit.colors.muted, maxLines = 1)
}
}
}
}
}
}
}
}
/** The half-hour rules and the lighter quarter-hour rules behind the session cards. */
@Composable
private fun androidx.compose.foundation.layout.BoxScope.CanvasGrid(
zoom: Float,
start: Instant,
end: Instant,
ticks: List<Instant>,
tickY: (Instant) -> Dp,
) {
ticks.forEach { tick ->
Box(
Modifier
.padding(top = tickY(tick))
.fillMaxWidth().height(1.dp)
.background(Kit.colors.line),
)
}
var seconds = 900.0
while (seconds < (end.epochSecond - start.epochSecond)) {
Box(
Modifier
.padding(top = (seconds / 60.0 * zoom).dp)
.fillMaxWidth().height(0.5.dp)
.background(Kit.colors.line.copy(alpha = 0.4f)),
)
seconds += 1800
}
}
/**
* A session card positioned on the board. Single tap opens the details and a double tap toggles
* the selection, matching the two gestures the iOS app teaches.
*/
@Composable
private fun SessionBlockPositioned(
entry: SessionEntry,
favorite: Boolean,
merged: Boolean,
zone: ZoneId,
width: Dp,
height: Dp,
offsetX: Dp,
offsetY: Dp,
onFavorite: (SessionEntry) -> Unit,
onDetail: (SessionEntry) -> Unit,
) {
var lastTap by remember { mutableStateOf(0L) }
val cardWidth = maxOf(width - 6.dp, 1.dp)
val color = Kit.parse(entry.venue.color)
Column(
Modifier
.padding(start = offsetX + 3.dp, top = offsetY + 2.dp)
.width(cardWidth)
.height(height)
.clip(RoundedCornerShape(5.dp))
.background(color.copy(alpha = 0.21f))
.pointerInput(entry.id) {
detectTapGestures(onTap = {
val now = System.currentTimeMillis()
if (now - lastTap < 300) {
onFavorite(entry)
lastTap = 0
} else {
lastTap = now
onDetail(entry)
}
})
},
) {
Row(Modifier.fillMaxWidth().height(height)) {
Box(Modifier.width(3.dp).height(height).background(color))
Column(Modifier.padding(horizontal = 8.dp).padding(vertical = verticalInset(height).dp)) {
val showTime = height.value >= 30f
if (showTime) {
Text(
KitDate.time(entry.session.startsAt, zone) + "–" + KitDate.time(entry.session.endsAt, zone),
fontSize = 9.sp, color = Kit.colors.ink, maxLines = 1,
)
}
Text(
entry.artist,
fontSize = if (merged) 14.sp else 12.sp,
fontWeight = FontWeight.Bold,
color = Kit.colors.ink,
maxLines = maxOf(1, (height.value / 14f).toInt()),
overflow = TextOverflow.Ellipsis,
lineHeight = if (merged) 17.sp else 14.sp,
)
if (merged && height.value >= 56f) {
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(
if (entry.session.kind == SessionKind.Live) Icons.Filled.GraphicEq else Icons.Filled.ShoppingBag,
contentDescription = null, tint = Kit.colors.ink, modifier = Modifier.size(10.dp),
)
Spacer(Modifier.width(3.dp))
Text(entry.kindName + " · " + entry.venue.name, fontSize = 10.sp, color = Kit.colors.ink,
maxLines = 2, overflow = TextOverflow.Ellipsis)
}
}
if (height.value >= 76f) {
Text(entry.session.area ?: entry.event.name, fontSize = 8.sp, color = Kit.colors.ink,
maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
}
if (favorite) {
Icon(
Icons.Filled.Favorite, contentDescription = null, tint = Kit.colors.accentText,
modifier = Modifier.size(9.dp).padding(top = 4.dp, start = cardWidth - 13.dp),
)
}
}
}
private fun verticalInset(height: Dp): Int = when {
height.value < 24f -> 1
height.value < 44f -> 2
else -> 6
}
/** Room a long name needs before the card would truncate it, used to widen a venue column. */
private fun laneWidth(artist: String, height: Float): Float {
val size = artist.length
val perCharacter = ARTIST_SIZE * 0.62f
val needed = size * perCharacter + 40f
val rows = maxOf(1, ((height - 12f) / (ARTIST_SIZE + 3f)).toInt())
return maxOf(MINIMUM_LANE_WIDTH, minOf(needed / rows, MINIMUM_LANE_WIDTH * 320f / 180f))
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#FFFFFF"
android:pathData="M32,34h10v26h18v10h-28z" />
<path
android:fillColor="#FF3D6E"
android:pathData="M64,34h12v10h-12z" />
</vector>
Binary file not shown.
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#2E4FDB</color>
</resources>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Oshicue Lineup</string>
</resources>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.OshicueLineup" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowBackground">#F8F7F5</item>
</style>
</resources>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="exports" path="exports/" />
</paths>
@@ -0,0 +1,119 @@
package com.oshicue.lineup.core
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class ScheduleImporterTest {
private val template = """
{
"schemaVersion": 1,
"events": [
{
"id": "fes-1", "name": "Test Fes", "city": "Tokyo", "timeZone": "Asia/Tokyo",
"venues": [{ "id": "v1", "name": "HALL", "color": "#78C9EB" }],
"artists": [{ "id": "a1", "name": "Artist" }],
"sessions": [
{ "id": "s1", "artistID": "a1", "venueID": "v1", "kind": "live",
"startsAt": "2026-10-14T14:30:00+09:00", "endsAt": "2026-10-14T15:10:00+09:00" }
]
}
]
}
""".trimIndent()
@Test
fun validDocumentRoundTrips() {
val document = ScheduleImporter.parse(template)
assertEquals(1, document.events.size)
assertEquals(1, document.events[0].sessions.size)
val encoded = ScheduleImporter.encode(document)
val again = ScheduleImporter.parse(encoded)
assertEquals(document.events[0].sessions[0].startsAt, again.events[0].sessions[0].startsAt)
}
@Test
fun timestampsRequireAnExplicitOffset() {
val noOffset = template.replace("2026-10-14T14:30:00+09:00", "2026-10-14T14:30:00")
val failure = runCatching { ScheduleImporter.parse(noOffset) }.exceptionOrNull()
assertTrue(failure is ImportError)
assertEquals("import.error.invalidJSON", (failure as ImportError).key)
}
@Test
fun impossibleCalendarDatesAreRejected() {
val bad = template.replace("2026-10-14T14:30:00+09:00", "2026-02-30T14:30:00+09:00")
assertTrue(runCatching { ScheduleImporter.parse(bad) }.isFailure)
}
@Test
fun unknownArtistReferencePointsAtTheField() {
val bad = template.replace("\"artistID\": \"a1\"", "\"artistID\": \"missing\"")
val failure = runCatching { ScheduleImporter.parse(bad) }.exceptionOrNull() as ImportError
assertEquals("import.error.artistReference", failure.key)
assertEquals("$.events[0].sessions[0].artistID", failure.path)
}
@Test
fun shortSessionAndInvalidZoneAreRejected() {
val short = template.replace("2026-10-14T15:10:00+09:00", "2026-10-14T14:00:00+09:00")
assertEquals("import.error.duration",
(runCatching { ScheduleImporter.parse(short) }.exceptionOrNull() as ImportError).key)
val badZone = template.replace("Asia/Tokyo", "Mars/Olympus")
assertEquals("import.error.timeZone",
(runCatching { ScheduleImporter.parse(badZone) }.exceptionOrNull() as ImportError).key)
}
@Test
fun duplicateEventIDsAreRejected() {
val duplicated = template.replace("\"events\": [", "\"events\": [").let {
val body = it.substringAfter("\"events\": [").substringBeforeLast("]")
it.replaceFirst(body, body + "," + body)
}
assertEquals("import.error.duplicateID",
(runCatching { ScheduleImporter.parse(duplicated) }.exceptionOrNull() as ImportError).key)
}
@Test
fun oversizedDocumentIsRejectedBeforeDecoding() {
val bytes = ByteArray(ScheduleImporter.maximumDocumentBytes + 1)
assertEquals("import.error.documentSize",
(runCatching { ScheduleImporter.parse(bytes) }.exceptionOrNull() as ImportError).key)
}
@Test
fun mergingReplacesMatchingEventIDs() {
val document = ScheduleImporter.parse(template)
val merged = document.merging(document)
assertEquals(1, merged.events.size)
}
@Test
fun deletingAnEventDropsOnlyItsSelections() {
val document = ScheduleImporter.parse(template)
val favorite = ScheduleFavorites.id("fes-1", "s1")
val result = ScheduleDeletion.deleteEvent(document, "fes-1", setOf(favorite))
assertEquals(0, result!!.document.events.size)
assertTrue(result.favorites.isEmpty())
assertNull(ScheduleDeletion.deleteEvent(document, "unknown", setOf(favorite)))
}
@Test
fun searchIgnoresCaseWidthAndDiacritics() {
val document = ScheduleImporter.parse(template)
val event = document.events[0]
val session = event.sessions[0]
assertTrue(event.sessionMatches(session, "artist"))
assertTrue(event.sessionMatches(session, "HALL"))
assertTrue(!event.sessionMatches(session, "nothing"))
}
private fun FestivalEvent.sessionMatches(session: FestivalSession, query: String): Boolean {
val words = query.split(Regex("\\s+")).filter { it.isNotEmpty() }
if (words.isEmpty()) return true
val fields = listOf(artist(session.artistID)?.name ?: session.artistID, venue(session.venueID)?.name ?: "",
session.area ?: "", session.notes ?: "").joinToString("\n")
return words.all { TextNormalizer.contains(fields, it) }
}
}
@@ -0,0 +1,86 @@
package com.oshicue.lineup.core
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import java.time.Instant
class TimelineLayoutTest {
private fun item(id: String, start: Int, end: Int) =
TimelineItem(id, Instant.ofEpochSecond(start * 60L), Instant.ofEpochSecond(end * 60L))
@Test
fun touchingSessionsUseFullWidth() {
val placements = TimelineLayout.place(listOf(item("b", 20, 40), item("a", 0, 20)))
assertEquals(listOf("a", "b"), placements.map { it.id })
assertTrue(placements.all { it.lane == 0 && it.laneCount == 1 && it.relativeWidth == 1.0 })
}
@Test
fun overlapChainUsesTwoLanesAndNextClusterResetsWidth() {
val sessions = listOf(item("a", 0, 30), item("b", 20, 50), item("c", 40, 60), item("isolated", 70, 80))
val placements = TimelineLayout.place(sessions)
assertEquals(listOf(2, 2, 2, 1), placements.map { it.laneCount })
assertEquals(listOf(0, 1, 0, 0), placements.map { it.lane })
}
@Test
fun nestedIntervalsUseMinimumConcurrentLanes() {
val sessions = listOf(item("long", 0, 100), item("short-a", 10, 30), item("short-b", 20, 40), item("short-c", 40, 60))
val placements = TimelineLayout.place(sessions)
assertTrue(placements.all { it.laneCount == 3 })
assertEquals(1, placements.first { it.id == "short-c" }.lane)
assertNoOverlapsShareLane(sessions, placements)
}
@Test
fun layoutIsDeterministicForEqualStarts() {
val sessions = listOf(item("c", 0, 40), item("b", 0, 20), item("a", 0, 20))
val placements = TimelineLayout.place(sessions)
assertEquals(listOf("a", "b", "c"), placements.map { it.id })
assertEquals(placements, TimelineLayout.place(sessions.reversed()))
assertEquals(listOf(3, 3, 3), placements.map { it.laneCount })
}
@Test
fun manyIntervalsHaveNoCollisionsAndOptimalWidth() {
// Fixed input exercises short, long, nested and touching intervals without depending on layout internals.
val sessions = (0 until 90).map { index ->
val start = (index * 37) % 240
item("s$index", start, start + 5 + (index * 11) % 60)
}
val placements = TimelineLayout.place(sessions)
assertNoOverlapsShareLane(sessions, placements)
val peak = sessions.maxOf { instant ->
sessions.count { it.start <= instant.start && it.end > instant.start }
}
assertEquals(peak, placements.maxOf { it.laneCount })
assertEquals(sessions.map { it.id }.toSet(), placements.map { it.id }.toSet())
}
@Test
fun columnWidensForTheBusiestCluster() {
val one = TimelineLayout.column(listOf(item("a", 0, 30)), minimumColumnWidth = 180.0, minimumLaneWidth = 180.0)
assertEquals(1, one.maximumLaneCount)
assertEquals(180.0, one.width, 0.001)
val three = TimelineLayout.column(
listOf(item("a", 0, 30), item("b", 0, 30), item("c", 0, 30)),
minimumColumnWidth = 180.0, minimumLaneWidth = 180.0,
)
assertEquals(3, three.maximumLaneCount)
assertEquals(540.0, three.width, 0.001)
}
private fun assertNoOverlapsShareLane(sessions: List<TimelineItem>, placements: List<TimelinePlacement>) {
val byId = sessions.associateBy { it.id }
for (left in placements) {
for (right in placements) {
if (left.id >= right.id || left.lane != right.lane) continue
val a = byId.getValue(left.id)
val b = byId.getValue(right.id)
val overlap = a.start < b.end && b.start < a.end
assertTrue("${left.id} and ${right.id} share lane ${left.lane}", !overlap)
}
}
}
}