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

This commit is contained in:
Oshicue committed 2026-11-14 23:46:57 +08:00
commit dc48c72135
57 files changed
+8006

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
name: Android
on:
push:
branches: [ main ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- uses: android-actions/setup-android@v3
- name: Install SDK platform
run: sdkmanager "platforms;android-37" "build-tools;36.0.0"
- name: Verify localizations
run: python3 scripts/verify_localizations.py
- name: Unit tests
run: ./gradlew :app:testDebugUnitTest --no-daemon --console=plain
- name: Build debug APK
run: ./gradlew :app:assembleDebug --no-daemon --console=plain
- uses: actions/upload-artifact@v4
with:
name: app-debug
path: app/build/outputs/apk/debug/app-debug.apk
+21
View File
@@ -0,0 +1,21 @@
# Build output
build/
.gradle/
captures/
.externalNativeBuild/
.cxx/
# Local machine configuration
local.properties
.idea/
*.iml
.DS_Store
# Release signing material — never commit these
keystore.properties
keystore/
*.jks
*.keystore
# Kotlin incremental session data
.kotlin/
+93
View File
@@ -0,0 +1,93 @@
Copyright 2022 The Unbounded Project Authors (https://github.com/googlefonts/unbounded)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+297
View File
@@ -0,0 +1,297 @@
# Oshicue Tempo · Android 1.0.0
<a name="readme-languages"></a>
[简体中文](#readme-zh-hans) · [繁體中文(台灣)](#readme-zh-hant) · [粵語(香港)](#readme-yue) · [English](#readme-en) · [日本語](#readme-ja) · [한국어](#readme-ko) · [ไทย](#readme-th) · [Bahasa Indonesia](#readme-id) · [Bahasa Melayu](#readme-ms)
<a name="readme-zh-hans"></a>
## 简体中文
**特典会现场用的多成员倒计时板。**
一场特典会,几个人同时在聊。三券、一券、五券;有人刚开始,有人快结束。手机架在场边,谁来都能一眼看清。
### 怎么用
- 先建团体:团体名称、每张券多少秒。再添成员,每人一个代表色和一个到时提示音。
- 点成员时钟,输入本轮券数就立刻开始。**总时长 = 每张券秒数 × 券数**。常用张数(1 / 2 / 3 / 5)一键可选,上次的张数会自动填入。
- 客人多买一张,点卡片上的 **+1**,倒计时直接顺延,不重启。长按 +1 可一次加 2 / 3 / 5 张。
- 每位成员可以单独暂停、继续、重置或开始下一轮。切换团体不会停掉其他团体的计时。
- 一屏四位成员,更多的翻页看。最后 10 秒进度环转为琥珀色。
### 提示音
内置四种原创提示音:星光、心跳、铃语、通关。也可以用别的录音 App 录好再导入(短于 30 秒,支持 M4A、WAV、OGG、FLAC 等)。前台按媒体音量播放,多人同时结束会混音播放;锁屏或后台则交给系统通知。
### 数据与外观
团体、成员、进行中的计时和设置都保存在本机,重新打开会恢复。界面跟随系统浅色 / 深色。
设置里可以开关触感反馈、计时时屏幕常亮,以及新成员默认提示音。
### 支持的语言
简体中文、繁體中文(台灣)、繁體粵語(香港)、English、日本語、한국어、ไทย、Bahasa Indonesia、Bahasa Melayu,可在「设置 → 语言」切换,也可跟随系统。
<a name="readme-en"></a>
## English
**A multi-member countdown board for meet & greet events.**
Several members are talking at once. Three tickets here, one there, five around the corner. The phone sits at the edge of the table so anyone can read it at a glance.
### Using it
- Create a group: a name and seconds per ticket. Add members, each with a colour and an alert sound.
- Tap a member's clock and enter the ticket count to start. **Total time = seconds per ticket × tickets.** The usual counts (1 / 2 / 3 / 5) are one tap away, and the last count is pre-filled.
- When a guest buys one more, tap **+1** on the card; the countdown extends without restarting. Long-press for 2 / 3 / 5.
- Every member pauses, resumes, resets or starts their next round independently. Switching groups never stops another group's timers.
- Four members per page, with paging for more. The ring turns amber for the final ten seconds.
### Sounds
Four original alert sounds ship with the app. You can also import a recording (under 30 seconds; M4A, WAV, OGG, FLAC and more). In the foreground sounds play at media volume and mix when several rounds end together; on the lock screen and in the background the system notification handles it.
### Data and appearance
Groups, members, running rounds and settings stay on the device and come back after a restart. The interface follows the system light and dark themes.
Settings covers haptics, keeping the screen on while timing, and the default sound for new members.
### Languages
简体中文, 繁體中文(台灣), 繁體粵語(香港), English, 日本語, 한국어, ไทย, Bahasa Indonesia and Bahasa Melayu — switch in Settings → Language, or follow the system.
### Building
```sh
export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
./gradlew :app:assembleDebug :app:testDebugUnitTest
python3 scripts/verify_localizations.py
```
Requires Android 8.0 (API 26) or newer. Compile SDK 37, Gradle 9.8.1, AGP 9.4.1.
### Project layout
```
app/src/main/java/com/oshicue/tempo/
├── MainActivity.kt composition root, routes, permission and picker launchers
├── core/ models, validation, storage, localisation (no Android UI)
├── audio/ built-in and imported cues
├── alert/ exact alarms and notification channels
└── ui/ board, ticket entry, groups, sounds, settings
app/src/main/assets/localization/<tag>.strings nine catalogs, iOS string format
```
<a name="readme-ja"></a>
## 日本語
**特典会で使う多人数カウントダウンボード。**
何人かが同時に話している。3枚、1枚、5枚。まだ始めたばかりの人もいれば、そろそろ終わる人もいる。端末を卓の端に置けば、誰でも一目で分かります。
### 使い方
- まずグループを作ります。グループ名と1枚あたりの秒数を決め、メンバーを追加します。それぞれに色と通知音を設定できます。
- メンバーの時計をタップし、枚数を入力すればすぐ開始。**合計時間 = 1枚の秒数 × 枚数**。よく使う枚数(1 / 2 / 3 / 5)はワンタップ、前回の枚数は自動で入ります。
- 追加で1枚買ったら、カードの **+1** をタップ。再起動せずに延長されます。長押しで 2 / 3 / 5 枚。
- メンバーごとに一時停止・再開・リセット・次の回の開始ができます。グループを切り替えても他のグループの計測は止まりません。
- 1ページに4人、それ以上はページ送り。残り10秒でリングが琥珀色になります。
### 通知音
オリジナルの通知音が4種類。録音アプリで録った音声も読み込めます(30秒未満、M4A・WAV・OGG・FLAC など)。アプリを開いている間はメディア音量で再生し、同時に終わった場合はミックスされます。画面ロック中やバックグラウンドではシステム通知が担当します。
### データと外観
グループ、メンバー、進行中の計測、設定は端末内に保存され、開き直すと復元されます。ライト / ダークはシステム設定に従います。
設定では触覚フィードバック、計測中の画面オンの維持、新しいメンバーの既定の通知音を変更できます。
### 対応言語
简体中文、繁體中文(台灣)、繁體粵語(香港)、English、日本語、한국어、ไทย、Bahasa Indonesia、Bahasa Melayu。設定 → 言語 で切り替えられます。
<a name="readme-ko"></a>
## 한국어
**사인회 현장에서 쓰는 다인원 카운트다운 보드.**
여러 멤버가 동시에 이야기합니다. 3장, 1장, 5장. 막 시작한 사람도 있고 곧 끝나는 사람도 있습니다. 기기를 테이블 끝에 두면 누구나 한눈에 확인할 수 있습니다.
### 사용법
- 먼저 그룹을 만듭니다. 그룹 이름과 티켓 한 장당 초를 정하고 멤버를 추가합니다. 각 멤버에게 색과 알림음을 지정할 수 있습니다.
- 멤버의 시계를 눌러 이번 장 수를 입력하면 바로 시작됩니다. **총 시간 = 장당 초 × 장 수.** 자주 쓰는 장 수(1 / 2 / 3 / 5)는 한 번에 선택할 수 있고, 지난 장 수가 자동으로 채워집니다.
- 손님이 한 장을 더 사면 카드의 **+1**을 누르세요. 다시 시작하지 않고 시간이 늘어납니다. 길게 누르면 2 / 3 / 5장.
- 멤버마다 일시정지, 재개, 초기화, 다음 회차 시작을 따로 할 수 있습니다. 그룹을 바꿔도 다른 그룹의 타이머는 멈추지 않습니다.
- 한 화면에 네 명, 더 많으면 페이지로 넘깁니다. 남은 10초 동안 링이 호박색으로 바뀝니다.
### 알림음
기본 알림음 네 가지가 들어 있습니다. 녹음 앱으로 만든 소리도 가져올 수 있습니다(30초 미만, M4A·WAV·OGG·FLAC 등). 앱이 열려 있을 때는 미디어 볼륨으로 재생되고, 여러 명이 동시에 끝나면 함께 재생됩니다. 잠금 화면이나 백그라운드에서는 시스템 알림이 담당합니다.
### 데이터와 화면
그룹, 멤버, 진행 중인 타이머, 설정은 기기에 저장되어 다시 열면 복원됩니다. 밝은/어두운 테마는 시스템 설정을 따릅니다.
설정에서 진동, 타이머 중 화면 켜짐 유지, 새 멤버의 기본 알림음을 바꿀 수 있습니다.
### 지원 언어
简体中文, 繁體中文(台灣), 繁體粵語(香港), English, 日本語, 한국어, ไทย, Bahasa Indonesia, Bahasa Melayu. 설정 → 언어에서 변경할 수 있습니다.
<a name="readme-zh-hant"></a>
## 繁體中文(台灣)
**特典會現場用的多成員倒數計時板。**
一場特典會,幾個人同時在聊。三張、一張、五張;有人剛開始,有人快結束。手機放在桌邊,誰都能一眼看清。
### 怎麼用
- 先建立團體:團體名稱、每張券幾秒。再新增成員,每人一個代表色和一個結束提示音。
- 點成員時鐘,輸入本輪券數就立刻開始。**總時長 = 每張券秒數 × 券數**。常用張數(1 / 2 / 3 / 5)一鍵可選,上次的張數會自動填入。
- 客人多買一張,點卡片上的 **+1**,倒數直接順延,不必重來。長按 +1 可一次加 2 / 3 / 5 張。
- 每位成員可以各自暫停、繼續、重設或開始下一輪。切換團體不會停掉其他團體的計時。
- 一頁四位成員,更多可翻頁。最後 10 秒進度環轉為琥珀色。
### 提示音
內建四種原創提示音:星光、心跳、鈴語、通關。也可以用其他錄音 App 錄好再匯入(短於 30 秒,支援 M4A、WAV、OGG、FLAC 等)。在前台依媒體音量播放,多人同時結束會混音;鎖定畫面或背景則交給系統通知。
### 資料與外觀
團體、成員、進行中的計時和設定都保存在本機,重新開啟會還原。介面跟隨系統的淺色 / 深色。
設定裡可以開關觸覺回饋、計時時螢幕恆亮,以及新成員的預設提示音。
### 支援語言
简体中文、繁體中文(台灣)、繁體粵語(香港)、English、日本語、한국어、ไทย、Bahasa Indonesia、Bahasa Melayu,可在「設定 → 語言」切換。
<a name="readme-yue"></a>
## 粵語(香港)
**特典會現場用嘅多人倒數板。**
一場特典會,幾個人一齊傾。三張、一張、五張;有啲啱啱開始,有啲就快完。部機擺喺枱邊,邊個都一眼睇得清。
### 點用
- 先開個團體:團體名、每張券幾多秒。再加成員,每人一個代表色同一個完場提示音。
- 撳成員個鐘,輸入今輪幾多張就即刻開始。**總時間 = 每張券秒數 × 張數**。常用張數(1 / 2 / 3 / 5)一撳就有,上次嘅張數會自動填好。
- 客人買多張,撳卡片上面嘅 **+1**,倒數直接順延,唔使重新開始。長撳 +1 可以一次加 2 / 3 / 5 張。
- 每位成員可以自己暫停、繼續、重設或者開下一輪。轉團體唔會停咗其他團體嘅計時。
- 一頁四位成員,多過就揭頁。最後 10 秒個進度環會變琥珀色。
### 提示音
內建四款原創提示音:星光、心跳、鈴語、通關。亦可以用其他錄音 App 錄好再匯入(短過 30 秒,支援 M4A、WAV、OGG、FLAC 等)。喺前台會用媒體音量播放,幾個人同時完會一齊播;鎖機或者喺後台就交畀系統通知。
### 資料同外觀
團體、成員、進行中嘅計時同設定都存喺部機,再開會還原。介面跟住系統嘅淺色 / 深色。
設定入面可以開關觸覺回饋、計時時螢幕長亮,同埋新成員嘅預設提示音。
### 支援語言
简体中文、繁體中文(台灣)、繁體粵語(香港)、English、日本語、한국어、ไทย、Bahasa Indonesia、Bahasa Melayu,喺「設定 → 語言」度轉。
<a name="readme-th"></a>
## ไทย
**กระดานนับถอยหลังหลายคนสำหรับงานมีตติ้งแอนด์กรีท**
ในงานหนึ่ง มีสมาชิกหลายคนคุยพร้อมกัน สามตั๋ว หนึ่งตั๋ว ห้าตั๋ว บางคนเพิ่งเริ่ม บางคนใกล้จบ วางโทรศัพท์ไว้ขอบโต๊ะ ใครมองก็อ่านออกทันที
### วิธีใช้
- สร้างกลุ่มก่อน ตั้งชื่อกลุ่มและจำนวนวินาทีต่อตั๋ว แล้วเพิ่มสมาชิก แต่ละคนมีสีและเสียงแจ้งเตือนของตัวเอง
- แตะนาฬิกาของสมาชิก ใส่จำนวนตั๋วของรอบนี้ แล้วเริ่มได้ทันที **เวลารวม = วินาทีต่อตั๋ว × จำนวนตั๋ว** จำนวนที่ใช้บ่อย (1 / 2 / 3 / 5) เลือกได้ในแตะเดียว และจำนวนครั้งก่อนหน้าจะถูกเติมให้อัตโนมัติ
- ถ้าแขกซื้อเพิ่มหนึ่งใบ แตะ **+1** บนการ์ด เวลาจะต่อออกไปโดยไม่ต้องเริ่มใหม่ กดค้างเพื่อเพิ่ม 2 / 3 / 5 ใบ
- สมาชิกแต่ละคนหยุดชั่วคราว ทำต่อ รีเซ็ต หรือเริ่มรอบถัดไปได้เอง สลับกลุ่มแล้ว计时ของกลุ่มอื่นไม่หยุด
- หนึ่งหน้าแสดงสี่คน ถ้ามากกว่านั้นปัดหน้าได้ สิบวินาทีสุดท้ายวงแหวนจะเปลี่ยนเป็นสีอำพัน
### เสียงแจ้งเตือน
มีเสียงแจ้งเตือนต้นฉบับสี่แบบ และนำเข้าไฟล์เสียงที่อัดเองได้ (สั้นกว่า 30 วินาที รองรับ M4A, WAV, OGG, FLAC) ขณะเปิดแอปจะเล่นด้วยระดับเสียงมีเดีย และถ้าหลายคนจบพร้อมกันจะเล่นผสมกัน บนหน้าจอล็อกหรือเบื้องหลังจะใช้การแจ้งเตือนของระบบ
### ข้อมูลและหน้าตา
กลุ่ม สมาชิก รอบที่กำลังนับ และการตั้งค่าเก็บไว้ในเครื่อง เปิดใหม่แล้วกลับมาครบ หน้าจอตามธีมสว่าง/มืดของระบบ
ในการตั้งค่าปรับการสั่น เปิดหน้าจอค้างไว้ขณะนับ และเสียงแจ้งเตือนเริ่มต้นของสมาชิกใหม่ได้
### ภาษา
简体中文, 繁體中文(台灣), 繁體粵語(香港), English, 日本語, 한국어, ไทย, Bahasa Indonesia, Bahasa Melayu เปลี่ยนได้ที่ ตั้งค่า → ภาษา
<a name="readme-id"></a>
## Bahasa Indonesia
**Papan hitung mundur multi-anggota untuk acara meet & greet.**
Beberapa anggota berbicara bersamaan. Tiga tiket di sini, satu di sana, lima di sudut lain. Ponsel diletakkan di tepi meja supaya siapa pun bisa membacanya sekilas.
### Cara pakai
- Buat grup lebih dulu: nama grup dan detik per tiket. Tambahkan anggota, masing-masing dengan warna dan suara peringatan.
- Ketuk jam anggota, masukkan jumlah tiket, dan hitungan langsung mulai. **Total waktu = detik per tiket × jumlah tiket.** Jumlah yang sering dipakai (1 / 2 / 3 / 5) bisa dipilih sekali ketuk, dan jumlah terakhir terisi otomatis.
- Bila tamu membeli satu tiket lagi, ketuk **+1** di kartu; hitungan mundur bertambah tanpa dimulai ulang. Tekan lama untuk 2 / 3 / 5.
- Setiap anggota bisa dijeda, dilanjutkan, diatur ulang, atau memulai putaran berikutnya sendiri. Berganti grup tidak menghentikan pengatur waktu grup lain.
- Empat anggota per halaman, halaman berikutnya bisa digeser. Sepuluh detik terakhir cincin berubah menjadi warna kuning tua.
### Suara
Empat suara peringatan orisinal sudah tersedia. Rekaman dari aplikasi lain juga bisa diimpor (di bawah 30 detik; M4A, WAV, OGG, FLAC, dan lainnya). Saat aplikasi terbuka, suara memakai volume media dan dicampur bila beberapa putaran selesai bersamaan; di layar kunci dan latar belakang, notifikasi sistem yang menanganinya.
### Data dan tampilan
Grup, anggota, putaran yang berjalan, dan pengaturan tersimpan di perangkat dan kembali saat aplikasi dibuka lagi. Antarmuka mengikuti tema terang dan gelap sistem.
Pengaturan mencakup getaran, layar tetap menyala saat menghitung, dan suara bawaan untuk anggota baru.
### Bahasa
简体中文, 繁體中文(台灣), 繁體粵語(香港), English, 日本語, 한국어, ไทย, Bahasa Indonesia, Bahasa Melayu — ganti di Pengaturan → Bahasa.
<a name="readme-ms"></a>
## Bahasa Melayu
**Papan kira detik berbilang ahli untuk acara meet & greet.**
Beberapa ahli bercakap serentak. Tiga tiket di sini, satu di situ, lima di hujung meja. Telefon diletakkan di tepi meja supaya sesiapa boleh membacanya sekali pandang.
### Cara guna
- Cipta kumpulan dahulu: nama kumpulan dan saat setiap tiket. Tambah ahli, masing-masing dengan warna dan bunyi makluman.
- Ketik jam ahli, masukkan bilangan tiket dan kiraan bermula serta-merta. **Jumlah masa = saat setiap tiket × bilangan tiket.** Bilangan biasa (1 / 2 / 3 / 5) boleh dipilih dengan satu ketikan, dan bilangan terakhir diisi secara automatik.
- Jika tetamu membeli satu tiket lagi, ketik **+1** pada kad; kiraan detik dilanjutkan tanpa bermula semula. Tekan lama untuk 2 / 3 / 5.
- Setiap ahli boleh menjeda, menyambung, menetapkan semula atau memulakan pusingan seterusnya sendiri. Menukar kumpulan tidak menghentikan pemasa kumpulan lain.
- Empat ahli setiap halaman, halaman lain boleh dileret. Sepuluh saat terakhir, cincin bertukar warna kuning tua.
### Bunyi
Empat bunyi makluman asli disertakan. Rakaman daripada aplikasi lain juga boleh diimport (bawah 30 saat; M4A, WAV, OGG, FLAC dan lain-lain). Apabila aplikasi dibuka, bunyi menggunakan kelantangan media dan dicampur jika beberapa pusingan tamat serentak; pada skrin kunci dan latar belakang, notifikasi sistem mengendalikannya.
### Data dan paparan
Kumpulan, ahli, pusingan yang berjalan dan tetapan disimpan pada peranti dan kembali apabila aplikasi dibuka semula. Antara muka mengikut tema cerah dan gelap sistem.
Tetapan merangkumi getaran, skrin kekal hidup semasa mengira, dan bunyi lalai untuk ahli baharu.
### Bahasa
简体中文, 繁體中文(台灣), 繁體粵語(香港), English, 日本語, 한국어, ไทย, Bahasa Indonesia, Bahasa Melayu — tukar di Tetapan → Bahasa.
+16
View File
@@ -0,0 +1,16 @@
# Third-party notices
## Unbounded
Oshicue Tempo bundles the **Unbounded** typeface (variable font, SIL Open Font License 1.1),
the same face the iOS app and the rest of the Oshicue family use for the wordmark and the
countdown digits.
- Copyright: The Unbounded Project Authors (2022)
- License: SIL Open Font License 1.1 — full text in `LICENSES/Unbounded-OFL.txt`
- Bundled at `app/src/main/res/font/unbounded_regular.ttf`
## Alert sounds
The four built-in alert sounds (`chime`, `pulse`, `bell`, `arcade`) are original
synthesised waveforms generated for Oshicue Tempo, licensed under the same terms as the app.
+77
View File
@@ -0,0 +1,77 @@
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.tempo"
compileSdk = 37
defaultConfig {
applicationId = "com.oshicue.tempo"
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")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
testImplementation("junit:junit:4.13.2")
testImplementation(kotlin("test"))
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; }
+42
View File
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.OshicueTempo">
<activity
android:name=".MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.OshicueTempo">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".alert.TempoAlarmReceiver"
android:exported="false" />
<receiver
android:name=".alert.TempoBootReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
</application>
</manifest>
+167
View File
@@ -0,0 +1,167 @@
// Oshicue Tempo — en
"audio.arcade.name" = "Level Up";
"audio.arcade.subtitle" = "An upbeat rising electronic tone";
"audio.bell.name" = "Bell";
"audio.bell.subtitle" = "A warm, harmonious bell";
"audio.chime.name" = "Starlight";
"audio.chime.subtitle" = "Three bright, clear notes";
"audio.deleteFailed" = "Couldn't delete the recording: %@";
"audio.fileNotFound" = "The sound file could not be found.";
"audio.import.empty" = "This recording has no playable audio.";
"audio.import.tooLarge" = "The audio file is too large. Choose a short recording under 50 MB.";
"audio.import.tooLong" = "Sounds must be shorter than 30 seconds. Trim the recording first.";
"audio.import.unreadable" = "This recording could not be decoded. Try exporting it as M4A or WAV.";
"audio.import.unsupported" = "Choose an M4A, WAV, AIFF, CAF, MP3, AAC, OGG, or FLAC audio file.";
"audio.importedReadFailed" = "Imported sounds could not be loaded: %@";
"audio.importedSubtitle" = "Imported · %.1f sec";
"audio.playbackError" = "The sound could not be played: %@";
"audio.playbackInterrupted" = "Sound playback was interrupted. Preview it again or import another recording.";
"audio.previewError" = "The sound could not be previewed: %@";
"audio.previewInterrupted" = "The preview was interrupted. Try again or import another recording.";
"audio.pulse.name" = "Heartbeat";
"audio.pulse.subtitle" = "Two soft, distinct pulses";
"audio.systemSound" = "System Sound";
"board.addFirstGroup" = "Add your first group";
"board.currentGroup" = "Current group";
"board.emptyMessage" = "Add a group, members, and seconds per ticket\nto start an independent timer for each member.";
"board.emptyTitle" = "Your first MEET & GREET starts here";
"board.eventKind" = "MEET & GREET";
"board.manageGroups" = "Manage groups and members";
"board.manageGroupsMenu" = "Manage groups";
"board.memberCount" = "Members: %ld";
"board.nextPage" = "Next members";
"board.operationFailed" = "Action could not be completed";
"board.previousPage" = "Previous members";
"board.quickGuide" = "Tap clock · Enter tickets · Start";
"board.ready" = "Ready";
"board.resetQuestion" = "Reset this round for %@?";
"board.resetRound" = "Reset round";
"board.runningCount" = "%ld running";
"board.secondsPerTicket" = "sec / ticket";
"board.settings" = "Settings";
"board.soundSettings" = "Alert sound settings";
"common.cancel" = "Cancel";
"common.done" = "Done";
"common.ok" = "OK";
"common.preview" = "Preview";
"common.save" = "Save";
"groupEditor.activeRound" = "A round is active. Its timer duration will stay the same.";
"groupEditor.addMember" = "Add Member";
"groupEditor.addTitle" = "Add Group";
"groupEditor.customSound" = "Custom Alert Sound";
"groupEditor.deleteMember" = "Delete Member";
"groupEditor.durationHelp" = "Enter 1–3600 seconds. Set the ticket count separately before starting each member’s timer.";
"groupEditor.editTitle" = "Edit Group";
"groupEditor.groupSection" = "Group";
"groupEditor.memberColor" = "Member Color";
"groupEditor.memberName" = "Name";
"groupEditor.memberNamePlaceholder" = "Member Name";
"groupEditor.memberNumber" = "Member %@";
"groupEditor.memberSound" = "Timer Alert Sound";
"groupEditor.membersHelp" = "Keep at least one member. Each page shows four members. Swipe between pages to see more.";
"groupEditor.namePlaceholder" = "Group Name";
"groupEditor.previewAccessibility" = "Preview %@";
"groupEditor.previewTickets" = "%1$ld → %2$ld s";
"groupEditor.removeMember" = "Remove Member";
"groupEditor.removeMemberMessage" = "Saving will end this member’s active timer and cancel its alert.";
"groupEditor.removeMemberTitle" = "Remove This Member?";
"groupEditor.secondsPerTicket" = "Time per Ticket";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "sec";
"groups.add" = "Add Group";
"groups.count" = "Groups · %ld";
"groups.currentAccessibility" = "Current group, %@";
"groups.delete" = "Delete";
"groups.deleteActiveMessage" = "Running or paused timers for this group will also end (%ld in total), and their alerts will be canceled. This cannot be undone.";
"groups.deleteAll" = "Delete Group and Members";
"groups.deleteMessage" = "All members and settings for this group will be deleted, and its timer alerts will be canceled. This cannot be undone.";
"groups.deleteNamedTitle" = "Delete “%@”?";
"groups.editAccessibility" = "Edit group, %@";
"groups.intro" = "Set the time per ticket for each group. Choose a color and an alert sound for each member.";
"groups.memberSummary" = "Members: %ld · %ld s / ticket";
"groups.reorderHint" = "Use the arrows to reorder";
"groups.selectAccessibility" = "Switch to %@";
"groups.title" = "Groups & Members";
"notifications.authorized" = "Notifications allowed";
"notifications.denied" = "Notifications are off. Enable them in system settings.";
"notifications.notDetermined" = "Enable notifications when you start your first timer.";
"notifications.roundFinishedBody" = "The countdown has ended. Thank you for this moment together.";
"notifications.roundFinishedTitle" = "%@ · Round Finished";
"notifications.scheduleFailed" = "The background alert could not be scheduled. Keep the app open while timing.";
"settings.about" = "Oshicue Tempo · a multi-member board timer for meet & greet events. Set in Unbounded.";
"settings.behaviour" = "Behaviour";
"settings.data" = "Data";
"settings.dataSaved" = "Groups, members and running rounds come back when you reopen the app.";
"settings.dataTitle" = "Saved on this device";
"settings.dataUnreadable" = "The saved file could not be read. It has been kept and will not be overwritten.";
"settings.defaultSound" = "Default alert sound";
"settings.defaultSoundHelp" = "Preselected for every newly added member. Each member can still choose their own.";
"settings.defaults" = "New members";
"settings.followSystem" = "Follow system";
"settings.haptics" = "Haptics";
"settings.hapticsHint" = "Vibrate when a round starts, pauses or ends.";
"settings.keepAwake" = "Keep screen on";
"settings.keepAwakeHint" = "The display stays awake while a countdown is running.";
"settings.language" = "Language";
"settings.roundStatus" = "Rounds now";
"settings.roundStatusValue" = "%1$ld running · %2$ld finished";
"settings.title" = "Settings";
"settings.version" = "Version";
"sounds.alertsHelp" = "While the app is open, sounds use your device\u2019s media volume. On the lock screen or in the background, alerts are affected by Do Not Disturb, silent mode and notification settings. Preview a sound and check the volume before your MEET & GREET.";
"sounds.alertsSection" = "Alert Behavior";
"sounds.allowNotifications" = "Allow Timer Notifications";
"sounds.backgroundAlerts" = "Lock Screen & Background Alerts";
"sounds.builtIn" = "Built-in Sounds";
"sounds.deleteRecording" = "Delete";
"sounds.import" = "Import Recording from Files";
"sounds.importHelp" = "Recordings must be shorter than 30 seconds. Record with any recorder app, then import the audio file here. Supports M4A, WAV, OGG, FLAC, and other audio files.";
"sounds.importedMessage" = "“%@” has been saved. Open Groups & Members to choose it as a member’s timer alert sound.";
"sounds.importedTitle" = "Recording Added";
"sounds.importing" = "Importing…";
"sounds.intro" = "Choose from four original alert sounds or import your own recording. Set a sound for each person in member settings.";
"sounds.introTitle" = "A Clear Sound to End Each Round";
"sounds.myRecordings" = "My Recordings";
"sounds.myRecordingsCount" = "My Recordings · %ld";
"sounds.openNotificationSettings" = "Open Notification Settings";
"sounds.operationFailed" = "Unable to Complete Action";
"sounds.previewAccessibility" = "Preview %@";
"sounds.title" = "Sounds & Alerts";
"storage.readFailed" = "Local data could not be loaded. The original file has been preserved without changes.\n%@";
"storage.unreadableSnapshot" = "The original data cannot be read. Saving has stopped to protect the file. Back up and move files/OshicueTempo/state.json, then reopen the app.";
"storage.writeFailed" = "Local data could not be saved. Check the available storage on your device.\n%@";
"tickets.confirmStart" = "Confirm & Start";
"tickets.formula" = "%ld sec / ticket × %ld";
"tickets.hint" = "Enter 1–999 tickets for this round. Confirm to start immediately.";
"tickets.maximumDuration" = "Each round is limited to 24 hours. Enter fewer tickets.";
"tickets.newRound" = "Start a new round";
"tickets.quickPick" = "%ld tickets";
"tickets.roundTickets" = "Tickets this round";
"tickets.unit" = "tickets";
"timer.accessibility" = "%@, %@, %@";
"timer.enterTickets" = "Enter tickets";
"timer.extendOneAccessibility" = "Extend %@ by one";
"timer.extendTickets" = "Extend by %ld";
"timer.finished" = "Time’s up";
"timer.live" = "LIVE";
"timer.nextRound" = "Next round";
"timer.pause" = "Pause";
"timer.paused" = "Paused";
"timer.resetMember" = "Reset timer for %@";
"timer.resume" = "Resume";
"timer.roundSummary" = "Tickets: %ld · %ld sec";
"timer.running" = "Counting down";
"timer.tapToStart" = "Tap clock to start";
"timer.ticketDuration" = "%ld sec / ticket";
"validation.corruptSnapshot" = "Local data is incomplete. The original file has been preserved.";
"validation.duplicateGroup" = "This data contains duplicate group IDs and cannot be loaded.";
"validation.duplicateMember" = "This member ID is duplicated. Add the member again.";
"validation.durationTooLong" = "A countdown cannot exceed 24 hours. Use fewer tickets.";
"validation.emptyGroupName" = "Enter a group name.";
"validation.emptyMemberName" = "Enter a member name.";
"validation.emptyMembers" = "Add at least one member.";
"validation.invalidColor" = "Member colors must use a six-digit hexadecimal code.";
"validation.invalidSecondsPerTicket" = "Set the time per ticket from 1 to 3600 seconds.";
"validation.invalidSound" = "Choose an end-of-round sound.";
"validation.invalidTickets" = "Enter a whole number of tickets from 1 to 999.";
"validation.memberNotFound" = "This member could not be found. Select a member again.";
+167
View File
@@ -0,0 +1,167 @@
// Oshicue Tempo — id
"audio.arcade.name" = "Naik Level";
"audio.arcade.subtitle" = "Nada elektronik ceria yang menanjak";
"audio.bell.name" = "Lonceng";
"audio.bell.subtitle" = "Lonceng hangat yang harmonis";
"audio.chime.name" = "Cahaya Bintang";
"audio.chime.subtitle" = "Tiga nada cerah yang jernih";
"audio.deleteFailed" = "Rekaman tidak dapat dihapus: %@";
"audio.fileNotFound" = "Berkas suara tidak ditemukan.";
"audio.import.empty" = "Rekaman ini tidak memiliki audio yang dapat diputar.";
"audio.import.tooLarge" = "Berkas audio terlalu besar. Pilih rekaman pendek di bawah 50 MB.";
"audio.import.tooLong" = "Suara harus lebih pendek dari 30 detik. Pangkas rekaman terlebih dahulu.";
"audio.import.unreadable" = "Rekaman ini tidak dapat didekode. Coba ekspor sebagai M4A atau WAV.";
"audio.import.unsupported" = "Pilih berkas audio M4A, WAV, AIFF, CAF, MP3, AAC, OGG, atau FLAC.";
"audio.importedReadFailed" = "Suara yang diimpor tidak dapat dimuat: %@";
"audio.importedSubtitle" = "Diimpor · %.1f detik";
"audio.playbackError" = "Suara tidak dapat diputar: %@";
"audio.playbackInterrupted" = "Pemutaran suara terputus. Coba pratinjau lagi atau impor rekaman lain.";
"audio.previewError" = "Suara tidak dapat dipratinjau: %@";
"audio.previewInterrupted" = "Pratinjau terputus. Coba lagi atau impor rekaman lain.";
"audio.pulse.name" = "Detak Jantung";
"audio.pulse.subtitle" = "Dua denyut lembut yang jelas";
"audio.systemSound" = "Suara Sistem";
"board.addFirstGroup" = "Tambahkan grup pertama Anda";
"board.currentGroup" = "Grup saat ini";
"board.emptyMessage" = "Tambahkan grup, anggota, dan detik per tiket\nuntuk memulai pengatur waktu terpisah bagi tiap anggota.";
"board.emptyTitle" = "MEET & GREET pertama Anda dimulai di sini";
"board.eventKind" = "MEET & GREET";
"board.manageGroups" = "Kelola grup dan anggota";
"board.manageGroupsMenu" = "Kelola grup";
"board.memberCount" = "Anggota: %ld";
"board.nextPage" = "Anggota berikutnya";
"board.operationFailed" = "Tindakan tidak dapat diselesaikan";
"board.previousPage" = "Anggota sebelumnya";
"board.quickGuide" = "Ketuk jam · Masukkan tiket · Mulai";
"board.ready" = "Siap";
"board.resetQuestion" = "Atur ulang babak ini untuk %@?";
"board.resetRound" = "Atur ulang babak";
"board.runningCount" = "%ld berjalan";
"board.secondsPerTicket" = "dtk / tiket";
"board.settings" = "Pengaturan";
"board.soundSettings" = "Pengaturan suara peringatan";
"common.cancel" = "Batal";
"common.done" = "Selesai";
"common.ok" = "OK";
"common.preview" = "Pratinjau";
"common.save" = "Simpan";
"groupEditor.activeRound" = "Ada babak yang sedang aktif. Durasi pengatur waktunya tidak akan berubah.";
"groupEditor.addMember" = "Tambah Anggota";
"groupEditor.addTitle" = "Tambah Grup";
"groupEditor.customSound" = "Suara Peringatan Khusus";
"groupEditor.deleteMember" = "Hapus Anggota";
"groupEditor.durationHelp" = "Masukkan 1–3600 detik. Atur jumlah tiket secara terpisah sebelum memulai pengatur waktu tiap anggota.";
"groupEditor.editTitle" = "Edit Grup";
"groupEditor.groupSection" = "Grup";
"groupEditor.memberColor" = "Warna Anggota";
"groupEditor.memberName" = "Nama";
"groupEditor.memberNamePlaceholder" = "Nama Anggota";
"groupEditor.memberNumber" = "Anggota %@";
"groupEditor.memberSound" = "Suara Peringatan Pengatur Waktu";
"groupEditor.membersHelp" = "Sisakan setidaknya satu anggota. Setiap halaman menampilkan empat anggota. Geser antarhalaman untuk melihat lebih banyak.";
"groupEditor.namePlaceholder" = "Nama Grup";
"groupEditor.previewAccessibility" = "Pratinjau %@";
"groupEditor.previewTickets" = "%1$ld → %2$ld dtk";
"groupEditor.removeMember" = "Keluarkan Anggota";
"groupEditor.removeMemberMessage" = "Menyimpan akan mengakhiri pengatur waktu aktif anggota ini dan membatalkan peringatannya.";
"groupEditor.removeMemberTitle" = "Keluarkan Anggota Ini?";
"groupEditor.secondsPerTicket" = "Waktu per Tiket";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "dtk";
"groups.add" = "Tambah Grup";
"groups.count" = "Grup · %ld";
"groups.currentAccessibility" = "Grup saat ini, %@";
"groups.delete" = "Hapus";
"groups.deleteActiveMessage" = "Pengatur waktu yang berjalan atau dijeda untuk grup ini juga akan berakhir (total %ld), dan peringatannya akan dibatalkan. Tindakan ini tidak dapat dibatalkan.";
"groups.deleteAll" = "Hapus Grup dan Anggota";
"groups.deleteMessage" = "Semua anggota dan pengaturan grup ini akan dihapus, dan peringatan pengatur waktunya akan dibatalkan. Tindakan ini tidak dapat dibatalkan.";
"groups.deleteNamedTitle" = "Hapus “%@”?";
"groups.editAccessibility" = "Edit grup, %@";
"groups.intro" = "Atur waktu per tiket untuk setiap grup. Pilih warna dan suara peringatan untuk setiap anggota.";
"groups.memberSummary" = "Anggota: %ld · %ld dtk / tiket";
"groups.reorderHint" = "Gunakan panah untuk mengubah urutan";
"groups.selectAccessibility" = "Beralih ke %@";
"groups.title" = "Grup & Anggota";
"notifications.authorized" = "Notifikasi diizinkan";
"notifications.denied" = "Notifikasi nonaktif. Aktifkan di pengaturan sistem.";
"notifications.notDetermined" = "Aktifkan notifikasi saat Anda memulai pengatur waktu pertama.";
"notifications.roundFinishedBody" = "Hitung mundur telah berakhir. Terima kasih untuk momen bersama ini.";
"notifications.roundFinishedTitle" = "%@ · Babak Selesai";
"notifications.scheduleFailed" = "Peringatan latar belakang tidak dapat dijadwalkan. Biarkan aplikasi tetap terbuka saat menghitung waktu.";
"settings.about" = "Oshicue Tempo · pengatur waktu papan multianggota untuk acara meet & greet. Disetel dalam Unbounded.";
"settings.behaviour" = "Perilaku";
"settings.data" = "Data";
"settings.dataSaved" = "Grup, anggota, dan babak yang berjalan akan kembali saat Anda membuka aplikasi lagi.";
"settings.dataTitle" = "Tersimpan di perangkat ini";
"settings.dataUnreadable" = "Berkas tersimpan tidak dapat dibaca. Berkas tersebut tetap disimpan dan tidak akan ditimpa.";
"settings.defaultSound" = "Suara peringatan default";
"settings.defaultSoundHelp" = "Otomatis terpilih untuk setiap anggota baru. Setiap anggota tetap bisa memilih suaranya sendiri.";
"settings.defaults" = "Anggota baru";
"settings.followSystem" = "Ikuti sistem";
"settings.haptics" = "Getaran";
"settings.hapticsHint" = "Bergetar saat babak dimulai, dijeda, atau berakhir.";
"settings.keepAwake" = "Layar tetap menyala";
"settings.keepAwakeHint" = "Layar tetap menyala selama hitung mundur berjalan.";
"settings.language" = "Bahasa";
"settings.roundStatus" = "Babak saat ini";
"settings.roundStatusValue" = "%1$ld berjalan · %2$ld selesai";
"settings.title" = "Pengaturan";
"settings.version" = "Versi";
"sounds.alertsHelp" = "Saat aplikasi terbuka, suara memakai volume media perangkat Anda. Di layar kunci atau di latar belakang, peringatan dipengaruhi oleh Jangan Ganggu, mode senyap, dan pengaturan notifikasi. Pratinjau suara dan periksa volume sebelum MEET & GREET Anda.";
"sounds.alertsSection" = "Perilaku Peringatan";
"sounds.allowNotifications" = "Izinkan Notifikasi Pengatur Waktu";
"sounds.backgroundAlerts" = "Peringatan Layar Kunci & Latar Belakang";
"sounds.builtIn" = "Suara Bawaan";
"sounds.deleteRecording" = "Hapus";
"sounds.import" = "Impor Rekaman dari File";
"sounds.importHelp" = "Rekaman harus lebih pendek dari 30 detik. Rekam dengan aplikasi perekam apa pun, lalu impor berkas audionya di sini. Mendukung M4A, WAV, OGG, FLAC, dan berkas audio lainnya.";
"sounds.importedMessage" = "“%@” telah disimpan. Buka Grup & Anggota untuk memilihnya sebagai suara peringatan pengatur waktu anggota.";
"sounds.importedTitle" = "Rekaman Ditambahkan";
"sounds.importing" = "Mengimpor…";
"sounds.intro" = "Pilih dari empat suara peringatan orisinal atau impor rekaman Anda sendiri. Atur suara untuk setiap orang di pengaturan anggota.";
"sounds.introTitle" = "Suara Jelas untuk Mengakhiri Setiap Babak";
"sounds.myRecordings" = "Rekaman Saya";
"sounds.myRecordingsCount" = "Rekaman Saya · %ld";
"sounds.openNotificationSettings" = "Buka Pengaturan Notifikasi";
"sounds.operationFailed" = "Tindakan Tidak Dapat Diselesaikan";
"sounds.previewAccessibility" = "Pratinjau %@";
"sounds.title" = "Suara & Peringatan";
"storage.readFailed" = "Data lokal tidak dapat dimuat. Berkas asli telah dipertahankan tanpa perubahan.\n%@";
"storage.unreadableSnapshot" = "Data asli tidak dapat dibaca. Penyimpanan dihentikan untuk melindungi berkas. Cadangkan lalu pindahkan files/OshicueTempo/state.json, kemudian buka kembali aplikasi.";
"storage.writeFailed" = "Data lokal tidak dapat disimpan. Periksa ruang penyimpanan yang tersedia di perangkat Anda.\n%@";
"tickets.confirmStart" = "Konfirmasi & Mulai";
"tickets.formula" = "%ld dtk / tiket × %ld";
"tickets.hint" = "Masukkan 1–999 tiket untuk babak ini. Konfirmasi untuk langsung memulai.";
"tickets.maximumDuration" = "Setiap babak dibatasi 24 jam. Masukkan tiket lebih sedikit.";
"tickets.newRound" = "Mulai babak baru";
"tickets.quickPick" = "%ld tiket";
"tickets.roundTickets" = "Tiket babak ini";
"tickets.unit" = "tiket";
"timer.accessibility" = "%@, %@, %@";
"timer.enterTickets" = "Masukkan tiket";
"timer.extendOneAccessibility" = "Perpanjang %@ satu tiket";
"timer.extendTickets" = "Perpanjang %ld tiket";
"timer.finished" = "Waktu habis";
"timer.live" = "LIVE";
"timer.nextRound" = "Babak berikutnya";
"timer.pause" = "Jeda";
"timer.paused" = "Dijeda";
"timer.resetMember" = "Atur ulang pengatur waktu untuk %@";
"timer.resume" = "Lanjutkan";
"timer.roundSummary" = "Tiket: %ld · %ld dtk";
"timer.running" = "Menghitung mundur";
"timer.tapToStart" = "Ketuk jam untuk memulai";
"timer.ticketDuration" = "%ld dtk / tiket";
"validation.corruptSnapshot" = "Data lokal tidak lengkap. Berkas asli telah dipertahankan.";
"validation.duplicateGroup" = "Data ini berisi ID grup ganda dan tidak dapat dimuat.";
"validation.duplicateMember" = "ID anggota ini ganda. Tambahkan anggota tersebut lagi.";
"validation.durationTooLong" = "Hitung mundur tidak boleh melebihi 24 jam. Gunakan tiket lebih sedikit.";
"validation.emptyGroupName" = "Masukkan nama grup.";
"validation.emptyMemberName" = "Masukkan nama anggota.";
"validation.emptyMembers" = "Tambahkan setidaknya satu anggota.";
"validation.invalidColor" = "Warna anggota harus memakai kode heksadesimal enam digit.";
"validation.invalidSecondsPerTicket" = "Atur waktu per tiket dari 1 sampai 3600 detik.";
"validation.invalidSound" = "Pilih suara akhir babak.";
"validation.invalidTickets" = "Masukkan jumlah tiket bilangan bulat dari 1 sampai 999.";
"validation.memberNotFound" = "Anggota ini tidak ditemukan. Pilih anggota lagi.";
+167
View File
@@ -0,0 +1,167 @@
// Oshicue Tempo — ja
"audio.arcade.name" = "レベルアップ";
"audio.arcade.subtitle" = "軽やかに上がる電子音";
"audio.bell.name" = "ベル";
"audio.bell.subtitle" = "あたたかな和音のベル";
"audio.chime.name" = "きらめき";
"audio.chime.subtitle" = "澄んだ3つの音";
"audio.deleteFailed" = "録音を削除できません:%@";
"audio.fileNotFound" = "通知音のファイルが見つかりません。";
"audio.import.empty" = "この録音には再生できる音声がありません。";
"audio.import.tooLarge" = "音声ファイルが大きすぎます。50 MB未満の短い録音を選んでください。";
"audio.import.tooLong" = "通知音は30秒未満にしてください。録音をトリミングしてから読み込んでください。";
"audio.import.unreadable" = "この録音を読み込めません。M4AまたはWAVで書き出してみてください。";
"audio.import.unsupported" = "M4A、WAV、AIFF、CAF、MP3、AAC、OGG、FLAC の音声ファイルを選んでください。";
"audio.importedReadFailed" = "読み込んだ通知音を開けません:%@";
"audio.importedSubtitle" = "読み込み済み · %.1f秒";
"audio.playbackError" = "通知音を再生できません:%@";
"audio.playbackInterrupted" = "通知音の再生が中断されました。試聴し直すか、別の録音を読み込んでください。";
"audio.previewError" = "通知音を試聴できません:%@";
"audio.previewInterrupted" = "試聴が中断されました。もう一度試聴するか、別の録音を読み込んでください。";
"audio.pulse.name" = "ハートビート";
"audio.pulse.subtitle" = "やさしく響く2つのパルス音";
"audio.systemSound" = "システム通知音";
"board.addFirstGroup" = "最初のグループを追加";
"board.currentGroup" = "選択中のグループ";
"board.emptyMessage" = "グループ、メンバー、券1枚あたりの秒数を\n設定すると、個別に計測できます。";
"board.emptyTitle" = "はじめての特典会は、ここから";
"board.eventKind" = "特典会";
"board.manageGroups" = "グループとメンバーを管理";
"board.manageGroupsMenu" = "グループを管理";
"board.memberCount" = "メンバー %ld 人";
"board.nextPage" = "次のメンバー";
"board.operationFailed" = "操作を完了できませんでした";
"board.previousPage" = "前のメンバー";
"board.quickGuide" = "時計をタップ · 券の枚数を入力 · スタート";
"board.ready" = "準備完了";
"board.resetQuestion" = "%@の今回のタイマーをリセットしますか?";
"board.resetRound" = "今回の計測をリセット";
"board.runningCount" = "%ld 人を計測中";
"board.secondsPerTicket" = "秒 / 枚";
"board.settings" = "設定";
"board.soundSettings" = "通知音の設定";
"common.cancel" = "キャンセル";
"common.done" = "完了";
"common.ok" = "OK";
"common.preview" = "試聴";
"common.save" = "保存";
"groupEditor.activeRound" = "この回は進行中です。開始済みのタイマーの時間は変わりません。";
"groupEditor.addMember" = "メンバーを追加";
"groupEditor.addTitle" = "グループを追加";
"groupEditor.customSound" = "カスタム終了音";
"groupEditor.deleteMember" = "メンバーを削除";
"groupEditor.durationHelp" = "1〜3600秒で入力してください。メンバーのタイマーを開始するたびに、その回の券の枚数を入力します。";
"groupEditor.editTitle" = "グループを編集";
"groupEditor.groupSection" = "グループ";
"groupEditor.memberColor" = "担当カラー";
"groupEditor.memberName" = "名前";
"groupEditor.memberNamePlaceholder" = "メンバー名";
"groupEditor.memberNumber" = "メンバー %@";
"groupEditor.memberSound" = "終了音";
"groupEditor.membersHelp" = "少なくとも1人のメンバーが必要です。1ページに4人ずつ表示されます。他のメンバーはページを切り替えて確認できます。";
"groupEditor.namePlaceholder" = "グループ名";
"groupEditor.previewAccessibility" = "「%@」を試聴";
"groupEditor.previewTickets" = "%1$ld枚 → %2$ld秒";
"groupEditor.removeMember" = "メンバーを削除";
"groupEditor.removeMemberMessage" = "保存すると、このメンバーの実行中のタイマーが終了し、終了通知も取り消されます。";
"groupEditor.removeMemberTitle" = "このメンバーを削除しますか?";
"groupEditor.secondsPerTicket" = "券1枚の時間";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "秒";
"groups.add" = "グループを追加";
"groups.count" = "グループ · %ld";
"groups.currentAccessibility" = "選択中のグループ、%@";
"groups.delete" = "削除";
"groups.deleteActiveMessage" = "このグループで実行中または一時停止中のタイマー %ld 件も終了し、終了通知が取り消されます。この操作は取り消せません。";
"groups.deleteAll" = "グループとメンバーを削除";
"groups.deleteMessage" = "このグループのすべてのメンバーと設定が削除され、タイマーの終了通知が取り消されます。この操作は取り消せません。";
"groups.deleteNamedTitle" = "「%@」を削除しますか?";
"groups.editAccessibility" = "グループ「%@」を編集";
"groups.intro" = "券1枚あたりの時間はグループごとに設定します。メンバーごとに担当カラーと終了音を選べます。";
"groups.memberSummary" = "メンバー %ld 人 · 1枚 %ld 秒";
"groups.reorderHint" = "矢印で並べ替え";
"groups.selectAccessibility" = "「%@」に切り替え";
"groups.title" = "グループとメンバー";
"notifications.authorized" = "通知は許可されています";
"notifications.denied" = "通知がオフです。システム設定で有効にしてください。";
"notifications.notDetermined" = "初めてタイマーを開始すると通知を許可できます";
"notifications.roundFinishedBody" = "カウントダウンが終了しました。このひとときをありがとう。";
"notifications.roundFinishedTitle" = "%@ · この回は終了";
"notifications.scheduleFailed" = "バックグラウンドの通知を設定できません。Appを開いたまま計時してください。";
"settings.about" = "Oshicue Tempo · 特典会向けの多人数ボードタイマー。Oshicue のブランドカラーと Unbounded で構成しています。";
"settings.behaviour" = "操作とフィードバック";
"settings.data" = "データ";
"settings.dataSaved" = "グループ・メンバー・進行中の計測は再起動時に復元されます。";
"settings.dataTitle" = "この端末に保存";
"settings.dataUnreadable" = "保存ファイルを読み込めません。元のファイルは保持され、上書きされません。";
"settings.defaultSound" = "デフォルト通知音";
"settings.defaultSoundHelp" = "新しいメンバーに自動で設定されます。個別に変更もできます。";
"settings.defaults" = "新しいメンバー";
"settings.followSystem" = "システムに従う";
"settings.haptics" = "触覚フィードバック";
"settings.hapticsHint" = "開始・一時停止・終了時に振動します。";
"settings.keepAwake" = "計測中は画面をオンのまま";
"settings.keepAwakeHint" = "カウントダウン中は画面がスリープしません。";
"settings.language" = "言語";
"settings.roundStatus" = "現在の計測";
"settings.roundStatusValue" = "%1$ld 進行中 · %2$ld 終了";
"settings.title" = "設定";
"settings.version" = "バージョン";
"sounds.alertsHelp" = "アプリを開いている間は端末のメディア音量で再生します。画面ロック中やバックグラウンドでは、おやすみモード・サイレントモード・通知設定の影響を受けます。特典会の前に試聴して音量を確認してください。";
"sounds.alertsSection" = "通知方法";
"sounds.allowNotifications" = "終了通知を許可";
"sounds.backgroundAlerts" = "ロック中・バックグラウンドの通知";
"sounds.builtIn" = "内蔵の終了音";
"sounds.deleteRecording" = "削除";
"sounds.import" = "ファイルから録音を読み込む";
"sounds.importHelp" = "録音は30秒未満にしてください。任意の録音アプリで録音し、ここから音声ファイルを読み込めます。M4A、WAV、OGG、FLAC などに対応。";
"sounds.importedMessage" = "「%@」を保存しました。「グループとメンバー」の設定で、メンバーの終了音として選択できます。";
"sounds.importedTitle" = "録音を追加しました";
"sounds.importing" = "読み込み中…";
"sounds.intro" = "4種類のオリジナル終了音に加えて、自分の録音も読み込めます。メンバー設定で一人ずつ選んでください。";
"sounds.introTitle" = "毎回の終了を音でお知らせ";
"sounds.myRecordings" = "自分の録音";
"sounds.myRecordingsCount" = "自分の録音 · %ld";
"sounds.openNotificationSettings" = "システムの通知設定を開く";
"sounds.operationFailed" = "操作を完了できません";
"sounds.previewAccessibility" = "「%@」を試聴";
"sounds.title" = "サウンドと通知";
"storage.readFailed" = "保存データを読み込めません。元のファイルは上書きせずに保持されています。\n%@";
"storage.unreadableSnapshot" = "元のデータを読み取れません。ファイルを保護するため保存を停止しました。files/OshicueTempo/state.json をバックアップして移動し、アプリを開き直してください。";
"storage.writeFailed" = "データを保存できません。デバイスの空き容量を確認してください。\n%@";
"tickets.confirmStart" = "確認してカウントダウン開始";
"tickets.formula" = "%ld 秒 / 枚 × %ld 枚";
"tickets.hint" = "毎回、券の枚数を1〜999枚で入力してください。確認するとすぐに開始します。";
"tickets.maximumDuration" = "1回の計測は24時間までです。券の枚数を減らしてください。";
"tickets.newRound" = "新しい回を開始";
"tickets.quickPick" = "%ld枚";
"tickets.roundTickets" = "今回の特典券";
"tickets.unit" = "枚";
"timer.accessibility" = "%@、%@、%@";
"timer.enterTickets" = "券の枚数を入力";
"timer.extendOneAccessibility" = "%@の券を1枚追加";
"timer.extendTickets" = "%ld枚を追加";
"timer.finished" = "時間です";
"timer.live" = "計測中";
"timer.nextRound" = "次の回";
"timer.pause" = "一時停止";
"timer.paused" = "一時停止中";
"timer.resetMember" = "%@のタイマーをリセット";
"timer.resume" = "再開";
"timer.roundSummary" = "%ld 枚 · %ld 秒";
"timer.running" = "カウントダウン中";
"timer.tapToStart" = "時計をタップして開始";
"timer.ticketDuration" = "%ld 秒 / 枚";
"validation.corruptSnapshot" = "保存データが不完全です。元のファイルは保持されています。";
"validation.duplicateGroup" = "グループIDが重複しているため、データを読み込めません。";
"validation.duplicateMember" = "メンバーIDが重複しています。このメンバーを追加し直してください。";
"validation.durationTooLong" = "1回のカウントダウンは24時間までです。特典券の枚数を減らしてください。";
"validation.emptyGroupName" = "グループ名を入力してください。";
"validation.emptyMemberName" = "メンバー名を入力してください。";
"validation.emptyMembers" = "メンバーを1人以上追加してください。";
"validation.invalidColor" = "メンバーカラーは6桁の16進数で指定してください。";
"validation.invalidSecondsPerTicket" = "特典券1枚あたりの時間は1〜3600秒で設定してください。";
"validation.invalidSound" = "終了時の通知音を選んでください。";
"validation.invalidTickets" = "特典券の枚数は1〜999の整数で入力してください。";
"validation.memberNotFound" = "メンバーが見つかりません。選び直してください。";
+167
View File
@@ -0,0 +1,167 @@
// Oshicue Tempo — ko
"audio.arcade.name" = "레벨 업";
"audio.arcade.subtitle" = "경쾌하게 상승하는 전자음";
"audio.bell.name" = "벨";
"audio.bell.subtitle" = "따뜻하고 화음이 어울리는 벨 소리";
"audio.chime.name" = "별빛";
"audio.chime.subtitle" = "맑고 선명한 세 개의 음";
"audio.deleteFailed" = "녹음을 삭제하지 못했습니다: %@";
"audio.fileNotFound" = "사운드 파일을 찾을 수 없습니다.";
"audio.import.empty" = "이 녹음에는 재생할 수 있는 오디오가 없습니다.";
"audio.import.tooLarge" = "오디오 파일이 너무 큽니다. 50MB 미만의 짧은 녹음을 선택해 주세요.";
"audio.import.tooLong" = "사운드는 30초보다 짧아야 합니다. 먼저 녹음을 잘라 주세요.";
"audio.import.unreadable" = "이 녹음을 디코딩할 수 없습니다. M4A 또는 WAV로 내보내 보세요.";
"audio.import.unsupported" = "M4A, WAV, AIFF, CAF, MP3, AAC, OGG 또는 FLAC 오디오 파일을 선택해 주세요.";
"audio.importedReadFailed" = "가져온 사운드를 불러오지 못했습니다: %@";
"audio.importedSubtitle" = "가져옴 · %.1f초";
"audio.playbackError" = "사운드를 재생하지 못했습니다: %@";
"audio.playbackInterrupted" = "사운드 재생이 중단되었습니다. 다시 미리 듣거나 다른 녹음을 가져와 주세요.";
"audio.previewError" = "사운드를 미리 들을 수 없습니다: %@";
"audio.previewInterrupted" = "미리 듣기가 중단되었습니다. 다시 시도하거나 다른 녹음을 가져와 주세요.";
"audio.pulse.name" = "심장 박동";
"audio.pulse.subtitle" = "부드럽고 또렷한 두 번의 박동";
"audio.systemSound" = "시스템 사운드";
"board.addFirstGroup" = "첫 그룹을 추가하세요";
"board.currentGroup" = "현재 그룹";
"board.emptyMessage" = "그룹과 멤버, 티켓당 초를 추가하면\n멤버마다 개별 타이머를 시작할 수 있습니다.";
"board.emptyTitle" = "첫 사인회는 여기서 시작됩니다";
"board.eventKind" = "사인회";
"board.manageGroups" = "그룹 및 멤버 관리";
"board.manageGroupsMenu" = "그룹 관리";
"board.memberCount" = "멤버: %ld";
"board.nextPage" = "다음 멤버";
"board.operationFailed" = "작업을 완료하지 못했습니다";
"board.previousPage" = "이전 멤버";
"board.quickGuide" = "시계를 탭 · 티켓 입력 · 시작";
"board.ready" = "준비됨";
"board.resetQuestion" = "%@의 이번 라운드를 초기화할까요?";
"board.resetRound" = "라운드 초기화";
"board.runningCount" = "%ld개 진행 중";
"board.secondsPerTicket" = "초 / 티켓";
"board.settings" = "설정";
"board.soundSettings" = "알림음 설정";
"common.cancel" = "취소";
"common.done" = "완료";
"common.ok" = "확인";
"common.preview" = "미리 듣기";
"common.save" = "저장";
"groupEditor.activeRound" = "라운드가 진행 중입니다. 타이머 시간은 그대로 유지됩니다.";
"groupEditor.addMember" = "멤버 추가";
"groupEditor.addTitle" = "그룹 추가";
"groupEditor.customSound" = "사용자 지정 알림음";
"groupEditor.deleteMember" = "멤버 삭제";
"groupEditor.durationHelp" = "1~3600초 사이로 입력하세요. 각 멤버의 타이머를 시작하기 전에 티켓 수를 따로 설정하세요.";
"groupEditor.editTitle" = "그룹 편집";
"groupEditor.groupSection" = "그룹";
"groupEditor.memberColor" = "멤버 색상";
"groupEditor.memberName" = "이름";
"groupEditor.memberNamePlaceholder" = "멤버 이름";
"groupEditor.memberNumber" = "멤버 %@";
"groupEditor.memberSound" = "타이머 알림음";
"groupEditor.membersHelp" = "멤버는 최소 한 명 이상 유지해야 합니다. 한 페이지에 네 명씩 표시되며, 페이지를 넘겨 더 볼 수 있습니다.";
"groupEditor.namePlaceholder" = "그룹 이름";
"groupEditor.previewAccessibility" = "%@ 미리 듣기";
"groupEditor.previewTickets" = "%1$ld → %2$ld초";
"groupEditor.removeMember" = "멤버 제거";
"groupEditor.removeMemberMessage" = "저장하면 이 멤버의 진행 중인 타이머가 종료되고 알림이 취소됩니다.";
"groupEditor.removeMemberTitle" = "이 멤버를 제거할까요?";
"groupEditor.secondsPerTicket" = "티켓당 시간";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "초";
"groups.add" = "그룹 추가";
"groups.count" = "그룹 · %ld";
"groups.currentAccessibility" = "현재 그룹, %@";
"groups.delete" = "삭제";
"groups.deleteActiveMessage" = "이 그룹의 진행 중이거나 일시정지된 타이머도 모두 종료되며(총 %ld개), 해당 알림이 취소됩니다. 이 작업은 되돌릴 수 없습니다.";
"groups.deleteAll" = "그룹과 멤버 삭제";
"groups.deleteMessage" = "이 그룹의 모든 멤버와 설정이 삭제되고 타이머 알림이 취소됩니다. 이 작업은 되돌릴 수 없습니다.";
"groups.deleteNamedTitle" = "“%@”을(를) 삭제할까요?";
"groups.editAccessibility" = "그룹 편집, %@";
"groups.intro" = "그룹마다 티켓당 시간을 설정하세요. 멤버마다 색상과 알림음을 선택할 수 있습니다.";
"groups.memberSummary" = "멤버: %ld · 티켓당 %ld초";
"groups.reorderHint" = "화살표로 순서를 변경하세요";
"groups.selectAccessibility" = "%@(으)로 전환";
"groups.title" = "그룹 및 멤버";
"notifications.authorized" = "알림 허용됨";
"notifications.denied" = "알림이 꺼져 있습니다. 시스템 설정에서 알림을 켜 주세요.";
"notifications.notDetermined" = "첫 타이머를 시작할 때 알림을 켜 주세요.";
"notifications.roundFinishedBody" = "카운트다운이 끝났습니다. 함께한 이 시간에 감사드립니다.";
"notifications.roundFinishedTitle" = "%@ · 라운드 종료";
"notifications.scheduleFailed" = "백그라운드 알림을 예약하지 못했습니다. 타이머를 사용하는 동안 앱을 열어 두세요.";
"settings.about" = "Oshicue Tempo · 사인회를 위한 멤버별 보드 타이머입니다. Unbounded 서체를 사용했습니다.";
"settings.behaviour" = "동작";
"settings.data" = "데이터";
"settings.dataSaved" = "앱을 다시 열면 그룹, 멤버, 진행 중인 라운드가 복원됩니다.";
"settings.dataTitle" = "이 기기에 저장됨";
"settings.dataUnreadable" = "저장된 파일을 읽을 수 없습니다. 파일은 그대로 보존되며 덮어쓰지 않습니다.";
"settings.defaultSound" = "기본 알림음";
"settings.defaultSoundHelp" = "새로 추가하는 멤버에 미리 선택됩니다. 멤버별로 개별 알림음을 고를 수도 있습니다.";
"settings.defaults" = "새 멤버";
"settings.followSystem" = "시스템 설정 따르기";
"settings.haptics" = "진동";
"settings.hapticsHint" = "라운드가 시작되거나 일시정지, 종료될 때 진동합니다.";
"settings.keepAwake" = "화면 켜 두기";
"settings.keepAwakeHint" = "카운트다운이 진행되는 동안 화면이 켜진 상태로 유지됩니다.";
"settings.language" = "언어";
"settings.roundStatus" = "현재 라운드";
"settings.roundStatusValue" = "%1$ld개 진행 중 · %2$ld개 완료";
"settings.title" = "설정";
"settings.version" = "버전";
"sounds.alertsHelp" = "앱을 열어 둔 상태에서는 기기 미디어 볼륨으로 소리가 재생됩니다. 잠금 화면이나 백그라운드에서는 방해 금지 모드, 무음 모드, 알림 설정의 영향을 받습니다. 사인회 전에 소리를 미리 듣고 볼륨을 확인해 주세요.";
"sounds.alertsSection" = "알림 동작";
"sounds.allowNotifications" = "타이머 알림 허용";
"sounds.backgroundAlerts" = "잠금 화면 및 백그라운드 알림";
"sounds.builtIn" = "기본 제공 사운드";
"sounds.deleteRecording" = "삭제";
"sounds.import" = "파일에서 녹음 가져오기";
"sounds.importHelp" = "녹음은 30초보다 짧아야 합니다. 원하는 녹음 앱으로 녹음한 뒤 오디오 파일을 여기로 가져오세요. M4A, WAV, OGG, FLAC 등 다양한 오디오 파일을 지원합니다.";
"sounds.importedMessage" = "“%@”이(가) 저장되었습니다. 그룹 및 멤버에서 이 멤버의 타이머 알림음으로 선택해 주세요.";
"sounds.importedTitle" = "녹음 추가됨";
"sounds.importing" = "가져오는 중…";
"sounds.intro" = "네 가지 기본 알림음 중에서 고르거나 직접 녹음한 파일을 가져오세요. 멤버 설정에서 각자의 알림음을 지정할 수 있습니다.";
"sounds.introTitle" = "라운드가 끝날 때를 알려 주는 선명한 사운드";
"sounds.myRecordings" = "내 녹음";
"sounds.myRecordingsCount" = "내 녹음 · %ld";
"sounds.openNotificationSettings" = "알림 설정 열기";
"sounds.operationFailed" = "작업을 완료할 수 없습니다";
"sounds.previewAccessibility" = "%@ 미리 듣기";
"sounds.title" = "사운드 및 알림";
"storage.readFailed" = "로컬 데이터를 불러오지 못했습니다. 원본 파일은 변경 없이 보존되었습니다.\n%@";
"storage.unreadableSnapshot" = "원본 데이터를 읽을 수 없습니다. 파일을 보호하기 위해 저장이 중단되었습니다. files/OshicueTempo/state.json을 백업하고 이동한 뒤 앱을 다시 열어 주세요.";
"storage.writeFailed" = "로컬 데이터를 저장하지 못했습니다. 기기의 사용 가능한 저장 공간을 확인해 주세요.\n%@";
"tickets.confirmStart" = "확인 후 시작";
"tickets.formula" = "%ld초 / 티켓 × %ld";
"tickets.hint" = "이번 라운드의 티켓 수를 1~999 사이로 입력하세요. 확인하면 바로 시작됩니다.";
"tickets.maximumDuration" = "라운드는 최대 24시간까지 가능합니다. 티켓 수를 줄여 주세요.";
"tickets.newRound" = "새 라운드 시작";
"tickets.quickPick" = "티켓 %ld장";
"tickets.roundTickets" = "이번 라운드 티켓";
"tickets.unit" = "티켓";
"timer.accessibility" = "%@, %@, %@";
"timer.enterTickets" = "티켓 입력";
"timer.extendOneAccessibility" = "%@ 1장 연장";
"timer.extendTickets" = "%ld장 연장";
"timer.finished" = "시간 종료";
"timer.live" = "진행 중";
"timer.nextRound" = "다음 라운드";
"timer.pause" = "일시정지";
"timer.paused" = "일시정지됨";
"timer.resetMember" = "%@의 타이머 초기화";
"timer.resume" = "재개";
"timer.roundSummary" = "티켓: %ld · %ld초";
"timer.running" = "카운트다운 중";
"timer.tapToStart" = "시계를 탭하여 시작";
"timer.ticketDuration" = "%ld초 / 티켓";
"validation.corruptSnapshot" = "로컬 데이터가 완전하지 않습니다. 원본 파일은 보존되었습니다.";
"validation.duplicateGroup" = "이 데이터에 중복된 그룹 ID가 있어 불러올 수 없습니다.";
"validation.duplicateMember" = "이 멤버 ID가 중복됩니다. 멤버를 다시 추가해 주세요.";
"validation.durationTooLong" = "카운트다운은 24시간을 초과할 수 없습니다. 티켓 수를 줄여 주세요.";
"validation.emptyGroupName" = "그룹 이름을 입력해 주세요.";
"validation.emptyMemberName" = "멤버 이름을 입력해 주세요.";
"validation.emptyMembers" = "멤버를 한 명 이상 추가해 주세요.";
"validation.invalidColor" = "멤버 색상은 6자리 16진수 코드를 사용해야 합니다.";
"validation.invalidSecondsPerTicket" = "티켓당 시간은 1~3600초 사이로 설정해 주세요.";
"validation.invalidSound" = "라운드 종료음을 선택해 주세요.";
"validation.invalidTickets" = "티켓 수를 1~999 사이의 정수로 입력해 주세요.";
"validation.memberNotFound" = "이 멤버를 찾을 수 없습니다. 멤버를 다시 선택해 주세요.";
+167
View File
@@ -0,0 +1,167 @@
// Oshicue Tempo — ms
"audio.arcade.name" = "Naik Tahap";
"audio.arcade.subtitle" = "Nada elektronik rancak yang menaik";
"audio.bell.name" = "Loceng";
"audio.bell.subtitle" = "Loceng harmoni yang hangat";
"audio.chime.name" = "Cahaya Bintang";
"audio.chime.subtitle" = "Tiga not cerah dan jernih";
"audio.deleteFailed" = "Rakaman tidak dapat dipadam: %@";
"audio.fileNotFound" = "Fail bunyi tidak ditemui.";
"audio.import.empty" = "Rakaman ini tiada audio yang boleh dimainkan.";
"audio.import.tooLarge" = "Fail audio terlalu besar. Pilih rakaman pendek di bawah 50 MB.";
"audio.import.tooLong" = "Bunyi mesti kurang daripada 30 saat. Potong rakaman terlebih dahulu.";
"audio.import.unreadable" = "Rakaman ini tidak dapat dinyahkod. Cuba eksport sebagai M4A atau WAV.";
"audio.import.unsupported" = "Pilih fail audio M4A, WAV, AIFF, CAF, MP3, AAC, OGG atau FLAC.";
"audio.importedReadFailed" = "Bunyi yang diimport tidak dapat dimuatkan: %@";
"audio.importedSubtitle" = "Diimport · %.1f saat";
"audio.playbackError" = "Bunyi tidak dapat dimainkan: %@";
"audio.playbackInterrupted" = "Main balik bunyi terganggu. Pratonton sekali lagi atau import rakaman lain.";
"audio.previewError" = "Bunyi tidak dapat dipratonton: %@";
"audio.previewInterrupted" = "Pratonton terganggu. Cuba lagi atau import rakaman lain.";
"audio.pulse.name" = "Denyutan Jantung";
"audio.pulse.subtitle" = "Dua denyutan lembut yang jelas";
"audio.systemSound" = "Bunyi Sistem";
"board.addFirstGroup" = "Tambah kumpulan pertama anda";
"board.currentGroup" = "Kumpulan semasa";
"board.emptyMessage" = "Tambah kumpulan, ahli dan saat setiap tiket\nuntuk memulakan pemasa berasingan bagi setiap ahli.";
"board.emptyTitle" = "MEET & GREET pertama anda bermula di sini";
"board.eventKind" = "MEET & GREET";
"board.manageGroups" = "Urus kumpulan dan ahli";
"board.manageGroupsMenu" = "Urus kumpulan";
"board.memberCount" = "Ahli: %ld";
"board.nextPage" = "Ahli seterusnya";
"board.operationFailed" = "Tindakan tidak dapat diselesaikan";
"board.previousPage" = "Ahli sebelumnya";
"board.quickGuide" = "Ketik jam · Masukkan tiket · Mula";
"board.ready" = "Sedia";
"board.resetQuestion" = "Tetapkan semula pusingan ini untuk %@?";
"board.resetRound" = "Tetapkan semula pusingan";
"board.runningCount" = "%ld berjalan";
"board.secondsPerTicket" = "s / tiket";
"board.settings" = "Tetapan";
"board.soundSettings" = "Tetapan bunyi isyarat";
"common.cancel" = "Batal";
"common.done" = "Selesai";
"common.ok" = "OK";
"common.preview" = "Pratonton";
"common.save" = "Simpan";
"groupEditor.activeRound" = "Pusingan sedang aktif. Tempoh pemasanya akan kekal sama.";
"groupEditor.addMember" = "Tambah Ahli";
"groupEditor.addTitle" = "Tambah Kumpulan";
"groupEditor.customSound" = "Bunyi Isyarat Tersuai";
"groupEditor.deleteMember" = "Padam Ahli";
"groupEditor.durationHelp" = "Masukkan 1–3600 saat. Tetapkan bilangan tiket secara berasingan sebelum memulakan pemasa setiap ahli.";
"groupEditor.editTitle" = "Edit Kumpulan";
"groupEditor.groupSection" = "Kumpulan";
"groupEditor.memberColor" = "Warna Ahli";
"groupEditor.memberName" = "Nama";
"groupEditor.memberNamePlaceholder" = "Nama Ahli";
"groupEditor.memberNumber" = "Ahli %@";
"groupEditor.memberSound" = "Bunyi Isyarat Pemasa";
"groupEditor.membersHelp" = "Kekalkan sekurang-kurangnya seorang ahli. Setiap halaman memaparkan empat ahli. Leret antara halaman untuk melihat lagi.";
"groupEditor.namePlaceholder" = "Nama Kumpulan";
"groupEditor.previewAccessibility" = "Pratonton %@";
"groupEditor.previewTickets" = "%1$ld → %2$ld s";
"groupEditor.removeMember" = "Alih Keluar Ahli";
"groupEditor.removeMemberMessage" = "Menyimpan akan menamatkan pemasa aktif ahli ini dan membatalkan isyaratnya.";
"groupEditor.removeMemberTitle" = "Alih Keluar Ahli Ini?";
"groupEditor.secondsPerTicket" = "Masa setiap Tiket";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "saat";
"groups.add" = "Tambah Kumpulan";
"groups.count" = "Kumpulan · %ld";
"groups.currentAccessibility" = "Kumpulan semasa, %@";
"groups.delete" = "Padam";
"groups.deleteActiveMessage" = "Pemasa yang sedang berjalan atau dijeda untuk kumpulan ini juga akan tamat (%ld kesemuanya), dan isyaratnya akan dibatalkan. Tindakan ini tidak boleh dibatalkan.";
"groups.deleteAll" = "Padam Kumpulan dan Ahli";
"groups.deleteMessage" = "Semua ahli dan tetapan untuk kumpulan ini akan dipadam, dan isyarat pemasanya akan dibatalkan. Tindakan ini tidak boleh dibatalkan.";
"groups.deleteNamedTitle" = "Padam “%@”?";
"groups.editAccessibility" = "Edit kumpulan, %@";
"groups.intro" = "Tetapkan masa setiap tiket bagi setiap kumpulan. Pilih warna dan bunyi isyarat untuk setiap ahli.";
"groups.memberSummary" = "Ahli: %ld · %ld s / tiket";
"groups.reorderHint" = "Gunakan anak panah untuk menyusun semula";
"groups.selectAccessibility" = "Tukar kepada %@";
"groups.title" = "Kumpulan & Ahli";
"notifications.authorized" = "Pemberitahuan dibenarkan";
"notifications.denied" = "Pemberitahuan dimatikan. Hidupkannya dalam tetapan sistem.";
"notifications.notDetermined" = "Hidupkan pemberitahuan apabila anda memulakan pemasa pertama.";
"notifications.roundFinishedBody" = "Detik telah tamat. Terima kasih atas masa bersama ini.";
"notifications.roundFinishedTitle" = "%@ · Pusingan Tamat";
"notifications.scheduleFailed" = "Isyarat latar belakang tidak dapat dijadualkan. Biarkan app terbuka semasa pemasa berjalan.";
"settings.about" = "Oshicue Tempo · pemasa papan berbilang ahli untuk acara meet & greet. Ditetapkan dalam Unbounded.";
"settings.behaviour" = "Tingkah Laku";
"settings.data" = "Data";
"settings.dataSaved" = "Kumpulan, ahli dan pusingan yang berjalan akan muncul semula apabila anda membuka semula app.";
"settings.dataTitle" = "Disimpan pada peranti ini";
"settings.dataUnreadable" = "Fail yang disimpan tidak dapat dibaca. Ia telah disimpan dan tidak akan ditulis ganti.";
"settings.defaultSound" = "Bunyi isyarat lalai";
"settings.defaultSoundHelp" = "Dipilih terlebih dahulu untuk setiap ahli yang baru ditambah. Setiap ahli masih boleh memilih bunyinya sendiri.";
"settings.defaults" = "Ahli baharu";
"settings.followSystem" = "Ikut sistem";
"settings.haptics" = "Getaran";
"settings.hapticsHint" = "Bergetar apabila pusingan bermula, dijeda atau tamat.";
"settings.keepAwake" = "Pastikan skrin hidup";
"settings.keepAwakeHint" = "Paparan kekal hidup semasa detik berjalan.";
"settings.language" = "Bahasa";
"settings.roundStatus" = "Pusingan sekarang";
"settings.roundStatusValue" = "%1$ld berjalan · %2$ld tamat";
"settings.title" = "Tetapan";
"settings.version" = "Versi";
"sounds.alertsHelp" = "Semasa app terbuka, bunyi menggunakan kelantangan media peranti anda. Pada skrin kunci atau di latar belakang, isyarat dipengaruhi oleh Jangan Ganggu, mod senyap dan tetapan pemberitahuan. Pratonton bunyi dan semak kelantangan sebelum MEET & GREET anda.";
"sounds.alertsSection" = "Tingkah Laku Isyarat";
"sounds.allowNotifications" = "Benarkan Pemberitahuan Pemasa";
"sounds.backgroundAlerts" = "Isyarat Skrin Kunci & Latar Belakang";
"sounds.builtIn" = "Bunyi Terbina Dalam";
"sounds.deleteRecording" = "Padam";
"sounds.import" = "Import Rakaman daripada Fail";
"sounds.importHelp" = "Rakaman mesti kurang daripada 30 saat. Rakam dengan mana-mana app perakam, kemudian import fail audio di sini. Menyokong M4A, WAV, OGG, FLAC dan fail audio lain.";
"sounds.importedMessage" = "“%@” telah disimpan. Buka Kumpulan & Ahli untuk memilihnya sebagai bunyi isyarat pemasa ahli.";
"sounds.importedTitle" = "Rakaman Ditambah";
"sounds.importing" = "Mengimport…";
"sounds.intro" = "Pilih antara empat bunyi isyarat asli atau import rakaman anda sendiri. Tetapkan bunyi untuk setiap ahli dalam tetapan ahli.";
"sounds.introTitle" = "Bunyi Jelas untuk Menamatkan Setiap Pusingan";
"sounds.myRecordings" = "Rakaman Saya";
"sounds.myRecordingsCount" = "Rakaman Saya · %ld";
"sounds.openNotificationSettings" = "Buka Tetapan Pemberitahuan";
"sounds.operationFailed" = "Tidak Dapat Melengkapkan Tindakan";
"sounds.previewAccessibility" = "Pratonton %@";
"sounds.title" = "Bunyi & Isyarat";
"storage.readFailed" = "Data setempat tidak dapat dimuatkan. Fail asal telah dikekalkan tanpa perubahan.\n%@";
"storage.unreadableSnapshot" = "Data asal tidak dapat dibaca. Penyimpanan dihentikan untuk melindungi fail. Sandarkan dan alihkan fail files/OshicueTempo/state.json, kemudian buka semula app.";
"storage.writeFailed" = "Data setempat tidak dapat disimpan. Semak storan yang tersedia pada peranti anda.\n%@";
"tickets.confirmStart" = "Sahkan & Mula";
"tickets.formula" = "%ld s / tiket × %ld";
"tickets.hint" = "Masukkan 1–999 tiket untuk pusingan ini. Sahkan untuk mula serta-merta.";
"tickets.maximumDuration" = "Setiap pusingan terhad kepada 24 jam. Masukkan lebih sedikit tiket.";
"tickets.newRound" = "Mulakan pusingan baharu";
"tickets.quickPick" = "%ld tiket";
"tickets.roundTickets" = "Tiket pusingan ini";
"tickets.unit" = "tiket";
"timer.accessibility" = "%@, %@, %@";
"timer.enterTickets" = "Masukkan tiket";
"timer.extendOneAccessibility" = "Panjangkan %@ sebanyak satu";
"timer.extendTickets" = "Panjangkan sebanyak %ld";
"timer.finished" = "Masa tamat";
"timer.live" = "LANGSUNG";
"timer.nextRound" = "Pusingan seterusnya";
"timer.pause" = "Jeda";
"timer.paused" = "Dijeda";
"timer.resetMember" = "Tetapkan semula pemasa untuk %@";
"timer.resume" = "Sambung";
"timer.roundSummary" = "Tiket: %ld · %ld s";
"timer.running" = "Mengira detik";
"timer.tapToStart" = "Ketik jam untuk mula";
"timer.ticketDuration" = "%ld s / tiket";
"validation.corruptSnapshot" = "Data setempat tidak lengkap. Fail asal telah dikekalkan.";
"validation.duplicateGroup" = "Data ini mengandungi ID kumpulan berganda dan tidak dapat dimuatkan.";
"validation.duplicateMember" = "ID ahli ini berganda. Tambah ahli itu semula.";
"validation.durationTooLong" = "Detik tidak boleh melebihi 24 jam. Gunakan lebih sedikit tiket.";
"validation.emptyGroupName" = "Masukkan nama kumpulan.";
"validation.emptyMemberName" = "Masukkan nama ahli.";
"validation.emptyMembers" = "Tambah sekurang-kurangnya seorang ahli.";
"validation.invalidColor" = "Warna ahli mesti menggunakan kod heksadesimal enam digit.";
"validation.invalidSecondsPerTicket" = "Tetapkan masa setiap tiket dari 1 hingga 3600 saat.";
"validation.invalidSound" = "Pilih bunyi tamat pusingan.";
"validation.invalidTickets" = "Masukkan nombor tiket bulat dari 1 hingga 999.";
"validation.memberNotFound" = "Ahli ini tidak ditemui. Pilih ahli sekali lagi.";
+167
View File
@@ -0,0 +1,167 @@
// Oshicue Tempo — th
"audio.arcade.name" = "เลเวลอัป";
"audio.arcade.subtitle" = "เสียงอิเล็กทรอนิกส์จังหวะสนุกที่ไต่ระดับขึ้น";
"audio.bell.name" = "ระฆัง";
"audio.bell.subtitle" = "เสียงระฆังที่นุ่มนวลและกลมกลืน";
"audio.chime.name" = "แสงดาว";
"audio.chime.subtitle" = "โน้ตใส ๆ สามตัวที่ชัดเจน";
"audio.deleteFailed" = "ลบไฟล์บันทึกเสียงไม่สำเร็จ: %@";
"audio.fileNotFound" = "ไม่พบไฟล์เสียง";
"audio.import.empty" = "ไฟล์บันทึกเสียงนี้ไม่มีข้อมูลเสียงที่เล่นได้";
"audio.import.tooLarge" = "ไฟล์เสียงมีขนาดใหญ่เกินไป เลือกไฟล์บันทึกสั้น ๆ ที่มีขนาดไม่เกิน 50 MB";
"audio.import.tooLong" = "เสียงต้องยาวไม่เกิน 30 วินาที กรุณาตัดไฟล์เสียงก่อนนำเข้า";
"audio.import.unreadable" = "ไม่สามารถถอดรหัสไฟล์บันทึกเสียงนี้ได้ ลองส่งออกเป็น M4A หรือ WAV";
"audio.import.unsupported" = "เลือกไฟล์เสียงแบบ M4A, WAV, AIFF, CAF, MP3, AAC, OGG หรือ FLAC";
"audio.importedReadFailed" = "โหลดเสียงที่นำเข้าไม่สำเร็จ: %@";
"audio.importedSubtitle" = "นำเข้า · %.1f วินาที";
"audio.playbackError" = "เล่นเสียงไม่สำเร็จ: %@";
"audio.playbackInterrupted" = "การเล่นเสียงถูกขัดจังหวะ ลองฟังตัวอย่างอีกครั้งหรือนำเข้าไฟล์เสียงใหม่";
"audio.previewError" = "เล่นตัวอย่างเสียงไม่สำเร็จ: %@";
"audio.previewInterrupted" = "การฟังตัวอย่างถูกขัดจังหวะ ลองอีกครั้งหรือนำเข้าไฟล์เสียงใหม่";
"audio.pulse.name" = "เสียงหัวใจเต้น";
"audio.pulse.subtitle" = "จังหวะเบา ๆ สองครั้งที่แยกกันชัดเจน";
"audio.systemSound" = "เสียงของระบบ";
"board.addFirstGroup" = "เพิ่มกลุ่มแรกของคุณ";
"board.currentGroup" = "กลุ่มปัจจุบัน";
"board.emptyMessage" = "เพิ่มกลุ่ม สมาชิก และจำนวนวินาทีต่อตั๋ว\nเพื่อเริ่มตัวจับเวลาแยกให้สมาชิกแต่ละคน";
"board.emptyTitle" = "มีตติ้งแอนด์กรีทครั้งแรกของคุณเริ่มต้นที่นี่";
"board.eventKind" = "มีตติ้งแอนด์กรีท";
"board.manageGroups" = "จัดการกลุ่มและสมาชิก";
"board.manageGroupsMenu" = "จัดการกลุ่ม";
"board.memberCount" = "สมาชิก: %ld";
"board.nextPage" = "สมาชิกหน้าถัดไป";
"board.operationFailed" = "ดำเนินการไม่สำเร็จ";
"board.previousPage" = "สมาชิกหน้าก่อนหน้า";
"board.quickGuide" = "แตะนาฬิกา · ใส่จำนวนตั๋ว · เริ่ม";
"board.ready" = "พร้อม";
"board.resetQuestion" = "รีเซ็ตรอบนี้สำหรับ %@ หรือไม่";
"board.resetRound" = "รีเซ็ตรอบ";
"board.runningCount" = "กำลังทำงาน %ld รายการ";
"board.secondsPerTicket" = "วิ / ตั๋ว";
"board.settings" = "การตั้งค่า";
"board.soundSettings" = "ตั้งค่าเสียงแจ้งเตือน";
"common.cancel" = "ยกเลิก";
"common.done" = "เสร็จสิ้น";
"common.ok" = "ตกลง";
"common.preview" = "ฟังตัวอย่าง";
"common.save" = "บันทึก";
"groupEditor.activeRound" = "มีรอบที่กำลังทำงานอยู่ ระยะเวลาของรอบนี้จะคงเดิม";
"groupEditor.addMember" = "เพิ่มสมาชิก";
"groupEditor.addTitle" = "เพิ่มกลุ่ม";
"groupEditor.customSound" = "เสียงแจ้งเตือนกำหนดเอง";
"groupEditor.deleteMember" = "ลบสมาชิก";
"groupEditor.durationHelp" = "ใส่ 1–3600 วินาที ตั้งจำนวนตั๋วแยกต่างหากก่อนเริ่มจับเวลาของสมาชิกแต่ละคน";
"groupEditor.editTitle" = "แก้ไขกลุ่ม";
"groupEditor.groupSection" = "กลุ่ม";
"groupEditor.memberColor" = "สีของสมาชิก";
"groupEditor.memberName" = "ชื่อ";
"groupEditor.memberNamePlaceholder" = "ชื่อสมาชิก";
"groupEditor.memberNumber" = "สมาชิก %@";
"groupEditor.memberSound" = "เสียงแจ้งเตือนของตัวจับเวลา";
"groupEditor.membersHelp" = "ต้องมีสมาชิกอย่างน้อยหนึ่งคน แต่ละหน้าแสดงสมาชิกสี่คน ปัดเพื่อดูหน้าอื่น";
"groupEditor.namePlaceholder" = "ชื่อกลุ่ม";
"groupEditor.previewAccessibility" = "ฟังตัวอย่าง %@";
"groupEditor.previewTickets" = "%1$ld → %2$ld วิ";
"groupEditor.removeMember" = "นำสมาชิกออก";
"groupEditor.removeMemberMessage" = "การบันทึกจะยุติตัวจับเวลาที่ทำงานอยู่ของสมาชิกคนนี้และยกเลิกการแจ้งเตือน";
"groupEditor.removeMemberTitle" = "นำสมาชิกคนนี้ออกหรือไม่";
"groupEditor.secondsPerTicket" = "เวลาต่อตั๋ว";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "วินาที";
"groups.add" = "เพิ่มกลุ่ม";
"groups.count" = "กลุ่ม · %ld";
"groups.currentAccessibility" = "กลุ่มปัจจุบัน %@";
"groups.delete" = "ลบ";
"groups.deleteActiveMessage" = "ตัวจับเวลาที่กำลังทำงานหรือหยุดชั่วคราวของกลุ่มนี้จะสิ้นสุดลงด้วย (รวม %ld รายการ) และการแจ้งเตือนจะถูกยกเลิก ไม่สามารถย้อนกลับได้";
"groups.deleteAll" = "ลบกลุ่มและสมาชิก";
"groups.deleteMessage" = "สมาชิกและการตั้งค่าทั้งหมดของกลุ่มนี้จะถูกลบ และการแจ้งเตือนของตัวจับเวลาจะถูกยกเลิก ไม่สามารถย้อนกลับได้";
"groups.deleteNamedTitle" = "ลบ “%@” หรือไม่";
"groups.editAccessibility" = "แก้ไขกลุ่ม %@";
"groups.intro" = "ตั้งเวลาต่อตั๋วสำหรับแต่ละกลุ่ม เลือกสีและเสียงแจ้งเตือนให้สมาชิกแต่ละคน";
"groups.memberSummary" = "สมาชิก: %ld · %ld วิ / ตั๋ว";
"groups.reorderHint" = "ใช้ลูกศรเพื่อจัดลำดับใหม่";
"groups.selectAccessibility" = "สลับไปที่ %@";
"groups.title" = "กลุ่มและสมาชิก";
"notifications.authorized" = "อนุญาตการแจ้งเตือนแล้ว";
"notifications.denied" = "การแจ้งเตือนปิดอยู่ เปิดได้ในการตั้งค่าระบบ";
"notifications.notDetermined" = "เปิดการแจ้งเตือนเมื่อคุณเริ่มจับเวลาครั้งแรก";
"notifications.roundFinishedBody" = "การนับถอยหลังสิ้นสุดลงแล้ว ขอบคุณสำหรับช่วงเวลานี้ด้วยกัน";
"notifications.roundFinishedTitle" = "%@ · รอบสิ้นสุดแล้ว";
"notifications.scheduleFailed" = "ไม่สามารถตั้งเวลาการแจ้งเตือนเบื้องหลังได้ กรุณาเปิดแอปค้างไว้ขณะจับเวลา";
"settings.about" = "Oshicue Tempo · ตัวจับเวลาบอร์ดหลายสมาชิกสำหรับงานมีตติ้งแอนด์กรีท ใช้ฟอนต์ Unbounded";
"settings.behaviour" = "การทำงาน";
"settings.data" = "ข้อมูล";
"settings.dataSaved" = "กลุ่ม สมาชิก และรอบที่กำลังทำงานจะกลับมาเมื่อคุณเปิดแอปอีกครั้ง";
"settings.dataTitle" = "บันทึกไว้ในเครื่องนี้";
"settings.dataUnreadable" = "อ่านไฟล์ที่บันทึกไว้ไม่สำเร็จ ไฟล์ยังคงอยู่และจะไม่ถูกเขียนทับ";
"settings.defaultSound" = "เสียงแจ้งเตือนเริ่มต้น";
"settings.defaultSoundHelp" = "เลือกไว้ล่วงหน้าสำหรับสมาชิกที่เพิ่มใหม่ทุกคน สมาชิกแต่ละคนยังเลือกเสียงของตัวเองได้";
"settings.defaults" = "สมาชิกใหม่";
"settings.followSystem" = "ตามระบบ";
"settings.haptics" = "การสั่น";
"settings.hapticsHint" = "สั่นเมื่อรอบเริ่ม หยุดชั่วคราว หรือสิ้นสุด";
"settings.keepAwake" = "เปิดหน้าจอค้างไว้";
"settings.keepAwakeHint" = "หน้าจอจะสว่างค้างไว้ขณะกำลังนับถอยหลัง";
"settings.language" = "ภาษา";
"settings.roundStatus" = "รอบในขณะนี้";
"settings.roundStatusValue" = "กำลังทำงาน %1$ld · สิ้นสุดแล้ว %2$ld";
"settings.title" = "การตั้งค่า";
"settings.version" = "เวอร์ชัน";
"sounds.alertsHelp" = "ขณะเปิดแอปอยู่ เสียงจะใช้ระดับเสียงสื่อของเครื่อง บนหน้าจอล็อกหรือในเบื้องหลัง การแจ้งเตือนจะได้รับผลจากโหมดห้ามรบกวน โหมดเงียบ และการตั้งค่าการแจ้งเตือน ควรฟังตัวอย่างเสียงและตรวจสอบระดับเสียงก่อนเริ่มมีตติ้งแอนด์กรีท";
"sounds.alertsSection" = "การทำงานของการแจ้งเตือน";
"sounds.allowNotifications" = "อนุญาตการแจ้งเตือนของตัวจับเวลา";
"sounds.backgroundAlerts" = "การแจ้งเตือนบนหน้าจอล็อกและในเบื้องหลัง";
"sounds.builtIn" = "เสียงในตัว";
"sounds.deleteRecording" = "ลบ";
"sounds.import" = "นำเข้าไฟล์บันทึกเสียงจากไฟล์";
"sounds.importHelp" = "ไฟล์บันทึกเสียงต้องยาวไม่เกิน 30 วินาที อัดด้วยแอปบันทึกเสียงใดก็ได้ แล้วนำเข้าไฟล์เสียงที่นี่ รองรับ M4A, WAV, OGG, FLAC และไฟล์เสียงอื่น ๆ";
"sounds.importedMessage" = "บันทึก “%@” แล้ว เปิดกลุ่มและสมาชิกเพื่อเลือกเป็นเสียงแจ้งเตือนของสมาชิก";
"sounds.importedTitle" = "เพิ่มไฟล์บันทึกเสียงแล้ว";
"sounds.importing" = "กำลังนำเข้า…";
"sounds.intro" = "เลือกจากเสียงแจ้งเตือนต้นฉบับสี่แบบ หรือนำเข้าไฟล์บันทึกเสียงของคุณเอง ตั้งเสียงให้แต่ละคนได้ในการตั้งค่าสมาชิก";
"sounds.introTitle" = "เสียงที่ชัดเจนเพื่อปิดท้ายแต่ละรอบ";
"sounds.myRecordings" = "ไฟล์บันทึกเสียงของฉัน";
"sounds.myRecordingsCount" = "ไฟล์บันทึกเสียงของฉัน · %ld";
"sounds.openNotificationSettings" = "เปิดการตั้งค่าการแจ้งเตือน";
"sounds.operationFailed" = "ดำเนินการไม่สำเร็จ";
"sounds.previewAccessibility" = "ฟังตัวอย่าง %@";
"sounds.title" = "เสียงและการแจ้งเตือน";
"storage.readFailed" = "โหลดข้อมูลในเครื่องไม่สำเร็จ ไฟล์ต้นฉบับยังคงอยู่โดยไม่มีการเปลี่ยนแปลง\n%@";
"storage.unreadableSnapshot" = "ไม่สามารถอ่านข้อมูลต้นฉบับได้ การบันทึกถูกหยุดเพื่อป้องกันไฟล์ กรุณาสำรองข้อมูลและย้ายไฟล์ files/OshicueTempo/state.json แล้วเปิดแอปอีกครั้ง";
"storage.writeFailed" = "บันทึกข้อมูลในเครื่องไม่สำเร็จ ตรวจสอบพื้นที่ว่างในเครื่อง\n%@";
"tickets.confirmStart" = "ยืนยันและเริ่ม";
"tickets.formula" = "%ld วิ / ตั๋ว × %ld";
"tickets.hint" = "ใส่จำนวนตั๋ว 1–999 สำหรับรอบนี้ ยืนยันเพื่อเริ่มทันที";
"tickets.maximumDuration" = "แต่ละรอบจำกัดที่ 24 ชั่วโมง กรุณาใส่จำนวนตั๋วให้น้อยลง";
"tickets.newRound" = "เริ่มรอบใหม่";
"tickets.quickPick" = "ตั๋ว %ld ใบ";
"tickets.roundTickets" = "ตั๋วในรอบนี้";
"tickets.unit" = "ตั๋ว";
"timer.accessibility" = "%@, %@, %@";
"timer.enterTickets" = "ใส่จำนวนตั๋ว";
"timer.extendOneAccessibility" = "เพิ่ม %@ อีกหนึ่งครั้ง";
"timer.extendTickets" = "เพิ่มอีก %ld";
"timer.finished" = "หมดเวลา";
"timer.live" = "ไลฟ์";
"timer.nextRound" = "รอบถัดไป";
"timer.pause" = "หยุดชั่วคราว";
"timer.paused" = "หยุดชั่วคราวอยู่";
"timer.resetMember" = "รีเซ็ตตัวจับเวลาของ %@";
"timer.resume" = "ทำงานต่อ";
"timer.roundSummary" = "ตั๋ว: %ld · %ld วิ";
"timer.running" = "กำลังนับถอยหลัง";
"timer.tapToStart" = "แตะนาฬิกาเพื่อเริ่ม";
"timer.ticketDuration" = "%ld วิ / ตั๋ว";
"validation.corruptSnapshot" = "ข้อมูลในเครื่องไม่สมบูรณ์ ไฟล์ต้นฉบับยังคงอยู่";
"validation.duplicateGroup" = "ข้อมูลนี้มีรหัสกลุ่มซ้ำและไม่สามารถโหลดได้";
"validation.duplicateMember" = "รหัสสมาชิกนี้ซ้ำ กรุณาเพิ่มสมาชิกอีกครั้ง";
"validation.durationTooLong" = "การนับถอยหลังต้องไม่เกิน 24 ชั่วโมง กรุณาใช้จำนวนตั๋วให้น้อยลง";
"validation.emptyGroupName" = "กรุณาใส่ชื่อกลุ่ม";
"validation.emptyMemberName" = "กรุณาใส่ชื่อสมาชิก";
"validation.emptyMembers" = "เพิ่มสมาชิกอย่างน้อยหนึ่งคน";
"validation.invalidColor" = "สีของสมาชิกต้องเป็นรหัสฐานสิบหกหกหลัก";
"validation.invalidSecondsPerTicket" = "ตั้งเวลาต่อตั๋วได้ตั้งแต่ 1 ถึง 3600 วินาที";
"validation.invalidSound" = "เลือกเสียงเมื่อจบรอบ";
"validation.invalidTickets" = "ใส่จำนวนตั๋วเป็นจำนวนเต็มตั้งแต่ 1 ถึง 999";
"validation.memberNotFound" = "ไม่พบสมาชิกคนนี้ กรุณาเลือกสมาชิกอีกครั้ง";
@@ -0,0 +1,167 @@
// Oshicue Tempo — zh-HK
"audio.arcade.name" = "升級";
"audio.arcade.subtitle" = "輕快上揚嘅電子音";
"audio.bell.name" = "鈴聲";
"audio.bell.subtitle" = "溫暖而和諧嘅鈴聲";
"audio.chime.name" = "星光";
"audio.chime.subtitle" = "三下清亮嘅音符";
"audio.deleteFailed" = "刪唔到呢段錄音:%@";
"audio.fileNotFound" = "搵唔到呢個提示音檔案。";
"audio.import.empty" = "呢段錄音冇可以播放嘅聲音。";
"audio.import.tooLarge" = "音訊檔案太大,請揀一段 50 MB 以下嘅短錄音。";
"audio.import.tooLong" = "提示音一定要短過 30 秒,請先裁剪段錄音。";
"audio.import.unreadable" = "解碼唔到呢段錄音,試吓匯出做 M4A 或者 WAV。";
"audio.import.unsupported" = "請揀 M4A、WAV、AIFF、CAF、MP3、AAC、OGG 或 FLAC 音訊檔案。";
"audio.importedReadFailed" = "載入唔到已匯入嘅提示音:%@";
"audio.importedSubtitle" = "已匯入 · %.1f 秒";
"audio.playbackError" = "播放唔到提示音:%@";
"audio.playbackInterrupted" = "播放中斷咗,請再試聽一次,或者匯入第二段錄音。";
"audio.previewError" = "試聽唔到提示音:%@";
"audio.previewInterrupted" = "試聽中斷咗,請再試一次,或者匯入第二段錄音。";
"audio.pulse.name" = "心跳";
"audio.pulse.subtitle" = "兩下柔和而分明嘅脈衝";
"audio.systemSound" = "系統提示音";
"board.addFirstGroup" = "新增你第一個團體";
"board.currentGroup" = "而家嘅團體";
"board.emptyMessage" = "新增團體、成員同每張券嘅秒數,\n就可以為每位成員獨立計時。";
"board.emptyTitle" = "你嘅第一個特典會,由呢度開始";
"board.eventKind" = "特典會";
"board.manageGroups" = "管理團體同成員";
"board.manageGroupsMenu" = "管理團體";
"board.memberCount" = "成員:%ld 位";
"board.nextPage" = "下一頁成員";
"board.operationFailed" = "做唔到呢個動作";
"board.previousPage" = "上一頁成員";
"board.quickGuide" = "撳時鐘 · 輸入券數 · 開始";
"board.ready" = "準備好";
"board.resetQuestion" = "重設 %@ 今輪嘅計時?";
"board.resetRound" = "重設今輪";
"board.runningCount" = "%ld 個計時中";
"board.secondsPerTicket" = "秒 / 張";
"board.settings" = "設定";
"board.soundSettings" = "提示音設定";
"common.cancel" = "取消";
"common.done" = "完成";
"common.ok" = "確定";
"common.preview" = "試聽";
"common.save" = "儲存";
"groupEditor.activeRound" = "今輪進行緊,計時長度會維持不變。";
"groupEditor.addMember" = "新增成員";
"groupEditor.addTitle" = "新增團體";
"groupEditor.customSound" = "自訂提示音";
"groupEditor.deleteMember" = "刪除成員";
"groupEditor.durationHelp" = "輸入 1–3600 秒。開始每位成員嘅計時之前,再逐個設定券數。";
"groupEditor.editTitle" = "編輯團體";
"groupEditor.groupSection" = "團體";
"groupEditor.memberColor" = "成員顏色";
"groupEditor.memberName" = "名字";
"groupEditor.memberNamePlaceholder" = "成員名稱";
"groupEditor.memberNumber" = "成員 %@";
"groupEditor.memberSound" = "計時提示音";
"groupEditor.membersHelp" = "最少要留一位成員。每頁顯示四位成員,左右掃就可以睇埋其他頁。";
"groupEditor.namePlaceholder" = "團體名稱";
"groupEditor.previewAccessibility" = "試聽 %@";
"groupEditor.previewTickets" = "%1$ld 張 → %2$ld 秒";
"groupEditor.removeMember" = "移除成員";
"groupEditor.removeMemberMessage" = "儲存之後,呢位成員進行緊嘅計時會結束,提示聲亦會取消。";
"groupEditor.removeMemberTitle" = "移除呢位成員?";
"groupEditor.secondsPerTicket" = "每張券時長";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "秒";
"groups.add" = "新增團體";
"groups.count" = "團體 · %ld";
"groups.currentAccessibility" = "而家嘅團體,%@";
"groups.delete" = "刪除";
"groups.deleteActiveMessage" = "呢個團體進行中或者暫停緊嘅計時(共 %ld 個)都會一齊結束,提示聲亦會取消。刪除之後無法復原。";
"groups.deleteAll" = "刪除團體同所有成員";
"groups.deleteMessage" = "呢個團體嘅所有成員同設定都會刪除,計時提示聲亦會取消。刪除之後無法復原。";
"groups.deleteNamedTitle" = "刪除「%@」?";
"groups.editAccessibility" = "編輯團體,%@";
"groups.intro" = "每個團體各自設定每張券嘅時間。每位成員可以揀自己嘅顏色同提示音。";
"groups.memberSummary" = "成員:%ld 位 · 每張 %ld 秒";
"groups.reorderHint" = "用箭嘴調整次序";
"groups.selectAccessibility" = "切換到 %@";
"groups.title" = "團體同成員";
"notifications.authorized" = "已允許通知";
"notifications.denied" = "通知閂咗,請去系統設定開啟。";
"notifications.notDetermined" = "第一次開始計時嗰陣就可以開啟通知。";
"notifications.roundFinishedBody" = "倒數完咗。多謝你陪我行到呢一刻。";
"notifications.roundFinishedTitle" = "%@ · 今輪完咗";
"notifications.scheduleFailed" = "排唔到背景提示,計時期間請保持 App 開啟。";
"settings.about" = "Oshicue Tempo · 特典會現場用嘅多成員計時板。字體用 Unbounded。";
"settings.behaviour" = "操作同回饋";
"settings.data" = "資料";
"settings.dataSaved" = "再開返 App 就會見到團體、成員同埋進行緊嘅計時。";
"settings.dataTitle" = "存在呢部機度";
"settings.dataUnreadable" = "讀唔到已儲存嘅檔案。原檔已經保留,唔會被覆寫。";
"settings.defaultSound" = "預設提示音";
"settings.defaultSoundHelp" = "新增成員時會自動揀呢個,之後每位成員仍然可以自己揀。";
"settings.defaults" = "新成員";
"settings.followSystem" = "跟隨系統";
"settings.haptics" = "觸覺回饋";
"settings.hapticsHint" = "每輪開始、暫停或者結束嗰陣震一震。";
"settings.keepAwake" = "螢幕長開";
"settings.keepAwakeHint" = "有倒數進行緊嘅時候,螢幕唔會自動熄。";
"settings.language" = "語言";
"settings.roundStatus" = "而家嘅計時";
"settings.roundStatusValue" = "%1$ld 個進行緊 · %2$ld 個已完";
"settings.title" = "設定";
"settings.version" = "版本";
"sounds.alertsHelp" = "App 開住嘅時候,聲音會跟部機嘅媒體音量。鎖機或者喺背景嘅時候,提示會受勿擾模式、靜音模式同通知設定影響。特典會開始之前,記得試聽同檢查音量。";
"sounds.alertsSection" = "提示方式";
"sounds.allowNotifications" = "允許計時通知";
"sounds.backgroundAlerts" = "鎖機同背景提示";
"sounds.builtIn" = "內建提示音";
"sounds.deleteRecording" = "刪除";
"sounds.import" = "由檔案匯入錄音";
"sounds.importHelp" = "錄音一定要短過 30 秒。用任何錄音 App 錄好,再喺度匯入音訊檔。支援 M4A、WAV、OGG、FLAC 等音訊檔案。";
"sounds.importedMessage" = "「%@」已經儲存。去「團體同成員」就可以揀佢做成員嘅計時提示音。";
"sounds.importedTitle" = "已加入錄音";
"sounds.importing" = "匯入緊…";
"sounds.intro" = "有四款原創提示音可以揀,亦可以匯入自己嘅錄音。喺成員設定度為每個人揀一個。";
"sounds.introTitle" = "每一輪都用清晰嘅提示聲結束";
"sounds.myRecordings" = "我嘅錄音";
"sounds.myRecordingsCount" = "我嘅錄音 · %ld";
"sounds.openNotificationSettings" = "開啟通知設定";
"sounds.operationFailed" = "做唔到呢個操作";
"sounds.previewAccessibility" = "試聽 %@";
"sounds.title" = "提示音同通知";
"storage.readFailed" = "載入唔到本機資料。原始檔案已經原封不動保留。\n%@";
"storage.unreadableSnapshot" = "讀唔到原始資料。為咗保護個檔案,已經停止儲存。請先備份再移走 files/OshicueTempo/state.json,然後再開返個 App。";
"storage.writeFailed" = "儲存唔到本機資料,請檢查部機仲有幾多空間。\n%@";
"tickets.confirmStart" = "確認並開始";
"tickets.formula" = "%ld 秒 / 張 × %ld 張";
"tickets.hint" = "今輪輸入 1–999 張券,確認之後即刻開始。";
"tickets.maximumDuration" = "每一輪最多 24 小時,請輸入少啲券。";
"tickets.newRound" = "開始新一輪";
"tickets.quickPick" = "%ld 張券";
"tickets.roundTickets" = "今輪券數";
"tickets.unit" = "張";
"timer.accessibility" = "%@,%@,%@";
"timer.enterTickets" = "輸入券數";
"timer.extendOneAccessibility" = "為 %@ 加多一張";
"timer.extendTickets" = "加多 %ld 張";
"timer.finished" = "夠鐘";
"timer.live" = "進行中";
"timer.nextRound" = "下一輪";
"timer.pause" = "暫停";
"timer.paused" = "暫停咗";
"timer.resetMember" = "重設 %@ 嘅計時";
"timer.resume" = "繼續";
"timer.roundSummary" = "券數:%ld · %ld 秒";
"timer.running" = "倒數緊";
"timer.tapToStart" = "撳時鐘開始";
"timer.ticketDuration" = "每張 %ld 秒";
"validation.corruptSnapshot" = "本機資料唔完整,原始檔案已經保留。";
"validation.duplicateGroup" = "呢份資料有重複嘅團體 ID,載入唔到。";
"validation.duplicateMember" = "呢個成員 ID 重複咗,請重新新增呢位成員。";
"validation.durationTooLong" = "倒數唔可以超過 24 小時,請用少啲券。";
"validation.emptyGroupName" = "請輸入團體名稱。";
"validation.emptyMemberName" = "請輸入成員名稱。";
"validation.emptyMembers" = "最少要新增一位成員。";
"validation.invalidColor" = "成員顏色要用六位十六進位色碼。";
"validation.invalidSecondsPerTicket" = "每張券嘅時間要喺 1 至 3600 秒之間。";
"validation.invalidSound" = "請揀一個結束提示音。";
"validation.invalidTickets" = "券數要係 1 至 999 嘅整數。";
"validation.memberNotFound" = "搵唔到呢位成員,請再揀一次。";
@@ -0,0 +1,167 @@
// Oshicue Tempo — zh-Hans
"audio.arcade.name" = "通关";
"audio.arcade.subtitle" = "轻快的上行电子音";
"audio.bell.name" = "铃语";
"audio.bell.subtitle" = "温暖的和弦铃声";
"audio.chime.name" = "星光";
"audio.chime.subtitle" = "清亮的三音提示";
"audio.deleteFailed" = "无法删除录音:%@";
"audio.fileNotFound" = "找不到提示音文件。";
"audio.import.empty" = "这段录音没有可播放的声音。";
"audio.import.tooLarge" = "音频文件过大,请选择小于 50 MB 的短录音。";
"audio.import.tooLong" = "提示音需要短于 30 秒,请先裁剪录音。";
"audio.import.unreadable" = "无法解码这段录音,请尝试导出为 M4A 或 WAV。";
"audio.import.unsupported" = "请选择 M4A、WAV、AIFF、CAF、MP3、AAC、OGG 或 FLAC 音频文件。";
"audio.importedReadFailed" = "无法读取已导入的提示音:%@";
"audio.importedSubtitle" = "已导入 · %.1f 秒";
"audio.playbackError" = "无法播放提示音:%@";
"audio.playbackInterrupted" = "提示音播放中断,请重新试听或导入其他录音。";
"audio.previewError" = "无法试听提示音:%@";
"audio.previewInterrupted" = "试听中断,请重新试听或导入其他录音。";
"audio.pulse.name" = "心跳";
"audio.pulse.subtitle" = "柔和、清晰的双脉冲";
"audio.systemSound" = "系统提示音";
"board.addFirstGroup" = "添加第一个团体";
"board.currentGroup" = "当前团体";
"board.emptyMessage" = "添加团体、成员和单券秒数,\n就能开始每位成员的独立计时。";
"board.emptyTitle" = "第一次见面,从这里开始";
"board.eventKind" = "特典会";
"board.manageGroups" = "管理团体和成员";
"board.manageGroupsMenu" = "管理团体";
"board.memberCount" = "%ld 位成员";
"board.nextPage" = "下一页成员";
"board.operationFailed" = "操作未完成";
"board.previousPage" = "上一页成员";
"board.quickGuide" = "点击时钟 · 输入券数 · 即刻开始";
"board.ready" = "准备就绪";
"board.resetQuestion" = "重置%@的本轮计时?";
"board.resetRound" = "重置本轮";
"board.runningCount" = "%ld 位计时中";
"board.secondsPerTicket" = "秒 / 张";
"board.settings" = "设置";
"board.soundSettings" = "提示音设置";
"common.cancel" = "取消";
"common.done" = "完成";
"common.ok" = "好";
"common.preview" = "试听";
"common.save" = "保存";
"groupEditor.activeRound" = "本轮正在进行,已开始的倒计时时长不变。";
"groupEditor.addMember" = "添加成员";
"groupEditor.addTitle" = "添加团体";
"groupEditor.customSound" = "自定义提示音";
"groupEditor.deleteMember" = "删除成员";
"groupEditor.durationHelp" = "输入 1–3600 秒。开始每位成员的倒计时时,再单独输入本轮券数。";
"groupEditor.editTitle" = "编辑团体";
"groupEditor.groupSection" = "团体";
"groupEditor.memberColor" = "代表色";
"groupEditor.memberName" = "名字";
"groupEditor.memberNamePlaceholder" = "成员名称";
"groupEditor.memberNumber" = "成员 %@";
"groupEditor.memberSound" = "到时提示音";
"groupEditor.membersHelp" = "至少保留一位成员。一个页面显示四位成员,更多成员可以翻页查看。";
"groupEditor.namePlaceholder" = "团体名称";
"groupEditor.previewAccessibility" = "试听%@";
"groupEditor.previewTickets" = "%1$ld 张 → %2$ld 秒";
"groupEditor.removeMember" = "移除成员";
"groupEditor.removeMemberMessage" = "保存后,这位成员正在进行的倒计时将结束,对应的到时提醒也会取消。";
"groupEditor.removeMemberTitle" = "删除这位成员?";
"groupEditor.secondsPerTicket" = "每张券时长";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "秒";
"groups.add" = "添加团体";
"groups.count" = "团体 · %ld";
"groups.currentAccessibility" = "当前团体,%@";
"groups.delete" = "删除";
"groups.deleteActiveMessage" = "该团体的 %ld 个进行中或暂停的倒计时也会结束,到时提醒会取消。删除后无法恢复。";
"groups.deleteAll" = "删除团体及其成员";
"groups.deleteMessage" = "将删除该团体的全部成员与设置,并取消其倒计时提醒。删除后无法恢复。";
"groups.deleteNamedTitle" = "删除「%@」?";
"groups.editAccessibility" = "编辑团体,%@";
"groups.intro" = "每个团体统一设置每张券的时长。成员可以拥有各自的代表色和到时提示音。";
"groups.memberSummary" = "%ld 位成员 · 每张 %ld 秒";
"groups.reorderHint" = "用箭头调整顺序";
"groups.selectAccessibility" = "切换到%@";
"groups.title" = "团体与成员";
"notifications.authorized" = "已允许通知";
"notifications.denied" = "通知已关闭,可在系统设置中开启";
"notifications.notDetermined" = "首次开始计时后可开启通知";
"notifications.roundFinishedBody" = "倒计时已结束,感谢这一轮的相见。";
"notifications.roundFinishedTitle" = "%@ · 本轮结束";
"notifications.scheduleFailed" = "无法安排后台提醒,请保持应用在前台计时。";
"settings.about" = "Oshicue Tempo · 特典会现场多成员计时器。界面沿用 Oshicue 品牌色与 Unbounded 字体。";
"settings.behaviour" = "操作与反馈";
"settings.data" = "数据";
"settings.dataSaved" = "团体、成员和进行中的计时会在重新打开 App 时恢复。";
"settings.dataTitle" = "保存在本机";
"settings.dataUnreadable" = "本地文件无法读取,原文件已保留且不会被覆盖。";
"settings.defaultSound" = "默认提示音";
"settings.defaultSoundHelp" = "新增成员时自动选中,之后仍可单独修改。";
"settings.defaults" = "新建成员";
"settings.followSystem" = "跟随系统";
"settings.haptics" = "触感反馈";
"settings.hapticsHint" = "开始、暂停或结束时轻振一下。";
"settings.keepAwake" = "计时时屏幕常亮";
"settings.keepAwakeHint" = "有倒计时进行时,屏幕不会自动熄灭。";
"settings.language" = "语言";
"settings.roundStatus" = "当前计时";
"settings.roundStatusValue" = "%1$ld 进行中 · %2$ld 已结束";
"settings.title" = "设置";
"settings.version" = "版本";
"sounds.alertsHelp" = "App 在前台时使用设备媒体音量。锁屏或切到后台后,提醒受免打扰、静音模式和通知设置影响。特典会开始前,请先试听并确认音量。";
"sounds.alertsSection" = "提醒方式";
"sounds.allowNotifications" = "允许到时通知";
"sounds.backgroundAlerts" = "锁屏与后台提醒";
"sounds.builtIn" = "内置提示音";
"sounds.deleteRecording" = "删除";
"sounds.import" = "从文件导入录音";
"sounds.importHelp" = "支持短于 30 秒的录音。用任意录音 App 录好,再从这里导入音频文件。支持 M4A、WAV、OGG、FLAC 等格式。";
"sounds.importedMessage" = "「%@」已保存。前往团体与成员设置,将它选为成员的到时提示音。";
"sounds.importedTitle" = "录音已添加";
"sounds.importing" = "正在导入…";
"sounds.intro" = "四种原创提示音,也可以导入自己的录音。在成员设置中为每个人单独选择。";
"sounds.introTitle" = "给每一轮一个清楚的结束信号";
"sounds.myRecordings" = "我的录音";
"sounds.myRecordingsCount" = "我的录音 · %ld";
"sounds.openNotificationSettings" = "打开系统通知设置";
"sounds.operationFailed" = "无法完成操作";
"sounds.previewAccessibility" = "试听%@";
"sounds.title" = "声音与提醒";
"storage.readFailed" = "无法读取本地数据。原文件已保留,未被覆盖。\n%@";
"storage.unreadableSnapshot" = "原数据无法读取。为保护原文件,已停止写入。请先备份并移走 files/OshicueTempo/state.json,再重新打开 App。";
"storage.writeFailed" = "无法保存本地数据,请检查设备的可用空间。\n%@";
"tickets.confirmStart" = "确认并开始倒计时";
"tickets.formula" = "%ld 秒 / 张 × %ld 张";
"tickets.hint" = "每轮开始前输入 1–999 张券,确认后立即计时。";
"tickets.maximumDuration" = "单轮最多 24 小时,请减少券数。";
"tickets.newRound" = "开始新一轮";
"tickets.quickPick" = "%ld 张";
"tickets.roundTickets" = "本轮特典券";
"tickets.unit" = "张";
"timer.accessibility" = "%@,%@,%@";
"timer.enterTickets" = "输入券数";
"timer.extendOneAccessibility" = "为%@再加 1 张";
"timer.extendTickets" = "再加 %ld 张";
"timer.finished" = "时间到";
"timer.live" = "计时中";
"timer.nextRound" = "下一轮";
"timer.pause" = "暂停";
"timer.paused" = "已暂停";
"timer.resetMember" = "重置%@的计时";
"timer.resume" = "继续";
"timer.roundSummary" = "%ld 张 · %ld 秒";
"timer.running" = "倒计时中";
"timer.tapToStart" = "点击时钟开始";
"timer.ticketDuration" = "%ld 秒 / 张";
"validation.corruptSnapshot" = "本地数据不完整,原文件已保留。";
"validation.duplicateGroup" = "团体标识重复,无法读取这份数据。";
"validation.duplicateMember" = "成员标识重复,请重新添加该成员。";
"validation.durationTooLong" = "单次倒计时不能超过 24 小时,请减少券数。";
"validation.emptyGroupName" = "请输入团体名称。";
"validation.emptyMemberName" = "请输入成员名称。";
"validation.emptyMembers" = "请至少添加一位成员。";
"validation.invalidColor" = "成员颜色需要是六位十六进制色值。";
"validation.invalidSecondsPerTicket" = "每张券的时间需为 1 至 3600 秒。";
"validation.invalidSound" = "请选择结束提示音。";
"validation.invalidTickets" = "券数需为 1 至 999 的整数。";
"validation.memberNotFound" = "找不到这位成员,请重新选择。";
@@ -0,0 +1,167 @@
// Oshicue Tempo — zh-Hant
"audio.arcade.name" = "過關";
"audio.arcade.subtitle" = "輕快的上行電子音";
"audio.bell.name" = "鈴語";
"audio.bell.subtitle" = "溫暖的和弦鈴聲";
"audio.chime.name" = "星光";
"audio.chime.subtitle" = "清亮的三音提示";
"audio.deleteFailed" = "無法刪除錄音:%@";
"audio.fileNotFound" = "找不到提示音檔案。";
"audio.import.empty" = "這段錄音沒有可播放的聲音。";
"audio.import.tooLarge" = "音訊檔案過大,請選擇小於 50 MB 的短錄音。";
"audio.import.tooLong" = "提示音必須短於 30 秒,請先裁剪錄音。";
"audio.import.unreadable" = "無法解碼這段錄音,請嘗試匯出為 M4A 或 WAV。";
"audio.import.unsupported" = "請選擇 M4A、WAV、AIFF、CAF、MP3、AAC、OGG 或 FLAC 音訊檔。";
"audio.importedReadFailed" = "無法讀取已匯入的提示音:%@";
"audio.importedSubtitle" = "已匯入 · %.1f 秒";
"audio.playbackError" = "無法播放提示音:%@";
"audio.playbackInterrupted" = "提示音播放中斷,請重新試聽或匯入其他錄音。";
"audio.previewError" = "無法試聽提示音:%@";
"audio.previewInterrupted" = "試聽中斷,請重新試聽或匯入其他錄音。";
"audio.pulse.name" = "心跳";
"audio.pulse.subtitle" = "柔和、清晰的雙脈衝";
"audio.systemSound" = "系統提示音";
"board.addFirstGroup" = "新增第一個團體";
"board.currentGroup" = "目前團體";
"board.emptyMessage" = "新增團體、成員與每張券的秒數,\n即可為每位成員獨立計時。";
"board.emptyTitle" = "第一次見面,從這裡開始";
"board.eventKind" = "特典會";
"board.manageGroups" = "管理團體與成員";
"board.manageGroupsMenu" = "管理團體";
"board.memberCount" = "%ld 位成員";
"board.nextPage" = "下一頁成員";
"board.operationFailed" = "操作未完成";
"board.previousPage" = "上一頁成員";
"board.quickGuide" = "點擊時鐘 · 輸入券數 · 立即開始";
"board.ready" = "準備就緒";
"board.resetQuestion" = "重設%@的本輪計時?";
"board.resetRound" = "重設本輪";
"board.runningCount" = "%ld 位計時中";
"board.secondsPerTicket" = "秒 / 張";
"board.settings" = "設定";
"board.soundSettings" = "提示音設定";
"common.cancel" = "取消";
"common.done" = "完成";
"common.ok" = "好";
"common.preview" = "試聽";
"common.save" = "儲存";
"groupEditor.activeRound" = "本輪正在進行,已開始的倒數計時時長不變。";
"groupEditor.addMember" = "新增成員";
"groupEditor.addTitle" = "新增團體";
"groupEditor.customSound" = "自訂提示音";
"groupEditor.deleteMember" = "刪除成員";
"groupEditor.durationHelp" = "請輸入 1–3600 秒。開始每位成員的倒數計時前,再個別輸入本輪券數。";
"groupEditor.editTitle" = "編輯團體";
"groupEditor.groupSection" = "團體";
"groupEditor.memberColor" = "代表色";
"groupEditor.memberName" = "名字";
"groupEditor.memberNamePlaceholder" = "成員名稱";
"groupEditor.memberNumber" = "成員 %@";
"groupEditor.memberSound" = "時間到提示音";
"groupEditor.membersHelp" = "請至少保留一位成員。每頁顯示四位成員,可翻頁查看其他成員。";
"groupEditor.namePlaceholder" = "團體名稱";
"groupEditor.previewAccessibility" = "試聽%@";
"groupEditor.previewTickets" = "%1$ld 張 → %2$ld 秒";
"groupEditor.removeMember" = "移除成員";
"groupEditor.removeMemberMessage" = "儲存後,這位成員進行中的倒數計時將結束,對應的時間到提醒也會取消。";
"groupEditor.removeMemberTitle" = "刪除這位成員?";
"groupEditor.secondsPerTicket" = "每張券時長";
"groupEditor.secondsPlaceholder" = "60";
"groupEditor.secondsUnit" = "秒";
"groups.add" = "新增團體";
"groups.count" = "團體 · %ld";
"groups.currentAccessibility" = "目前團體,%@";
"groups.delete" = "刪除";
"groups.deleteActiveMessage" = "此團體的 %ld 個進行中或暫停的倒數計時也會結束,時間到提醒會取消。刪除後無法復原。";
"groups.deleteAll" = "刪除團體及所有成員";
"groups.deleteMessage" = "將刪除此團體的所有成員與設定,並取消其倒數計時提醒。刪除後無法復原。";
"groups.deleteNamedTitle" = "刪除「%@」?";
"groups.editAccessibility" = "編輯團體,%@";
"groups.intro" = "每個團體統一設定每張券的時長。成員可以各自設定代表色和時間到提示音。";
"groups.memberSummary" = "%ld 位成員 · 每張 %ld 秒";
"groups.reorderHint" = "用箭頭調整順序";
"groups.selectAccessibility" = "切換至%@";
"groups.title" = "團體與成員";
"notifications.authorized" = "已允許通知";
"notifications.denied" = "通知已關閉,可在系統設定中開啟";
"notifications.notDetermined" = "首次開始計時後可開啟通知";
"notifications.roundFinishedBody" = "倒數計時已結束,感謝這一輪的相見。";
"notifications.roundFinishedTitle" = "%@ · 本輪結束";
"notifications.scheduleFailed" = "無法安排背景提醒,請保持 App 在前景計時。";
"settings.about" = "Oshicue Tempo · 特典會現場多成員計時器。介面沿用 Oshicue 品牌色與 Unbounded 字體。";
"settings.behaviour" = "操作與回饋";
"settings.data" = "資料";
"settings.dataSaved" = "團體、成員和進行中的計時會在重新開啟 App 時恢復。";
"settings.dataTitle" = "儲存在本機";
"settings.dataUnreadable" = "本機檔案無法讀取,原檔案已保留且不會被覆寫。";
"settings.defaultSound" = "預設提示音";
"settings.defaultSoundHelp" = "新增成員時自動選中,之後仍可單獨修改。";
"settings.defaults" = "新增成員";
"settings.followSystem" = "跟隨系統";
"settings.haptics" = "觸覺回饋";
"settings.hapticsHint" = "開始、暫停或結束時輕振一下。";
"settings.keepAwake" = "計時時螢幕常亮";
"settings.keepAwakeHint" = "有倒數進行時,螢幕不會自動熄滅。";
"settings.language" = "語言";
"settings.roundStatus" = "目前計時";
"settings.roundStatusValue" = "%1$ld 進行中 · %2$ld 已結束";
"settings.title" = "設定";
"settings.version" = "版本";
"sounds.alertsHelp" = "App 在前景時使用裝置媒體音量。鎖定畫面或切到背景後,提醒受勿擾模式、靜音模式和通知設定影響。特典會開始前,請先試聽並確認音量。";
"sounds.alertsSection" = "提醒方式";
"sounds.allowNotifications" = "允許時間到通知";
"sounds.backgroundAlerts" = "鎖定畫面與背景提醒";
"sounds.builtIn" = "內建提示音";
"sounds.deleteRecording" = "刪除";
"sounds.import" = "從檔案匯入錄音";
"sounds.importHelp" = "支援短於 30 秒的錄音。用任意錄音 App 錄好,再從這裡匯入音訊檔。支援 M4A、WAV、OGG、FLAC 等格式。";
"sounds.importedMessage" = "已儲存「%@」。請前往團體與成員設定,將它選為成員的時間到提示音。";
"sounds.importedTitle" = "已新增錄音";
"sounds.importing" = "正在匯入…";
"sounds.intro" = "提供四種原創提示音,也可以匯入自己的錄音。在成員設定中為每個人個別選擇。";
"sounds.introTitle" = "讓每一輪都有清楚的結束提示";
"sounds.myRecordings" = "我的錄音";
"sounds.myRecordingsCount" = "我的錄音 · %ld";
"sounds.openNotificationSettings" = "開啟系統通知設定";
"sounds.operationFailed" = "無法完成操作";
"sounds.previewAccessibility" = "試聽%@";
"sounds.title" = "聲音與提醒";
"storage.readFailed" = "無法讀取本機資料。原始檔案已保留,未被覆寫。\n%@";
"storage.unreadableSnapshot" = "原始資料無法讀取。為保護原檔,已停止寫入。請先備份並移走 files/OshicueTempo/state.json,再重新開啟 App。";
"storage.writeFailed" = "無法儲存本機資料,請檢查裝置的可用空間。\n%@";
"tickets.confirmStart" = "確認並開始倒數計時";
"tickets.formula" = "%ld 秒 / 張 × %ld 張";
"tickets.hint" = "每輪開始前輸入 1–999 張券,確認後立即計時。";
"tickets.maximumDuration" = "單輪最多 24 小時,請減少券數。";
"tickets.newRound" = "開始新一輪";
"tickets.quickPick" = "%ld 張";
"tickets.roundTickets" = "本輪特典券";
"tickets.unit" = "張";
"timer.accessibility" = "%@,%@,%@";
"timer.enterTickets" = "輸入券數";
"timer.extendOneAccessibility" = "為%@再加 1 張";
"timer.extendTickets" = "再加 %ld 張";
"timer.finished" = "時間到";
"timer.live" = "計時中";
"timer.nextRound" = "下一輪";
"timer.pause" = "暫停";
"timer.paused" = "已暫停";
"timer.resetMember" = "重設%@的計時";
"timer.resume" = "繼續";
"timer.roundSummary" = "%ld 張 · %ld 秒";
"timer.running" = "倒數計時中";
"timer.tapToStart" = "點擊時鐘開始";
"timer.ticketDuration" = "%ld 秒 / 張";
"validation.corruptSnapshot" = "本機資料不完整,原始檔案已保留。";
"validation.duplicateGroup" = "團體識別碼重複,無法讀取這份資料。";
"validation.duplicateMember" = "成員識別碼重複,請重新新增該成員。";
"validation.durationTooLong" = "單次倒數計時不能超過 24 小時,請減少券數。";
"validation.emptyGroupName" = "請輸入團體名稱。";
"validation.emptyMemberName" = "請輸入成員名稱。";
"validation.emptyMembers" = "請至少新增一位成員。";
"validation.invalidColor" = "成員顏色必須是六位十六進位色碼。";
"validation.invalidSecondsPerTicket" = "每張券的時間必須是 1 至 3600 秒。";
"validation.invalidSound" = "請選擇結束提示音。";
"validation.invalidTickets" = "券數必須是 1 至 999 的整數。";
"validation.memberNotFound" = "找不到這位成員,請重新選擇。";
@@ -0,0 +1,436 @@
package com.oshicue.tempo
import android.Manifest
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.PowerManager
import android.provider.OpenableColumns
import android.view.WindowManager
import androidx.activity.ComponentActivity
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.compose.setContent
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.core.view.WindowCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import com.oshicue.tempo.alert.TempoNotifications
import com.oshicue.tempo.audio.TempoAudio
import com.oshicue.tempo.core.AppLanguage
import com.oshicue.tempo.core.L10n
import com.oshicue.tempo.core.TempoGroup
import com.oshicue.tempo.core.configuration
import com.oshicue.tempo.ui.BoardActions
import com.oshicue.tempo.ui.BoardScreen
import com.oshicue.tempo.ui.GroupEditorScreen
import com.oshicue.tempo.ui.GroupManagementScreen
import com.oshicue.tempo.ui.SettingsScreen
import com.oshicue.tempo.ui.SoundSettingsScreen
import com.oshicue.tempo.ui.TempoStore
import com.oshicue.tempo.ui.TempoTheme
import com.oshicue.tempo.ui.TicketEntryScreen
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.io.File
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent { TempoApp() }
}
}
/** Which sheet is open. A single value keeps the back stack trivial and the board stable. */
private sealed interface Route {
data object Board : Route
data class Tickets(val memberId: String, val groupId: String) : Route
data object Groups : Route
data class GroupEditor(val groupId: String?) : Route
data object Sounds : Route
data object Settings : Route
}
@Composable
fun TempoApp() {
val systemConfiguration = LocalConfiguration.current
val context = LocalContext.current
val preferences = remember {
context.getSharedPreferences("tempo", Context.MODE_PRIVATE)
}
var languageTag by remember {
mutableStateOf(preferences.getString(AppLanguage.preferenceKey, null))
}
val storedLanguage = AppLanguage.fromTag(languageTag)
val language = remember(languageTag, systemConfiguration) {
if (storedLanguage == 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 storedLanguage
}
L10n.apply(context, languageTag)
val store: TempoStore = viewModel(factory = TempoStore.Factory(context))
val state by store.state.collectAsStateWithLifecycle()
val audio = remember { TempoAudio(context.applicationContext) }
val notifications = remember { TempoNotifications(context.applicationContext) }
val importedSounds by audio.importedSounds.collectAsStateWithLifecycle()
LaunchedEffect(language) { audio.relocalizeImported() }
var route by remember { mutableStateOf<Route>(Route.Board) }
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
var importing by remember { mutableStateOf(false) }
var importError by remember { mutableStateOf<String?>(null) }
var importedName by remember { mutableStateOf<String?>(null) }
var alertError by remember { mutableStateOf<String?>(null) }
val scope = rememberCoroutineScope()
// One 0.2 s clock drives both the display and the "round finished" settle.
LaunchedEffect(Unit) {
while (true) {
now = System.currentTimeMillis()
store.tick(now)
delay(200)
}
}
// Wire the alert scheduler to store events, and keep the engine's own state in sync.
DisposableEffect(store, audio, notifications) {
store.onRoundStarted = { round, member ->
if (state.preferences.hapticsEnabled) Haptics.start(context)
round.deadline?.let { deadline ->
notifications.schedule(
roundId = round.id,
memberName = member.name,
deadline = deadline,
soundUri = audio.notificationSoundUri(round.soundId ?: member.soundId),
)
}
}
store.onRoundCancelled = { roundId -> notifications.cancel(roundId) }
store.onRoundFinished = { round, member ->
notifications.cancel(round.id)
audio.play(round.soundId ?: member.soundId)
if (state.preferences.hapticsEnabled) Haptics.finish(context)
}
onDispose {
store.onRoundStarted = null
store.onRoundCancelled = null
store.onRoundFinished = null
}
}
// Re-schedule after a process restart, matching the iOS launch path.
LaunchedEffect(Unit) {
notifications.refresh()
val running = store.current.rounds.values.filter {
it.phase(System.currentTimeMillis()) == com.oshicue.tempo.core.CountdownPhase.Running
}
running.forEach { round ->
val member = store.current.member(round.memberId) ?: return@forEach
val deadline = round.deadline ?: return@forEach
notifications.schedule(
roundId = round.id,
memberName = member.name,
deadline = deadline,
soundUri = audio.notificationSoundUri(round.soundId ?: member.soundId),
)
}
}
// Clear delivered cues when the user comes back, exactly like the iOS scene-active catch-up.
val lifecycleOwner = LocalLifecycleOwner.current
DisposableEffect(lifecycleOwner) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME) {
now = System.currentTimeMillis()
store.tick(now)
notifications.refresh()
}
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
}
// Screen-on while a countdown runs, gated by the preference.
val activity = LocalContext.current as? ComponentActivity
LaunchedEffect(state.runningCount(now), state.preferences.keepAwakeEnabled) {
val shouldStayAwake = state.preferences.keepAwakeEnabled && state.runningCount(now) > 0
activity?.window?.apply {
if (shouldStayAwake) {
addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
} else {
clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}
}
val notificationPermission = rememberLauncherForActivityResult(
ActivityResultContracts.RequestPermission(),
) { granted ->
if (granted) notifications.refresh() else notifications.markDenied()
scope.launch {
notifications.refresh()
store.current.rounds.values
.filter { it.phase(System.currentTimeMillis()) == com.oshicue.tempo.core.CountdownPhase.Running }
.forEach { round ->
val member = store.current.member(round.memberId) ?: return@forEach
val deadline = round.deadline ?: return@forEach
notifications.schedule(
roundId = round.id,
memberName = member.name,
deadline = deadline,
soundUri = audio.notificationSoundUri(round.soundId ?: member.soundId),
)
}
}
}
val audioPicker = rememberLauncherForActivityResult(
ActivityResultContracts.OpenDocument(),
) { uri: Uri? ->
if (uri == null) return@rememberLauncherForActivityResult
importing = true
scope.launch {
try {
val name = displayName(context, uri) ?: "recording"
val id = audio.import(name) {
context.contentResolver.openInputStream(uri)?.use { it.readBytes() }
}
importError = null
importedName = audio.title(id)
} catch (error: TempoAudio.ImportException) {
importError = L10n.text(error.failure.messageKey)
} catch (error: Exception) {
importError = L10n.text("audio.import.unreadable")
} finally {
importing = false
}
}
}
val localeConfiguration = remember(language, context) {
language.configuration(systemConfiguration)
}
val localizedContext = remember(localeConfiguration, context) {
context.createConfigurationContext(localeConfiguration)
}
CompositionLocalProvider(LocalContext provides localizedContext) {
TempoTheme {
Box(Modifier.fillMaxSize()) {
AnimatedContent(
targetState = route,
transitionSpec = {
val entering = targetState != Route.Board
if (entering) {
(slideInVertically { it / 12 } + fadeIn()) togetherWith fadeOut()
} else {
fadeIn() togetherWith (slideOutVertically { it / 12 } + fadeOut())
}
},
label = "route",
) { current ->
when (current) {
is Route.Board -> BoardScreen(
state = state,
now = now,
actions = BoardActions(
start = { member -> route = Route.Tickets(member.id, groupIdFor(state, member.id)) },
pause = { store.pause(it) },
resume = { store.resume(it) },
extend = { member, tickets ->
store.extend(member.id, tickets)
if (state.preferences.hapticsEnabled) Haptics.tap(context)
},
reset = { member ->
store.reset(member.id)
},
selectGroup = { store.selectGroup(it) },
),
onOpenSounds = { route = Route.Sounds },
onOpenSettings = { route = Route.Settings },
onOpenGroups = { route = Route.Groups },
)
is Route.Tickets -> {
val group = state.group(current.groupId)
val member = group?.member(current.memberId)
if (group == null || member == null) {
LaunchedEffect(Unit) { route = Route.Board }
} else {
TicketEntryScreen(
member = member,
group = group,
lastTicketCount = state.preferences.lastTicketCount,
onCancel = { route = Route.Board },
onConfirm = { tickets ->
store.start(member.id, tickets)
route = Route.Board
},
)
}
}
is Route.Groups -> GroupManagementScreen(
state = state,
now = now,
onDone = { route = Route.Board },
onEdit = { group -> route = Route.GroupEditor(group?.id) },
onSelect = { store.selectGroup(it) },
onDelete = { store.deleteGroup(it.id) },
onMove = { index, direction ->
// +1 moves up, -1 moves down, matching the arrow icons.
val target = index - direction
if (target in state.groups.indices) {
val list = state.groups.toMutableList()
val item = list.removeAt(index)
list.add(target, item)
store.moveGroups(listOf(index), if (target > index) target + 1 else target)
}
},
)
is Route.GroupEditor -> {
val existing = current.groupId?.let { state.group(it) }
GroupEditorScreen(
existing = existing,
preferences = state.preferences,
hasActiveRound = { state.hasActiveRound(it, now) },
audio = audio,
onCancel = { route = Route.Groups },
onSave = { group ->
store.saveGroup(group)
if (store.current.errorMessage == null) route = Route.Groups
},
)
}
is Route.Sounds -> SoundSettingsScreen(
audio = audio,
importedSounds = importedSounds,
notifications = notifications,
importing = importing,
importError = importError,
importedName = importedName,
onDismissImported = { importedName = null },
onImport = {
importError = null
audioPicker.launch(arrayOf("audio/*"))
},
onDismissImportError = { importError = null },
onRequestPermission = { notificationPermission.launch(Manifest.permission.POST_NOTIFICATIONS) },
onDone = { route = Route.Board },
)
is Route.Settings -> SettingsScreen(
state = state,
audio = audio,
language = storedLanguage,
versionName = BuildInfo.versionName(context),
hasUnreadableSnapshot = store.hasUnreadableSnapshot,
onLanguageChange = { value ->
languageTag = value.tag
preferences.edit().putString(AppLanguage.preferenceKey, value.tag).apply()
},
onPreferences = { change -> store.updatePreferences(change) },
onDone = { route = Route.Board },
)
}
}
}
val errors = listOfNotNull(state.errorMessage, audio.errorMessage.value, notifications.errorMessage.value)
if (errors.isNotEmpty()) {
AlertDialog(
onDismissRequest = {
store.clearError()
audio.clearError()
notifications.clearError()
},
title = { Text(L10n.text("board.operationFailed")) },
text = { Text(errors.first()) },
confirmButton = {
TextButton(onClick = {
store.clearError()
audio.clearError()
notifications.clearError()
}) { Text(L10n.text("common.ok")) }
},
containerColor = com.oshicue.tempo.ui.Tempo.colors.surface,
)
}
}
}
}
private fun groupIdFor(state: com.oshicue.tempo.ui.TempoUiState, memberId: String): String =
state.groups.firstOrNull { it.member(memberId) != null }?.id ?: state.groups.first()?.id.orEmpty()
private fun displayName(context: Context, uri: Uri): String? {
val cursor = context.contentResolver.query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)
?: return uri.lastPathSegment?.substringAfterLast('/')
return cursor.use {
if (it.moveToFirst() && !it.isNull(0)) it.getString(0) else uri.lastPathSegment?.substringAfterLast('/')
}
}
/** Small wrapper so the UI does not depend on the vibrator API directly. */
private object Haptics {
fun tap(context: Context) {
val manager = context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as? android.os.VibratorManager
manager?.defaultVibrator?.vibrate(android.os.VibrationEffect.createOneShot(18, 60))
}
fun start(context: Context) = tap(context)
fun finish(context: Context) {
val manager = context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as? android.os.VibratorManager
manager?.defaultVibrator?.vibrate(
android.os.VibrationEffect.createWaveform(longArrayOf(0, 30, 60, 30), -1),
)
}
}
/** Version label for the About row, read from the installed package. */
private object BuildInfo {
fun versionName(context: Context): String {
val info = context.packageManager.getPackageInfo(context.packageName, 0)
return info.versionName ?: "1.0.0"
}
}
@@ -0,0 +1,21 @@
package com.oshicue.tempo.alert
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
/**
* A reboot clears every pending alarm. The board re-schedules itself the next time the app
* opens, so the receiver only needs to leave a clean slate rather than reconstruct state
* the app does not own.
*/
class TempoBootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MY_PACKAGE_REPLACED -> {
context.getSharedPreferences("tempo-scheduled-alerts", Context.MODE_PRIVATE)
.edit().clear().apply()
}
}
}
}
@@ -0,0 +1,222 @@
package com.oshicue.tempo.alert
import android.Manifest
import android.app.AlarmManager
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat
import com.oshicue.tempo.MainActivity
import com.oshicue.tempo.R
import com.oshicue.tempo.audio.TempoAudio
import com.oshicue.tempo.core.L10n
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
/**
* End-of-round alerts for the lock screen and the background.
*
* iOS uses a local notification per round. The Android equivalent is an exact alarm that
* posts a notification on a per-sound channel; the channel owns the sound, so the cue is
* correct even when the process has been killed. Each round has one alarm, keyed by its
* id, and rescheduling replaces it rather than stacking.
*/
class TempoNotifications(private val context: Context) {
enum class Authorization { NotDetermined, Authorized, Denied }
private val manager = NotificationManagerCompat.from(context)
private val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
private val _authorization = MutableStateFlow(Authorization.NotDetermined)
val authorization: StateFlow<Authorization> = _authorization.asStateFlow()
private val _errorMessage = MutableStateFlow<String?>(null)
val errorMessage: StateFlow<String?> = _errorMessage.asStateFlow()
init {
refresh()
}
fun refresh() {
_authorization.value = when {
Build.VERSION.SDK_INT >= 33 -> {
val granted = ContextCompat.checkSelfPermission(
context, Manifest.permission.POST_NOTIFICATIONS,
) == PackageManager.PERMISSION_GRANTED
when {
granted -> Authorization.Authorized
// Before the first request the permission simply has not been asked for.
else -> Authorization.NotDetermined
}
}
manager.areNotificationsEnabled() -> Authorization.Authorized
else -> Authorization.Denied
}
}
fun markDenied() {
_authorization.value = Authorization.Denied
}
val isAuthorized: Boolean get() = _authorization.value == Authorization.Authorized
val authorizationDescription: String
get() = when (_authorization.value) {
Authorization.Authorized -> L10n.text("notifications.authorized")
Authorization.Denied -> L10n.text("notifications.denied")
Authorization.NotDetermined -> L10n.text("notifications.notDetermined")
}
/**
* Schedules the round alert. A missing exact-alarm permission, or denied notifications,
* degrades to an inexact alarm: the cue still arrives, just not to the second.
*/
fun schedule(roundId: String, memberName: String, deadline: Long, soundUri: Uri?) {
ensureChannel(soundUri)
val triggerAt = maxOf(deadline, System.currentTimeMillis() + 1_000)
val pending = pendingIntent(roundId, memberName, soundKindKey(soundUri), triggerAt)
val canExact = Build.VERSION.SDK_INT < 31 || alarmManager.canScheduleExactAlarms()
try {
if (canExact) {
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerAt, pending)
} else {
alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerAt, pending)
}
} catch (_: SecurityException) {
alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerAt, pending)
} catch (error: Exception) {
_errorMessage.value = L10n.text("notifications.scheduleFailed")
}
}
fun cancel(roundId: String) {
val intent = Intent(context, TempoAlarmReceiver::class.java)
val identifier = requestCode(roundId)
val pending = PendingIntent.getBroadcast(
context, identifier, intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
alarmManager.cancel(pending)
pending.cancel()
manager.cancel(identifier)
}
fun cancelAll() {
// Only alarms this app scheduled are cancelled; ids are derived from the round id.
val scheduled = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE)
scheduled.all.keys.toList().forEach { cancel(it) }
scheduled.edit().clear().apply()
}
/**
* Channels are immutable once created, so each distinct sound gets its own channel.
* Re-creating an existing channel is a no-op, which keeps rescheduling cheap.
*/
fun ensureChannel(soundUri: Uri?) {
val soundKey = soundKindKey(soundUri)
val channelId = channelId(soundKey)
if (Build.VERSION.SDK_INT >= 26) {
val existing = manager.getNotificationChannel(channelId)
if (existing != null) return
val channel = NotificationChannel(
channelId,
L10n.text("sounds.backgroundAlerts"),
NotificationManager.IMPORTANCE_HIGH,
).apply {
description = L10n.text("notifications.roundFinishedBody")
enableVibration(true)
if (soundUri != null) {
setSound(soundUri, android.media.AudioAttributes.Builder()
.setUsage(android.media.AudioAttributes.USAGE_NOTIFICATION_EVENT)
.build())
}
}
manager.createNotificationChannel(channel)
}
}
private fun soundKindKey(soundUri: Uri?): String =
soundUri?.lastPathSegment?.substringAfterLast('/')?.ifBlank { "default" } ?: "default"
private fun channelId(soundKey: String): String =
"tempo-round-" + soundKey.replace(Regex("[^A-Za-z0-9_.-]"), "-")
private fun requestCode(roundId: String): Int = roundId.hashCode() and 0x7FFFFFFF
private fun pendingIntent(roundId: String, memberName: String, soundKey: String, triggerAt: Long): PendingIntent {
val intent = Intent(context, TempoAlarmReceiver::class.java).apply {
putExtra(TempoNotifications.EXTRA_ROUND_ID, roundId)
putExtra(TempoNotifications.EXTRA_MEMBER, memberName)
putExtra(TempoNotifications.EXTRA_CHANNEL, channelId(soundKey))
putExtra(TempoNotifications.EXTRA_NOTIFICATION_ID, requestCode(roundId))
// A distinct data URI keeps PendingIntents for different rounds from matching.
data = Uri.parse("tempo://round/$roundId")
}
context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE)
.edit().putBoolean(roundId, true).apply()
return PendingIntent.getBroadcast(
context, requestCode(roundId), intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
}
fun clearError() {
_errorMessage.value = null
}
companion object {
private const val PREFERENCES = "tempo-scheduled-alerts"
const val EXTRA_ROUND_ID = "roundId"
const val EXTRA_MEMBER = "member"
const val EXTRA_CHANNEL = "channel"
const val EXTRA_NOTIFICATION_ID = "notificationId"
}
}
/** Posts the end-of-round notification when its alarm fires. */
class TempoAlarmReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val member = intent.getStringExtra(TempoNotifications.EXTRA_MEMBER) ?: return
val channel = intent.getStringExtra(TempoNotifications.EXTRA_CHANNEL) ?: return
val identifier = intent.getIntExtra(TempoNotifications.EXTRA_NOTIFICATION_ID, member.hashCode())
val roundId = intent.getStringExtra(TempoNotifications.EXTRA_ROUND_ID)
if (roundId != null) {
context.getSharedPreferences("tempo-scheduled-alerts", Context.MODE_PRIVATE)
.edit().remove(roundId).apply()
}
val open = Intent(context, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
}
val contentIntent = PendingIntent.getActivity(
context, identifier, open,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
val notification = NotificationCompat.Builder(context, channel)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(L10n.format("notifications.roundFinishedTitle", member))
.setContentText(L10n.text("notifications.roundFinishedBody"))
.setStyle(NotificationCompat.BigTextStyle().bigText(L10n.text("notifications.roundFinishedBody")))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_ALARM)
.setAutoCancel(true)
.setContentIntent(contentIntent)
.build()
runCatching {
NotificationManagerCompat.from(context).notify(identifier, notification)
}
}
}
/** Kept here so the audio module and the alert module agree on the fallback cue. */
internal fun TempoAudio.notificationUriFor(soundId: String): Uri? = notificationSoundUri(soundId)
@@ -0,0 +1,365 @@
package com.oshicue.tempo.audio
import android.content.Context
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.MediaPlayer
import android.media.RingtoneManager
import android.net.Uri
import com.oshicue.tempo.core.L10n
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import java.io.File
import java.util.UUID
/** One selectable end-of-round sound. */
data class TempoSound(
val id: String,
val name: String,
val subtitle: String,
)
/** A sound the user imported from device storage. */
@Serializable
private data class ImportedRecord(
val id: String,
val name: String,
val fileName: String,
val duration: Double,
)
/**
* Foreground cues use a short-lived [MediaPlayer]; background cues belong to the
* notification channel. Imported recordings are converted to 16-bit PCM WAV so the
* system can read them from the app's private storage.
*/
class TempoAudio(private val context: Context) {
enum class ImportFailure(val messageKey: String) {
Unsupported("audio.import.unsupported"),
Empty("audio.import.empty"),
TooLong("audio.import.tooLong"),
TooLarge("audio.import.tooLarge"),
Unreadable("audio.import.unreadable"),
}
class ImportException(val failure: ImportFailure) :
Exception(L10n.text(failure.messageKey))
private val _importedSounds = MutableStateFlow<List<TempoSound>>(emptyList())
val importedSounds: StateFlow<List<TempoSound>> = _importedSounds.asStateFlow()
private val _errorMessage = MutableStateFlow<String?>(null)
val errorMessage: StateFlow<String?> = _errorMessage.asStateFlow()
private val records = mutableListOf<ImportedRecord>()
/** Live players, so volume can be shared when several members finish together. */
private val players = mutableListOf<MediaPlayer>()
private var previewPlayer: MediaPlayer? = null
private val soundsDirectory: File
get() = File(context.filesDir, "Sounds").apply { mkdirs() }
private val metadataFile: File
get() = File(soundsDirectory, "tempo-imports.json")
val builtInSounds: List<TempoSound>
get() = listOf(
TempoSound("chime", L10n.text("audio.chime.name"), L10n.text("audio.chime.subtitle")),
TempoSound("pulse", L10n.text("audio.pulse.name"), L10n.text("audio.pulse.subtitle")),
TempoSound("bell", L10n.text("audio.bell.name"), L10n.text("audio.bell.subtitle")),
TempoSound("arcade", L10n.text("audio.arcade.name"), L10n.text("audio.arcade.subtitle")),
)
val sounds: List<TempoSound>
get() = builtInSounds + _importedSounds.value
init {
runCatching {
if (metadataFile.exists()) {
records += decodeRecords(metadataFile.readText(Charsets.UTF_8))
records.removeAll { !File(soundsDirectory, it.fileName).exists() }
}
publishImported()
}.onFailure {
_errorMessage.value = L10n.format("audio.importedReadFailed", it.localizedMessage ?: "")
}
}
// MARK: catalogue
fun title(soundId: String): String =
sounds.firstOrNull { it.id == soundId }?.name ?: L10n.text("audio.systemSound")
fun subtitle(soundId: String): String =
sounds.firstOrNull { it.id == soundId }?.subtitle ?: L10n.text("groupEditor.customSound")
fun isImported(soundId: String): Boolean = records.any { it.id == soundId }
/** Removes an imported recording. Members still pointing at it fall back to the chime. */
fun deleteImported(soundId: String) {
val record = records.firstOrNull { it.id == soundId } ?: return
stopPreview()
val updated = records.filterNot { it.id == soundId }
runCatching {
writeRecords(updated)
File(soundsDirectory, record.fileName).delete()
records.clear()
records += updated
publishImported()
}.onFailure {
_errorMessage.value = L10n.format("audio.deleteFailed", it.localizedMessage ?: "")
}
}
/** Path the system notification channel can play, or null for an unknown id. */
fun soundUri(soundId: String): Uri? {
records.firstOrNull { it.id == soundId }?.let {
val file = File(soundsDirectory, it.fileName)
return if (file.exists()) Uri.fromFile(file) else null
}
if (builtInSounds.none { it.id == soundId }) return null
val resources = context.resources
val identifier = resources.getIdentifier(soundId, "raw", context.packageName)
if (identifier == 0) return null
return Uri.parse("android.resource://${context.packageName}/$identifier")
}
/** Sound URI used by a notification channel, falling back to the built-in chime. */
fun notificationSoundUri(soundId: String): Uri? =
soundUri(soundId) ?: soundUri(TempoSounds.FALLBACK)
// MARK: playback
/**
* Plays a completion cue. Several rounds can end together, so each player is kept
* alive and the group's gain is shared; that bounds the combined peak.
*/
fun play(soundId: String) {
stopPreview()
val uri = soundUri(soundId) ?: soundUri(TempoSounds.FALLBACK)
if (uri == null) {
_errorMessage.value = L10n.text("audio.fileNotFound")
return
}
runCatching {
val player = createPlayer(uri)
players += player
player.setOnCompletionListener { finish(player) }
player.setOnErrorListener { _, _, _ ->
finish(player, error = true)
true
}
normalizeVolumes()
player.start()
}.onFailure {
_errorMessage.value = L10n.format("audio.playbackError", it.localizedMessage ?: "")
}
}
fun preview(soundId: String) {
stopPreview()
// Timer completions take priority over a settings preview.
if (players.isNotEmpty()) return
val uri = soundUri(soundId) ?: return
runCatching {
val player = createPlayer(uri)
previewPlayer = player
player.setOnCompletionListener { finishPreview(player) }
player.setOnErrorListener { _, _, _ ->
finishPreview(player, error = true)
true
}
player.start()
}.onFailure {
stopPreview()
_errorMessage.value = L10n.format("audio.previewError", it.localizedMessage ?: "")
}
}
fun stopPreview() {
previewPlayer?.let { player ->
player.setOnCompletionListener(null)
player.setOnErrorListener(null)
if (player.isPlaying) player.stop()
player.release()
}
previewPlayer = null
}
fun stop() {
stopPreview()
players.toList().forEach { player ->
player.setOnCompletionListener(null)
player.setOnErrorListener(null)
if (player.isPlaying) player.stop()
player.release()
}
players.clear()
}
fun clearError() {
_errorMessage.value = null
}
fun reportError(message: String) {
_errorMessage.value = message
}
// MARK: import
/**
* Imports an audio file chosen from the system picker. The caller supplies the bytes
* through [open], so no storage permission is needed. The file is stored verbatim:
* Android's media stack and notification channels handle m4a, mp3, ogg, flac and wav
* natively, so re-encoding would only lose quality.
*/
@Throws(ImportException::class)
fun import(displayName: String, open: () -> ByteArray?): String {
val extension = displayName.substringAfterLast('.', "").lowercase()
if (extension !in TempoSounds.SUPPORTED_EXTENSIONS) throw ImportException(ImportFailure.Unsupported)
val bytes = open() ?: throw ImportException(ImportFailure.Unreadable)
if (bytes.isEmpty()) throw ImportException(ImportFailure.Empty)
if (bytes.size > TempoSounds.MAXIMUM_BYTES) throw ImportException(ImportFailure.TooLarge)
val duration = TempoSounds.probeDuration(context, bytes, extension)
?: throw ImportException(ImportFailure.Unreadable)
if (duration <= 0) throw ImportException(ImportFailure.Empty)
if (duration >= TempoSounds.MAXIMUM_SECONDS) throw ImportException(ImportFailure.TooLong)
val id = "import-${UUID.randomUUID().toString().lowercase()}"
val fileName = "$id.$extension"
val destination = File(soundsDirectory, fileName)
return try {
destination.writeBytes(bytes)
val record = ImportedRecord(
id = id,
name = displayName.substringBeforeLast('.').ifBlank { L10n.text("audio.systemSound") },
fileName = fileName,
duration = duration,
)
val updated = records + record
writeRecords(updated)
records.clear()
records += updated
publishImported()
id
} catch (error: Exception) {
destination.delete()
throw ImportException(ImportFailure.Unreadable)
}
}
// MARK: plumbing
private fun createPlayer(uri: Uri): MediaPlayer = MediaPlayer().apply {
setAudioAttributes(
AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build(),
)
setDataSource(context, uri)
prepare()
}
private fun finish(player: MediaPlayer, error: Boolean = false) {
player.setOnCompletionListener(null)
player.setOnErrorListener(null)
if (player.isPlaying) runCatching { player.stop() }
player.release()
players.remove(player)
if (error) _errorMessage.value = L10n.text("audio.playbackInterrupted")
normalizeVolumes()
}
private fun finishPreview(player: MediaPlayer, error: Boolean = false) {
if (previewPlayer !== player) return
previewPlayer?.release()
previewPlayer = null
if (error) _errorMessage.value = L10n.text("audio.previewInterrupted")
}
/** Linear gain sharing bounds the combined peak, even for identical recordings. */
private fun normalizeVolumes() {
if (players.isEmpty()) return
val gain = 1f / players.size
players.forEach { player -> runCatching { player.setVolume(gain, gain) } }
}
private fun publishImported() {
_importedSounds.value = records.map {
TempoSound(it.id, it.name, L10n.format("audio.importedSubtitle", it.duration))
}
}
/** Re-resolves the imported subtitles in the current language. */
fun relocalizeImported() {
publishImported()
}
private fun writeRecords(values: List<ImportedRecord>) {
val text = TempoRecordsCodec.encode(values)
val temporary = File(soundsDirectory, "${metadataFile.name}.tmp")
temporary.writeText(text, Charsets.UTF_8)
if (!temporary.renameTo(metadataFile)) {
metadataFile.writeText(text, Charsets.UTF_8)
temporary.delete()
}
}
private fun decodeRecords(text: String): List<ImportedRecord> =
runCatching { TempoRecordsCodec.decode(text) }.getOrDefault(emptyList())
/** The system default notification sound, used when a custom cue is unavailable. */
fun defaultNotificationSound(): Uri =
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
/** Media volume is user-controlled; expose it so the settings screen can explain state. */
fun isSilentMode(): Boolean {
val manager = context.getSystemService(Context.AUDIO_SERVICE) as? AudioManager ?: return false
return manager.ringerMode != AudioManager.RINGER_MODE_NORMAL
}
}
private object TempoRecordsCodec {
private val json = Json { ignoreUnknownKeys = true; prettyPrint = true }
fun encode(values: List<ImportedRecord>): String = json.encodeToString(
kotlinx.serialization.builtins.ListSerializer(ImportedRecord.serializer()), values,
)
fun decode(text: String): List<ImportedRecord> = json.decodeFromString(
kotlinx.serialization.builtins.ListSerializer(ImportedRecord.serializer()), text,
)
}
/** Names, limits and probing shared by the import and playback paths. */
object TempoSounds {
const val FALLBACK = "chime"
const val MAXIMUM_BYTES = 50_000_000L
const val MAXIMUM_SECONDS = 30.0
val SUPPORTED_EXTENSIONS = setOf("m4a", "wav", "aif", "aiff", "caf", "mp3", "aac", "ogg", "flac")
/** Duration in seconds, or null when the bytes are not decodable audio. */
fun probeDuration(context: Context, bytes: ByteArray, extension: String): Double? {
val staged = File.createTempFile("tempo-probe-", ".$extension", context.cacheDir)
return try {
staged.writeBytes(bytes)
val retriever = android.media.MediaMetadataRetriever()
try {
retriever.setDataSource(staged.absolutePath)
val millis = retriever
.extractMetadata(android.media.MediaMetadataRetriever.METADATA_KEY_DURATION)
?.toLongOrNull()
if (millis != null && millis > 0) millis / 1000.0 else null
} finally {
retriever.release()
}
} catch (_: Exception) {
null
} finally {
staged.delete()
}
}
}
@@ -0,0 +1,266 @@
package com.oshicue.tempo.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"
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 TempoL10n. */
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 {
table(language)[key]?.let { return it }
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, `%.1f` and `%ld` pass through as `%.1f` and `%d`.
*/
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')
// `%ld` is an integer in Java too: emit %d and consume the l's type letter.
'l' -> {
builder.append('d')
while (index + 1 < pattern.length && pattern[index + 1] in "ldiu") index++
}
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) }
/** Product identity shown by the wordmark and the About row. */
object AppBrand {
const val productName = "TEMPO"
const val storageFolder = "OshicueTempo"
}
@@ -0,0 +1,22 @@
package com.oshicue.tempo.core
/**
* The first-run sample troupe. Fictional on purpose: a new installation has something to
* try before the user builds their real line-up, and every field stays editable or
* deletable. Ids are fixed so the demo is identical on every device.
*/
object TempoDemo {
val groups: List<TempoGroup> = listOf(
TempoGroup(
id = "12BB2EA5-EAA5-48D3-99DB-1183EE8EA901",
name = "LUMINA",
secondsPerTicket = 30,
members = listOf(
TempoMember("726462D2-4B80-4CD1-9D01-80D7C910A001", "小葵", "FF688D"),
TempoMember("726462D2-4B80-4CD1-9D01-80D7C910A002", "凛", "79B8FF", "bell"),
TempoMember("726462D2-4B80-4CD1-9D01-80D7C910A003", "诗音", "C4A2FF", "pulse"),
TempoMember("726462D2-4B80-4CD1-9D01-80D7C910A004", "柚月", "F7CB6B", "arcade"),
),
),
)
}
@@ -0,0 +1,276 @@
package com.oshicue.tempo.core
import kotlinx.serialization.Serializable
/** A performer on the board. Order inside [TempoGroup.members] is the on-screen order. */
@Serializable
data class TempoMember(
val id: String = newId(),
val name: String,
val colorHex: String,
val soundId: String = DEFAULT_SOUND,
) {
companion object {
const val DEFAULT_SOUND = "chime"
}
}
/** One troupe. Members are paged four at a time, in list order. */
@Serializable
data class TempoGroup(
val id: String = newId(),
val name: String,
/** Seconds granted by one ticket. A round freezes this value when it starts. */
val secondsPerTicket: Int = 30,
val members: List<TempoMember> = emptyList(),
) {
val pageCount: Int
get() = maxOf(1, (members.size + TempoLimits.MEMBERS_PER_PAGE - 1) / TempoLimits.MEMBERS_PER_PAGE)
fun member(id: String): TempoMember? = members.firstOrNull { it.id == id }
fun membersOnPage(page: Int): List<TempoMember> =
members.drop(page * TempoLimits.MEMBERS_PER_PAGE).take(TempoLimits.MEMBERS_PER_PAGE)
}
/** Hard limits shared by the UI, the store and the tests. */
object TempoLimits {
const val MEMBERS_PER_PAGE = 4
val TICKETS = 1..999
val SECONDS_PER_TICKET = 1..3600
const val MAXIMUM_DURATION_SECONDS = 24 * 60 * 60.0
/** One-tap ticket counts that cover most rounds at a meet & greet. */
val QUICK_TICKET_COUNTS = listOf(1, 2, 3, 5)
/** Seconds for a round, or a validation failure. */
fun duration(tickets: Int, secondsPerTicket: Int): Double {
if (tickets !in TICKETS) throw TempoValidationException("validation.invalidTickets")
if (secondsPerTicket !in SECONDS_PER_TICKET) {
throw TempoValidationException("validation.invalidSecondsPerTicket")
}
val seconds = tickets.toDouble() * secondsPerTicket
if (seconds > MAXIMUM_DURATION_SECONDS) throw TempoValidationException("validation.durationTooLong")
return seconds
}
}
enum class CountdownPhase { Idle, Running, Paused, Finished }
/**
* A round keeps its original ticket price in seconds even when its group is edited.
* Running timers use an absolute deadline, so backgrounding never loses elapsed time.
*/
@Serializable
data class CountdownRound(
val id: String = newId(),
val groupId: String,
val memberId: String,
val tickets: Int,
val secondsPerTicket: Int,
val duration: Double,
val soundId: String? = null,
/** Epoch millis. */
val deadline: Long? = null,
val pausedRemaining: Double? = null,
/** Epoch millis. */
val completedAt: Long? = null,
) {
fun remaining(now: Long): Double {
if (completedAt != null) return 0.0
pausedRemaining?.let { return minOf(duration, maxOf(0.0, it)) }
deadline?.let { return minOf(duration, maxOf(0.0, (it - now) / 1000.0)) }
return duration
}
/** 1 when the round starts, 0 when it ends. Drives the progress ring. */
fun progress(now: Long): Double {
if (duration <= 0) return 0.0
return minOf(1.0, maxOf(0.0, remaining(now) / duration))
}
fun phase(now: Long): CountdownPhase = when {
completedAt != null -> CountdownPhase.Finished
pausedRemaining != null -> CountdownPhase.Paused
deadline != null -> if (remaining(now) > 0) CountdownPhase.Running else CountdownPhase.Finished
else -> CountdownPhase.Idle
}
/**
* Adds tickets mid-round: the usual case when a guest buys one more.
* Running rounds push their deadline out; paused rounds add to the frozen remaining.
*/
fun extended(extraTickets: Int): CountdownRound {
if (extraTickets <= 0 || completedAt != null) throw TempoValidationException("validation.invalidTickets")
val total = tickets + extraTickets
val extendedSeconds = TempoLimits.duration(total, secondsPerTicket)
val added = extendedSeconds - duration
return copy(
tickets = total,
duration = extendedSeconds,
deadline = deadline?.let { it + (added * 1000).toLong() },
pausedRemaining = pausedRemaining?.let { minOf(extendedSeconds, it + added) },
)
}
fun paused(now: Long): CountdownRound {
if (deadline == null || completedAt != null) return this
val left = remaining(now)
return if (left <= 0) finished(deadline) else copy(pausedRemaining = left, deadline = null)
}
fun resumed(now: Long): CountdownRound {
val left = pausedRemaining ?: return this
if (completedAt != null) return this
return copy(deadline = now + (left * 1000).toLong(), pausedRemaining = null)
}
fun finished(now: Long): CountdownRound = copy(completedAt = now, deadline = null, pausedRemaining = null)
companion object {
fun start(
groupId: String,
memberId: String,
tickets: Int,
secondsPerTicket: Int,
soundId: String?,
now: Long,
): CountdownRound {
val duration = TempoLimits.duration(tickets, secondsPerTicket)
return CountdownRound(
groupId = groupId,
memberId = memberId,
tickets = tickets,
secondsPerTicket = secondsPerTicket,
duration = duration,
soundId = soundId,
deadline = now + (duration * 1000).toLong(),
)
}
}
}
/** Preferences that are not tied to a specific group. */
@Serializable
data class TempoPreferences(
val hapticsEnabled: Boolean = true,
val keepAwakeEnabled: Boolean = true,
val defaultSoundId: String = TempoMember.DEFAULT_SOUND,
val lastTicketCount: Int? = null,
val colorCycle: List<String> = COLORS,
) {
/** Next unused representative colour for a group, wrapping once every hue is taken. */
fun nextColor(group: TempoGroup): String {
val used = group.members.map { it.colorHex }.toSet()
return colorCycle.firstOrNull { it !in used }
?: colorCycle[group.members.size % maxOf(1, colorCycle.size)]
}
companion object {
val COLORS = listOf("FF3D6E", "79B8FF", "C4A2FF", "F7CB6B", "70D6B1", "FF934F")
}
}
@Serializable
data class TempoSnapshot(
val version: Int = CURRENT_VERSION,
val groups: List<TempoGroup> = emptyList(),
val rounds: List<CountdownRound> = emptyList(),
val selectedGroupId: String? = null,
val preferences: TempoPreferences = TempoPreferences(),
) {
companion object {
const val CURRENT_VERSION = 1
}
}
/** A validation failure carrying the localisation key of its message. */
class TempoValidationException(val messageKey: String) : Exception(messageKey)
/** A storage failure carrying the localisation key of its message. */
class TempoStorageException(val messageKey: String, val detail: String? = null) : Exception(messageKey)
fun newId(): String = java.util.UUID.randomUUID().toString()
// MARK: validation
fun TempoMember.validated(): TempoMember {
val cleanName = name.trim()
if (cleanName.isEmpty()) throw TempoValidationException("validation.emptyMemberName")
val hex = colorHex.removePrefix("#")
if (hex.length != 6 || !hex.all { it.isDigit() || it in 'a'..'f' || it in 'A'..'F' }) {
throw TempoValidationException("validation.invalidColor")
}
if (soundId.isEmpty()) throw TempoValidationException("validation.invalidSound")
return copy(name = cleanName, colorHex = hex.uppercase())
}
fun TempoGroup.validated(): TempoGroup {
val cleanName = name.trim()
if (cleanName.isEmpty()) throw TempoValidationException("validation.emptyGroupName")
if (secondsPerTicket !in TempoLimits.SECONDS_PER_TICKET) {
throw TempoValidationException("validation.invalidSecondsPerTicket")
}
if (members.isEmpty()) throw TempoValidationException("validation.emptyMembers")
if (members.map { it.id }.toSet().size != members.size) {
throw TempoValidationException("validation.duplicateMember")
}
return copy(name = cleanName, members = members.map { it.validated() })
}
fun TempoSnapshot.validated(): TempoSnapshot {
if (version != TempoSnapshot.CURRENT_VERSION) throw TempoValidationException("validation.corruptSnapshot")
if (groups.map { it.id }.toSet().size != groups.size) {
throw TempoValidationException("validation.duplicateGroup")
}
val cleanGroups = groups.map { it.validated() }
val members = cleanGroups.flatMap { it.members }
if (members.map { it.id }.toSet().size != members.size) {
throw TempoValidationException("validation.duplicateMember")
}
if (rounds.map { it.memberId }.toSet().size != rounds.size) {
throw TempoValidationException("validation.corruptSnapshot")
}
if (rounds.map { it.id }.toSet().size != rounds.size) {
throw TempoValidationException("validation.corruptSnapshot")
}
rounds.forEach { round ->
val group = cleanGroups.firstOrNull { it.id == round.groupId }
?: throw TempoValidationException("validation.corruptSnapshot")
if (group.member(round.memberId) == null) throw TempoValidationException("validation.corruptSnapshot")
val expected = TempoLimits.duration(round.tickets, round.secondsPerTicket)
if (round.duration != expected || !round.duration.isFinite()) {
throw TempoValidationException("validation.corruptSnapshot")
}
if (round.soundId?.isEmpty() == true) throw TempoValidationException("validation.corruptSnapshot")
if (round.completedAt != null && (round.deadline != null || round.pausedRemaining != null)) {
throw TempoValidationException("validation.corruptSnapshot")
}
round.pausedRemaining?.let { left ->
if (!left.isFinite() || left <= 0 || left > round.duration || round.deadline != null || round.completedAt != null) {
throw TempoValidationException("validation.corruptSnapshot")
}
}
}
val selected = if (cleanGroups.none { it.id == selectedGroupId }) cleanGroups.firstOrNull()?.id else selectedGroupId
val lastTickets = preferences.lastTicketCount?.takeIf { it in TempoLimits.TICKETS }
return copy(
groups = cleanGroups,
selectedGroupId = selected,
preferences = preferences.copy(lastTicketCount = lastTickets),
)
}
/**
* Moves the elements at [source] so they land before the element currently at [destination],
* matching the semantics list reordering reports.
*/
fun <T> MutableList<T>.tempoMove(source: Collection<Int>, destination: Int) {
val indices = source.filter { it in indices }.distinct().sorted()
if (indices.isEmpty()) return
val moved = indices.map { this[it] }
indices.sortedDescending().forEach { removeAt(it) }
var target = destination - indices.count { it < destination }
target = target.coerceIn(0, size)
addAll(target, moved)
}
@@ -0,0 +1,65 @@
package com.oshicue.tempo.core
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import java.io.File
/**
* Launch flags mirroring the iOS `--uitesting` arguments. Release builds always read the
* user's own file; these exist so a preview or a future instrumentation run can opt out.
*/
object TempoLaunch {
var isUITest: Boolean = false
var preservesUITestData: Boolean = false
val loadsSavedData: Boolean get() = !isUITest || preservesUITestData
}
/**
* The app's single JSON file. Writes are atomic (temp file + rename), and the original is
* never overwritten once it has been found unreadable, so a corrupt file cannot take the
* user's data with it.
*/
class TempoStorageFile(private val file: File) {
var isUnreadable: Boolean = false
private set
val exists: Boolean get() = TempoLaunch.loadsSavedData && file.exists()
fun readText(): String = file.readText(Charsets.UTF_8)
fun markUnreadable() {
isUnreadable = true
}
fun writeText(text: String) {
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.writeText(text, Charsets.UTF_8)
if (!temporary.renameTo(file)) {
file.writeText(text, Charsets.UTF_8)
temporary.delete()
}
}
}
/** The JSON codec shared by the store, the sound catalogue and the tests. */
object TempoCodec {
val json = Json {
prettyPrint = true
ignoreUnknownKeys = true
encodeDefaults = true
}
fun encode(snapshot: TempoSnapshot): String = json.encodeToString(TempoSnapshot.serializer(), snapshot)
fun decode(text: String): TempoSnapshot = json.decodeFromString(TempoSnapshot.serializer(), text)
@Serializable
private data class LegacyProbe(val version: Int? = null)
}
@@ -0,0 +1,524 @@
package com.oshicue.tempo.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.BoxWithConstraints
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
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.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.ArrowBackIosNew
import androidx.compose.material.icons.filled.ArrowForwardIos
import androidx.compose.material.icons.filled.AutoAwesome
import androidx.compose.material.icons.filled.MoreHoriz
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.GraphicEq
import androidx.compose.material.icons.filled.Tune
import androidx.compose.material.icons.filled.Timer
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.mutableLongStateOf
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.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.tempo.core.L10n
import com.oshicue.tempo.core.TempoGroup
import com.oshicue.tempo.core.TempoLimits
import com.oshicue.tempo.core.TempoMember
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/** The board. Presentation only; timers, alerts and haptics live in [com.oshicue.tempo.TempoSession]. */
@Composable
fun BoardScreen(
state: TempoUiState,
now: Long,
actions: BoardActions,
onOpenSounds: () -> Unit,
onOpenSettings: () -> Unit,
onOpenGroups: () -> Unit,
) {
var resetting by remember { mutableStateOf<TempoMember?>(null) }
BoxWithConstraints(
Modifier
.fillMaxSize()
.background(Tempo.colors.background)
.windowInsetsPadding(WindowInsets.safeDrawing),
) {
val metrics = BoardMetrics(maxWidth, maxHeight)
Column(
Modifier
.fillMaxSize()
.padding(horizontal = metrics.horizontalPadding)
.padding(top = 8.dp, bottom = 10.dp),
verticalArrangement = Arrangement.spacedBy(metrics.sectionSpacing),
) {
Header(metrics, onOpenSounds, onOpenSettings, onOpenGroups)
val group = state.selectedGroup
if (group != null) {
val pagerState = rememberPagerState(pageCount = { group.pageCount })
// A group change or a shorter list must not leave the pager past the last page.
LaunchedEffect(group.id, group.pageCount) {
if (pagerState.currentPage > group.pageCount - 1) {
pagerState.scrollToPage((group.pageCount - 1).coerceAtLeast(0))
}
}
GroupSwitcher(state, group, now, metrics, actions, onOpenGroups)
StatusRow(state, now, metrics)
Board(
group = group,
state = state,
now = now,
metrics = metrics,
actions = actions,
pagerState = pagerState,
onResetRequest = { resetting = it },
modifier = Modifier.fillMaxWidth().weight(1f),
)
Pager(pagerState, metrics)
if (metrics.showsFooterHint) Footer(pagerState.currentPage, group.pageCount)
} else {
EmptyBoard(onOpenGroups)
}
}
}
resetting?.let { member ->
androidx.compose.material3.AlertDialog(
onDismissRequest = { resetting = null },
title = { Text(L10n.format("board.resetQuestion", member.name)) },
confirmButton = {
androidx.compose.material3.TextButton(onClick = {
actions.reset(member)
resetting = null
}) { Text(L10n.text("board.resetRound"), color = androidx.compose.ui.graphics.Color(0xFFC62828)) }
},
dismissButton = {
androidx.compose.material3.TextButton(onClick = { resetting = null }) {
Text(L10n.text("common.cancel"))
}
},
containerColor = Tempo.colors.surface,
)
}
}
/** Callbacks the board needs; keeps the screen free of store details. */
data class BoardActions(
val start: (TempoMember) -> Unit,
val pause: (String) -> Unit,
val resume: (String) -> Unit,
val extend: (TempoMember, Int) -> Unit,
val reset: (TempoMember) -> Unit,
val selectGroup: (String) -> Unit,
)
@Composable
private fun Header(
metrics: BoardMetrics,
onOpenSounds: () -> Unit,
onOpenSettings: () -> Unit,
onOpenGroups: () -> Unit,
) {
Row(
Modifier.fillMaxWidth().padding(bottom = if (metrics.isCompact) 0.dp else 2.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(9.dp),
) {
BrandWordmark(compact = metrics.isCompact)
Spacer(Modifier.weight(1f))
CircleIconButton(Icons.Filled.GraphicEq, L10n.text("board.soundSettings"), onClick = onOpenSounds)
CircleIconButton(Icons.Filled.Settings, L10n.text("board.settings"), onClick = onOpenSettings)
CircleIconButton(Icons.Filled.Tune, L10n.text("board.manageGroups"), onClick = onOpenGroups)
}
}
@Composable
private fun StatusRow(state: TempoUiState, now: Long, metrics: BoardMetrics) {
val running = state.runningCount(now)
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
Text(
L10n.text("board.eventKind"),
fontSize = 10.sp,
fontWeight = FontWeight.Bold,
letterSpacing = 2.sp,
color = Tempo.colors.muted,
)
Spacer(Modifier.weight(1f))
Box(
Modifier.size(5.dp).clip(CircleShape)
.background(if (running > 0) Tempo.colors.runningIndicator else Tempo.colors.muted.copy(alpha = 0.6f)),
)
Spacer(Modifier.width(6.dp))
Text(
if (running > 0) L10n.format("board.runningCount", running) else L10n.text("board.ready"),
fontSize = 11.sp,
color = Tempo.colors.muted,
maxLines = 1,
softWrap = false,
)
}
}
@Composable
private fun GroupSwitcher(
state: TempoUiState,
group: TempoGroup,
now: Long,
metrics: BoardMetrics,
actions: BoardActions,
onManage: () -> Unit,
) {
TempoCard(
modifier = Modifier.fillMaxWidth(),
radius = TempoMetric.PANEL_RADIUS.dp,
) {
Column(Modifier.padding(vertical = 13.dp, horizontal = 15.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Row(Modifier.fillMaxWidth()) {
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(3.dp)) {
Text(L10n.text("board.currentGroup"), fontSize = 9.sp, color = Tempo.colors.muted)
Text(
group.name,
fontSize = if (metrics.width < 360.dp) 19.sp else 22.sp,
fontWeight = FontWeight.Bold,
color = Tempo.colors.ink,
maxLines = 1,
softWrap = false,
overflow = TextOverflow.Ellipsis,
)
}
Column(
horizontalAlignment = Alignment.End,
verticalArrangement = Arrangement.spacedBy(3.dp),
modifier = Modifier.widthIn(min = 84.dp),
) {
Row(verticalAlignment = Alignment.Bottom, horizontalArrangement = Arrangement.spacedBy(3.dp)) {
Text(
"${group.secondsPerTicket}",
fontFamily = DigitsFont, fontSize = 19.sp, color = Tempo.colors.pink,
)
Text(
L10n.text("board.secondsPerTicket"),
fontSize = 10.sp, color = Tempo.colors.pink.copy(alpha = 0.9f),
modifier = Modifier.padding(bottom = 2.dp),
)
}
Text(
L10n.format("board.memberCount", group.members.size),
fontSize = 10.sp,
color = Tempo.colors.muted,
maxLines = 1,
softWrap = false,
)
}
}
if (state.groups.size > 1) {
LazyRow(horizontalArrangement = Arrangement.spacedBy(7.dp)) {
items(state.groups, key = { it.id }) { value ->
GroupChip(
group = value,
selected = value.id == group.id,
active = state.activeCount(value, now),
onSelect = { actions.selectGroup(value.id) },
)
}
item {
Box(
Modifier.clip(CircleShape).background(Tempo.colors.controlSurface)
.border(1.dp, Tempo.colors.line, CircleShape)
.clickable(onClick = onManage)
.padding(horizontal = 12.dp, vertical = 7.dp),
) {
Icon(
Icons.Filled.MoreHoriz, contentDescription = L10n.text("board.manageGroupsMenu"),
tint = Tempo.colors.muted, modifier = Modifier.size(14.dp),
)
}
}
}
}
}
}
}
@Composable
private fun GroupChip(group: TempoGroup, selected: Boolean, active: Int, onSelect: () -> Unit) {
Row(
Modifier
.clip(CircleShape)
.background(if (selected) Tempo.colors.primaryFill else Tempo.colors.controlSurface)
.border(1.dp, if (selected) androidx.compose.ui.graphics.Color.Transparent else Tempo.colors.line, CircleShape)
.clickable(onClick = onSelect)
.padding(horizontal = 12.dp, vertical = 7.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp),
) {
if (active > 0) {
Box(
Modifier.size(5.dp).clip(CircleShape)
.background(if (selected) androidx.compose.ui.graphics.Color.White.copy(alpha = 0.85f) else Tempo.colors.runningIndicator),
)
}
Text(
group.name,
fontSize = 12.sp,
fontWeight = FontWeight.SemiBold,
color = if (selected) androidx.compose.ui.graphics.Color.White else Tempo.colors.ink,
maxLines = 1,
)
if (active > 0) {
Text(
"$active",
fontFamily = DigitsFont,
fontSize = 9.sp,
color = if (selected) androidx.compose.ui.graphics.Color.White.copy(alpha = 0.8f) else Tempo.colors.runningIndicator,
)
}
}
}
@Composable
private fun Board(
group: TempoGroup,
state: TempoUiState,
now: Long,
metrics: BoardMetrics,
actions: BoardActions,
pagerState: androidx.compose.foundation.pager.PagerState,
onResetRequest: (TempoMember) -> Unit,
modifier: Modifier = Modifier,
) {
HorizontalPager(
state = pagerState,
modifier = modifier,
) { page ->
MemberPage(
members = group.membersOnPage(page),
baseIndex = page * TempoLimits.MEMBERS_PER_PAGE,
group = group,
state = state,
now = now,
metrics = metrics,
actions = actions,
onResetRequest = onResetRequest,
)
}
}
@Composable
private fun MemberPage(
members: List<TempoMember>,
baseIndex: Int,
group: TempoGroup,
state: TempoUiState,
now: Long,
metrics: BoardMetrics,
actions: BoardActions,
onResetRequest: (TempoMember) -> Unit,
) {
if (metrics.singleRow) {
Row(Modifier.fillMaxSize(), horizontalArrangement = Arrangement.spacedBy(metrics.cardSpacing)) {
members.forEachIndexed { offset, member ->
MemberTimerCard(
member = member,
group = group,
round = state.roundFor(member.id),
now = now,
index = baseIndex + offset,
metrics = metrics,
onStart = { actions.start(member) },
onPause = { actions.pause(member.id) },
onResume = { actions.resume(member.id) },
onExtend = { actions.extend(member, it) },
onReset = { onResetRequest(member) },
modifier = Modifier.weight(1f),
)
}
}
} else {
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(metrics.cardSpacing)) {
for (row in 0 until 2) {
Row(Modifier.weight(1f).fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(metrics.cardSpacing)) {
for (column in 0 until 2) {
val index = row * 2 + column
Box(Modifier.weight(1f).fillMaxHeight()) {
if (index < members.size) {
val member = members[index]
MemberTimerCard(
member = member,
group = group,
round = state.roundFor(member.id),
now = now,
index = baseIndex + index,
metrics = metrics,
onStart = { actions.start(member) },
onPause = { actions.pause(member.id) },
onResume = { actions.resume(member.id) },
onExtend = { actions.extend(member, it) },
onReset = { onResetRequest(member) },
)
} else {
EmptySlot(metrics.cardCornerRadius)
}
}
}
}
}
}
}
}
@Composable
private fun EmptySlot(radius: androidx.compose.ui.unit.Dp) {
Box(
Modifier
.fillMaxSize()
.clip(RoundedCornerShape(radius))
.background(Tempo.colors.controlSurface.copy(alpha = 0.5f)),
contentAlignment = Alignment.Center,
) {
Icon(
Icons.Filled.AutoAwesome, contentDescription = null,
tint = Tempo.colors.line, modifier = Modifier.size(16.dp),
)
}
}
@Composable
private fun Pager(pagerState: androidx.compose.foundation.pager.PagerState, metrics: BoardMetrics) {
val scope = rememberCoroutineScope()
val pages = pagerState.pageCount
val page = pagerState.currentPage
Row(
Modifier.fillMaxWidth().height(if (metrics.isCompact) 26.dp else 30.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (pages > 1) {
Icon(
Icons.Filled.ArrowBackIosNew,
contentDescription = L10n.text("board.previousPage"),
tint = Tempo.colors.muted.copy(alpha = if (page == 0) 0.35f else 1f),
modifier = Modifier.size(14.dp).clickable(enabled = page > 0) {
scope.launch { pagerState.animateScrollToPage(page - 1) }
},
)
}
Spacer(Modifier.weight(1f))
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.CenterVertically) {
repeat(pages) { index ->
Box(
Modifier
.height(6.dp)
.width(if (index == page) 20.dp else 6.dp)
.clip(CircleShape)
.background(if (index == page) Tempo.colors.pink else Tempo.colors.line),
)
}
}
Spacer(Modifier.weight(1f))
if (pages > 1) {
Icon(
Icons.Filled.ArrowForwardIos,
contentDescription = L10n.text("board.nextPage"),
tint = Tempo.colors.muted.copy(alpha = if (page == pages - 1) 0.35f else 1f),
modifier = Modifier.size(14.dp).clickable(enabled = page < pages - 1) {
scope.launch { pagerState.animateScrollToPage(page + 1) }
},
)
}
}
}
@Composable
private fun Footer(page: Int, pageCount: Int) {
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
Text(L10n.text("board.quickGuide"), fontSize = 10.sp, color = Tempo.colors.muted)
Spacer(Modifier.weight(1f))
Text(
String.format("%02d / %02d", page + 1, pageCount),
fontFamily = DigitsFont, fontSize = 10.sp, color = Tempo.colors.muted,
)
}
}
@Composable
private fun EmptyBoard(onAdd: () -> Unit) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(22.dp)) {
Box(contentAlignment = Alignment.Center) {
Box(
Modifier.size(116.dp).clip(CircleShape)
.background(Tempo.colors.pink.copy(alpha = 0.08f)),
)
Box(
Modifier.size(92.dp).clip(CircleShape)
.border(1.dp, Tempo.colors.pink.copy(alpha = 0.22f), CircleShape),
)
Icon(
Icons.Filled.Timer, contentDescription = null,
tint = Tempo.colors.pink, modifier = Modifier.size(42.dp),
)
}
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(
L10n.text("board.emptyTitle"),
fontSize = 20.sp, fontWeight = FontWeight.Bold,
color = Tempo.colors.ink, textAlign = TextAlign.Center,
)
Text(
L10n.text("board.emptyMessage"),
fontSize = 14.sp, color = Tempo.colors.muted, textAlign = TextAlign.Center,
modifier = Modifier.padding(horizontal = 24.dp),
)
}
TempoCapsuleButton(
fill = Tempo.colors.primaryFill,
contentColor = androidx.compose.ui.graphics.Color.White,
minHeight = 52.dp,
onClick = onAdd,
) {
Row(
Modifier.padding(horizontal = 26.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Icon(Icons.Filled.Add, contentDescription = null, modifier = Modifier.size(16.dp))
Text(L10n.text("board.addFirstGroup"), fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
}
}
}
}
}
@@ -0,0 +1,348 @@
package com.oshicue.tempo.ui
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
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.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.draw.scale
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontVariation
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.tempo.R
import com.oshicue.tempo.core.AppBrand
/**
* 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)),
),
)
/** Countdown digits: 700, so a four-card board stays crisp without looking like a logo. */
val DigitsFont = FontFamily(
Font(
R.font.unbounded_regular,
weight = FontWeight.SemiBold,
variationSettings = FontVariation.Settings(FontVariation.weight(600)),
),
)
/** The OSHI**CUE** wordmark with TEMPO underneath, matching the iOS header. */
@Composable
fun BrandWordmark(compact: Boolean = false) {
Column {
Row {
Text(
"OSHI", color = Tempo.colors.ink, fontFamily = BrandFont,
fontSize = if (compact) 18.sp else 22.sp, letterSpacing = 0.4.sp,
)
Text(
"CUE", color = Tempo.colors.brandPink, fontFamily = BrandFont,
fontSize = if (compact) 18.sp else 22.sp, letterSpacing = 0.4.sp,
)
}
Text(
AppBrand.productName,
color = Tempo.colors.ink,
fontFamily = BrandFont,
fontSize = if (compact) 8.sp else 10.sp,
letterSpacing = if (compact) 3.8.sp else 4.6.sp,
modifier = Modifier.padding(top = 1.dp),
)
}
}
/** Circular icon button used in the header and card corners. */
@Composable
fun CircleIconButton(
symbol: ImageVector,
label: String,
modifier: Modifier = Modifier,
size: Dp = 42.dp,
prominent: Boolean = false,
onClick: () -> Unit,
) {
val interaction = remember { MutableInteractionSource() }
val pressed by interaction.collectIsPressedAsState()
Box(
modifier = modifier
.size(size)
.scale(if (pressed) 0.95f else 1f)
.clip(CircleShape)
.background(if (prominent) Tempo.colors.primaryFill else Tempo.colors.surface)
.border(1.dp, if (prominent) Color.Transparent else Tempo.colors.line, CircleShape)
.clickable(interactionSource = interaction, indication = null, onClick = onClick),
contentAlignment = Alignment.Center,
) {
Icon(
symbol,
contentDescription = label,
tint = if (prominent) Color.White else Tempo.colors.ink,
modifier = Modifier.size(if (size > 40.dp) 18.dp else 15.dp),
)
}
}
/** Small uppercase status chip — LIVE, paused and finished states. */
@Composable
fun TempoStatusChip(text: String, color: Color, symbol: ImageVector? = null) {
Row(
modifier = Modifier
.clip(CircleShape)
.background(color.copy(alpha = 0.12f))
.padding(horizontal = 6.dp, vertical = 3.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
if (symbol != null) {
Icon(symbol, contentDescription = null, tint = color, modifier = Modifier.size(8.dp))
}
Text(
text,
color = color,
fontSize = 8.sp,
fontWeight = FontWeight.Bold,
letterSpacing = 0.9.sp,
maxLines = 1,
softWrap = false,
)
}
}
/**
* The progress ring. Draws the track, a subtle neutral backing in light mode (so a white
* member colour stays visible), and the progress arc as a sweep gradient.
*/
@Composable
fun TempoProgressRing(
progress: Float,
color: Color,
strokeWidth: Dp,
modifier: Modifier = Modifier,
faint: Boolean = false,
content: @Composable () -> Unit,
) {
val animated by animateFloatAsState(
targetValue = progress.coerceIn(0f, 1f),
animationSpec = tween(durationMillis = 220),
label = "ring",
)
val dark = isDark()
val trackColor = color.copy(alpha = if (dark) 0.14f else 0.10f)
val backingColor = Tempo.colors.line
Box(modifier, contentAlignment = Alignment.Center) {
Canvas(Modifier.matchParentSize()) {
val stroke = strokeWidth.toPx()
val inset = stroke / 2
val diameter = size.minDimension - stroke
val topLeft = Offset((size.width - diameter) / 2, (size.height - diameter) / 2)
val arcSize = Size(diameter, diameter)
drawArc(
color = trackColor,
startAngle = 0f,
sweepAngle = 360f,
useCenter = false,
topLeft = topLeft,
size = arcSize,
style = Stroke(width = stroke),
)
if (!dark) {
// Neutral backing keeps a white representative colour visible on white.
drawArc(
color = backingColor,
startAngle = 0f,
sweepAngle = 360f,
useCenter = false,
topLeft = Offset(topLeft.x - 1, topLeft.y - 1),
size = Size(arcSize.width + 2, arcSize.height + 2),
style = Stroke(width = stroke + 1),
)
}
if (animated > 0.001f) {
drawArc(
brush = Brush.sweepGradient(
listOf(
if (faint) color.copy(alpha = 0.45f) else color,
if (faint) color.copy(alpha = 0.2f) else color.copy(alpha = 0.78f),
if (faint) color.copy(alpha = 0.45f) else color,
),
),
startAngle = -90f,
sweepAngle = animated * 360f,
useCenter = false,
topLeft = topLeft,
size = arcSize,
style = Stroke(width = stroke, cap = StrokeCap.Round),
)
}
// `inset` is referenced to keep the ring optically centred when the stroke is fat.
if (inset < 0f) drawArc(Color.Transparent, 0f, 0f, false, topLeft, arcSize)
}
content()
}
}
@Composable
private fun isDark(): Boolean = Tempo.colors.isDark
/** Card surface with the hairline border and a soft accent wash from the top-left. */
@Composable
fun TempoCard(
modifier: Modifier = Modifier,
radius: Dp = TempoMetric.CARD_RADIUS.dp,
accent: Color? = null,
wash: Float = 0f,
borderColor: Color? = null,
borderWidth: Dp = 1.dp,
content: @Composable () -> Unit,
) {
val dark = isDark()
Box(
modifier
.shadow(if (dark) 0.dp else 6.dp, RoundedCornerShape(radius), clip = false)
.clip(RoundedCornerShape(radius))
.background(Tempo.colors.surface)
.then(
if (accent != null && wash > 0f) {
Modifier.background(
Brush.linearGradient(
listOf(
accent.copy(alpha = if (dark) wash else wash * 0.8f),
accent.copy(alpha = 0.01f),
),
),
)
} else Modifier
)
.border(
borderWidth,
borderColor ?: Tempo.colors.line,
RoundedCornerShape(radius),
),
) { content() }
}
/** Fills the width with a capsule button and a pressed-state scale. */
@Composable
fun TempoCapsuleButton(
modifier: Modifier = Modifier,
fill: Color,
contentColor: Color,
enabled: Boolean = true,
minHeight: Dp = 36.dp,
onClick: () -> Unit,
content: @Composable () -> Unit,
) {
val interaction = remember { MutableInteractionSource() }
val pressed by interaction.collectIsPressedAsState()
Box(
modifier = modifier
.height(minHeight)
.scale(if (pressed && enabled) 0.97f else 1f)
.clip(CircleShape)
.background(fill)
.clickable(enabled = enabled, interactionSource = interaction, indication = null, onClick = onClick),
contentAlignment = Alignment.Center,
) {
androidx.compose.runtime.CompositionLocalProvider(
androidx.compose.material3.LocalContentColor provides contentColor,
) { content() }
}
}
/** Section heading used above settings groups. */
@Composable
fun TempoSectionLabel(text: String, modifier: Modifier = Modifier) {
Text(
text,
modifier = modifier,
fontSize = 12.sp,
fontWeight = FontWeight.SemiBold,
color = Tempo.colors.muted,
letterSpacing = 0.3.sp,
)
}
/** A row inside a settings card: label on the left, trailing slot on the right. */
@Composable
fun TempoSettingRow(
title: String,
subtitle: String? = null,
leading: ImageVector? = null,
trailing: @Composable (() -> Unit)? = null,
onClick: (() -> Unit)? = null,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier)
.padding(horizontal = 16.dp, vertical = 13.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (leading != null) {
Icon(leading, contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(20.dp))
Spacer(Modifier.width(12.dp))
}
Column(Modifier.weight(1f)) {
Text(title, fontSize = 15.sp, color = Tempo.colors.ink)
if (subtitle != null) {
Text(
subtitle,
fontSize = 12.sp,
color = Tempo.colors.muted,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(top = 2.dp),
)
}
}
if (trailing != null) {
Spacer(Modifier.width(10.dp))
trailing()
}
}
}
@@ -0,0 +1,537 @@
package com.oshicue.tempo.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.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
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.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ChevronLeft
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.PersonAdd
import androidx.compose.material.icons.filled.PlayCircle
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Icon
import androidx.compose.material3.RadioButton
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.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.SolidColor
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.oshicue.tempo.audio.TempoAudio
import com.oshicue.tempo.core.L10n
import com.oshicue.tempo.core.TempoGroup
import com.oshicue.tempo.core.TempoLimits
import com.oshicue.tempo.core.TempoMember
import com.oshicue.tempo.core.TempoPreferences
/** Editable copy of a member, so Cancel is a true cancel. */
data class MemberDraft(
val id: String = com.oshicue.tempo.core.newId(),
var name: String = "",
var colorHex: String,
var soundId: String = TempoMember.DEFAULT_SOUND,
) {
fun asMember(): TempoMember = TempoMember(id = id, name = name, colorHex = colorHex, soundId = soundId)
companion object {
fun of(member: TempoMember) = MemberDraft(member.id, member.name, member.colorHex, member.soundId)
}
}
/**
* Create or edit a group: name, seconds per ticket, members. A local draft means a failed
* save or a cancel never leaves a half-edited group on the board.
*/
@Composable
fun GroupEditorScreen(
existing: TempoGroup?,
preferences: TempoPreferences,
hasActiveRound: (String) -> Boolean,
audio: TempoAudio,
onCancel: () -> Unit,
onSave: (TempoGroup) -> Unit,
) {
val groupId = existing?.id ?: com.oshicue.tempo.core.newId()
var name by remember { mutableStateOf(existing?.name ?: "") }
var secondsText by remember { mutableStateOf((existing?.secondsPerTicket ?: 60).toString()) }
var members by remember {
mutableStateOf(
existing?.members?.map { MemberDraft.of(it) }
?: listOf(MemberDraft(colorHex = preferences.colorCycle.first())),
)
}
var pendingRemove by remember { mutableStateOf<MemberDraft?>(null) }
var errorMessage by remember { mutableStateOf<String?>(null) }
var soundPickerFor by remember { mutableStateOf<MemberDraft?>(null) }
val seconds = secondsText.toIntOrNull()?.takeIf { it in TempoLimits.SECONDS_PER_TICKET }
val canSave = name.isNotBlank() && seconds != null && members.isNotEmpty() &&
members.all { it.name.isNotBlank() }
Column(
Modifier
.fillMaxSize()
.background(Tempo.colors.background)
.windowInsetsPadding(WindowInsets.safeDrawing),
) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 12.dp).padding(top = 12.dp, bottom = 10.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
L10n.text("common.cancel"),
fontSize = 15.sp, color = Tempo.colors.muted,
modifier = Modifier.clickable(onClick = onCancel).padding(8.dp),
)
Text(
L10n.text(if (existing == null) "groupEditor.addTitle" else "groupEditor.editTitle"),
fontSize = 17.sp, fontWeight = FontWeight.SemiBold, color = Tempo.colors.ink,
modifier = Modifier.weight(1f), textAlign = androidx.compose.ui.text.style.TextAlign.Center,
)
Text(
L10n.text("common.save"),
fontSize = 15.sp,
fontWeight = FontWeight.SemiBold,
color = if (canSave) Tempo.colors.pink else Tempo.colors.muted.copy(alpha = 0.5f),
modifier = Modifier.clickable(enabled = canSave) {
val group = TempoGroup(
id = groupId,
name = name.trim(),
secondsPerTicket = seconds ?: 60,
members = members.map { it.asMember() },
)
onSave(group)
}.padding(8.dp),
)
}
Column(
Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).padding(bottom = 30.dp),
verticalArrangement = Arrangement.spacedBy(14.dp),
) {
TempoSectionLabel(L10n.text("groupEditor.groupSection"))
Column(
Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface),
) {
LabelledField(
label = L10n.text("groupEditor.namePlaceholder"),
value = name,
placeholder = L10n.text("groupEditor.namePlaceholder"),
onValueChange = { name = it },
)
Divider()
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(L10n.text("groupEditor.secondsPerTicket"), fontSize = 15.sp, color = Tempo.colors.ink)
Spacer(Modifier.weight(1f))
Box(Modifier.width(64.dp)) {
if (secondsText.isEmpty()) {
Text(
L10n.text("groupEditor.secondsPlaceholder"),
fontSize = 16.sp,
color = Tempo.colors.muted.copy(alpha = 0.55f),
textAlign = androidx.compose.ui.text.style.TextAlign.End,
modifier = Modifier.fillMaxWidth(),
)
}
BasicTextField(
value = secondsText,
onValueChange = { secondsText = it.filter { c -> c.isDigit() }.take(4) },
singleLine = true,
textStyle = TextStyle(
fontSize = 16.sp, color = Tempo.colors.ink,
textAlign = androidx.compose.ui.text.style.TextAlign.End,
),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
cursorBrush = SolidColor(Tempo.colors.pink),
modifier = Modifier.fillMaxWidth(),
)
}
Text(
L10n.text("groupEditor.secondsUnit"),
fontSize = 14.sp, color = Tempo.colors.muted,
modifier = Modifier.padding(start = 6.dp),
)
}
Divider()
Text(
L10n.text("groupEditor.durationHelp"),
fontSize = 12.sp, color = Tempo.colors.muted,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
)
}
if (seconds != null) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
listOf(1, 2, 3).forEach { tickets ->
Text(
L10n.format("groupEditor.previewTickets", tickets, tickets * seconds),
fontSize = 12.sp, color = Tempo.colors.muted,
)
}
}
}
Row(verticalAlignment = Alignment.CenterVertically) {
TempoSectionLabel(L10n.format("groupEditor.memberNumber", "").trim())
Spacer(Modifier.weight(1f))
Text(L10n.text("groups.reorderHint"), fontSize = 11.sp, color = Tempo.colors.muted)
}
members.forEachIndexed { index, draft ->
MemberEditorCard(
draft = draft,
number = index + 1,
canMoveUp = index > 0,
canMoveDown = index < members.lastIndex,
hasActiveRound = hasActiveRound(draft.id),
canDelete = members.size > 1,
audio = audio,
onNameChange = { value -> members = members.toMutableList().also { it[index] = draft.copy(name = value) } },
onColorChange = { hex -> members = members.toMutableList().also { it[index] = draft.copy(colorHex = hex) } },
onPickSound = { soundPickerFor = members[index] },
onMoveUp = {
members = members.toMutableList().also {
val previous = it[index - 1]
it[index - 1] = it[index]
it[index] = previous
}
},
onMoveDown = {
members = members.toMutableList().also {
val next = it[index + 1]
it[index + 1] = it[index]
it[index] = next
}
},
onDelete = {
if (hasActiveRound(draft.id)) pendingRemove = draft else members = members.filterNot { it.id == draft.id }
},
)
}
Row(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(Tempo.colors.surface)
.clickable {
val partial = TempoGroup(
id = groupId,
name = name,
secondsPerTicket = seconds ?: 60,
members = members.map { it.asMember() },
)
members = members + MemberDraft(
colorHex = preferences.nextColor(partial),
soundId = preferences.defaultSoundId,
)
}
.padding(horizontal = 16.dp, vertical = 14.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Icon(Icons.Filled.PersonAdd, contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(17.dp))
Text(L10n.text("groupEditor.addMember"), fontSize = 15.sp, color = Tempo.colors.pink)
}
Text(L10n.text("groupEditor.membersHelp"), fontSize = 12.sp, color = Tempo.colors.muted)
errorMessage?.let { Text(it, fontSize = 12.sp, color = Color(0xFFC62828)) }
}
}
pendingRemove?.let { draft ->
AlertDialog(
onDismissRequest = { pendingRemove = null },
title = { Text(L10n.text("groupEditor.removeMemberTitle")) },
text = { Text(L10n.text("groupEditor.removeMemberMessage")) },
confirmButton = {
TextButton(onClick = {
pendingRemove = null
members = members.filterNot { it.id == draft.id }
}) { Text(L10n.text("groupEditor.removeMember"), color = Color(0xFFC62828)) }
},
dismissButton = {
TextButton(onClick = { pendingRemove = null }) { Text(L10n.text("common.cancel")) }
},
containerColor = Tempo.colors.surface,
)
}
soundPickerFor?.let { draft ->
SoundPickerDialog(
sounds = audio.sounds,
selected = draft.soundId,
onPreview = { audio.preview(it) },
onDismiss = {
audio.stopPreview()
soundPickerFor = null
},
onSelect = { id ->
val index = members.indexOfFirst { it.id == draft.id }
if (index >= 0) {
members = members.toMutableList().also { it[index] = it[index].copy(soundId = id) }
}
errorMessage = null
soundPickerFor = null
},
)
}
}
@Composable
private fun MemberEditorCard(
draft: MemberDraft,
number: Int,
canMoveUp: Boolean,
canMoveDown: Boolean,
hasActiveRound: Boolean,
canDelete: Boolean,
audio: TempoAudio,
onNameChange: (String) -> Unit,
onColorChange: (String) -> Unit,
onPickSound: () -> Unit,
onMoveUp: () -> Unit,
onMoveDown: () -> Unit,
onDelete: () -> Unit,
) {
Column(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(Tempo.colors.surface)
.padding(vertical = 12.dp),
) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
TempoSectionLabel(L10n.format("groupEditor.memberNumber", String.format("%02d", number)))
Spacer(Modifier.weight(1f))
Icon(
Icons.Filled.ChevronLeft, contentDescription = L10n.text("groups.reorderHint"),
tint = Tempo.colors.muted.copy(alpha = if (canMoveUp) 1f else 0.3f),
modifier = Modifier.size(18.dp).clickable(enabled = canMoveUp, onClick = onMoveUp),
)
Icon(
Icons.Filled.ChevronRight, contentDescription = L10n.text("groups.reorderHint"),
tint = Tempo.colors.muted.copy(alpha = if (canMoveDown) 1f else 0.3f),
modifier = Modifier.size(18.dp).clickable(enabled = canMoveDown, onClick = onMoveDown),
)
}
Spacer(Modifier.height(10.dp))
LabelledField(
label = L10n.text("groupEditor.memberName"),
value = draft.name,
placeholder = L10n.text("groupEditor.memberNamePlaceholder"),
onValueChange = onNameChange,
)
Divider()
MemberColorRow(draft.colorHex, onColorChange)
Divider()
Row(
Modifier.fillMaxWidth().clickable(onClick = onPickSound).padding(horizontal = 16.dp, vertical = 13.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(L10n.text("groupEditor.memberSound"), fontSize = 15.sp, color = Tempo.colors.ink)
Spacer(Modifier.weight(1f))
Text(
audio.title(draft.soundId),
fontSize = 14.sp, color = Tempo.colors.pink, maxLines = 1, overflow = TextOverflow.Ellipsis,
)
Icon(
Icons.Filled.ChevronRight, contentDescription = null,
tint = Tempo.colors.muted, modifier = Modifier.size(16.dp).padding(start = 2.dp),
)
}
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
audio.subtitle(draft.soundId),
fontSize = 12.sp, color = Tempo.colors.muted,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f),
)
Icon(
Icons.Filled.PlayCircle,
contentDescription = L10n.format("groupEditor.previewAccessibility", audio.title(draft.soundId)),
tint = Tempo.colors.pink, modifier = Modifier.size(24.dp).clickable { audio.preview(draft.soundId) },
)
}
if (hasActiveRound) {
Text(
L10n.text("groupEditor.activeRound"),
fontSize = 12.sp, color = Tempo.colors.muted,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp),
)
}
if (canDelete) {
Row(
Modifier.fillMaxWidth().clickable(onClick = onDelete).padding(horizontal = 16.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp),
) {
Icon(Icons.Filled.Delete, contentDescription = null, tint = Color(0xFFC62828), modifier = Modifier.size(15.dp))
Text(L10n.text("groupEditor.deleteMember"), fontSize = 14.sp, color = Color(0xFFC62828))
}
}
}
}
@Composable
private fun MemberColorRow(colorHex: String, onChange: (String) -> Unit) {
Column(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(L10n.text("groupEditor.memberColor"), fontSize = 15.sp, color = Tempo.colors.ink)
Spacer(Modifier.weight(1f))
Box(
Modifier.size(22.dp).clip(CircleShape)
.background(Tempo.parse(colorHex))
.border(1.dp, Tempo.colors.swatchOutline, CircleShape),
)
}
Spacer(Modifier.height(10.dp))
FlowRow(horizontalArrangement = Arrangement.spacedBy(10.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
TempoPreferences.COLORS.forEach { hex ->
val selected = hex.equals(colorHex, ignoreCase = true)
Box(
Modifier
.size(30.dp)
.clip(CircleShape)
.background(Tempo.parse(hex))
.border(
if (selected) 2.dp else 1.dp,
if (selected) Tempo.colors.ink else Tempo.colors.swatchOutline.copy(alpha = 0.6f),
CircleShape,
)
.clickable { onChange(hex) },
)
}
}
}
}
@Composable
private fun LabelledField(
label: String,
value: String,
placeholder: String,
onValueChange: (String) -> Unit,
) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(label, fontSize = 15.sp, color = Tempo.colors.ink)
Spacer(Modifier.width(14.dp))
Box(Modifier.weight(1f)) {
if (value.isEmpty()) {
Text(
placeholder,
fontSize = 15.sp,
color = Tempo.colors.muted.copy(alpha = 0.55f),
textAlign = androidx.compose.ui.text.style.TextAlign.End,
modifier = Modifier.fillMaxWidth(),
)
}
BasicTextField(
value = value,
onValueChange = onValueChange,
singleLine = true,
textStyle = TextStyle(
fontSize = 15.sp, color = Tempo.colors.ink,
textAlign = androidx.compose.ui.text.style.TextAlign.End,
),
cursorBrush = SolidColor(Tempo.colors.pink),
modifier = Modifier.fillMaxWidth(),
)
}
}
}
@Composable
private fun Divider() {
Box(Modifier.fillMaxWidth().height(1.dp).background(Tempo.colors.line.copy(alpha = 0.7f)))
}
/** Sound chooser: built-in cues and imported recordings, each with a preview. */
@Composable
fun SoundPickerDialog(
sounds: List<com.oshicue.tempo.audio.TempoSound>,
selected: String,
onPreview: (String) -> Unit,
onDismiss: () -> Unit,
onSelect: (String) -> Unit,
) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text(L10n.text("groupEditor.memberSound")) },
text = {
Column(
Modifier.height(320.dp).verticalScroll(rememberScrollState()),
) {
sounds.forEach { sound ->
Row(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(10.dp))
.clickable { onSelect(sound.id) }
.padding(vertical = 8.dp, horizontal = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
RadioButton(selected = sound.id == selected, onClick = { onSelect(sound.id) })
Column(Modifier.weight(1f)) {
Text(sound.name, fontSize = 15.sp, color = Tempo.colors.ink)
Text(sound.subtitle, fontSize = 12.sp, color = Tempo.colors.muted)
}
Icon(
Icons.Filled.PlayCircle, contentDescription = L10n.text("common.preview"),
tint = Tempo.colors.pink,
modifier = Modifier.size(22.dp).clickable { onPreview(sound.id) },
)
}
}
}
},
confirmButton = {
TextButton(onClick = onDismiss) { Text(L10n.text("common.cancel")) }
},
containerColor = Tempo.colors.surface,
)
}
@@ -0,0 +1,232 @@
package com.oshicue.tempo.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.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
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.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.DragHandle
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material.icons.filled.RadioButtonUnchecked
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.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.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.sp
import com.oshicue.tempo.core.L10n
import com.oshicue.tempo.core.TempoGroup
/** The group list: select, edit, reorder, delete, add. */
@Composable
fun GroupManagementScreen(
state: TempoUiState,
now: Long,
onDone: () -> Unit,
onEdit: (TempoGroup?) -> Unit,
onSelect: (String) -> Unit,
onDelete: (TempoGroup) -> Unit,
onMove: (Int, Int) -> Unit,
) {
var pendingDelete by remember { mutableStateOf<TempoGroup?>(null) }
Column(
Modifier
.fillMaxSize()
.background(Tempo.colors.background)
.windowInsetsPadding(WindowInsets.safeDrawing),
) {
SheetHeader(L10n.text("groups.title"), L10n.text("common.done"), onDone)
Column(
Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).padding(bottom = 24.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Text(L10n.text("groups.intro"), fontSize = 14.sp, color = Tempo.colors.muted)
Row(verticalAlignment = Alignment.CenterVertically) {
TempoSectionLabel(L10n.format("groups.count", state.groups.size))
Spacer(Modifier.weight(1f))
if (state.groups.size > 1) {
Text(L10n.text("groups.reorderHint"), fontSize = 11.sp, color = Tempo.colors.muted)
}
}
state.groups.forEachIndexed { index, group ->
GroupRow(
group = group,
selected = state.selectedGroupId == group.id,
activeCount = state.activeCount(group, now),
canMoveUp = index > 0,
canMoveDown = index < state.groups.lastIndex,
onEdit = { onEdit(group) },
onSelect = { onSelect(group.id) },
onDelete = { pendingDelete = group },
onMoveUp = { onMove(index, 1) },
onMoveDown = { onMove(index, -1) },
)
}
Row(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(Tempo.colors.surface)
.clickable { onEdit(null) }
.padding(horizontal = 16.dp, vertical = 14.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Icon(Icons.Filled.Add, contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(17.dp))
Text(L10n.text("groups.add"), fontSize = 15.sp, color = Tempo.colors.pink, fontWeight = FontWeight.Medium)
}
}
}
pendingDelete?.let { group ->
val active = group.members.count { state.hasActiveRound(it.id, now) }
AlertDialog(
onDismissRequest = { pendingDelete = null },
title = { Text(L10n.format("groups.deleteNamedTitle", group.name)) },
text = {
Text(
if (active > 0) L10n.format("groups.deleteActiveMessage", active)
else L10n.text("groups.deleteMessage"),
)
},
confirmButton = {
TextButton(onClick = {
pendingDelete = null
onDelete(group)
}) { Text(L10n.text("groups.deleteAll"), color = Color(0xFFC62828)) }
},
dismissButton = {
TextButton(onClick = { pendingDelete = null }) { Text(L10n.text("common.cancel")) }
},
containerColor = Tempo.colors.surface,
)
}
}
@Composable
private fun GroupRow(
group: TempoGroup,
selected: Boolean,
activeCount: Int,
canMoveUp: Boolean,
canMoveDown: Boolean,
onEdit: () -> Unit,
onSelect: () -> Unit,
onDelete: () -> Unit,
onMoveUp: () -> Unit,
onMoveDown: () -> Unit,
) {
Row(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(Tempo.colors.surface)
.border(1.dp, if (selected) Tempo.colors.pink.copy(alpha = 0.45f) else Tempo.colors.line, RoundedCornerShape(16.dp))
.padding(horizontal = 14.dp, vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Column(
modifier = Modifier
.weight(1f)
.clickable(onClick = onEdit)
.semantics { contentDescription = L10n.format("groups.editAccessibility", group.name) },
verticalArrangement = Arrangement.spacedBy(6.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Text(
group.name,
fontSize = 16.sp, fontWeight = FontWeight.Bold, color = Tempo.colors.ink,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false),
)
if (activeCount > 0) TempoStatusChip("$activeCount", Tempo.colors.runningIndicator, Icons.Filled.Check)
}
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
Row(horizontalArrangement = Arrangement.spacedBy(3.dp)) {
group.members.take(6).forEach { member ->
Box(
Modifier.size(8.dp).clip(CircleShape)
.background(Tempo.parse(member.colorHex))
.border(0.75.dp, Tempo.colors.swatchOutline, CircleShape),
)
}
}
Text(
L10n.format("groups.memberSummary", group.members.size, group.secondsPerTicket),
fontSize = 12.sp, color = Tempo.colors.muted, maxLines = 1, overflow = TextOverflow.Ellipsis,
)
}
}
// Reordering is explicit arrows rather than drag: a long list stays reachable in one hand,
// and a mis-drag cannot silently reshuffle the board mid-event.
Column {
Icon(
Icons.Filled.KeyboardArrowUp,
contentDescription = L10n.text("groups.reorderHint"),
tint = Tempo.colors.muted.copy(alpha = if (canMoveUp) 1f else 0.3f),
modifier = Modifier.size(18.dp).clickable(enabled = canMoveUp, onClick = onMoveUp),
)
Icon(
Icons.Filled.KeyboardArrowDown,
contentDescription = L10n.text("groups.reorderHint"),
tint = Tempo.colors.muted.copy(alpha = if (canMoveDown) 1f else 0.3f),
modifier = Modifier.size(18.dp).clickable(enabled = canMoveDown, onClick = onMoveDown),
)
}
Spacer(Modifier.width(10.dp))
Icon(
if (selected) Icons.Filled.CheckCircle else Icons.Filled.RadioButtonUnchecked,
contentDescription = L10n.format(
if (selected) "groups.currentAccessibility" else "groups.selectAccessibility", group.name,
),
tint = if (selected) Tempo.colors.pink else Tempo.colors.muted.copy(alpha = 0.7f),
modifier = Modifier.size(24.dp).clickable(onClick = onSelect),
)
Spacer(Modifier.width(12.dp))
Icon(
Icons.Filled.Delete,
contentDescription = L10n.text("groups.delete"),
tint = Tempo.colors.muted.copy(alpha = 0.7f),
modifier = Modifier.size(20.dp).clickable(onClick = onDelete),
)
}
}
@@ -0,0 +1,456 @@
package com.oshicue.tempo.ui
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
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.heightIn
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.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.FiberManualRecord
import androidx.compose.material.icons.filled.GraphicEq
import androidx.compose.material.icons.filled.Pause
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
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.graphics.Color
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.dp
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.sp
import com.oshicue.tempo.core.CountdownPhase
import com.oshicue.tempo.core.CountdownRound
import com.oshicue.tempo.core.L10n
import com.oshicue.tempo.core.TempoGroup
import com.oshicue.tempo.core.TempoLimits
import com.oshicue.tempo.core.TempoMember
/** Layout decisions derived from the available size, covering small phones through tablets. */
data class BoardMetrics(val width: Dp, val height: Dp) {
val isCompact: Boolean get() = height < 820.dp
val isSmallScreen: Boolean get() = height < 700.dp
val horizontalPadding: Dp get() = if (width > 700.dp) 40.dp else if (width > 420.dp) 20.dp else 16.dp
val sectionSpacing: Dp get() = if (isCompact) 12.dp else 16.dp
val cardSpacing: Dp get() = if (isSmallScreen) 9.dp else 11.dp
val showsFooterHint: Boolean get() = !isSmallScreen
/** Landscape phones put the four cards in one row instead of 2 × 2. */
val singleRow: Boolean get() = width > 560.dp && height < 520.dp
val cardCornerRadius: Dp get() = if (isSmallScreen) 20.dp else 26.dp
}
/** One member's tile: identity, name, ring, round summary, actions. */
@Composable
fun MemberTimerCard(
member: TempoMember,
group: TempoGroup,
round: CountdownRound?,
now: Long,
index: Int,
metrics: BoardMetrics,
onStart: () -> Unit,
onPause: () -> Unit,
onResume: () -> Unit,
onExtend: (Int) -> Unit,
onReset: () -> Unit,
modifier: Modifier = Modifier,
) {
val accent = Tempo.memberAccent(member.colorHex)
val dark = Tempo.colors.isDark
val phase = round?.phase(now) ?: CountdownPhase.Idle
val remaining = round?.remaining(now) ?: group.secondsPerTicket.toDouble()
val running = phase == CountdownPhase.Running
val paused = phase == CountdownPhase.Paused
val finished = phase == CountdownPhase.Finished
val ending = running && remaining <= 10
val ringColor = if (ending) Tempo.colors.warning else accent
val wash = when {
finished -> if (dark) 0.14f else 0.05f
running -> 0.09f
else -> 0.045f
}
val border = when {
finished -> accent.copy(alpha = if (dark) 0.6f else 0.5f)
running -> accent.copy(alpha = if (dark) 0.55f else 0.55f)
else -> accent.copy(alpha = if (dark) 0.22f else 0.34f)
}
TempoCard(
modifier = modifier.fillMaxSize(),
radius = metrics.cardCornerRadius,
accent = accent,
wash = wash,
borderColor = border,
borderWidth = if (running) 1.4.dp else 1.dp,
) {
BoxWithConstraints(Modifier.fillMaxSize()) {
val compact = metrics.isSmallScreen
val padding = if (compact) 10.dp else if (metrics.isCompact) 13.dp else 16.dp
val gap = if (compact) 4.dp else if (metrics.isCompact) 6.dp else 9.dp
val actionHeight = if (compact) 30.dp else 36.dp
Column(
modifier = Modifier.fillMaxSize().padding(padding),
verticalArrangement = Arrangement.spacedBy(gap),
) {
// One row carries the member's identity: dot, index, name and state.
// The old separate name row cost 20dp that the ring needs on a small phone.
HeaderRow(member, index, phase, ringColor, accent, compact)
ClockRing(
memberName = member.name,
idleSeconds = group.secondsPerTicket.toDouble(),
round = round,
now = now,
ringColor = ringColor,
accent = accent,
finished = finished,
status = statusText(finished, paused, running),
onTap = { if (!running && !paused) onStart() },
modifier = Modifier.weight(1f).fillMaxWidth(),
)
// Idle cards already say "Enter tickets" below, and on a small phone the
// ring's own status line carries the same news. The breakdown stays on
// larger cards, where there is room to spell it out.
if (round != null && !compact) {
SummaryRow(round = round, group = group, showIcon = !compact)
}
if (running || paused) {
ActiveActions(
accent = accent,
running = running,
isSmall = compact,
onPause = onPause,
onResume = onResume,
onExtend = onExtend,
onReset = onReset,
memberName = member.name,
)
} else {
StartAction(
accent = accent,
finished = finished,
isSmall = compact,
onStart = onStart,
)
}
}
}
}
}
/** The per-ticket line. On the smallest screens the icon is dropped, not the text. */
@Composable
private fun SummaryRow(round: CountdownRound?, group: TempoGroup, showIcon: Boolean) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(5.dp),
modifier = Modifier.fillMaxWidth(),
) {
if (showIcon) {
Icon(
Icons.Filled.GraphicEq,
contentDescription = null,
tint = Tempo.colors.muted,
modifier = Modifier.size(11.dp),
)
}
Text(
summaryText(round, group),
fontSize = 10.sp,
color = Tempo.colors.muted,
maxLines = 1,
softWrap = false,
overflow = TextOverflow.Ellipsis,
)
}
}
@Composable
private fun HeaderRow(
member: TempoMember,
index: Int,
phase: CountdownPhase,
ringColor: Color,
accent: Color,
compact: Boolean,
) {
Row(
Modifier.fillMaxWidth().heightIn(min = 20.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Box(
Modifier.size(7.dp).clip(CircleShape)
.background(Tempo.parse(member.colorHex))
.border(0.75.dp, Tempo.colors.swatchOutline, CircleShape),
)
Spacer(Modifier.width(6.dp))
Text(
String.format("%02d", index + 1),
fontFamily = DigitsFont,
fontSize = 9.sp,
color = Tempo.colors.muted,
maxLines = 1,
softWrap = false,
)
Spacer(Modifier.width(7.dp))
Text(
member.name,
fontSize = if (compact) 16.sp else 18.sp,
fontWeight = FontWeight.Bold,
color = Tempo.colors.ink,
maxLines = 1,
softWrap = false,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
)
// On a narrow card the chip keeps its word and loses only the dot.
when (phase) {
CountdownPhase.Running -> TempoStatusChip(
L10n.text("timer.live"), ringColor,
if (compact) null else Icons.Filled.FiberManualRecord,
)
CountdownPhase.Paused -> TempoStatusChip(
L10n.text("timer.paused"), Tempo.colors.muted,
if (compact) null else Icons.Filled.Pause,
)
CountdownPhase.Finished -> TempoStatusChip(
L10n.text("timer.finished"), accent,
if (compact) null else Icons.Filled.Check,
)
CountdownPhase.Idle -> Icon(
Icons.Filled.GraphicEq, contentDescription = null,
tint = accent.copy(alpha = 0.75f), modifier = Modifier.size(10.dp),
)
}
}
}
@Composable
private fun ClockRing(
memberName: String,
idleSeconds: Double,
round: CountdownRound?,
now: Long,
ringColor: Color,
accent: Color,
finished: Boolean,
status: String,
onTap: () -> Unit,
modifier: Modifier = Modifier,
) {
val remaining = round?.remaining(now) ?: idleSeconds
val progress = round?.progress(now) ?: 1.0
val description = L10n.format("timer.accessibility", memberName, status, tempoTime(remaining))
BoxWithConstraints(
modifier = modifier.clickable(onClick = onTap).semantics { contentDescription = description },
contentAlignment = Alignment.Center,
) {
val diameter = minOf(maxWidth, maxHeight).coerceAtLeast(48.dp)
Box(Modifier.size(diameter)) {
TempoProgressRing(
progress = progress.toFloat(),
color = ringColor,
strokeWidth = if (diameter < 104.dp) 5.dp else 6.dp,
faint = finished,
modifier = Modifier.fillMaxSize(),
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
// Keep both lines inside the ring: the circle is the hard edge, and a
// text wider than it gets clipped rather than wrapped.
modifier = Modifier.width(diameter * 0.84f),
) {
// "00:30" is ~3.1 em wide in Unbounded, so this keeps it inside the ring.
Text(
tempoTime(remaining),
fontFamily = DigitsFont,
fontSize = (diameter.value * 0.195f).coerceIn(12f, 30f).sp,
color = if (finished) accent else Tempo.colors.ink,
maxLines = 1,
softWrap = false,
)
Text(
status,
fontSize = (diameter.value * 0.066f).coerceIn(6.5f, 10.5f).sp,
color = if (finished) accent else Tempo.colors.muted,
maxLines = 2,
textAlign = TextAlign.Center,
lineHeight = (diameter.value * 0.085f).coerceIn(8f, 13f).sp,
)
}
}
}
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun ActiveActions(
memberName: String,
accent: Color,
running: Boolean,
isSmall: Boolean,
onPause: () -> Unit,
onResume: () -> Unit,
onExtend: (Int) -> Unit,
onReset: () -> Unit,
) {
val dark = Tempo.colors.isDark
val height = if (isSmall) 32.dp else 36.dp
val fill = accent.copy(alpha = if (dark) 0.14f else 0.08f)
var menuOpen by remember { mutableStateOf(false) }
val interaction = remember { MutableInteractionSource() }
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
TempoCapsuleButton(
modifier = Modifier.weight(1f),
fill = fill,
contentColor = accent,
minHeight = height,
onClick = if (running) onPause else onResume,
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp)) {
Icon(
if (running) Icons.Filled.Pause else Icons.Filled.PlayArrow,
contentDescription = null, modifier = Modifier.size(12.dp),
)
Text(
if (running) L10n.text("timer.pause") else L10n.text("timer.resume"),
fontSize = 11.sp, fontWeight = FontWeight.SemiBold, maxLines = 1,
)
}
}
// Adding one ticket is the routine case: one tap. Multi-ticket guests are a long press away.
Box {
Box(
Modifier
.height(height)
.clip(CircleShape)
.background(fill)
.combinedClickable(
interactionSource = interaction,
indication = null,
onClick = { onExtend(1) },
onLongClick = { menuOpen = true },
)
.semantics {
contentDescription = L10n.format("timer.extendOneAccessibility", memberName)
}
.padding(horizontal = 11.dp),
contentAlignment = Alignment.Center,
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(1.dp)) {
Icon(Icons.Filled.Add, contentDescription = null, tint = accent, modifier = Modifier.size(11.dp))
Text("1", fontFamily = DigitsFont, fontSize = 11.sp, color = accent)
}
}
DropdownMenu(expanded = menuOpen, onDismissRequest = { menuOpen = false }) {
TempoLimits.QUICK_TICKET_COUNTS.drop(1).forEach { count ->
DropdownMenuItem(
text = { Text(L10n.format("timer.extendTickets", count)) },
onClick = {
menuOpen = false
onExtend(count)
},
)
}
}
}
Box(
Modifier.height(height).width(height).clip(CircleShape)
.background(Tempo.colors.controlSurface)
.clickable(onClick = onReset)
.semantics { contentDescription = L10n.format("timer.resetMember", memberName) },
contentAlignment = Alignment.Center,
) {
Icon(
Icons.Filled.Refresh, contentDescription = null,
tint = Tempo.colors.muted, modifier = Modifier.size(13.dp),
)
}
}
}
@Composable
private fun StartAction(accent: Color, finished: Boolean, isSmall: Boolean, onStart: () -> Unit) {
val dark = Tempo.colors.isDark
TempoCapsuleButton(
modifier = Modifier.fillMaxWidth(),
fill = accent.copy(alpha = if (dark) 0.12f else 0.07f),
contentColor = accent,
minHeight = if (isSmall) 32.dp else 36.dp,
onClick = onStart,
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp)) {
Icon(
if (finished) Icons.Filled.Refresh else Icons.Filled.Add,
contentDescription = null, modifier = Modifier.size(11.dp),
)
Text(
if (finished) L10n.text("timer.nextRound") else L10n.text("timer.enterTickets"),
fontSize = 11.sp, fontWeight = FontWeight.SemiBold, maxLines = 1,
)
}
}
}
/** `MM:SS`, or `H:MM:SS` once a round is genuinely that long. */
fun tempoTime(seconds: Double): String {
val value = maxOf(0, Math.ceil(seconds).toInt())
return if (value >= 3600) {
String.format("%d:%02d:%02d", value / 3600, value / 60 % 60, value % 60)
} else {
String.format("%02d:%02d", value / 60, value % 60)
}
}
private fun statusText(finished: Boolean, paused: Boolean, running: Boolean): String = when {
finished -> L10n.text("timer.finished")
paused -> L10n.text("timer.paused")
running -> L10n.text("timer.running")
else -> L10n.text("timer.tapToStart")
}
private fun summaryText(round: CountdownRound?, group: TempoGroup): String =
if (round == null) {
L10n.format("timer.ticketDuration", group.secondsPerTicket)
} else {
L10n.format("timer.roundSummary", round.tickets, round.duration.toInt())
}
@@ -0,0 +1,253 @@
package com.oshicue.tempo.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.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
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.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Language
import androidx.compose.material.icons.filled.WbSunny
import androidx.compose.material.icons.filled.Timer
import androidx.compose.material.icons.filled.Vibration
import androidx.compose.material.icons.filled.VolumeUp
import androidx.compose.material.icons.filled.Storage
import androidx.compose.material3.Icon
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
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.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.oshicue.tempo.audio.TempoAudio
import com.oshicue.tempo.core.AppLanguage
import com.oshicue.tempo.core.L10n
import com.oshicue.tempo.core.TempoMember
import com.oshicue.tempo.core.TempoPreferences
/**
* App-level behaviour that is not about any single group: language, feedback, the default
* sound for new members, and the state of saved data.
*/
@Composable
fun SettingsScreen(
state: TempoUiState,
audio: TempoAudio,
language: AppLanguage,
versionName: String,
hasUnreadableSnapshot: Boolean,
onLanguageChange: (AppLanguage) -> Unit,
onPreferences: ((TempoPreferences) -> TempoPreferences) -> Unit,
onDone: () -> Unit,
) {
var languageOpen by remember { mutableStateOf(false) }
var soundOpen by remember { mutableStateOf(false) }
val preferences = state.preferences
Column(
Modifier
.fillMaxSize()
.background(Tempo.colors.background)
.windowInsetsPadding(WindowInsets.safeDrawing),
) {
SheetHeader(L10n.text("settings.title"), L10n.text("common.done"), onDone)
Column(
Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).padding(bottom = 28.dp),
verticalArrangement = Arrangement.spacedBy(14.dp),
) {
TempoSectionLabel(L10n.text("settings.behaviour"))
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface)) {
SettingSwitch(
title = L10n.text("settings.haptics"),
subtitle = L10n.text("settings.hapticsHint"),
icon = Icons.Filled.Vibration,
checked = preferences.hapticsEnabled,
onChange = { value -> onPreferences { it.copy(hapticsEnabled = value) } },
)
Box(Modifier.fillMaxWidth().padding(start = 48.dp).height(1.dp).background(Tempo.colors.line.copy(alpha = 0.7f)))
SettingSwitch(
title = L10n.text("settings.keepAwake"),
subtitle = L10n.text("settings.keepAwakeHint"),
icon = Icons.Filled.WbSunny,
checked = preferences.keepAwakeEnabled,
onChange = { value -> onPreferences { it.copy(keepAwakeEnabled = value) } },
)
}
TempoSectionLabel(L10n.text("settings.defaults"))
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface)) {
TempoSettingRow(
title = L10n.text("settings.defaultSound"),
subtitle = audio.title(preferences.defaultSoundId),
leading = Icons.Filled.VolumeUp,
trailing = {
Icon(
Icons.Filled.Check, contentDescription = null,
tint = Tempo.colors.pink.copy(alpha = 0.0f), modifier = Modifier.size(16.dp),
)
},
onClick = { soundOpen = true },
)
Text(
L10n.text("settings.defaultSoundHelp"),
fontSize = 12.sp, color = Tempo.colors.muted,
modifier = Modifier.padding(start = 48.dp, end = 16.dp, bottom = 13.dp),
)
}
TempoSectionLabel(L10n.text("settings.language"))
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface)) {
TempoSettingRow(
title = language.nativeName,
leading = Icons.Filled.Language,
trailing = {
Icon(
Icons.Filled.Check, contentDescription = null,
tint = Tempo.colors.pink.copy(alpha = 0f), modifier = Modifier.size(16.dp),
)
},
onClick = { languageOpen = !languageOpen },
)
if (languageOpen) {
AppLanguage.entries.forEach { value ->
Row(
Modifier.fillMaxWidth().clickable {
onLanguageChange(value)
languageOpen = false
}.padding(horizontal = 16.dp, vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
value.nativeName, fontSize = 14.sp, color = Tempo.colors.ink,
modifier = Modifier.weight(1f),
)
if (value == language) {
Icon(
Icons.Filled.Check, contentDescription = null,
tint = Tempo.colors.pink, modifier = Modifier.size(16.dp),
)
}
}
}
}
}
TempoSectionLabel(L10n.text("settings.data"))
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface)) {
Row(Modifier.fillMaxWidth().padding(16.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Icon(Icons.Filled.Storage, contentDescription = null, tint = Tempo.colors.muted, modifier = Modifier.size(20.dp))
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(L10n.text("settings.dataTitle"), fontSize = 15.sp, color = Tempo.colors.ink)
Text(
if (hasUnreadableSnapshot) L10n.text("settings.dataUnreadable")
else L10n.text("settings.dataSaved"),
fontSize = 12.sp,
color = if (hasUnreadableSnapshot) Tempo.colors.warning else Tempo.colors.muted,
)
}
}
Box(Modifier.fillMaxWidth().padding(start = 48.dp).height(1.dp).background(Tempo.colors.line.copy(alpha = 0.7f)))
Row(Modifier.fillMaxWidth().padding(16.dp), verticalAlignment = Alignment.CenterVertically) {
Icon(Icons.Filled.Timer, contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(20.dp))
Spacer(Modifier.width(12.dp))
Text(L10n.text("settings.roundStatus"), fontSize = 15.sp, color = Tempo.colors.ink, modifier = Modifier.weight(1f))
Text(
L10n.format(
"settings.roundStatusValue",
state.runningCount(System.currentTimeMillis()),
state.finishedCount(System.currentTimeMillis()),
),
fontSize = 13.sp, color = Tempo.colors.muted,
)
}
}
TempoSectionLabel(L10n.text("settings.about"))
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface)) {
Row(Modifier.fillMaxWidth().padding(16.dp), verticalAlignment = Alignment.CenterVertically) {
BrandWordmark(compact = true)
Spacer(Modifier.weight(1f))
Column(horizontalAlignment = Alignment.End) {
Text(L10n.text("settings.version"), fontSize = 12.sp, color = Tempo.colors.muted)
Text(versionName, fontSize = 12.sp, color = Tempo.colors.ink)
}
}
Text(
L10n.text("settings.about"),
fontSize = 12.sp, color = Tempo.colors.muted,
modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp),
)
}
}
}
if (soundOpen) {
SoundPickerDialog(
sounds = audio.sounds,
selected = preferences.defaultSoundId,
onPreview = { audio.preview(it) },
onDismiss = {
audio.stopPreview()
soundOpen = false
},
onSelect = { id ->
onPreferences { it.copy(defaultSoundId = id) }
soundOpen = false
},
)
}
}
@Composable
private fun SettingSwitch(
title: String,
subtitle: String,
icon: androidx.compose.ui.graphics.vector.ImageVector,
checked: Boolean,
onChange: (Boolean) -> Unit,
) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(icon, contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(20.dp))
Spacer(Modifier.width(12.dp))
Column(Modifier.weight(1f)) {
Text(title, fontSize = 15.sp, color = Tempo.colors.ink)
Text(subtitle, fontSize = 12.sp, color = Tempo.colors.muted)
}
Switch(
checked = checked,
onCheckedChange = onChange,
colors = SwitchDefaults.colors(
checkedThumbColor = androidx.compose.ui.graphics.Color.White,
checkedTrackColor = Tempo.colors.pink,
),
)
}
}
@@ -0,0 +1,266 @@
package com.oshicue.tempo.ui
import android.content.Intent
import android.provider.Settings
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.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.fillMaxWidth
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.FileDownload
import androidx.compose.material.icons.filled.Mic
import androidx.compose.material.icons.filled.Notifications
import androidx.compose.material.icons.filled.PlayCircle
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Waves
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.CircularProgressIndicator
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.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
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 com.oshicue.tempo.alert.TempoNotifications
import com.oshicue.tempo.audio.TempoAudio
import com.oshicue.tempo.audio.TempoSound
import com.oshicue.tempo.core.L10n
/** Built-in cues, imported recordings, and the notification permission. */
@Composable
fun SoundSettingsScreen(
audio: TempoAudio,
importedSounds: List<TempoSound>,
notifications: TempoNotifications,
importing: Boolean,
importError: String?,
onImport: () -> Unit,
onDismissImportError: () -> Unit,
importedName: String?,
onRequestPermission: () -> Unit,
onDismissImported: () -> Unit,
onDone: () -> Unit,
) {
val context = LocalContext.current
var pendingDelete by remember { mutableStateOf<TempoSound?>(null) }
Column(
Modifier
.fillMaxSize()
.background(Tempo.colors.background)
.windowInsetsPadding(WindowInsets.safeDrawing),
) {
SheetHeader(L10n.text("sounds.title"), L10n.text("common.done"), onDone)
Column(
Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).padding(bottom = 28.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
TempoCard(Modifier.fillMaxWidth()) {
Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Icon(Icons.Filled.Waves, contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(18.dp))
Text(
L10n.text("sounds.introTitle"),
fontSize = 16.sp, fontWeight = FontWeight.Bold, color = Tempo.colors.ink,
)
}
Text(L10n.text("sounds.intro"), fontSize = 13.sp, color = Tempo.colors.muted)
}
}
TempoSectionLabel(L10n.text("sounds.builtIn"))
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface)) {
audio.builtInSounds.forEachIndexed { index, sound ->
if (index > 0) Box(Modifier.fillMaxWidth().height(1.dp).background(Tempo.colors.line.copy(alpha = 0.7f)))
SoundRow(sound, imported = false, onPreview = { audio.preview(sound.id) })
}
}
TempoSectionLabel(
if (importedSounds.isEmpty()) L10n.text("sounds.myRecordings")
else L10n.format("sounds.myRecordingsCount", importedSounds.size),
)
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(16.dp)).background(Tempo.colors.surface)) {
importedSounds.forEachIndexed { index, sound ->
if (index > 0) Box(Modifier.fillMaxWidth().height(1.dp).background(Tempo.colors.line.copy(alpha = 0.7f)))
SoundRow(
sound,
imported = true,
onPreview = { audio.preview(sound.id) },
onDelete = { pendingDelete = sound },
)
}
Box(Modifier.fillMaxWidth().height(1.dp).background(Tempo.colors.line.copy(alpha = 0.7f)))
Row(
Modifier
.fillMaxWidth()
.clickable(enabled = !importing, onClick = onImport)
.padding(horizontal = 16.dp, vertical = 14.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
if (importing) {
CircularProgressIndicator(
modifier = Modifier.size(16.dp),
strokeWidth = 2.dp,
color = Tempo.colors.pink,
)
} else {
Icon(Icons.Filled.FileDownload, contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(18.dp))
}
Text(
L10n.text(if (importing) "sounds.importing" else "sounds.import"),
fontSize = 15.sp, color = Tempo.colors.pink,
)
}
}
Text(L10n.text("sounds.importHelp"), fontSize = 12.sp, color = Tempo.colors.muted)
TempoSectionLabel(L10n.text("sounds.alertsSection"))
TempoCard(Modifier.fillMaxWidth()) {
Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Icon(
Icons.Filled.Notifications, contentDescription = null,
tint = if (notifications.isAuthorized) Tempo.colors.pink else Tempo.colors.muted,
modifier = Modifier.size(20.dp),
)
Column {
Text(L10n.text("sounds.backgroundAlerts"), fontSize = 15.sp, color = Tempo.colors.ink)
Text(notifications.authorizationDescription, fontSize = 12.sp, color = Tempo.colors.muted)
}
}
if (notifications.authorization.value == TempoNotifications.Authorization.NotDetermined) {
TextButton(onClick = { onRequestPermission() }) {
Text(L10n.text("sounds.allowNotifications"), color = Tempo.colors.pink)
}
} else {
TextButton(onClick = {
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
runCatching { context.startActivity(intent) }
}) {
Text(L10n.text("sounds.openNotificationSettings"), color = Tempo.colors.pink)
}
}
Text(L10n.text("sounds.alertsHelp"), fontSize = 12.sp, color = Tempo.colors.muted)
}
}
}
}
pendingDelete?.let { sound ->
AlertDialog(
onDismissRequest = { pendingDelete = null },
title = { Text(L10n.text("sounds.deleteRecording")) },
text = { Text(sound.name) },
confirmButton = {
TextButton(onClick = {
audio.deleteImported(sound.id)
pendingDelete = null
}) { Text(L10n.text("sounds.deleteRecording"), color = Color(0xFFC62828)) }
},
dismissButton = {
TextButton(onClick = { pendingDelete = null }) { Text(L10n.text("common.cancel")) }
},
containerColor = Tempo.colors.surface,
)
}
importedName?.let { name ->
AlertDialog(
onDismissRequest = onDismissImported,
title = { Text(L10n.text("sounds.importedTitle")) },
text = { Text(L10n.format("sounds.importedMessage", name)) },
confirmButton = {
TextButton(onClick = onDismissImported) { Text(L10n.text("common.ok")) }
},
containerColor = Tempo.colors.surface,
)
}
importError?.let { message ->
AlertDialog(
onDismissRequest = onDismissImportError,
title = { Text(L10n.text("sounds.operationFailed")) },
text = { Text(message) },
confirmButton = {
TextButton(onClick = onDismissImportError) { Text(L10n.text("common.ok")) }
},
containerColor = Tempo.colors.surface,
)
}
}
@Composable
private fun SoundRow(
sound: TempoSound,
imported: Boolean,
onPreview: () -> Unit,
onDelete: (() -> Unit)? = null,
) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Box(
Modifier.size(34.dp).clip(RoundedCornerShape(10.dp)).background(Tempo.colors.pink.copy(alpha = 0.1f)),
contentAlignment = Alignment.Center,
) {
Icon(
if (imported) Icons.Filled.Mic else Icons.Filled.Waves,
contentDescription = null, tint = Tempo.colors.pink, modifier = Modifier.size(16.dp),
)
}
Spacer(Modifier.width(12.dp))
Column(Modifier.weight(1f)) {
Text(
sound.name, fontSize = 15.sp, fontWeight = FontWeight.Medium, color = Tempo.colors.ink,
maxLines = 1, overflow = TextOverflow.Ellipsis,
)
Text(
sound.subtitle, fontSize = 12.sp, color = Tempo.colors.muted,
maxLines = 1, overflow = TextOverflow.Ellipsis,
)
}
Icon(
Icons.Filled.PlayCircle, contentDescription = L10n.format("sounds.previewAccessibility", sound.name),
tint = Tempo.colors.pink, modifier = Modifier.size(26.dp).clickable(onClick = onPreview),
)
if (onDelete != null) {
Spacer(Modifier.width(10.dp))
Icon(
Icons.Filled.Delete, contentDescription = L10n.text("sounds.deleteRecording"),
tint = Tempo.colors.muted.copy(alpha = 0.8f),
modifier = Modifier.size(20.dp).clickable(onClick = onDelete),
)
}
}
}
@@ -0,0 +1,353 @@
package com.oshicue.tempo.ui
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import android.content.Context
import com.oshicue.tempo.core.CountdownRound
import com.oshicue.tempo.core.CountdownPhase
import com.oshicue.tempo.core.L10n
import com.oshicue.tempo.core.TempoCodec
import com.oshicue.tempo.core.TempoDemo
import com.oshicue.tempo.core.TempoGroup
import com.oshicue.tempo.core.TempoMember
import com.oshicue.tempo.core.TempoPreferences
import com.oshicue.tempo.core.TempoSnapshot
import com.oshicue.tempo.core.TempoStorageException
import com.oshicue.tempo.core.TempoStorageFile
import com.oshicue.tempo.core.TempoValidationException
import com.oshicue.tempo.core.tempoMove
import com.oshicue.tempo.core.validated
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import java.io.File
/** What the board reads. Every mutation publishes a whole new state. */
data class TempoUiState(
val groups: List<TempoGroup> = emptyList(),
val rounds: Map<String, CountdownRound> = emptyMap(),
val selectedGroupId: String? = null,
val preferences: TempoPreferences = TempoPreferences(),
val errorMessage: String? = null,
) {
val selectedGroup: TempoGroup?
get() = groups.firstOrNull { it.id == selectedGroupId } ?: groups.firstOrNull()
fun roundFor(memberId: String): CountdownRound? = rounds[memberId]
fun group(id: String): TempoGroup? = groups.firstOrNull { it.id == id }
fun member(id: String): TempoMember? = groups.firstNotNullOfOrNull { it.member(id) }
fun runningCount(now: Long): Int = rounds.values.count { it.phase(now) == CountdownPhase.Running }
fun finishedCount(now: Long): Int = rounds.values.count { it.phase(now) == CountdownPhase.Finished }
/** Running or paused rounds in a group, used by the group switcher badges. */
fun activeCount(group: TempoGroup, now: Long): Int =
group.members.count { member ->
val phase = rounds[member.id]?.phase(now)
phase == CountdownPhase.Running || phase == CountdownPhase.Paused
}
fun hasActiveRound(memberId: String, now: Long): Boolean {
val phase = rounds[memberId]?.phase(now) ?: return false
return phase == CountdownPhase.Running || phase == CountdownPhase.Paused
}
}
/**
* The single source of truth. A failed save never publishes a partial edit: the complete
* candidate is validated and written first, then published. That is why every mutation
* goes through [commit] rather than assigning state.
*/
class TempoStore(context: Context, seedGroups: List<TempoGroup> = TempoDemo.groups) : ViewModel() {
/** Alert scheduling hooks, wired by the session. */
var onRoundStarted: ((CountdownRound, TempoMember) -> Unit)? = null
var onRoundCancelled: ((String) -> Unit)? = null
var onRoundFinished: ((CountdownRound, TempoMember) -> Unit)? = null
private val storage = TempoStorageFile(
File(File(context.applicationContext.filesDir, "OshicueTempo"), "state.json"),
)
private val _state = MutableStateFlow(TempoUiState())
val state: StateFlow<TempoUiState> = _state.asStateFlow()
/** True when the saved file could not be read; all writes stay blocked until it is moved aside. */
var hasUnreadableSnapshot: Boolean = false
private set
init {
load(seedGroups)
}
private fun load(seedGroups: List<TempoGroup>) {
if (storage.exists) {
try {
val restored = TempoCodec.decode(storage.readText()).validated()
publish(restored, error = null)
} catch (error: Exception) {
// Preserve the only copy of unreadable user data.
hasUnreadableSnapshot = true
storage.markUnreadable()
_state.value = TempoUiState(errorMessage = readFailureMessage(error))
}
return
}
try {
val initial = TempoSnapshot(
groups = seedGroups,
selectedGroupId = seedGroups.firstOrNull()?.id,
).validated()
persist(initial)
publish(initial, error = null)
} catch (error: Exception) {
publish(TempoSnapshot(groups = seedGroups, selectedGroupId = seedGroups.firstOrNull()?.id), error = null)
}
}
// MARK: queries
val current: TempoUiState get() = _state.value
fun selectGroup(id: String?) {
val snapshot = snapshotOf(_state.value)
if (id != null && snapshot.groups.none { it.id == id }) return
commit(snapshot.copy(selectedGroupId = id))
}
// MARK: group editing
fun saveGroup(group: TempoGroup) {
mutate {
val clean = group.validated()
val otherIds = _state.value.groups.filter { it.id != clean.id }.flatMap { it.members }.map { it.id }.toSet()
if (clean.members.any { it.id in otherIds }) throw TempoValidationException("validation.duplicateMember")
val next = snapshotOf(_state.value)
val groups = next.groups.toMutableList()
val index = groups.indexOfFirst { it.id == clean.id }
if (index >= 0) groups[index] = clean else groups.add(clean)
val retained = clean.members.map { it.id }.toSet()
val removed = next.rounds.filter { it.groupId == clean.id && it.memberId !in retained }
val rounds = next.rounds.filterNot { it.groupId == clean.id && it.memberId !in retained }
commit(
next.copy(
groups = groups,
rounds = rounds,
selectedGroupId = next.selectedGroupId ?: clean.id,
),
)
removed.forEach { onRoundCancelled?.invoke(it.id) }
}
}
fun deleteGroup(id: String) {
mutate {
val next = snapshotOf(_state.value)
val removed = next.rounds.filter { it.groupId == id }
val groups = next.groups.filterNot { it.id == id }
val rounds = next.rounds.filterNot { it.groupId == id }
val selected = if (next.selectedGroupId == id) groups.firstOrNull()?.id else next.selectedGroupId
commit(next.copy(groups = groups, rounds = rounds, selectedGroupId = selected))
removed.forEach { onRoundCancelled?.invoke(it.id) }
}
}
fun moveGroups(source: Collection<Int>, destination: Int) {
mutate {
val next = snapshotOf(_state.value)
val groups = next.groups.toMutableList().also { it.tempoMove(source, destination) }
commit(next.copy(groups = groups))
}
}
fun moveMembers(groupId: String, source: Collection<Int>, destination: Int) {
mutate {
val next = snapshotOf(_state.value)
val groups = next.groups.toMutableList()
val index = groups.indexOfFirst { it.id == groupId }
if (index < 0) return@mutate
val members = groups[index].members.toMutableList().also { it.tempoMove(source, destination) }
groups[index] = groups[index].copy(members = members)
commit(next.copy(groups = groups))
}
}
fun updatePreferences(change: (TempoPreferences) -> TempoPreferences) {
mutate {
val next = snapshotOf(_state.value)
val updated = change(next.preferences)
if (updated == next.preferences) return@mutate
commit(next.copy(preferences = updated))
}
}
// MARK: rounds
fun start(memberId: String, tickets: Int, now: Long = System.currentTimeMillis()) {
mutate {
val group = _state.value.groups.firstOrNull { it.member(memberId) != null }
?: throw TempoValidationException("validation.memberNotFound")
val member = group.member(memberId) ?: throw TempoValidationException("validation.memberNotFound")
val round = CountdownRound.start(
groupId = group.id,
memberId = memberId,
tickets = tickets,
secondsPerTicket = group.secondsPerTicket,
soundId = member.soundId,
now = now,
)
val next = snapshotOf(_state.value)
val replaced = _state.value.rounds[memberId]
val rounds = next.rounds.filterNot { it.memberId == memberId } + round
commit(
next.copy(
rounds = rounds,
preferences = next.preferences.copy(lastTicketCount = tickets),
),
)
replaced?.let { onRoundCancelled?.invoke(it.id) }
onRoundStarted?.invoke(round, member)
}
}
fun pause(memberId: String, now: Long = System.currentTimeMillis()) {
val round = _state.value.rounds[memberId] ?: return
if (round.deadline == null || round.completedAt != null) return
mutate {
val updated = round.paused(now)
replaceRound(updated)
onRoundCancelled?.invoke(round.id)
if (updated.completedAt != null) {
_state.value.member(memberId)?.let { onRoundFinished?.invoke(updated, it) }
}
}
}
fun resume(memberId: String, now: Long = System.currentTimeMillis()) {
val round = _state.value.rounds[memberId] ?: return
if (round.pausedRemaining == null) return
val member = _state.value.member(memberId) ?: return
mutate {
val updated = round.resumed(now)
replaceRound(updated)
onRoundStarted?.invoke(updated, member)
}
}
/** Adds tickets to a running or paused round without restarting it. */
fun extend(memberId: String, extraTickets: Int) {
mutate {
val round = _state.value.rounds[memberId] ?: throw TempoValidationException("validation.memberNotFound")
val member = _state.value.member(memberId) ?: throw TempoValidationException("validation.memberNotFound")
val wasRunning = round.phase(System.currentTimeMillis()) == CountdownPhase.Running
val updated = round.extended(extraTickets)
replaceRound(updated)
// A running round has a new deadline, so its alert must be rescheduled.
if (wasRunning) onRoundStarted?.invoke(updated, member)
}
}
fun reset(memberId: String) {
val round = _state.value.rounds[memberId] ?: return
mutate {
val next = snapshotOf(_state.value)
commit(next.copy(rounds = next.rounds.filterNot { it.memberId == memberId }))
onRoundCancelled?.invoke(round.id)
}
}
/** Settles rounds whose deadline has passed. Returns the rounds that just finished. */
fun tick(now: Long = System.currentTimeMillis()): List<CountdownRound> {
val next = snapshotOf(_state.value)
val completed = mutableListOf<CountdownRound>()
val rounds = next.rounds.map { round ->
if (round.completedAt == null && round.deadline != null && round.deadline <= now) {
round.finished(round.deadline).also { completed.add(it) }
} else round
}
if (completed.isEmpty()) return emptyList()
try {
commit(next.copy(rounds = rounds))
} catch (_: Exception) {
// An unavailable disk must not replay the alarm on every display tick.
publish(next.copy(rounds = rounds), error = storageMessage())
}
completed.forEach { round ->
_state.value.member(round.memberId)?.let { onRoundFinished?.invoke(round, it) }
}
return completed
}
// MARK: plumbing
private fun replaceRound(round: CountdownRound) {
val next = snapshotOf(_state.value)
commit(next.copy(rounds = next.rounds.filterNot { it.memberId == round.memberId } + round))
}
private fun snapshotOf(ui: TempoUiState) = TempoSnapshot(
groups = ui.groups,
rounds = ui.rounds.values.toList(),
selectedGroupId = ui.selectedGroupId,
preferences = ui.preferences,
)
private fun commit(snapshot: TempoSnapshot) {
persist(snapshot)
publish(snapshot, error = null)
}
/** Runs a mutation and surfaces any failure on the state instead of crashing. */
private inline fun mutate(block: () -> Unit) {
try {
block()
} catch (error: TempoValidationException) {
_state.value = _state.value.copy(errorMessage = L10n.text(error.messageKey))
} catch (error: TempoStorageException) {
_state.value = _state.value.copy(errorMessage = storageMessage(error))
}
}
private fun persist(snapshot: TempoSnapshot) {
if (hasUnreadableSnapshot) throw TempoStorageException("storage.unreadableSnapshot")
try {
storage.writeText(TempoCodec.encode(snapshot))
} catch (error: TempoStorageException) {
throw error
} catch (error: Exception) {
throw TempoStorageException("storage.writeFailed", error.localizedMessage)
}
}
private fun publish(snapshot: TempoSnapshot, error: String?) {
_state.value = TempoUiState(
groups = snapshot.groups,
rounds = snapshot.rounds.associateBy { it.memberId },
selectedGroupId = snapshot.selectedGroupId,
preferences = snapshot.preferences,
errorMessage = error,
)
}
private fun readFailureMessage(error: Exception): String =
L10n.format("storage.readFailed", error.localizedMessage ?: error.message ?: "")
private fun storageMessage(error: TempoStorageException? = null): String {
val detail = error?.detail
return when (error?.messageKey ?: "storage.writeFailed") {
"storage.unreadableSnapshot" -> L10n.text("storage.unreadableSnapshot")
else -> if (detail.isNullOrBlank()) L10n.text("storage.writeFailed")
else L10n.format("storage.writeFailed", detail)
}
}
fun clearError() {
_state.value = _state.value.copy(errorMessage = null)
}
class Factory(private val context: Context) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T = TempoStore(context) as T
}
}
@@ -0,0 +1,179 @@
package com.oshicue.tempo.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.runtime.compositionLocalOf
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
import com.oshicue.tempo.core.TempoPreferences
/**
* The app's semantic palette, taken from the iOS `TempoStyle`. Light is pure white with
* white cards; dark keeps the Oshicue black. Member colours are never stored differently —
* only the rendering is compensated for contrast.
*/
data class TempoColors(
val background: Color,
val surface: Color,
val controlSurface: Color,
val ink: Color,
val muted: Color,
val pink: Color,
val primaryFill: Color,
val brandPink: Color,
val line: Color,
val swatchOutline: Color,
val runningIndicator: Color,
val warning: Color,
val isDark: Boolean,
)
private fun color(hex: String): Color =
Color(0xFF000000L.or((hex.removePrefix("#").toLongOrNull(16) ?: 0x8F8F9BL)).toInt())
private val lightColors = TempoColors(
background = Color.White,
surface = Color.White,
controlSurface = color("F4F5F8"),
ink = color("202027"),
muted = color("62626D"),
pink = color("C51C4B"),
primaryFill = color("C51C4B"),
brandPink = color("FF3D6E"),
line = color("ECEEF2"),
swatchOutline = color("85858F"),
runningIndicator = color("317A54"),
warning = color("C2410C"),
isDark = false,
)
private val darkColors = TempoColors(
background = color("0A0A0D"),
surface = color("18181F"),
controlSurface = color("24242E"),
ink = color("F4F3EE"),
muted = color("A4A4B4"),
pink = color("FF668C"),
primaryFill = color("D82051"),
brandPink = color("FF3D6E"),
line = color("363640"),
swatchOutline = color("898995"),
runningIndicator = color("92E5BE"),
warning = color("FFA36B"),
isDark = true,
)
val LocalTempoColors: ProvidableCompositionLocal<TempoColors> = staticCompositionLocalOf { lightColors }
/** `TempoStyle.x` in Swift becomes `Tempo.x` here. */
object Tempo {
val colors: TempoColors
@Composable get() = LocalTempoColors.current
/**
* The dark-mode accent is reused in both appearances, then pushed toward white only as
* far as needed to clear a contrast target against the card and its 27% tint.
*/
fun memberAccent(hex: String): Color {
val source = color(hex)
val background = color("18181F")
val backgroundLuminance = background.luminance().toDouble()
var result = source
for (step in 0..100) {
val fraction = step / 100.0
result = Color(
red = (source.red * (1 - fraction) + fraction).toFloat(),
green = (source.green * (1 - fraction) + fraction).toFloat(),
blue = (source.blue * (1 - fraction) + fraction).toFloat(),
)
val tinted = Color(
red = (result.red * 0.27f + background.red * 0.73f),
green = (result.green * 0.27f + background.green * 0.73f),
blue = (result.blue * 0.27f + background.blue * 0.73f),
)
// The card and its 12% wash stack, so the accent must clear both.
if (contrast(result, background) >= 4.5 && contrast(result, tinted) >= 4.5) break
}
return result
}
fun parse(hex: String): Color = color(hex)
/** Stable uppercase hex for persistence, so a picked colour round-trips. */
fun hex(value: Color): String {
fun channel(v: Float): Int = Math.round(v.coerceIn(0f, 1f) * 255)
return String.format("%02X%02X%02X", channel(value.red), channel(value.green), channel(value.blue))
}
val defaultColorCycle: List<String> get() = TempoPreferences.COLORS
private fun contrast(first: Color, second: Color): Double {
val a = luminanceOf(first)
val b = luminanceOf(second)
return (maxOf(a, b) + 0.05) / (minOf(a, b) + 0.05)
}
private fun luminanceOf(value: Color): Double {
fun linear(channel: Float): Double {
val v = channel.toDouble()
return if (v <= 0.04045) v / 12.92 else Math.pow((v + 0.055) / 1.055, 2.4)
}
return linear(value.red) * 0.2126 + linear(value.green) * 0.7152 + linear(value.blue) * 0.0722
}
}
/** Card radii and type scale shared by every screen. */
object TempoMetric {
const val CARD_RADIUS = 26
const val PANEL_RADIUS = 20
const val CONTROL_RADIUS = 15
}
val TempoTitleStyle = TextStyle(fontSize = 22.sp, fontWeight = FontWeight.Bold)
val TempoEyebrowStyle = TextStyle(fontSize = 10.sp, fontWeight = FontWeight.Bold, letterSpacing = 1.6.sp)
@Composable
fun TempoTheme(content: @Composable () -> Unit) {
val dark = isSystemInDarkTheme()
val palette = if (dark) darkColors else lightColors
val scheme = if (dark) {
darkColorScheme(
primary = palette.pink,
onPrimary = Color.White,
background = palette.background,
surface = palette.surface,
onSurface = palette.ink,
onBackground = palette.ink,
surfaceVariant = palette.controlSurface,
outline = palette.line,
error = Color(0xFFD93A3A),
)
} else {
lightColorScheme(
primary = palette.pink,
onPrimary = Color.White,
background = palette.background,
surface = palette.surface,
onSurface = palette.ink,
onBackground = palette.ink,
surfaceVariant = palette.controlSurface,
outline = palette.line,
error = Color(0xFFC62828),
)
}
CompositionLocalProvider(LocalTempoColors provides palette) {
MaterialTheme(colorScheme = scheme, content = content)
}
}
/** Non-composable palette for code that needs a colour outside composition (e.g. tone mapping). */
val LocalTempoDark = compositionLocalOf { false }
@@ -0,0 +1,285 @@
package com.oshicue.tempo.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.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
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.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.PlayArrow
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.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.sp
import com.oshicue.tempo.core.L10n
import com.oshicue.tempo.core.TempoGroup
import com.oshicue.tempo.core.TempoLimits
import com.oshicue.tempo.core.TempoMember
/**
* Ticket entry for one member. The common case is one to three tickets, so those are
* one-tap chips; the keypad stays for anything larger. The duration preview updates as
* you type, and the last used count is pre-filled.
*/
@Composable
fun TicketEntryScreen(
member: TempoMember,
group: TempoGroup,
lastTicketCount: Int?,
onCancel: () -> Unit,
onConfirm: (Int) -> Unit,
) {
var tickets by remember {
mutableStateOf(
lastTicketCount?.takeIf { it in TempoLimits.TICKETS }?.toString() ?: "",
)
}
var errorMessage by remember { mutableStateOf<String?>(null) }
val focus = remember { FocusRequester() }
val count = tickets.toIntOrNull()
val totalSeconds = (count ?: 0) * group.secondsPerTicket
val valid = count != null && count in TempoLimits.TICKETS &&
totalSeconds <= TempoLimits.MAXIMUM_DURATION_SECONDS
val accent = Tempo.memberAccent(member.colorHex)
LaunchedEffect(member.id) {
if (tickets.isEmpty()) runCatching { focus.requestFocus() }
}
Column(
Modifier
.fillMaxSize()
.background(Tempo.colors.background)
.windowInsetsPadding(WindowInsets.safeDrawing),
) {
SheetHeader(title = L10n.text("tickets.newRound"), onDone = onCancel, doneLabel = L10n.text("common.cancel"))
Column(
Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(horizontal = 22.dp).padding(top = 4.dp),
verticalArrangement = Arrangement.spacedBy(20.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Box(
Modifier.size(12.dp).clip(CircleShape).background(Tempo.parse(member.colorHex))
.border(0.75.dp, Tempo.colors.swatchOutline, CircleShape),
)
Spacer(Modifier.width(11.dp))
Text(
member.name,
fontSize = 20.sp, fontWeight = FontWeight.Bold, color = Tempo.colors.ink,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f),
)
Text(
L10n.text("tickets.roundTickets"),
fontSize = 13.sp,
color = Tempo.colors.muted,
maxLines = 1,
softWrap = false,
modifier = Modifier.padding(start = 8.dp),
)
}
Row(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(TempoMetric.PANEL_RADIUS.dp))
.background(Tempo.colors.surface)
.border(1.dp, Tempo.colors.line, RoundedCornerShape(TempoMetric.PANEL_RADIUS.dp))
.padding(horizontal = 20.dp, vertical = 14.dp),
verticalAlignment = Alignment.Bottom,
) {
Box(Modifier.weight(1f)) {
if (tickets.isEmpty()) {
Text(
"0",
fontFamily = DigitsFont, fontSize = 54.sp,
color = Tempo.colors.ink.copy(alpha = 0.3f),
)
}
BasicTextField(
value = tickets,
onValueChange = { value ->
val filtered = value.filter { it.isDigit() }.take(3)
tickets = filtered
errorMessage = null
},
singleLine = true,
textStyle = TextStyle(
fontFamily = DigitsFont,
fontSize = 50.sp,
color = if (valid) Tempo.colors.ink else Tempo.colors.ink.copy(alpha = 0.55f),
),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
cursorBrush = SolidColor(accent),
modifier = Modifier.fillMaxWidth().focusRequester(focus),
)
}
Text(L10n.text("tickets.unit"), fontSize = 22.sp, color = Tempo.colors.muted)
}
Row(horizontalArrangement = Arrangement.spacedBy(9.dp), modifier = Modifier.fillMaxWidth()) {
TempoLimits.QUICK_TICKET_COUNTS.forEach { value ->
val selected = count == value
Box(
Modifier
.weight(1f)
.height(46.dp)
.clip(RoundedCornerShape(TempoMetric.CONTROL_RADIUS.dp))
.background(if (selected) Tempo.colors.primaryFill else Tempo.colors.controlSurface)
.border(
1.dp,
if (selected) Color.Transparent else Tempo.colors.line,
RoundedCornerShape(TempoMetric.CONTROL_RADIUS.dp),
)
.clickable {
tickets = value.toString()
errorMessage = null
}
.semantics { contentDescription = L10n.format("tickets.quickPick", value) },
contentAlignment = Alignment.Center,
) {
Text(
"$value",
fontFamily = DigitsFont,
fontSize = 16.sp,
color = if (selected) Color.White else Tempo.colors.ink,
)
}
}
}
Column(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(TempoMetric.PANEL_RADIUS.dp))
.background(Tempo.colors.surface)
.border(1.dp, Tempo.colors.line, RoundedCornerShape(TempoMetric.PANEL_RADIUS.dp))
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Row(verticalAlignment = Alignment.Bottom) {
Text(
L10n.format("tickets.formula", group.secondsPerTicket, count ?: 0),
fontSize = 13.sp,
color = Tempo.colors.muted,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f).padding(end = 10.dp),
)
Text(
tempoTime(totalSeconds.toDouble()),
fontFamily = DigitsFont,
fontSize = 22.sp,
color = if (Tempo.colors.isDark) accent else Tempo.colors.ink,
)
}
val fraction = (totalSeconds / TempoLimits.MAXIMUM_DURATION_SECONDS).coerceIn(0.0, 1.0).toFloat()
Box(Modifier.fillMaxWidth().height(5.dp).clip(CircleShape).background(Tempo.colors.controlSurface)) {
Box(
Modifier
.fillMaxWidth(fraction.coerceAtLeast(0.02f))
.height(5.dp)
.clip(CircleShape)
.background(accent.copy(alpha = if (valid) 0.8f else 0.35f)),
)
}
Text(
if (totalSeconds > TempoLimits.MAXIMUM_DURATION_SECONDS) {
L10n.text("tickets.maximumDuration")
} else {
L10n.text("tickets.hint")
},
fontSize = 12.sp,
color = if (totalSeconds > TempoLimits.MAXIMUM_DURATION_SECONDS) Tempo.colors.warning else Tempo.colors.muted,
)
errorMessage?.let { Text(it, fontSize = 12.sp, color = Color(0xFFC62828)) }
}
}
Box(Modifier.fillMaxWidth().padding(horizontal = 22.dp).padding(top = 8.dp, bottom = 14.dp)) {
TempoCapsuleButton(
modifier = Modifier.fillMaxWidth(),
fill = if (valid) Tempo.colors.primaryFill else Tempo.colors.controlSurface,
contentColor = if (valid) Color.White else Tempo.colors.muted,
enabled = valid,
minHeight = 56.dp,
onClick = { count?.let(onConfirm) },
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Icon(Icons.Filled.PlayArrow, contentDescription = null, modifier = Modifier.size(18.dp))
Text(
L10n.text("tickets.confirmStart"),
fontSize = 16.sp, fontWeight = FontWeight.SemiBold, maxLines = 1,
)
}
}
}
}
}
/** Shared sheet header: a title on the left and one action on the right. */
@Composable
fun SheetHeader(title: String, doneLabel: String, onDone: () -> Unit) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 20.dp).padding(top = 14.dp, bottom = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
title,
fontSize = 17.sp,
fontWeight = FontWeight.SemiBold,
color = Tempo.colors.ink,
modifier = Modifier.weight(1f),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
doneLabel,
fontSize = 15.sp,
fontWeight = FontWeight.SemiBold,
color = Tempo.colors.pink,
maxLines = 1,
softWrap = false,
modifier = Modifier
.padding(start = 12.dp)
.clickable(onClick = onDone)
.padding(vertical = 4.dp, horizontal = 2.dp),
)
}
}
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Oshicue Tempo mark: a countdown ring broken by the family pink, on the Oshicue black. -->
<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="#00000000"
android:strokeColor="#F4F3EE"
android:strokeWidth="7"
android:pathData="M54,26 A28,28 0 0,1 82,54 A28,28 0 0,1 54,82 A28,28 0 0,1 26,54 A28,28 0 0,1 54,26 Z" />
<path
android:fillColor="#00000000"
android:strokeColor="#FF3D6E"
android:strokeWidth="7"
android:strokeLineCap="round"
android:pathData="M54,26 A28,28 0 0,1 74.6,37.8" />
<path
android:fillColor="#F4F3EE"
android:pathData="M52,44h4v14h-4z M52,62h4v4h-4z" />
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,2 A10,10 0 1,1 11.99,2 Z M12,4 A8,8 0 1,0 12.01,4 Z" />
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11,7h2v6h-2z M11,15h2v2h-2z" />
</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>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.OshicueTempo" parent="android:Theme.Material.NoActionBar">
<item name="android:windowBackground">#0A0A0D</item>
</style>
</resources>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#0A0A0D</color>
</resources>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Oshicue Tempo</string>
</resources>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.OshicueTempo" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowBackground">#FFFFFF</item>
</style>
</resources>
@@ -0,0 +1,209 @@
package com.oshicue.tempo.core
import org.junit.Before
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlin.test.assertTrue
/**
* Ports the iOS `TempoCoreTests` / `TempoFeatureTests` suite. Time is passed in explicitly
* so every case is deterministic; nothing here touches Android APIs.
*/
class TempoCoreTest {
private val start = 1_800_000_000_000L
@Before
fun setUp() {
L10n.setLanguage(AppLanguage.En)
}
// MARK: countdown arithmetic
@Test
fun deadlineUsesElapsedTimeAndClampsAtZero() {
val round = CountdownRound.start("g", "m", 3, 30, "chime", start)
assertEquals(90.0, round.duration, 0.001)
assertEquals(77.5, round.remaining(start + 12_500), 0.001)
assertEquals(0.0, round.remaining(start + 95_000), 0.001)
assertEquals(CountdownPhase.Finished, round.phase(start + 95_000))
assertEquals(90.0, round.remaining(start - 20_000), 0.001)
}
@Test
fun pauseFreezesAndResumeCreatesANewDeadline() {
val started = CountdownRound.start("g", "m", 2, 30, "chime", start)
val paused = started.paused(start + 10_000)
assertEquals(CountdownPhase.Paused, paused.phase(start + 1_000_000))
assertEquals(50.0, paused.remaining(start + 1_000_000), 0.001)
assertNull(paused.deadline)
val resumed = paused.resumed(start + 100_000)
assertEquals(start + 150_000, resumed.deadline)
assertNull(resumed.pausedRemaining)
assertEquals(10.0, resumed.remaining(start + 140_000), 0.001)
}
@Test
fun pausingAnExpiredTimerFinishesInsteadOfCreatingZeroLengthPause() {
val started = CountdownRound.start("g", "m", 1, 10, "chime", start)
val paused = started.paused(start + 20_000)
assertEquals(start + 10_000, paused.completedAt)
assertEquals(CountdownPhase.Finished, paused.phase(start + 20_000))
assertNull(paused.pausedRemaining)
}
@Test
fun ticketSecondsAndDailyDurationLimits() {
for (tickets in listOf(-1, 0, 1_000)) {
assertFailsWith<TempoValidationException> { TempoLimits.duration(tickets, 30) }
}
for (seconds in listOf(-1, 0, 3_601)) {
assertFailsWith<TempoValidationException> { TempoLimits.duration(1, seconds) }
}
assertEquals(86_400.0, TempoLimits.duration(24, 3_600), 0.001)
assertFailsWith<TempoValidationException> { TempoLimits.duration(25, 3_600) }
assertEquals(999.0, TempoLimits.duration(999, 1), 0.001)
}
// MARK: extend
@Test
fun extendingRunningRoundPushesDeadlineWithoutRestarting() {
val round = CountdownRound.start("g", "m", 2, 30, "chime", start)
val elapsed = start + 45_000
assertEquals(15.0, round.remaining(elapsed), 0.001)
val extended = round.extended(1)
assertEquals(3, extended.tickets)
assertEquals(90.0, extended.duration, 0.001)
assertEquals(45.0, extended.remaining(elapsed), 0.001)
assertEquals(CountdownPhase.Running, extended.phase(elapsed))
}
@Test
fun extendingPausedRoundAddsToFrozenRemaining() {
val paused = CountdownRound.start("g", "m", 1, 30, "chime", start).paused(start + 20_000)
val extended = paused.extended(2)
assertEquals(CountdownPhase.Paused, extended.phase(start))
assertEquals(70.0, extended.remaining(start), 0.001)
assertNull(extended.deadline)
}
@Test
fun extendRespectsLimitsAndFinishedRounds() {
val almost = CountdownRound.start("g", "m", 998, 1, "chime", start)
assertFailsWith<TempoValidationException> { almost.extended(2) }
assertEquals(998, almost.tickets)
assertFailsWith<TempoValidationException> { almost.extended(0) }
val finished = almost.finished(start)
assertFailsWith<TempoValidationException> { finished.extended(1) }
}
// MARK: validation
@Test
fun groupValidationNormalizesNamesAndColors() {
val clean = TempoGroup(
name = " LUMINA\n",
secondsPerTicket = 30,
members = listOf(TempoMember(name = " 小葵 ", colorHex = "#ff688d")),
).validated()
assertEquals("LUMINA", clean.name)
assertEquals("小葵", clean.members[0].name)
assertEquals("FF688D", clean.members[0].colorHex)
assertFailsWith<TempoValidationException> {
clean.copy(members = listOf(clean.members[0].copy(colorHex = "FF"))).validated()
}
assertFailsWith<TempoValidationException> {
clean.copy(members = listOf(clean.members[0].copy(name = " \n "))).validated()
}
assertFailsWith<TempoValidationException> { clean.copy(members = emptyList()).validated() }
}
@Test
fun snapshotRejectsOrphanedAndConflictingRounds() {
val group = TempoDemo.groups[0]
val orphan = CountdownRound.start(group.id, "missing", 1, 30, null, start)
assertFailsWith<TempoValidationException> {
TempoSnapshot(groups = listOf(group), rounds = listOf(orphan)).validated()
}
val badDuration = CountdownRound.start(group.id, group.members[0].id, 1, 30, null, start)
.copy(duration = 31.0)
assertFailsWith<TempoValidationException> {
TempoSnapshot(groups = listOf(group), rounds = listOf(badDuration)).validated()
}
}
@Test
fun snapshotRoundTripsRunningAndPausedRounds() {
val group = TempoDemo.groups[0]
val running = CountdownRound.start(group.id, group.members[0].id, 2, 30, null, start)
val paused = CountdownRound.start(group.id, group.members[1].id, 1, 30, null, start)
.paused(start + 4_000)
val snapshot = TempoSnapshot(
groups = listOf(group),
rounds = listOf(running, paused),
selectedGroupId = group.id,
)
val decoded = TempoCodec.decode(TempoCodec.encode(snapshot)).validated()
assertEquals(snapshot, decoded)
assertEquals(20.0, decoded.rounds[0].remaining(start + 40_000), 0.001)
assertEquals(26.0, decoded.rounds[1].remaining(start + 1_000_000), 0.001)
}
@Test
fun preferencesDefaultAndRoundTrip() {
val decoded = TempoCodec.decode(TempoCodec.encode(TempoSnapshot(groups = TempoDemo.groups)))
assertTrue(decoded.preferences.hapticsEnabled)
assertTrue(decoded.preferences.keepAwakeEnabled)
assertEquals("chime", decoded.preferences.defaultSoundId)
assertNull(decoded.preferences.lastTicketCount)
}
@Test
fun nextColorAvoidsColoursAlreadyInTheGroup() {
val group = TempoGroup(
name = "X",
members = listOf(
TempoMember(name = "a", colorHex = TempoPreferences.COLORS[0]),
TempoMember(name = "b", colorHex = TempoPreferences.COLORS[1]),
),
)
assertEquals(TempoPreferences.COLORS[2], TempoPreferences().nextColor(group))
}
@Test
fun outOfRangeRememberedTicketCountIsDropped() {
val snapshot = TempoSnapshot(
groups = TempoDemo.groups,
preferences = TempoPreferences(lastTicketCount = 5_000),
)
assertNull(snapshot.validated().preferences.lastTicketCount)
}
// MARK: reordering
@Test
fun moveHelperMatchesListReorderSemantics() {
val values = mutableListOf("a", "b", "c", "d")
values.tempoMove(listOf(0), 3)
assertEquals(listOf("b", "c", "a", "d"), values)
values.tempoMove(listOf(3), 0)
assertEquals(listOf("d", "b", "c", "a"), values)
values.tempoMove(listOf(0, 1), 4)
assertEquals(listOf("c", "a", "d", "b"), values)
}
@Test
fun pagingSplitsMembersFourAtATime() {
val members = (1..9).map { TempoMember(name = "m$it", colorHex = "FF3D6E") }
val group = TempoGroup(name = "G", members = members)
assertEquals(3, group.pageCount)
assertEquals(4, group.membersOnPage(0).size)
assertEquals(1, group.membersOnPage(2).size)
assertNotNull(group.member(members[8].id))
}
}
+5
View File
@@ -0,0 +1,5 @@
plugins {
id("com.android.application") version "9.4.1" apply false
id("org.jetbrains.kotlin.plugin.compose") version "2.4.21" apply false
id("org.jetbrains.kotlin.plugin.serialization") version "2.4.21" apply false
}
+5
View File
@@ -0,0 +1,5 @@
org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true
android.useAndroidX=true
kotlin.code.style=official
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+248
View File
@@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# gradlew start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh gradlew
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+112
View File
@@ -0,0 +1,112 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem gradlew startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
@rem Catch executions from older scripts and ensure they exit cleanly.
@rem This can be removed once we can be reasonably confident that few people
@rem will be migrating directly to this new wrapper.
goto afterSafetyNet
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto exitWithErrorLevel
:afterSafetyNet
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
1>&2 echo.
1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
1>&2 echo.
1>&2 echo Please set the JAVA_HOME variable in your environment to match the
1>&2 echo location of your Java installation.
"%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
1>&2 echo.
1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
1>&2 echo.
1>&2 echo Please set the JAVA_HOME variable in your environment to match the
1>&2 echo location of your Java installation.
"%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:execute
@rem Setup the command line
@rem Execute gradlew
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel
@rem This label must not be changed. We rely on old scripts being able to jump to this point.
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
+5
View File
@@ -0,0 +1,5 @@
# Copy to keystore.properties and fill in to build a signed release APK.
storeFile=keystore/release.jks
storePassword=
keyAlias=
keyPassword=
+142
View File
@@ -0,0 +1,142 @@
#!/usr/bin/env python3
"""Check the nine native catalogs against the English base and the Kotlin call sites."""
from __future__ import annotations
import json
from collections import Counter
from pathlib import Path
import re
import sys
ROOT = Path(__file__).resolve().parents[1]
RESOURCES = ROOT / "app/src/main/assets/localization"
LANGUAGES = ("en", "zh-Hans", "zh-Hant", "zh-HK", "ja", "ko", "th", "id", "ms")
QUOTED = r'"(?:\\.|[^"\\])*"'
ENTRY = re.compile(rf"({QUOTED})\s*=\s*({QUOTED})\s*;")
CALL = re.compile(r"L10n\.(?:text|format)\(\s*")
# Loan words and acronyms that are correctly identical across languages.
SHARED_WORD_KEYS = {
"board.eventKind", "timer.live", "timer.accessibility", "settings.data",
"groups.edit", "groupEditor.previewTickets", "groupEditor.secondsPlaceholder",
}
PLACEHOLDER = re.compile(
r"%(?:(?P<position>\d+)\$)?[-+ #0']*"
r"(?:\d+|\*(?:\d+\$)?)?(?:\.(?:\d+|\*(?:\d+\$)?))?"
r"(?P<length>hh|ll|[hljztL])?(?P<type>[@diuoxXfFeEgGaAcCsSpn])"
)
def load(path: Path) -> dict[str, str]:
source = path.read_text(encoding="utf-8")
matches = list(ENTRY.finditer(source))
keys = [json.loads(match.group(1)) for match in matches]
duplicates = [key for key, count in Counter(keys).items() if count > 1]
if duplicates:
raise ValueError(f"{path.name}: duplicate keys: {', '.join(duplicates)}")
rest = ENTRY.sub("", source)
leftover = [line for line in rest.splitlines() if line.strip() and not line.strip().startswith("//")]
if leftover:
raise ValueError(f"{path.name}: unexpected content: {leftover[0][:60]}")
return {json.loads(m.group(1)): json.loads(m.group(2)) for m in matches}
def arguments(value: str) -> Counter[tuple[int, str]]:
"""Order-independent positional signature of the printf placeholders."""
value = value.replace("%%", "")
signature: Counter[tuple[int, str]] = Counter()
next_position = 1
for match in PLACEHOLDER.finditer(value):
position = int(match.group("position") or next_position)
signature[(position, (match.group("length") or "") + match.group("type"))] += 1
if not match.group("position"):
next_position += 1
return signature
def referenced_keys(source: str) -> set[str]:
keys: set[str] = set()
quoted = re.compile(QUOTED)
for call in CALL.finditer(source):
position = call.end()
depth = 0
while position < len(source):
literal = quoted.match(source, position)
if literal:
keys.add(json.loads(literal.group()))
position = literal.end()
continue
character = source[position]
if depth == 0 and character in ",)":
break
if character == "(":
depth += 1
elif character == ")":
depth -= 1
position += 1
return keys
def main() -> int:
try:
catalogs = {language: load(RESOURCES / f"{language}.strings") for language in LANGUAGES}
except (OSError, ValueError) as error:
print(f"Localization verification failed: {error}", file=sys.stderr)
return 1
base = catalogs["en"]
errors: list[str] = []
for language, values in catalogs.items():
missing = base.keys() - values.keys()
extra = values.keys() - base.keys()
if missing:
errors.append(f"{language}: missing keys: {', '.join(sorted(missing))}")
if extra:
errors.append(f"{language}: unexpected keys: {', '.join(sorted(extra))}")
for key in base.keys() & values.keys():
if arguments(base[key]) != arguments(values[key]):
errors.append(f"{language}: incompatible format arguments for {key}")
if not values[key].strip():
errors.append(f"{language}: empty translation for {key}")
if language != "en" and values[key] == base[key] and len(base[key]) > 3 \
and key not in SHARED_WORD_KEYS:
errors.append(f"{language}: untranslated value for {key}")
expected_event = {"en": "MEET & GREET", "zh-Hans": "特典会", "zh-Hant": "特典會",
"zh-HK": "特典會", "ja": "特典会"}.get(language)
if expected_event and values.get("board.eventKind") != expected_event:
errors.append(f"{language}: board.eventKind must be {expected_event!r}")
# zh-HK must not be a copy of zh-Hant.
shared = sum(1 for key in base if catalogs["zh-HK"].get(key) == catalogs["zh-Hant"].get(key))
if shared > len(base) * 0.5:
errors.append(f"zh-HK: {shared}/{len(base)} values identical to zh-Hant")
references: set[str] = set()
for path in (ROOT / "app/src/main/java").rglob("*.kt"):
references |= referenced_keys(path.read_text(encoding="utf-8"))
for key in sorted(references - base.keys()):
errors.append(f"Kotlin source references missing localization key: {key}")
# Keys used indirectly: validation messages arrive as a key from the core layer,
# so any "validation.*" literal anywhere in the sources counts as a reference.
sources = "\n".join(path.read_text(encoding="utf-8")
for path in (ROOT / "app/src/main/java").rglob("*.kt"))
indirect = {
key for key in base
if (key.startswith("validation.") or key.startswith("audio.import."))
and key in sources
}
unused = sorted(base.keys() - references - indirect)
if unused:
errors.append(f"unused keys: {', '.join(unused)}")
if errors:
print("\n".join(errors), file=sys.stderr)
return 1
print(f"Verified {len(base)} keys across {len(LANGUAGES)} native localizations; "
f"{len(references)} static source references resolve.")
return 0
if __name__ == "__main__":
sys.exit(main())
+17
View File
@@ -0,0 +1,17 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
rootProject.name = "OshicueTempoAndroid"
include(":app")