기본 달력 자동 반영과 평일 이름 표시 및 설정 분류 추가

일반근무 아래 이름을 작게 표시한다. 다른 사람의 당직 주기와 매주 요일 및 날짜 간격을 선택하며 회원별 규칙을 보관한다. 당직 기초와 달력 표시 및 이름 표시와 일정·알림 및 달력 연동·공유와 위젯 꾸미기로 설정을 나눴다. 제목과 메모로 다가오는 일정도 찾을 수 있다.

Android Calendar Provider에 선택한 근무와 일정 및 기념일을 자동 반영한다. 로그인 없이 나의 근무표를 보낼 수 있다. 기기별 소유 표식을 확인한 사본만 수정하고 삭제한다. 외부 일정은 보존하며 자동 반영한 사본을 다시 가져오는 중복도 막았다. 원본 수정은 당직근무에서 한다.

회원이 선택한 범위로 ICS 구독 주소와 파일을 만든다. 구독 비밀값은 해시로 보관하고 재발급과 종료 및 회원 정지를 적용한다. calendar_feeds 테이블을 추가했다. 기존 회원과 근무 및 소속 자료 이전은 없다. 구독 경로의 프록시 로그에는 비밀 주소 대신 고정 경로와 응답 상태를 남긴다.

주요 파일은 WorkNames와 NameRule 및 CalendarMirror와 설정 화면과 일정 검색이다. 서버는 work_names.py와 calendar_export.py 및 calendar_sharing.py와 웹 설정을 추가했다. 사용법과 제작 매뉴얼 및 배포 절차를 함께 갱신했다. 앞으로도 검증을 마친 기능과 배포 단위마다 Gitea와 포럼에 기록한다.

앱 단위 검사 42개와 서버 검사 74개 통과. 웹 이름·주 시작·반복·음력·업데이트 검사 및 JavaScript 문법 검사 통과. 정적 검사 오류 0개와 경고 80개. 공개 ZIP을 새 폴더에 풀어 앱 빌드 통과. Android API 36에서 달력 등록·재실행 중복 방지·제목 수정·원본 삭제·앱 사본만 삭제를 확인했다. 위젯 크기와 주 시작도 재검사했다. 웹에서 이름 저장과 표시 및 ICS 파일 다운로드와 일정 검색을 확인했다.

0.13.0과 설치 번호 17 및 웹 2026-11-21.3으로 운영 반영했다. 변경 전 소스와 회원 DB 및 공휴일 DB와 프록시 설정은 보조서버 비공개 20261121-calendar-bridge 백업에 보관했다. 기존 회원과 근무 및 소속 행 전체와 관리자 월요일 시작을 보존했다. 다른 컨테이너와 원격 작업 세션은 유지했다. 기본 달력에서 역방향 자동 수정은 지원하지 않으며 외부 구독 갱신 시간과 제조사별 실물 달력 화면은 별도 확인이 필요하다.
This commit is contained in:
블리어 committed 2026-11-21 00:30:46 +00:00
1 parent 30d2fb26c7
commit 45ca9f675e
44 files changed
+1182 -55

No files matched your search

