당직근무 0.15.4 (웹 2026-11-25.8): 근무 순서 이름 줄마다 표시 고르기

사용자 지시(2026-11-25): 근무 순서 이름 창 위쪽의 공통 달력에 보일 것 하나로 하지 말고 이름 줄마다 고르게 할 것.

- 근무표(rotation)에 nameModes를 더했다. 순서와 같은 길이이고 값은 both·name·shift 또는 빈 글자(예전 공통 선택 nameDisplay를 따름).
- 앱·웹 이름 창: 줄마다 이름 칸 옆에 둘 다·이름만·근무만. 공통 선택 칸은 뺐다. 웹은 비회원도 고를 수 있다.
- 달력 칸·위젯·오늘 카드·다른 달력 반영·구독 제목이 줄마다 고른 대로 보인다(Schedule.nameModeOn, WorkPlan.nameModeOn, name_mode_on).
- 서버: validate_rotation_name_modes, 0.15.0~0.15.3 앱이 nameModes 없이 저장해도 이름이 있고 길이가 같으면 보존, 소속 공유에는 넣지 않음.
- 기초 설정에서 근무 종류만 바꾸면(길이 같음) 이름과 표시를 남긴다.
- 앱 0.15.4 / 설치 번호 28. APK 876810바이트, SHA-256 05d64c0b57c9817719d6b067fc7c6e7a3a6260c78b05ff02ecb78aa6b2e009c3
This commit is contained in:
블리어 committed 2026-11-25 04:05:14 +00:00
1 parent 5f1b5b076c
commit f7aaa68fd0
26 files changed
+244 -88

No files matched your search

