당직근무 0.15.1 (웹 2026-11-25.5): 근무 순서 이름 줄을 내 당직 기준 +1·-1로, 출력은 비번(이름)

- 근무 순서 이름 창 줄 이름: +1 · 비번, +2 · 일반근무(-1)(relativeLabel, 앱·웹 같음)
- 둘 다 보일 때 글 줄·다른 달력 제목: 비번(김철수) 모양
- 창 안내를 이름(명칭) 추가로 고침
- 앱 0.15.1 / 설치 번호 25. APK 876078바이트, SHA-256 e8847f6ade031bf4a35de8f5f64949f9adb6cdee378f230ec70773e643cb2b5f
This commit is contained in:
블리어 committed 2026-11-25 01:54:33 +00:00
1 parent 8c455f4448
commit f77bb94bee
17 files changed
+61 -33

No files matched your search

@@ -451,7 +451,7 @@ class MainActivity : Activity() {
if (!ScheduleStore.isConfigured(this)) { Toast.makeText(this, "먼저 당직 기초 설정에서 근무 순서를 저장해 주세요.", Toast.LENGTH_LONG).show(); return }
val current = ScheduleStore.load(this)
val form = column().apply { setPadding(dp(20), dp(8), dp(20), dp(16)) }
form.addView(label("당직 다음 날(비번)부터 순서대로 그날 당직 서는 사람 이름을 적습니다. 근무 순서와 날짜는 바뀌지 않습니다. 근무 종류와 반복 일수는 당직 기초 설정에서 고칩니다.", 12f, muted))
form.addView(label("내 당직(나) 기준으로 +1(비번)부터 각 근무에 그날 당직 서는 다른 사람 이름을 붙입니다. 근무 순서는 그대로이고 이름(명칭)만 더해집니다. 달력에는 비번(김철수)·일반(이영희)처럼 보입니다.", 12f, muted))
space(form, 12)
form.addView(label("달력에 보일 것", 14f, ink, true))
val mode = Spinner(this).apply {
@@ -460,12 +460,12 @@ class MainActivity : Activity() {
contentDescription = "달력에 보일 것"
}
form.addView(mode, LinearLayout.LayoutParams(-1, dp(48)))
form.addView(label("이름이 없는 날과 날짜별로 바꾼 날은 근무가 보입니다.", 12f, muted))
form.addView(label("이름을 비운 근무는 근무만 보입니다.", 12f, muted))
val inputs = mutableMapOf<Int, EditText>()
current.pattern.forEachIndexed { index, shift ->
if (shift == Shift.DUTY) return@forEachIndexed
space(form, 10)
form.addView(label("${index + 1}일째 · ${shift.title}", 14f, ink, true))
form.addView(label(ShiftNames.relativeLabel(current.pattern, index), 14f, ink, true))
val input = EditText(this).apply {
setSingleLine(true); hint = "이름 (선택)"; setText(current.names.getOrNull(index).orEmpty()); minHeight = dp(48)
filters = arrayOf(android.text.InputFilter.LengthFilter(ShiftNames.SLOT_NAME_MAX * 2)); contentDescription = "${index + 1}일째 이름"
@@ -25,11 +25,23 @@ object ShiftNames {
if (name.isNotEmpty() && nameDisplay == "name") return SlotView("", name, true)
return SlotView(cellLabel(shift), if (nameDisplay == "both") name else "", false)
}
/** 오늘 카드·날짜 상세 같은 글 줄: 비번 · 김철수. 근무만 고르면 근무 이름만(웹 slotTitle과 같다). */
/** 오늘 카드·날짜 상세 같은 글 줄: 비번(김철수). 근무만 고르면 근무 이름만(웹 slotTitle과 같다). */
fun slotTitle(schedule: Schedule, date: java.time.LocalDate): String {
val title = schedule.shiftOn(date).title
val name = schedule.nameOn(date)
return if (name.isEmpty() || nameDisplay == "shift") title else "$title · $name"
return if (name.isEmpty() || nameDisplay == "shift") title else "$title($name)"
}
/**
* 근무 순서 이름 창의 줄 이름: 내 당직 기준으로 +1 · 비번, +2 · 일반근무(-1)처럼 보인다.
* 당직 다음 날부터 +1, +2…이고 다음 당직 바로 전날에는 (-1)을 덧붙인다. 순서에 당직이 없으면 n일째로 보인다.
*/
fun relativeLabel(pattern: List<Shift>, index: Int): String {
val size = pattern.size
val title = pattern[index].title
if (Shift.DUTY !in pattern) return "${index + 1}일째 · $title"
val after = (1..size).first { pattern[Math.floorMod(index - it, size)] == Shift.DUTY }
val before = (1..size).first { pattern[(index + it) % size] == Shift.DUTY }
return "+$after · $title" + if (before == 1) "(-1)" else ""
}
/** 다른 달력으로 보내는 제목은 칸과 같이 표시 방법을 그대로 따른다(이름만이면 이름만). 서버 구독 제목과 같다. */
fun calendarTitle(schedule: Schedule, date: java.time.LocalDate): String {