@@ -74,6 +74,7 @@ class MainActivity : Activity() {
override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState); outState.putString("month", month.toString()); outState.putString("selectedDate", selectedDate.toString()) }
override fun onResume() {
super.onResume(); render(); DutyWidget.updateAll(this); Reminders.reschedule(this)
CalendarMirror.request(this)
Holidays.schedule(this)
Holidays.refresh(this) { success -> if (success) runOnUiThread { if (!isFinishing && !isDestroyed) render() } }
SyncClient.schedule(this)
@@ -165,6 +166,7 @@ class MainActivity : Activity() {
val lunar = if (schedule.showLunar) LunarDates.label(this, date) else null
val events = PlannerStore.eventsOn(this, date)
val personalDays = Anniversaries.on(this, date)
val workNames = WorkNames.on(this, date, schedule)
val colleagues = People.onDuty(people, date)
val inside = YearMonth.from(date) == month
val cell = column().apply {
@@ -180,6 +182,8 @@ class MainActivity : Activity() {
setPadding(dp(4), dp(2), dp(4), dp(2))
background = background(schedule.shiftPale(date), 3)
}, LinearLayout.LayoutParams(-2, -2).apply { topMargin = dp(3) })
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 {
gravity = Gravity.CENTER; maxLines = 1; ellipsize = android.text.TextUtils.TruncateAt.END
})
@@ -189,7 +193,7 @@ 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}개. 기념일: ${personalDays.joinToString { it.getJSONObject("data").getString("title") }}. 함께 당직: ${colleagues.joinToString { it.name }}"
contentDescription = "${date.monthValue}월 ${date.dayOfMonth}일 ${shift.title} ${lunar.orEmpty()} ${holiday.orEmpty()} 일정 ${events.size}개. 일반근무 이름: ${workNames.joinToString { it.name }}. 기념일: ${personalDays.joinToString { it.getJSONObject("data").getString("title") }}. 함께 당직: ${colleagues.joinToString { it.name }}"
isFocusable = true
setOnClickListener {
selectedDate = date
@@ -199,11 +203,11 @@ class MainActivity : Activity() {
.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${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("나: ${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()
}.setNegativeButton("닫기", null).show()
}
}
cells.addView(cell, LinearLayout.LayoutParams(0, dp((if (people.isEmpty()) 103 else 148) + if (schedule.showLunar) 14 else 0), 1f))
cells.addView(cell, LinearLayout.LayoutParams(0, dp((if (people.isEmpty() && WorkNames.rules(this).isEmpty()) 103 else 174) + if (schedule.showLunar) 14 else 0), 1f))
}
calendar.addView(View(this).apply { setBackgroundColor(0xFFE6E4DC.toInt()) }, LinearLayout.LayoutParams(-1, dp(1)))
calendar.addView(cells)
@@ -397,12 +401,31 @@ class MainActivity : Activity() {
/** 계산 기준과 표시 선택을 분리한다. 취소는 저장하지 않으며 옵션 저장도 근무 순서를 바꾸지 않는다. */
private fun showOptions() {
val form=column().apply { setPadding(dp(20),dp(8),dp(20),dp(16)) }
val dialog=AlertDialog.Builder(this).setTitle("설정").setView(ScrollView(this).apply{addView(form)}).setNegativeButton("닫기",null).create()
fun group(title:String,description:String,action:()->Unit) {
space(form,12)
form.addView(button(title){dialog.dismiss();action()},LinearLayout.LayoutParams(-1,dp(48)))
form.addView(label(description,12f,muted))
}
group("당직 기초 설정","근무 유형 · 반복 순서 · 기준일 · 주5일·주6일제",::showSettings)
group("달력 표시","주 시작 · 날짜 색상 · 음력",::showDisplayOptions)
group("이름 표시","일반근무 아래 이름 · 다른 사람 주기 · 요일과 간격") { WorkNameDialogs(this){render()}.open() }
group("일정·알림","일정과 알바 · 기념일 · 휴대폰 알림") {
AlertDialog.Builder(this).setTitle("일정·알림").setItems(arrayOf("일정 찾기 · 다가오는 일정","일정 추가","알바·시간근무 추가","내 생일·기념일","휴대폰 알림 허용")){_,index->
when(index){0->AgendaDialogs(this){render()}.open();1->planner.event(selectedDate);2->planner.event(selectedDate,partTime=true);3->anniversaries.list();else->Reminders.requestPermission(this)}
}.setNegativeButton("닫기",null).show()
}
group("달력 연동·공유","휴대폰 기본 달력 · 다른 달력 · 웹과 소속") { deviceCalendar.open() }
group("위젯 꾸미기","크기 · 투명도 · 글자 · 표시 항목") { WidgetStyleDialog.show(this) }
dialog.show()
}
private fun showDisplayOptions() {
val current = ScheduleStore.load(this)
val form = column().apply { setPadding(dp(20), dp(8), dp(20), dp(16)) }
form.addView(label("달력 표시", 16f, ink, true))
form.addView(label(if (SyncClient.connected(this)) "${SyncClient.memberName(this)} 계정에 개인 설정을 보관합니다." else "현재 기기에 저장합니다. 회원 로그인 후 서버에 보관할 수 있습니다.", 12f, muted))
form.addView(button("위젯 꾸미기 · 투명도와 크기") { WidgetStyleDialog.show(this) }, LinearLayout.LayoutParams(-1,dp(48)))
form.addView(button("휴대폰 달력 연동") { deviceCalendar.open() }, LinearLayout.LayoutParams(-1,dp(48)))
form.addView(label("앱과 홈 위젯에 함께 적용합니다.\n근무 순서와 기준일은 바뀌지 않습니다.", 12f, muted))
space(form, 12)
form.addView(label("주 시작 요일", 14f, ink, true))
@@ -420,7 +443,7 @@ class MainActivity : Activity() {
val weekday = choice("당직일은 평일색으로 표시", "주말·공휴일에도 당직 날짜는 평일색으로 표시합니다.", current.dutyAsWeekday)
val off = choice("비번을 빨간색으로 표시", "비번 날짜와 비번 글씨를 빨간색으로 표시합니다.", current.offAsHoliday)
val lunar = choice("음력 날짜 함께 보기", "양력 아래에 작은 글씨로 표시합니다. 윤달은 윤으로 구분합니다.", current.showLunar)
val dialog = AlertDialog.Builder(this).setTitle("옵션").setView(ScrollView(this).apply { addView(form) })
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 {