@@ -413,7 +413,7 @@ class MainActivity : Activity() {
runCatching {
// 근무 순서 이름은 따로 된 창에서 넣는다. 순서 길이가 그대로면 이름을 남기고 바뀌면 비운다.
val latest = ScheduleStore.load(this); val pattern = patternEditor.pattern()
ScheduleStore.save(this, latest.copy(anchor = anchor, pattern = pattern, workWeek = patternEditor.workWeek(), names = latest.names.takeIf { it.size == pattern.size } ?: emptyList()))
ScheduleStore.save(this, latest.copy(anchor = anchor, pattern = pattern, workWeek = patternEditor.workWeek(), names = latest.names.takeIf { it.size == pattern.size } ?: emptyList(), nameModes = latest.nameModes.takeIf { it.size == pattern.size } ?: emptyList()))
}
.onSuccess { render(); dialog.dismiss(); Toast.makeText(this, "근무표와 위젯을 갱신했습니다.", Toast.LENGTH_SHORT).show() }
.onFailure { Toast.makeText(this, it.message ?: "입력 내용을 확인해 주세요.", Toast.LENGTH_LONG).show() }
@@ -446,32 +446,36 @@ class MainActivity : Activity() {
dialog.show()
}
/** 근무 순서 이름: 당직이 아닌 자리(비번부터)마다 이름만 적는다. 근무 종류는 글자로만 보이고 여기서 바꾸지 않는다. */
/** 근무 순서 이름: 당직이 아닌 자리(비번부터)마다 이름을 적고 그 줄의 달력 표시(둘 다·이름만·근무만)를 고른다.
* 근무 종류는 글자로만 보이고 여기서 바꾸지 않는다. 표시는 줄마다 따로다(2026-11-25 사용자 지시: 공통 선택 하나로 하지 말 것). */
private fun showSlotNames() {
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("내 당직(나) 기준으로 +1(비번)부터 각 근무에 그날 당직 서는 다른 사람 이름을 붙입니다. 근무 순서는 그대로이고 이름(명칭)만 더해집니다. 달력에는 비번(김철수)·일반(이영희)처럼 보입니다.", 12f, muted))
space(form, 12)
form.addView(label("달력에 보일 것", 14f, ink, true))
val mode = Spinner(this).apply {
adapter = ArrayAdapter(this@MainActivity, android.R.layout.simple_spinner_dropdown_item, listOf("근무와 이름 둘 다", "이름만", "근무만"))
setSelection(ShiftNames.NAME_DISPLAYS.indexOf(ScheduleStore.nameDisplay(this@MainActivity)).coerceAtLeast(0))
contentDescription = "달력에 보일 것"
}
form.addView(mode, LinearLayout.LayoutParams(-1, dp(48)))
form.addView(label("이름을 비운 근무는 근무만 보입니다.", 12f, muted))
form.addView(label("내 당직(나) 기준으로 +1(비번)부터 각 근무에 그날 당직 서는 다른 사람 이름을 붙입니다. 근무 순서는 그대로이고 이름(명칭)만 더해집니다.", 12f, muted))
form.addView(label("이름 옆에서 그 이름을 달력에 어떻게 보일지 줄마다 고릅니다. 둘 다: 비번(김철수) · 이름만: 김철수 · 근무만: 비번. 이름을 비운 근무는 근무만 보입니다.", 12f, muted))
val inputs = mutableMapOf<Int, EditText>()
val modes = mutableMapOf<Int, Spinner>()
val choices = listOf("둘 다", "이름만", "근무만")
current.pattern.forEachIndexed { index, shift ->
if (shift == Shift.DUTY) return@forEachIndexed
space(form, 10)
form.addView(label(ShiftNames.relativeLabel(current.pattern, index), 14f, ink, true))
val title = ShiftNames.relativeLabel(current.pattern, index)
form.addView(label(title, 14f, ink, true))
val line = row()
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}일째 이름"
filters = arrayOf(android.text.InputFilter.LengthFilter(ShiftNames.SLOT_NAME_MAX * 2)); contentDescription = "$title 이름"
}
inputs[index] = input
form.addView(input, LinearLayout.LayoutParams(-1, -2))
val mode = Spinner(this).apply {
adapter = ArrayAdapter(this@MainActivity, android.R.layout.simple_spinner_dropdown_item, choices)
setSelection(ShiftNames.NAME_DISPLAYS.indexOf(current.nameModeAt(index)).coerceAtLeast(0))
contentDescription = "$title 달력에 보일 것"
}
inputs[index] = input; modes[index] = mode
line.addView(input, LinearLayout.LayoutParams(0, -2, 1f))
line.addView(mode, LinearLayout.LayoutParams(dp(116), dp(48)))
form.addView(line, LinearLayout.LayoutParams(-1, -2))
}
if (inputs.isEmpty()) form.addView(label("당직만 있는 순서라 이름을 넣을 자리가 없습니다.", 12f, muted))
val dialog = AlertDialog.Builder(this).setTitle("근무 순서 이름").setView(ScrollView(this).apply { addView(form) })
@@ -482,9 +486,8 @@ class MainActivity : Activity() {
val latest = ScheduleStore.load(this)
require(latest.pattern == current.pattern) { "그사이 근무 순서가 바뀌었습니다. 창을 닫고 다시 열어 주세요." }
val names = ShiftNames.cleanSlotNames(List(latest.pattern.size) { inputs[it]?.text?.toString().orEmpty() })
ScheduleStore.save(this, latest.copy(names = names))
val chosen = ShiftNames.NAME_DISPLAYS[mode.selectedItemPosition.coerceIn(0, 2)]
if (chosen != ScheduleStore.nameDisplay(this)) ScheduleStore.saveDisplay(this, latest.dutyAsWeekday, latest.showLunar, latest.offAsHoliday, latest.weekStart, nameDisplay = chosen)
val chosen = ShiftNames.cleanNameModes(List(latest.pattern.size) { i -> modes[i]?.let { ShiftNames.NAME_DISPLAYS[it.selectedItemPosition.coerceIn(0, 2)] }.orEmpty() }, names)
ScheduleStore.save(this, latest.copy(names = names, nameModes = chosen))
}.onSuccess { render(); dialog.dismiss(); Toast.makeText(this, "근무 순서 이름을 저장했습니다.", Toast.LENGTH_SHORT).show() }
.onFailure { Toast.makeText(this, it.message ?: "입력 내용을 확인해 주세요.", Toast.LENGTH_LONG).show() }
}