당직근무 0.15.0 (웹 2026-11-25.4): 근무 순서 이름
- 옵션 → 근무 순서 이름: 당직 다음 날(비번)부터 순서 자리마다 그날 당직 서는 사람 이름. 근무 종류는 글자로만 보이고 당직 기초 설정 화면은 그대로 - 달력에 보일 것: 근무와 이름 둘 다 · 이름만 · 근무만(nameDisplay). 앱 달력·위젯·근무표 그림, 웹 달력·그림, 기본 달력 반영과 구독 제목 - 근무표 names(순서와 같은 길이) 저장·검사, 구버전 저장 때 보존, 소속 공유 제외. 날짜별 변경 날은 이름 없음 - 앱 0.15.0 / 설치 번호 24. APK 875878바이트, SHA-256 22f4070a33d0d4c553f0391cb13f473dbec73d2174ba7a5e653318b394c3c55e - 검사: 서버 106개, 앱 단위 59개, 웹 이름 계산, 위젯 기기 검사(세 가지 표시)
This commit is contained in:
1 parent
6c77fc998c
commit
8c455f4448
32 files changed
+432
-58
No files matched your search
@@ -141,7 +141,7 @@ class MainActivity : Activity() {
|
||||
val todayCard = card(content, 0xFFFFFEFA.toInt())
|
||||
todayCard.addView(label(today.format(DateTimeFormatter.ofPattern("M월 d일 EEEE", Locale.KOREAN)), 12f, muted))
|
||||
space(todayCard, 6)
|
||||
todayCard.addView(label(if (configured) "오늘은 ${schedule.shiftOn(today).title}" else "근무표를 설정해 주세요", 22f, if (configured) schedule.shiftColor(today) else ink, true))
|
||||
todayCard.addView(label(if (configured) "오늘은 ${ShiftNames.slotTitle(schedule, today)}" else "근무표를 설정해 주세요", 22f, if (configured) schedule.shiftColor(today) else ink, true))
|
||||
space(todayCard, 6)
|
||||
todayCard.addView(label(if (configured) "${(schedule.workPlan?.regime(today)?.pattern?:schedule.pattern).size}일 반복 · 다음 날 ${schedule.shiftOn(today.plusDays(1)).title}" else "여기를 눌러 근무표를 설정하세요. 아래는 예시입니다.", 13f, muted))
|
||||
if (!configured) {
|
||||
@@ -189,12 +189,16 @@ class MainActivity : Activity() {
|
||||
addView(label(date.dayOfMonth.toString(), 18f, dateColor, true).apply { gravity = Gravity.CENTER })
|
||||
if (lunar != null) addView(label(lunar, 9f, muted).apply { gravity = Gravity.CENTER; maxLines = 1 })
|
||||
// 일반근무 숨기기를 켜면 글자만 비우고 자리는 남겨 날짜 줄이 흔들리지 않게 한다.
|
||||
val shiftText = ShiftNames.cellLabel(shift)
|
||||
// 근무 순서 이름: 이름만이면 근무 글자 자리에 이름을, 둘 다면 근무 아래 이름을 한 줄 더 보인다.
|
||||
val slot = ShiftNames.slotView(schedule, date)
|
||||
val shiftText = if (slot.nameOnly) slot.name else slot.shift
|
||||
addView(label(shiftText, 12f, schedule.shiftColor(date), true).apply {
|
||||
gravity = Gravity.CENTER
|
||||
setPadding(dp(4), dp(2), dp(4), dp(2))
|
||||
maxLines = 1; ellipsize = android.text.TextUtils.TruncateAt.END
|
||||
if (shiftText.isNotEmpty()) background = background(schedule.shiftPale(date), 3)
|
||||
}, LinearLayout.LayoutParams(-2, -2).apply { topMargin = dp(3) })
|
||||
if (slot.name.isNotEmpty() && !slot.nameOnly) addView(label(slot.name, 11f, ink, true).apply { gravity = Gravity.CENTER; maxLines = 1; ellipsize = android.text.TextUtils.TruncateAt.END })
|
||||
workNames.take(2).forEach { name -> addView(label(name.name, 10f, name.color).apply { gravity=Gravity.CENTER; maxLines=1; ellipsize=android.text.TextUtils.TruncateAt.END }) }
|
||||
if (workNames.size > 2) addView(label("외 ${workNames.size - 2}명", 9f, muted).apply { gravity=Gravity.CENTER })
|
||||
if (holiday != null) addView(label(if (holiday.contains("대체공휴일")) "대체휴일" else holiday.replace("기독탄신일", "성탄절").replace("1월 1일", "신정"), 10f, 0xFFBD5163.toInt(), true).apply {
|
||||
@@ -206,17 +210,17 @@ class MainActivity : Activity() {
|
||||
if (colleagues.size > 2) addView(label("외 ${colleagues.size - 2}명", 9f, muted).apply { gravity = Gravity.CENTER })
|
||||
// 좁은 칸에서 공휴일 이름이 생략돼도 날짜를 누르면 전체 이름을 확인할 수 있다.
|
||||
// 화면 읽기 기능에도 날짜와 전체 근무 이름 및 공휴일을 함께 전달한다.
|
||||
contentDescription = "${date.monthValue}월 ${date.dayOfMonth}일 ${shift.title} ${lunar.orEmpty()} ${holiday.orEmpty()} 일정 ${events.size}개. ${Shift.REGULAR.title} 아래 이름: ${workNames.joinToString { it.name }}. 기념일: ${personalDays.joinToString { it.getJSONObject("data").getString("title") }}. 함께 당직: ${colleagues.joinToString { it.name }}"
|
||||
contentDescription = "${date.monthValue}월 ${date.dayOfMonth}일 ${ShiftNames.slotTitle(schedule, date)} ${lunar.orEmpty()} ${holiday.orEmpty()} 일정 ${events.size}개. ${Shift.REGULAR.title} 아래 이름: ${workNames.joinToString { it.name }}. 기념일: ${personalDays.joinToString { it.getJSONObject("data").getString("title") }}. 함께 당직: ${colleagues.joinToString { it.name }}"
|
||||
isFocusable = true
|
||||
setOnClickListener {
|
||||
selectedDate = date
|
||||
render()
|
||||
val titles = (events.map { it.getJSONObject("data").getString("title") } + personalDays.map { "기념일 · " + it.getJSONObject("data").getString("title") }).toTypedArray()
|
||||
AlertDialog.Builder(this@MainActivity).setTitle("${date.monthValue}월 ${date.dayOfMonth}일 ${shift.title}")
|
||||
AlertDialog.Builder(this@MainActivity).setTitle("${date.monthValue}월 ${date.dayOfMonth}일 ${ShiftNames.slotTitle(schedule, date)}")
|
||||
.setItems(titles) { _, index -> if (index < events.size) planner.event(date, events[index]) else anniversaries.edit(personalDays[index - events.size]) }
|
||||
.setPositiveButton("일정 추가") { _, _ -> planner.event(date) }
|
||||
.setNeutralButton("날짜 상세") { _, _ ->
|
||||
AlertDialog.Builder(this@MainActivity).setTitle(date.toString()).setMessage("나: ${shift.title}\n${workNames.joinToString { it.name }}\n${holiday ?: "공휴일이 아닙니다."}\n일정 ${events.size}개\n\n" + people.joinToString("\n") { "${it.name}: ${it.schedule.shiftOn(date).title}" }).setPositiveButton("확인", null).show()
|
||||
AlertDialog.Builder(this@MainActivity).setTitle(date.toString()).setMessage("나: ${ShiftNames.slotTitle(schedule, date)}\n${workNames.joinToString { it.name }}\n${holiday ?: "공휴일이 아닙니다."}\n일정 ${events.size}개\n\n" + people.joinToString("\n") { "${it.name}: ${it.schedule.shiftOn(date).title}" }).setPositiveButton("확인", null).show()
|
||||
}.setNegativeButton("닫기", null).show()
|
||||
}
|
||||
}
|
||||
@@ -406,7 +410,11 @@ class MainActivity : Activity() {
|
||||
dialog.setOnShowListener {
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
// 기초 설정에서 표시 옵션을 저장하지 않는다. 창을 연 뒤 들어온 최신 표시 선택도 보존한다.
|
||||
runCatching { ScheduleStore.save(this, ScheduleStore.load(this).copy(anchor = anchor, pattern = patternEditor.pattern(), workWeek = patternEditor.workWeek())) }
|
||||
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()))
|
||||
}
|
||||
.onSuccess { render(); dialog.dismiss(); Toast.makeText(this, "근무표와 위젯을 갱신했습니다.", Toast.LENGTH_SHORT).show() }
|
||||
.onFailure { Toast.makeText(this, it.message ?: "입력 내용을 확인해 주세요.", Toast.LENGTH_LONG).show() }
|
||||
}
|
||||
@@ -425,6 +433,7 @@ class MainActivity : Activity() {
|
||||
}
|
||||
group("당직 기초 설정","근무 유형 · 반복 순서 · 기준일 · 주5일·주6일제",::showSettings)
|
||||
group("달력 표시","주 시작 · 날짜 색상 · 음력 · 일반근무 이름과 숨기기",::showDisplayOptions)
|
||||
group("근무 순서 이름","비번부터 그날 당직 서는 사람 이름 · 달력에 보일 것",::showSlotNames)
|
||||
group("이름 표시","${Shift.REGULAR.title} 아래 이름 · 다른 사람 주기 · 요일과 간격") { WorkNameDialogs(this){render()}.open() }
|
||||
group("일정·알림","일정과 알바 · 기념일 · 휴대폰 알림") {
|
||||
AlertDialog.Builder(this).setTitle("일정·알림").setItems(arrayOf("일정 찾기 · 다가오는 일정","일정 추가","알바·시간근무 추가","내 생일·기념일","휴대폰 알림 허용")){_,index->
|
||||
@@ -437,6 +446,52 @@ class MainActivity : Activity() {
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
/** 근무 순서 이름: 당직이 아닌 자리(비번부터)마다 이름만 적는다. 근무 종류는 글자로만 보이고 여기서 바꾸지 않는다. */
|
||||
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("당직 다음 날(비번)부터 순서대로 그날 당직 서는 사람 이름을 적습니다. 근무 순서와 날짜는 바뀌지 않습니다. 근무 종류와 반복 일수는 당직 기초 설정에서 고칩니다.", 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))
|
||||
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))
|
||||
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}일째 이름"
|
||||
}
|
||||
inputs[index] = input
|
||||
form.addView(input, LinearLayout.LayoutParams(-1, -2))
|
||||
}
|
||||
if (inputs.isEmpty()) form.addView(label("당직만 있는 순서라 이름을 넣을 자리가 없습니다.", 12f, muted))
|
||||
val dialog = AlertDialog.Builder(this).setTitle("근무 순서 이름").setView(ScrollView(this).apply { addView(form) })
|
||||
.setNegativeButton("취소", null).setPositiveButton("저장", null).create()
|
||||
dialog.setOnShowListener {
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
runCatching {
|
||||
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)
|
||||
}.onSuccess { render(); dialog.dismiss(); Toast.makeText(this, "근무 순서 이름을 저장했습니다.", Toast.LENGTH_SHORT).show() }
|
||||
.onFailure { Toast.makeText(this, it.message ?: "입력 내용을 확인해 주세요.", Toast.LENGTH_LONG).show() }
|
||||
}
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun showDisplayOptions() {
|
||||
val current = ScheduleStore.load(this)
|
||||
val form = column().apply { setPadding(dp(20), dp(8), dp(20), dp(16)) }
|
||||
|
||||
Reference in new issue
Block a user