위젯을 월간과 가로형 및 세로형과 오늘 근무 네 크기로 분리
위젯 공급자가 하나뿐이고 최소 높이가 월간 달력에 맞춰져 있어 작은 위젯을 고를 수 없었다. 4×4 월간 달력은 유지하고 4×2 두 주 달력과 2×4 근무 목록 및 2×2 오늘 근무를 별도 항목으로 추가했다. 앱의 추가 메뉴에서도 가로×세로 기준으로 고른다. WidgetKind와 CompactWidgetViews 및 세 레이아웃과 공급자 정보를 추가했다. DutyWidget의 기간 이동과 모든 종류의 갱신 및 위젯별 꾸미기를 연결했다. Android 12 이상은 홈 화면이 전달한 크기마다 배치를 준비한다. 버전은 0.11.0이며 설치 번호는 15다. 사용법과 제작 및 배포 문서와 변경 기록도 맞췄다. 앱 단위 검사 34개와 서버 검사 63개 및 웹 업데이트와 반복 및 음력 검사 통과. 앱 빌드와 소스 ZIP의 새 폴더 빌드 통과. 정적 검사 오류 0개와 경고 71개. Android 16 가상 기기에서 네 공급자와 기본 칸 수 및 최소 크기의 글자 80·100·120% 표시 높이를 검사했다. 기존 앱 위에 설치하고 홈 화면에 세 종류를 추가해 배치와 기간 이동을 확인했다. 운영 웹과 직접 APK 업데이트 경로에 반영했다. DB 구조 변경과 자료 이전은 없다. 변경 전 소스와 회원 DB 및 공휴일 DB는 보조서버의 비공개 20261121-widget-sizes 백업에 보관했다. 기존 회원과 근무 설정을 보존했다. 실물 휴대폰과 제조사별 홈 화면 앱은 아직 확인하지 않았다. 공식 APK와 해당 소스 ZIP은 포럼 당직근무 자료실에 배포한다.
This commit is contained in:
1 parent
8112721fa8
commit
2d237cb532
31 files changed
+466
-53
No files matched your search
@@ -1,5 +1,13 @@
|
||||
# 변경 기록
|
||||
|
||||
## 0.11.0 · 2026년 11월 21일
|
||||
|
||||
- 홈 화면 위젯을 4×4 월간 달력과 4×2 두 주 달력 및 2×4 근무 목록과 2×2 오늘 근무로 나눴습니다.
|
||||
- 앱의 위젯 추가에서도 가로×세로 기준으로 크기를 고릅니다.
|
||||
- 작은 위젯은 크기에 맞는 별도 배치를 사용합니다. 가로형은 14일씩 이동하고 세로형은 7일씩 이동합니다.
|
||||
- 투명도와 색상 및 글자 크기를 종류에 관계없이 위젯마다 저장합니다.
|
||||
- 기존 월간 위젯과 개인 일정 및 회원 설정은 유지합니다.
|
||||
|
||||
## 0.10.0 · 2026년 11월 20일
|
||||
|
||||
- 위젯별 배경 투명도 0~100%와 밝은·어두운 모양을 추가했습니다.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 당직근무
|
||||
|
||||
제작자 블리어 (이창현) · 미리보기 0.10.0 · Android 8.0 이상
|
||||
제작자 블리어 (이창현) · 미리보기 0.11.0 · Android 8.0 이상
|
||||
|
||||
당직과 교대근무를 달력으로 확인하고 홈 화면에 계속 놓아두는 앱입니다. 본인의 근무표는 로그인 없이 사용할 수 있습니다. 서버가 잠시 멈춰도 기기에 저장한 근무와 일정 및 기념일은 그대로 사용합니다.
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
| --- | --- |
|
||||
| 일당직과 교대근무 | 2~366당직과 대표 근무 배열 12개. 직접 반복 배열 수정 |
|
||||
| 토요일 근무 | 주 5일·6일제와 당직일 평일색 및 비번 빨간색 선택 |
|
||||
| 홈 화면 달력 | 월 이동과 오늘 이동. 위젯별 투명도·색상·글자 크기·표시 항목 |
|
||||
| 홈 화면 위젯 | 4×4 월간 달력 · 4×2 두 주 달력 · 2×4 근무 목록 · 2×2 오늘 근무 |
|
||||
| 위젯 꾸미기 | 위젯별 투명도·색상·글자 크기·표시 항목 |
|
||||
| 개인 일정과 알바 | 여러 일정과 매일·매주·매월·매년 반복. 자정을 넘는 근무 |
|
||||
| 기념일 | 생일과 개인 기념일. 양력·음력 및 윤달 선택 |
|
||||
| 공휴일과 음력 | 한국 공휴일 자동 확인과 정상 자료 보관. 음력 날짜 선택 표시 |
|
||||
|
||||
@@ -10,8 +10,8 @@ android {
|
||||
applicationId = "kr.co.itosm.dutycalendar"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 14
|
||||
versionName = "0.10.0"
|
||||
versionCode = 15
|
||||
versionName = "0.11.0"
|
||||
testInstrumentationRunner = "kr.co.itosm.dutycalendar.StorageSyncCheck"
|
||||
}
|
||||
// 빌드 도구는 JDK 21로 실행하지만 앱의 Java와 Kotlin 바이트코드 대상은 17로 통일한다.
|
||||
|
||||
@@ -18,6 +18,8 @@ object WidgetAppearanceCheck {
|
||||
val app=checker.targetContext
|
||||
val prefs=app.getSharedPreferences("widget_style",0)
|
||||
val original=prefs.all.toMap()
|
||||
val positions=app.getSharedPreferences("widget",0)
|
||||
val originalPositions=positions.all.toMap()
|
||||
var success=false
|
||||
var message=""
|
||||
try {
|
||||
@@ -26,6 +28,16 @@ object WidgetAppearanceCheck {
|
||||
WidgetStyle.save(app,99002,WidgetStyle(transparency=40,detail="FULL"))
|
||||
check(WidgetStyle.load(app,99001)==dark)
|
||||
check(WidgetStyle.load(app,99002).transparency==40)
|
||||
val manager=AppWidgetManager.getInstance(app)
|
||||
val registered=manager.installedProviders.filter{it.provider.packageName==app.packageName}
|
||||
check(registered.map{it.provider.className}.toSet()==WidgetKind.entries.map{it.receiver.name}.toSet()) { "위젯 목록에 네 종류가 모두 등록되지 않았습니다." }
|
||||
if(android.os.Build.VERSION.SDK_INT>=31) {
|
||||
val expected=listOf(4 to 4,4 to 2,2 to 4,2 to 2)
|
||||
WidgetKind.entries.forEachIndexed{index,kind->
|
||||
val info=registered.single{it.provider==kind.component(app)}
|
||||
check(info.targetCellWidth==expected[index].first&&info.targetCellHeight==expected[index].second)
|
||||
}
|
||||
}
|
||||
var failure:Throwable?=null
|
||||
checker.runOnMainSync {
|
||||
try {
|
||||
@@ -47,16 +59,46 @@ object WidgetAppearanceCheck {
|
||||
check(WidgetStyle.load(app,99001)==WidgetStyle())
|
||||
check(render(99001,250).findViewById<TextView>(R.id.day_0).maxLines==2)
|
||||
check(render(99001,500).findViewById<TextView>(R.id.day_0).maxLines==7)
|
||||
// 제공자 등록만 확인하지 않고 최소 크기의 실제 글줄이 영역 안에 들어오는지도 확인한다.
|
||||
val density=app.resources.displayMetrics.density
|
||||
for(kind in WidgetKind.entries.filter{it!=WidgetKind.MONTH}) {
|
||||
for(scale in listOf(80,100,120)) {
|
||||
WidgetStyle.save(app,99003,WidgetStyle(transparency=50,scale=scale))
|
||||
val options=Bundle().apply {
|
||||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,kind.width);putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,kind.width)
|
||||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,kind.height);putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,kind.height)
|
||||
}
|
||||
val root=DutyWidget.buildViews(app,99003,options,kind).apply(app,FrameLayout(app))
|
||||
root.measure(View.MeasureSpec.makeMeasureSpec((kind.width*density).toInt(),View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec((kind.height*density).toInt(),View.MeasureSpec.EXACTLY))
|
||||
root.layout(0,0,root.measuredWidth,root.measuredHeight)
|
||||
val cell=root.findViewById<TextView>(if(kind==WidgetKind.TODAY)R.id.compact_shift else R.id.compact_day_0)
|
||||
check(cell.layout!=null&&cell.layout.height<=cell.height) { "${kind.title} 배율 $scale 글자 높이 초과: ${cell.layout.height}/${cell.height}" }
|
||||
check(Color.alpha((root.background as ColorDrawable).color)==128)
|
||||
}
|
||||
}
|
||||
// 실제 홈 화면에 배치된 새 종류는 자신의 날짜 범위만 이동하고 오늘로 돌아와야 한다.
|
||||
for(kind in listOf(WidgetKind.WIDE,WidgetKind.TALL)) {
|
||||
val id=manager.getAppWidgetIds(kind.component(app)).firstOrNull()?:continue
|
||||
positions.edit().remove("offset_$id").commit()
|
||||
val receiver=kind.receiver.getDeclaredConstructor().newInstance()
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.NEXT).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(positions.getInt("offset_$id",0)==if(kind==WidgetKind.WIDE)14 else 7)
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.TODAY).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(!positions.contains("offset_$id"))
|
||||
}
|
||||
} catch(error:Throwable){failure=error}
|
||||
}
|
||||
failure?.let{throw it}
|
||||
success=true
|
||||
message="위젯별 설정 분리와 전체 적용 및 투명도 100%·40% 확인. 실제 RemoteViews의 색상과 간단·자세한 배치 및 크기 자동 전환 확인."
|
||||
message="위젯 네 종류 등록과 4×4·4×2·2×4·2×2 기본 칸 수 확인. 작은 위젯 최소 크기와 글자 80·100·120%의 실제 표시 및 위젯별 설정과 전체 적용 확인."
|
||||
} catch(error:Throwable) {message=error.stackTraceToString()}
|
||||
finally {
|
||||
val editor=prefs.edit().clear()
|
||||
original.forEach{(key,value)->editor.putString(key,value as String)}
|
||||
check(editor.commit());DutyWidget.updateAll(app)
|
||||
val restore=positions.edit().clear()
|
||||
originalPositions.forEach{(key,value)->when(value){is String->restore.putString(key,value);is Int->restore.putInt(key,value)}}
|
||||
check(restore.commit());DutyWidget.updateAll(app)
|
||||
}
|
||||
checker.finish(if(success)Activity.RESULT_OK else Activity.RESULT_CANCELED,Bundle().apply{putString("stream",message)})
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!-- 시스템 위젯 알림과 앱이 만든 명시적 PendingIntent만 받도록 외부 일반 호출을 막는다. -->
|
||||
<receiver android:name=".DutyWidget" android:exported="false">
|
||||
<receiver android:name=".DutyWidget" android:label="@string/widget_month_name" android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="android.intent.action.DATE_CHANGED" />
|
||||
@@ -39,6 +39,36 @@
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/duty_widget_info" />
|
||||
</receiver>
|
||||
<receiver android:name=".WideDutyWidget" android:label="@string/widget_wide_name" android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="android.intent.action.DATE_CHANGED" />
|
||||
<action android:name="android.intent.action.TIME_SET" />
|
||||
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/duty_widget_wide_info" />
|
||||
</receiver>
|
||||
<receiver android:name=".TallDutyWidget" android:label="@string/widget_tall_name" android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="android.intent.action.DATE_CHANGED" />
|
||||
<action android:name="android.intent.action.TIME_SET" />
|
||||
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/duty_widget_tall_info" />
|
||||
</receiver>
|
||||
<receiver android:name=".TodayDutyWidget" android:label="@string/widget_day_name" android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="android.intent.action.DATE_CHANGED" />
|
||||
<action android:name="android.intent.action.TIME_SET" />
|
||||
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/duty_widget_today_info" />
|
||||
</receiver>
|
||||
<!-- 운영체제의 예약 관리자만 서비스를 연결할 수 있도록 전용 권한을 지정한다. -->
|
||||
<service android:name=".HolidaySyncService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
|
||||
<service android:name=".PlannerSyncService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package kr.co.itosm.dutycalendar
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Typeface
|
||||
import android.net.Uri
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.util.TypedValue
|
||||
import android.widget.RemoteViews
|
||||
import java.time.LocalDate
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Locale
|
||||
|
||||
/** 작은 위젯에 월간 42칸을 그대로 축소하면 근무 글자가 잘린다.
|
||||
* 가로형은 두 주를 표시하고 세로형은 일주일의 근무 목록을 사용한다. 오늘형은 오늘과 내일에 집중한다.
|
||||
* 세 종류 모두 본문과 날짜 선택에 기존 근무 계산과 저장소를 그대로 사용한다.
|
||||
*/
|
||||
object CompactWidgetViews {
|
||||
private val cells=intArrayOf(R.id.compact_day_0,R.id.compact_day_1,R.id.compact_day_2,R.id.compact_day_3,R.id.compact_day_4,R.id.compact_day_5,R.id.compact_day_6,
|
||||
R.id.compact_day_7,R.id.compact_day_8,R.id.compact_day_9,R.id.compact_day_10,R.id.compact_day_11,R.id.compact_day_12,R.id.compact_day_13)
|
||||
fun start(context:Context,id:Int,kind:WidgetKind):LocalDate {
|
||||
val today=LocalDate.now()
|
||||
val base=if(kind==WidgetKind.WIDE)today.minusDays((today.dayOfWeek.value%7).toLong()) else today
|
||||
return base.plusDays(context.getSharedPreferences("widget",0).getInt("offset_$id",0).toLong())
|
||||
}
|
||||
private fun dateIntent(context:Context,id:Int,date:LocalDate)=PendingIntent.getActivity(context,id,
|
||||
Intent(context,MainActivity::class.java).setData(Uri.parse("dutycalendar://date/$date")).putExtra("selectedDate",date.toString()),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
|
||||
fun build(context:Context,id:Int,kind:WidgetKind,width:Int,height:Int):RemoteViews {
|
||||
val style=WidgetStyle.load(context,id)
|
||||
val schedule=ScheduleStore.load(context)
|
||||
val today=LocalDate.now()
|
||||
val density=context.resources.displayMetrics.density
|
||||
val layout=when(kind){WidgetKind.WIDE->R.layout.duty_widget_wide;WidgetKind.TALL->R.layout.duty_widget_tall;else->R.layout.duty_widget_today}
|
||||
val views=RemoteViews(context.packageName,layout)
|
||||
views.setInt(R.id.compact_root,"setBackgroundColor",style.background)
|
||||
views.setViewPadding(R.id.compact_root,(8*density).toInt(),(6*density).toInt(),(8*density).toInt(),(6*density).toInt())
|
||||
views.setOnClickPendingIntent(R.id.compact_root,dateIntent(context,id,today))
|
||||
views.setTextColor(R.id.compact_title,style.ink)
|
||||
views.setTextColor(R.id.compact_customize,style.ink)
|
||||
views.setTextViewTextSize(R.id.compact_title,TypedValue.COMPLEX_UNIT_SP,if(kind==WidgetKind.WIDE)14f else 12f)
|
||||
val customize=Intent(context,MainActivity::class.java).setData(Uri.parse("dutycalendar://widget/$id/style")).putExtra("widgetStyleId",id)
|
||||
views.setOnClickPendingIntent(R.id.compact_customize,PendingIntent.getActivity(context,id,customize,PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
|
||||
|
||||
if(kind==WidgetKind.TODAY) {
|
||||
val configured=ScheduleStore.isConfigured(context)
|
||||
views.setTextViewText(R.id.compact_title,today.format(DateTimeFormatter.ofPattern("M.d E",Locale.KOREAN)))
|
||||
views.setTextViewText(R.id.compact_shift,if(configured)schedule.shiftOn(today).title else "설정 필요")
|
||||
views.setTextColor(R.id.compact_shift,style.color(schedule.shiftColor(today)))
|
||||
val scale=style.scale/100f
|
||||
views.setTextViewTextSize(R.id.compact_shift,TypedValue.COMPLEX_UNIT_SP,(minOf((width-16)/5.3f,(height-64)/1.35f)).coerceIn(15f,26f)*scale)
|
||||
views.setInt(R.id.compact_shift,"setBackgroundColor",if(style.today)(if(style.dark)0x334A6D96 else 0x22A7B5CB) else 0)
|
||||
views.setTextViewText(R.id.compact_tomorrow,"내일 ${schedule.shiftOn(today.plusDays(1)).title}")
|
||||
views.setTextColor(R.id.compact_tomorrow,style.ink)
|
||||
views.setTextViewTextSize(R.id.compact_tomorrow,TypedValue.COMPLEX_UNIT_SP,11f*scale)
|
||||
views.setOnClickPendingIntent(R.id.compact_tomorrow,dateIntent(context,id,today.plusDays(1)))
|
||||
val details=detail(context,today,schedule,style)
|
||||
views.setTextViewText(R.id.compact_detail,details.ifBlank{"당직근무"})
|
||||
views.setTextColor(R.id.compact_detail,style.muted)
|
||||
views.setContentDescription(R.id.compact_shift,"${today} ${schedule.shiftOn(today).title}. $details")
|
||||
return views
|
||||
}
|
||||
|
||||
val first=start(context,id,kind)
|
||||
val count=if(kind==WidgetKind.WIDE)14 else 7
|
||||
val last=first.plusDays((count-1).toLong())
|
||||
views.setTextViewText(R.id.compact_title,if(kind==WidgetKind.WIDE)"${first.monthValue}.${first.dayOfMonth} – ${last.monthValue}.${last.dayOfMonth}" else "${first.monthValue}월 근무")
|
||||
for(control in listOf(R.id.compact_previous,R.id.compact_today,R.id.compact_next))views.setTextColor(control,style.ink)
|
||||
listOf(R.id.compact_previous to DutyWidget.PREVIOUS,R.id.compact_today to DutyWidget.TODAY,R.id.compact_next to DutyWidget.NEXT).forEach{(control,action)->
|
||||
val intent=Intent(context,kind.receiver).setAction(action).putExtra(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID,id)
|
||||
views.setOnClickPendingIntent(control,PendingIntent.getBroadcast(context,id,intent,PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
|
||||
}
|
||||
for(index in 0 until count) {
|
||||
val date=first.plusDays(index.toLong())
|
||||
val shift=schedule.shiftOn(date)
|
||||
val holiday=Holidays.name(context,date)
|
||||
val events=PlannerStore.eventsOn(context,date)
|
||||
val anniversaries=Anniversaries.on(context,date)
|
||||
val plus=if(style.eventMark&&(events.isNotEmpty()||anniversaries.isNotEmpty()))"+" else ""
|
||||
val dateLabel=if(kind==WidgetKind.WIDE)date.dayOfMonth.toString()+plus else date.format(DateTimeFormatter.ofPattern("M.d E",Locale.KOREAN))+plus
|
||||
val shiftLabel=if(kind==WidgetKind.WIDE)shift.shortTitle else shift.title
|
||||
val extra=if(kind==WidgetKind.TALL&&height>=380&&style.detail!="COMPACT")detail(context,date,schedule,style) else ""
|
||||
val separator=if(kind==WidgetKind.WIDE)"\n" else " "
|
||||
val text=dateLabel+separator+shiftLabel+(if(extra.isNotBlank())"\n$extra" else "")
|
||||
val styled=SpannableString(text)
|
||||
styled.setSpan(ForegroundColorSpan(style.color(schedule.dateColor(date,holiday!=null))),0,dateLabel.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
val shiftStart=dateLabel.length+separator.length
|
||||
styled.setSpan(ForegroundColorSpan(style.color(schedule.shiftColor(date))),shiftStart,shiftStart+shiftLabel.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
styled.setSpan(StyleSpan(Typeface.BOLD),shiftStart,shiftStart+shiftLabel.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
if(extra.isNotBlank())styled.setSpan(ForegroundColorSpan(style.muted),text.length-extra.length,text.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
val cell=cells[index]
|
||||
views.setTextViewText(cell,styled)
|
||||
views.setTextColor(cell,style.ink)
|
||||
val font=if(kind==WidgetKind.WIDE)minOf((height-54)/5.0f,(width-16)/7/3.0f).coerceIn(9f,15f) else minOf((width-16)/10f,(height-54)/7/2.4f).coerceIn(9f,14f)
|
||||
// 글자 확대를 선택해도 최소 높이에서 두 줄의 근무가 잘리지는 않게 상한을 둔다.
|
||||
// 위젯을 넓히거나 높이면 여유 공간만큼 선택한 배율이 그대로 드러난다.
|
||||
val lineLimit=if(kind==WidgetKind.WIDE)(height-56)/2/2.6f else (height-56)/7/2.6f
|
||||
views.setTextViewTextSize(cell,TypedValue.COMPLEX_UNIT_SP,minOf(font*style.scale/100,lineLimit.coerceAtLeast(8f)))
|
||||
views.setInt(cell,"setBackgroundColor",if(date==today&&style.today)(if(style.dark)0x554A6D96 else 0x44A7B5CB) else 0)
|
||||
views.setOnClickPendingIntent(cell,dateIntent(context,id,date))
|
||||
views.setContentDescription(cell,"${date} ${shift.title}. ${holiday.orEmpty()} 일정 ${events.size}개. 기념일 ${anniversaries.size}개. ${detail(context,date,schedule,style)}")
|
||||
}
|
||||
return views
|
||||
}
|
||||
private fun detail(context:Context,date:LocalDate,schedule:Schedule,style:WidgetStyle):String {
|
||||
val values=mutableListOf<String>()
|
||||
if(style.lunar&&schedule.showLunar)LunarDates.label(context,date)?.let{values.add(it)}
|
||||
if(style.holidays)Holidays.name(context,date)?.let{values.add(it)}
|
||||
if(style.anniversaries)Anniversaries.on(context,date).firstOrNull()?.let{values.add(it.getJSONObject("data").getString("title"))}
|
||||
if(style.people)People.onDuty(People.all(context),date).firstOrNull()?.let{values.add(it.name)}
|
||||
if(style.eventMark)PlannerStore.eventsOn(context,date).size.takeIf{it>0}?.let{values.add("일정 ${it}개")}
|
||||
return values.joinToString(" · ")
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import java.time.YearMonth
|
||||
* 월을 고르지 않은 위젯은 현재 달을 따라간다. 직접 이동한 위젯은 오늘 버튼을 누를 때까지 선택을 유지한다.
|
||||
* 날짜 변경과 부팅 알림 및 주기 갱신으로 오늘 표시를 갱신한다. 실제 전달 시점은 운영체제의 영향을 받는다.
|
||||
*/
|
||||
class DutyWidget : AppWidgetProvider() {
|
||||
open class DutyWidget : AppWidgetProvider() {
|
||||
override fun onUpdate(context: Context, manager: AppWidgetManager, ids: IntArray) {
|
||||
Holidays.schedule(context)
|
||||
SyncClient.schedule(context)
|
||||
@@ -32,7 +32,7 @@ class DutyWidget : AppWidgetProvider() {
|
||||
override fun onAppWidgetOptionsChanged(context: Context, manager: AppWidgetManager, id: Int, options: Bundle) { update(context, manager, id) }
|
||||
override fun onDeleted(context: Context, ids: IntArray) {
|
||||
val editor = context.getSharedPreferences("widget", Context.MODE_PRIVATE).edit()
|
||||
ids.forEach { editor.remove("month_$it") }
|
||||
ids.forEach { editor.remove("month_$it");editor.remove("offset_$it") }
|
||||
editor.apply()
|
||||
context.getSharedPreferences("widget_style",0).edit().apply { ids.forEach { remove("style_$it") } }.apply()
|
||||
}
|
||||
@@ -43,11 +43,16 @@ class DutyWidget : AppWidgetProvider() {
|
||||
if (action in listOf(PREVIOUS, NEXT, TODAY)) {
|
||||
val id = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1)
|
||||
// 삭제된 위젯이나 이 앱에 속하지 않은 번호로 들어온 요청은 처리하지 않는다.
|
||||
if (id !in manager.getAppWidgetIds(ComponentName(context, DutyWidget::class.java))) return
|
||||
if (manager.getAppWidgetInfo(id)?.provider != ComponentName(context,javaClass)) return
|
||||
val kind=WidgetKind.of(context,id)
|
||||
val prefs = context.getSharedPreferences("widget", Context.MODE_PRIVATE)
|
||||
val editor = prefs.edit()
|
||||
if (action == TODAY) editor.remove("month_$id")
|
||||
else editor.putString("month_$id", selectedMonth(context, id).plusMonths(if (action == NEXT) 1 else -1).toString())
|
||||
if (action == TODAY) { editor.remove("month_$id");editor.remove("offset_$id") }
|
||||
else if(kind==WidgetKind.MONTH)editor.putString("month_$id", selectedMonth(context, id).plusMonths(if (action == NEXT) 1 else -1).toString())
|
||||
else {
|
||||
val step=if(kind==WidgetKind.WIDE)14 else 7
|
||||
editor.putInt("offset_$id",(prefs.getInt("offset_$id",0)+(if(action==NEXT)step else -step)).coerceIn(-36500,36500))
|
||||
}
|
||||
editor.apply()
|
||||
update(context, manager, id)
|
||||
} else if (action in listOf(Intent.ACTION_DATE_CHANGED, Intent.ACTION_TIME_CHANGED, Intent.ACTION_TIMEZONE_CHANGED, Intent.ACTION_BOOT_COMPLETED)) {
|
||||
@@ -58,9 +63,9 @@ class DutyWidget : AppWidgetProvider() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PREVIOUS = "kr.co.itosm.dutycalendar.PREVIOUS"
|
||||
private const val NEXT = "kr.co.itosm.dutycalendar.NEXT"
|
||||
private const val TODAY = "kr.co.itosm.dutycalendar.TODAY"
|
||||
internal const val PREVIOUS = "kr.co.itosm.dutycalendar.PREVIOUS"
|
||||
internal const val NEXT = "kr.co.itosm.dutycalendar.NEXT"
|
||||
internal const val TODAY = "kr.co.itosm.dutycalendar.TODAY"
|
||||
// 날짜 칸의 리소스 참조를 명시해 코드와 42칸 레이아웃의 순서를 맞춘다.
|
||||
// 문자열로 리소스를 찾지 않으므로 이름 변경이나 리소스 축소 때도 참조 관계를 추적할 수 있다.
|
||||
private val DAY_IDS = intArrayOf(
|
||||
@@ -78,15 +83,32 @@ class DutyWidget : AppWidgetProvider() {
|
||||
|
||||
fun updateAll(context: Context) {
|
||||
val manager = AppWidgetManager.getInstance(context)
|
||||
manager.getAppWidgetIds(ComponentName(context, DutyWidget::class.java)).forEach { update(context, manager, it) }
|
||||
WidgetKind.ids(context).forEach { update(context, manager, it) }
|
||||
}
|
||||
private fun update(context: Context, manager: AppWidgetManager, id: Int) {
|
||||
manager.updateAppWidget(id, buildViews(context,id,manager.getAppWidgetOptions(id)))
|
||||
val options=manager.getAppWidgetOptions(id)
|
||||
val kind=WidgetKind.of(context,id)
|
||||
// Android 12 이상은 홈 화면이 알려 준 각 크기별로 배치를 준비한다.
|
||||
// 방향 전환만으로도 알맞은 RemoteViews가 선택되며 작은 종류를 4칸 높이로 강제하지 않는다.
|
||||
if(android.os.Build.VERSION.SDK_INT>=31) {
|
||||
@Suppress("DEPRECATION")
|
||||
val sizes=options.getParcelableArrayList<android.util.SizeF>(AppWidgetManager.OPTION_APPWIDGET_SIZES)?.filter{it.width>0&&it.height>0}?.distinct()?.take(16)
|
||||
if(!sizes.isNullOrEmpty()) {
|
||||
manager.updateAppWidget(id,RemoteViews(sizes.associateWith{size->buildViews(context,id,Bundle(options).apply{
|
||||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,size.width.toInt());putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,size.width.toInt())
|
||||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,size.height.toInt());putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,size.height.toInt())
|
||||
},kind)}))
|
||||
return
|
||||
}
|
||||
}
|
||||
manager.updateAppWidget(id, buildViews(context,id,options,kind))
|
||||
}
|
||||
internal fun buildViews(context:Context,id:Int,options:Bundle):RemoteViews {
|
||||
internal fun buildViews(context:Context,id:Int,options:Bundle,kind:WidgetKind=WidgetKind.of(context,id)):RemoteViews {
|
||||
val style=WidgetStyle.load(context,id)
|
||||
val portrait=context.resources.configuration.orientation!=android.content.res.Configuration.ORIENTATION_LANDSCAPE
|
||||
val height=options.getInt(if(portrait)AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT else AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,420).coerceIn(250,1200)
|
||||
val height=options.getInt(if(portrait)AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT else AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,kind.height).coerceIn(90,1200)
|
||||
val width=options.getInt(if(portrait)AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH else AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,kind.width).coerceIn(90,1200)
|
||||
if(kind!=WidgetKind.MONTH)return CompactWidgetViews.build(context,id,kind,width,height)
|
||||
val compact=style.compact(height)
|
||||
val density=context.resources.displayMetrics.density
|
||||
val month = selectedMonth(context, id)
|
||||
|
||||
@@ -346,7 +346,10 @@ class MainActivity : Activity() {
|
||||
if (!ScheduleStore.isConfigured(this)) { showSettings(); return }
|
||||
val manager = getSystemService(AppWidgetManager::class.java)
|
||||
if (manager.isRequestPinAppWidgetSupported) {
|
||||
manager.requestPinAppWidget(ComponentName(this, DutyWidget::class.java), null, null)
|
||||
AlertDialog.Builder(this).setTitle("위젯 크기 선택 · 가로×세로")
|
||||
.setItems(WidgetKind.entries.map{it.title}.toTypedArray()){_,index->
|
||||
manager.requestPinAppWidget(WidgetKind.entries[index].component(this),null,null)
|
||||
}.setNegativeButton("취소",null).show()
|
||||
} else {
|
||||
AlertDialog.Builder(this).setTitle("홈 화면에 추가하기").setMessage("홈 화면의 빈 곳을 길게 누른 뒤 위젯 목록에서 ‘당직근무’를 선택해 주세요.").setPositiveButton("확인", null).show()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package kr.co.itosm.dutycalendar
|
||||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
|
||||
/** 홈 화면의 위젯 목록에 크기별 항목을 실제로 등록한다.
|
||||
* 기존 수신자 이름은 그대로 남겨 업데이트 전에 배치한 월간 달력을 보존한다.
|
||||
* 위젯 번호는 시스템 전체에서 구분되므로 종류가 달라도 월 이동과 꾸미기 저장 키가 겹치지 않는다.
|
||||
*/
|
||||
enum class WidgetKind(val receiver:Class<out DutyWidget>,val title:String,val width:Int,val height:Int) {
|
||||
MONTH(DutyWidget::class.java,"월간 달력 · 4×4",250,250),
|
||||
WIDE(WideDutyWidget::class.java,"두 주 달력 · 4×2",250,110),
|
||||
TALL(TallDutyWidget::class.java,"근무 목록 · 2×4",110,250),
|
||||
TODAY(TodayDutyWidget::class.java,"오늘 근무 · 2×2",110,110);
|
||||
|
||||
fun component(context:Context)=ComponentName(context,receiver)
|
||||
companion object {
|
||||
fun of(context:Context,id:Int):WidgetKind {
|
||||
val name=AppWidgetManager.getInstance(context).getAppWidgetInfo(id)?.provider?.className
|
||||
return entries.firstOrNull{it.receiver.name==name}?:MONTH
|
||||
}
|
||||
fun ids(context:Context):IntArray {
|
||||
val manager=AppWidgetManager.getInstance(context)
|
||||
return entries.flatMap{manager.getAppWidgetIds(it.component(context)).toList()}.toIntArray()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WideDutyWidget:DutyWidget()
|
||||
class TallDutyWidget:DutyWidget()
|
||||
class TodayDutyWidget:DutyWidget()
|
||||
@@ -50,11 +50,11 @@ data class WidgetStyle(
|
||||
|
||||
object WidgetStyleDialog {
|
||||
fun show(activity:Activity,id:Int?=null) {
|
||||
val ids=AppWidgetManager.getInstance(activity).getAppWidgetIds(ComponentName(activity,DutyWidget::class.java))
|
||||
val ids=WidgetKind.ids(activity)
|
||||
if(id!=null){if(id in ids)edit(activity,id);return}
|
||||
if(ids.isEmpty()){edit(activity,null);return}
|
||||
AlertDialog.Builder(activity).setTitle("꾸밀 위젯 선택")
|
||||
.setItems((listOf("모든 위젯과 새 위젯의 기본값")+ids.mapIndexed{index,_->"위젯 ${index+1}"}).toTypedArray()){_,index->edit(activity,if(index==0)null else ids[index-1])}
|
||||
.setItems((listOf("모든 위젯과 새 위젯의 기본값")+ids.mapIndexed{index,widgetId->"${WidgetKind.of(activity,widgetId).title} · ${index+1}"}).toTypedArray()){_,index->edit(activity,if(index==0)null else ids[index-1])}
|
||||
.setNegativeButton("닫기",null).show()
|
||||
}
|
||||
private fun edit(activity:Activity,id:Int?) {
|
||||
@@ -73,7 +73,7 @@ object WidgetStyleDialog {
|
||||
val theme=spinner("배경과 글자 색상",listOf("밝은 배경 · 어두운 글자","어두운 배경 · 밝은 글자"),if(original.dark)1 else 0)
|
||||
val size=spinner("글자 크기",listOf("작게 · 80%","기본 · 100%","크게 · 120%"),listOf(80,100,120).indexOf(original.scale))
|
||||
val details=spinner("내용 배치",listOf("자동 · 위젯 크기에 맞춤","간단히 · 날짜와 근무","자세히 · 추가 정보 표시"),listOf("AUTO","COMPACT","FULL").indexOf(original.detail))
|
||||
label("위젯 전체 크기는 홈 화면에서 위젯을 길게 누른 뒤 테두리를 끌어 조절합니다. 작은 위젯은 간단한 배치가 읽기 좋습니다.")
|
||||
label("홈 화면에 추가할 때 4×4, 4×2, 2×4, 2×2를 고릅니다. 가로×세로 기준입니다. 배치 후 길게 누르고 테두리를 끌어 크기를 조절할 수 있습니다. 작은 종류는 공간에 맞는 항목만 표시합니다.")
|
||||
fun choice(title:String,value:Boolean)=CheckBox(activity).apply{text=title;isChecked=value;textSize=14f;minHeight=dp(42);form.addView(this)}
|
||||
val lunar=choice("음력 표시 · 앱의 음력 옵션을 따름",original.lunar)
|
||||
val holidays=choice("공휴일 이름 표시",original.holidays)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/compact_root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/widget_background" android:padding="6dp">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="24dp" android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/compact_title" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center_vertical" android:text="@string/widget_name" android:textColor="#26364D" android:textSize="12sp" android:textStyle="bold" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_customize" android:layout_width="34dp" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_customize" android:textSize="11sp" android:textColor="#26364D" />
|
||||
</LinearLayout>
|
||||
<TextView android:id="@+id/compact_day_0" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_list_example_0" android:textSize="12sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_list_example_1" android:textSize="12sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_2" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_list_example_2" android:textSize="12sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_3" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_list_example_3" android:textSize="12sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_4" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_list_example_4" android:textSize="12sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_5" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_list_example_5" android:textSize="12sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_6" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_list_example_6" android:textSize="12sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="20dp" android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/compact_previous" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="@string/widget_previous" android:textSize="11sp" android:gravity="center" />
|
||||
<TextView android:id="@+id/compact_today" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="@string/widget_today" android:textSize="11sp" android:gravity="center" />
|
||||
<TextView android:id="@+id/compact_next" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="@string/widget_next" android:textSize="11sp" android:gravity="center" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/compact_root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/widget_background" android:padding="6dp">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="24dp" android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/compact_title" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center_vertical" android:text="@string/widget_name" android:textColor="#26364D" android:textSize="12sp" android:textStyle="bold" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_customize" android:layout_width="34dp" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_customize" android:textSize="11sp" android:textColor="#26364D" />
|
||||
</LinearLayout>
|
||||
<TextView android:id="@+id/compact_shift" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/widget_duty_example" android:textColor="#AA4C2E" android:textStyle="bold" android:textSize="22sp" android:maxLines="1" android:ellipsize="end" android:includeFontPadding="false" />
|
||||
<TextView android:id="@+id/compact_tomorrow" android:layout_width="match_parent" android:layout_height="18dp" android:text="@string/widget_tomorrow_example" android:textSize="11sp" android:textColor="#26364D" android:maxLines="1" android:ellipsize="end" android:includeFontPadding="false" />
|
||||
<TextView android:id="@+id/compact_detail" android:layout_width="match_parent" android:layout_height="16dp" android:text="@string/widget_name" android:textSize="11sp" android:textColor="#64748B" android:maxLines="1" android:ellipsize="end" android:includeFontPadding="false" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/compact_root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/widget_background" android:padding="6dp">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="24dp" android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/compact_title" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center_vertical" android:text="@string/widget_name" android:textColor="#26364D" android:textSize="12sp" android:textStyle="bold" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_customize" android:layout_width="34dp" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_customize" android:textSize="11sp" android:textColor="#26364D" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/compact_day_0" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_0" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_1" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_1" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_2" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_2" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_3" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_3" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_4" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_4" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_5" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_5" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_6" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_6" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/compact_day_7" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_7" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_8" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_8" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_9" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_9" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_10" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_10" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_11" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_11" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_12" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_12" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/compact_day_13" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="@string/widget_example_13" android:textSize="11sp" android:textColor="#26364D" android:maxLines="2" android:includeFontPadding="false" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="20dp" android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/compact_previous" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="@string/widget_previous" android:textSize="11sp" android:gravity="center" />
|
||||
<TextView android:id="@+id/compact_today" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="@string/widget_today" android:textSize="11sp" android:gravity="center" />
|
||||
<TextView android:id="@+id/compact_next" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="@string/widget_next" android:textSize="11sp" android:gravity="center" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -12,4 +12,36 @@
|
||||
<string name="widget_previous">이전</string>
|
||||
<string name="widget_legend">당직 · 비번 · 일반근무</string>
|
||||
<string name="widget_next">다음</string>
|
||||
<string name="widget_customize">꾸미기</string>
|
||||
<string name="widget_month_name">월간 달력 · 4×4</string>
|
||||
<string name="widget_wide_name">두 주 달력 · 4×2</string>
|
||||
<string name="widget_tall_name">근무 목록 · 2×4</string>
|
||||
<string name="widget_day_name">오늘 근무 · 2×2</string>
|
||||
<string name="widget_month_description">한 달의 당직과 일정. 가로 4칸과 세로 4칸.</string>
|
||||
<string name="widget_wide_description">이번 주와 다음 주 근무. 가로 4칸과 세로 2칸.</string>
|
||||
<string name="widget_tall_description">다가오는 일주일 근무. 가로 2칸과 세로 4칸.</string>
|
||||
<string name="widget_day_description">오늘과 내일 근무. 가로 2칸과 세로 2칸.</string>
|
||||
<string name="widget_duty_example">당직</string>
|
||||
<string name="widget_tomorrow_example">내일 비번</string>
|
||||
<string name="widget_example_0">15\n일반</string>
|
||||
<string name="widget_example_1">16\n당직</string>
|
||||
<string name="widget_example_2">17\n비번</string>
|
||||
<string name="widget_example_3">18\n일반</string>
|
||||
<string name="widget_example_4">19\n당직</string>
|
||||
<string name="widget_example_5">20\n비번</string>
|
||||
<string name="widget_example_6">21\n일반</string>
|
||||
<string name="widget_example_7">22\n당직</string>
|
||||
<string name="widget_example_8">23\n비번</string>
|
||||
<string name="widget_example_9">24\n일반</string>
|
||||
<string name="widget_example_10">25\n당직</string>
|
||||
<string name="widget_example_11">26\n비번</string>
|
||||
<string name="widget_example_12">27\n일반</string>
|
||||
<string name="widget_example_13">28\n당직</string>
|
||||
<string name="widget_list_example_0">11.21 당직</string>
|
||||
<string name="widget_list_example_1">11.22 비번</string>
|
||||
<string name="widget_list_example_2">11.23 일반</string>
|
||||
<string name="widget_list_example_3">11.24 당직</string>
|
||||
<string name="widget_list_example_4">11.25 비번</string>
|
||||
<string name="widget_list_example_5">11.26 일반</string>
|
||||
<string name="widget_list_example_6">11.27 당직</string>
|
||||
</resources>
|
||||
@@ -3,7 +3,7 @@
|
||||
android:minResizeWidth="250dp" android:minResizeHeight="250dp"
|
||||
android:targetCellWidth="4" android:targetCellHeight="4"
|
||||
android:initialLayout="@layout/duty_widget"
|
||||
android:previewLayout="@layout/duty_widget_preview"
|
||||
android:previewLayout="@layout/duty_widget_preview" android:description="@string/widget_month_description"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:widgetCategory="home_screen"
|
||||
android:updatePeriodMillis="1800000" />
|
||||
@@ -0,0 +1,7 @@
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="110dp" android:minHeight="250dp"
|
||||
android:minResizeWidth="110dp" android:minResizeHeight="250dp"
|
||||
android:initialLayout="@layout/duty_widget_tall"
|
||||
android:resizeMode="horizontal|vertical" android:widgetCategory="home_screen" android:updatePeriodMillis="1800000"
|
||||
android:targetCellWidth="2" android:targetCellHeight="4"
|
||||
android:previewLayout="@layout/duty_widget_tall" android:description="@string/widget_tall_description" />
|
||||
@@ -0,0 +1,7 @@
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="110dp" android:minHeight="110dp"
|
||||
android:minResizeWidth="110dp" android:minResizeHeight="110dp"
|
||||
android:initialLayout="@layout/duty_widget_today"
|
||||
android:resizeMode="horizontal|vertical" android:widgetCategory="home_screen" android:updatePeriodMillis="1800000"
|
||||
android:targetCellWidth="2" android:targetCellHeight="2"
|
||||
android:previewLayout="@layout/duty_widget_today" android:description="@string/widget_day_description" />
|
||||
@@ -0,0 +1,7 @@
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="250dp" android:minHeight="110dp"
|
||||
android:minResizeWidth="250dp" android:minResizeHeight="110dp"
|
||||
android:initialLayout="@layout/duty_widget_wide"
|
||||
android:resizeMode="horizontal|vertical" android:widgetCategory="home_screen" android:updatePeriodMillis="1800000"
|
||||
android:targetCellWidth="4" android:targetCellHeight="2"
|
||||
android:previewLayout="@layout/duty_widget_wide" android:description="@string/widget_wide_description" />
|
||||
@@ -0,0 +1,5 @@
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="110dp" android:minHeight="250dp"
|
||||
android:minResizeWidth="110dp" android:minResizeHeight="250dp"
|
||||
android:initialLayout="@layout/duty_widget_tall"
|
||||
android:resizeMode="horizontal|vertical" android:widgetCategory="home_screen" android:updatePeriodMillis="1800000" />
|
||||
@@ -0,0 +1,5 @@
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="110dp" android:minHeight="110dp"
|
||||
android:minResizeWidth="110dp" android:minResizeHeight="110dp"
|
||||
android:initialLayout="@layout/duty_widget_today"
|
||||
android:resizeMode="horizontal|vertical" android:widgetCategory="home_screen" android:updatePeriodMillis="1800000" />
|
||||
@@ -0,0 +1,5 @@
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="250dp" android:minHeight="110dp"
|
||||
android:minResizeWidth="250dp" android:minResizeHeight="110dp"
|
||||
android:initialLayout="@layout/duty_widget_wide"
|
||||
android:resizeMode="horizontal|vertical" android:widgetCategory="home_screen" android:updatePeriodMillis="1800000" />
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# 소스 구조와 자료 흐름
|
||||
|
||||
제작자 블리어 (이창현) · 0.10.0
|
||||
제작자 블리어 (이창현) · 0.11.0
|
||||
|
||||
## 폴더별 역할
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
## 위젯 표시 흐름
|
||||
|
||||
`DutyWidget`이 위젯 번호별 월과 `WidgetStyle`을 읽어 42칸 RemoteViews를 만듭니다. 가로·세로 크기 변경은 `onAppWidgetOptionsChanged`로 받아 다시 표시합니다. 자동 배치는 현재 방향의 높이를 보고 간단한 배치와 상세 배치를 고릅니다. 글자 배율은 RemoteViews의 실제 글자 크기에 적용합니다.
|
||||
`WidgetKind`가 월간과 두 주 및 목록과 오늘의 네 공급자를 구분합니다. `DutyWidget`은 월간의 42칸을 표시하고 작은 세 종류는 `CompactWidgetViews`로 보냅니다. 모든 갱신과 꾸미기 목록은 네 공급자의 위젯 번호를 함께 조회합니다. 월과 기간 및 모양은 위젯 번호별로 따로 읽습니다. 가로·세로 크기 변경은 `onAppWidgetOptionsChanged`로 받아 다시 표시합니다. Android 12 이상은 전달받은 크기 목록별 RemoteViews를 구성합니다. 자동 배치는 현재 방향의 높이를 보고 간단한 배치와 상세 배치를 고릅니다. 글자 배율은 RemoteViews의 실제 글자 크기에 적용합니다.
|
||||
|
||||
투명도는 배경의 알파값만 바꿉니다. 글자까지 흐려지지 않게 색상을 따로 유지합니다. 위젯마다 다른 설정 키를 사용하며 전체 적용을 선택하면 개별 키를 비우고 기본값을 저장합니다. 삭제된 위젯의 모양 키도 함께 정리합니다. 손상된 값은 기본 모양으로 복구해 달력이 사라지지 않게 합니다.
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# 새 버전 배포와 복구
|
||||
|
||||
제작자 블리어 (이창현) · 0.10.0
|
||||
제작자 블리어 (이창현) · 0.11.0
|
||||
|
||||
## 배포 위치
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
| `server/web/index.html` | 소개의 버전과 최신 포럼 링크 |
|
||||
| `server/app.py` | 상태 응답의 버전 |
|
||||
|
||||
빌드한 APK의 파일 이름과 바이트 수 및 SHA-256을 `release.json`의 apkFile과 apkBytes 및 apkSha256에 넣습니다. 예를 들어 0.10.0은 versionCode 14이며 웹 빌드는 2026-11-20.10입니다. 값만 미리 올리고 실제 파일을 늦게 배치하면 업데이트 검증이 실패합니다.
|
||||
빌드한 APK의 파일 이름과 바이트 수 및 SHA-256을 `release.json`의 apkFile과 apkBytes 및 apkSha256에 넣습니다. 예를 들어 0.11.0은 versionCode 15이며 웹 빌드는 2026-11-21.1입니다. 값만 미리 올리고 실제 파일을 늦게 배치하면 업데이트 검증이 실패합니다.
|
||||
|
||||
```powershell
|
||||
Get-FileHash app/build/outputs/apk/debug/app-debug.apk -Algorithm SHA256
|
||||
|
||||
+16
-3
@@ -1,6 +1,6 @@
|
||||
# 당직근무 설치와 사용법
|
||||
|
||||
제작자 블리어 (이창현) · 0.10.0
|
||||
제작자 블리어 (이창현) · 0.11.0
|
||||
|
||||
## 설치와 처음 설정
|
||||
|
||||
@@ -18,6 +18,19 @@
|
||||
|
||||
주 5일제를 고르면 토요일의 일반근무는 휴무로 계산합니다. 주 6일제의 토요일은 기존 근무 규칙을 따릅니다. 당직 날짜는 유지합니다. 옵션의 **당직일 평일색**은 주말과 공휴일에 걸린 당직 날짜 숫자를 평일색으로 보여 줍니다. **비번 빨간색**은 비번 날짜를 빨간색으로 표시합니다. 두 옵션은 달력 색상에 대한 설정이며 실제 반복 순서를 바꾸지 않습니다.
|
||||
|
||||
## 위젯 크기 고르기
|
||||
|
||||
**홈 화면에 달력 추가**를 누르면 크기 목록이 나타납니다. 홈 화면의 위젯 목록에서도 네 종류를 따로 고를 수 있습니다.
|
||||
|
||||
| 크기 · 가로×세로 | 표시 내용 |
|
||||
| --- | --- |
|
||||
| 4×4 월간 달력 | 한 달 전체와 월 이동 |
|
||||
| 4×2 두 주 달력 | 이번 주와 다음 주의 14일 근무 |
|
||||
| 2×4 근무 목록 | 오늘부터 7일간 날짜와 근무를 세로로 표시 |
|
||||
| 2×2 오늘 근무 | 오늘 근무와 내일 근무를 크게 표시 |
|
||||
|
||||
4×2는 가로형이며 2×4는 세로형입니다. 기존 월간 달력을 억지로 줄이는 방식이 아니라 각 크기에 맞는 별도 위젯입니다. 두 주 달력의 이전·다음은 14일씩 이동하고 근무 목록은 7일씩 이동합니다. 오늘 버튼은 현재 기간으로 돌아갑니다. 날짜나 내일 근무를 누르면 앱에서 해당 날짜를 엽니다.
|
||||
|
||||
## 위젯 모양 바꾸기
|
||||
|
||||
위젯 위의 **꾸미기**를 누르면 해당 위젯만 바꿉니다. 앱의 **위젯 꾸미기 · 투명도와 크기** 또는 **옵션 → 위젯 꾸미기**에서는 위젯 하나를 고르거나 모든 위젯에 함께 적용할 수 있습니다.
|
||||
@@ -32,9 +45,9 @@
|
||||
| 일정 표시 | 일정과 기념일이 있는 날의 + 표시 켜기·끄기 |
|
||||
| 오늘 표시 | 오늘 날짜 배경 강조 켜기·끄기 |
|
||||
|
||||
위젯 전체 크기는 홈 화면에서 길게 누른 뒤 테두리를 끌어 조절합니다. 최소 크기와 가능한 칸 수는 홈 화면 앱에 따라 달라집니다. 자동 배치는 높이가 작은 위젯에서 추가 글줄을 숨깁니다. 작은 크기에서는 글자 100%나 80%가 적당합니다. 큰 글자를 쓰려면 위젯도 넓히세요.
|
||||
위젯 전체 크기는 홈 화면에서 길게 누른 뒤 테두리를 끌어 조절합니다. 최소 크기와 가능한 칸 수는 홈 화면 앱에 따라 달라집니다. 월간 달력의 자동 배치는 높이가 작은 위젯에서 추가 글줄을 숨깁니다. 두 주 달력은 날짜와 근무를 우선 표시합니다. 세로 근무 목록의 상세 내용은 충분히 높일 때 표시합니다. 오늘 근무의 상세 내용은 한 줄에 들어가는 범위만 표시합니다. 작은 크기에서는 글자 100%나 80%가 적당합니다. 큰 글자를 쓰려면 위젯도 넓히세요.
|
||||
|
||||
음력은 앱의 음력 옵션도 켜져 있어야 보입니다. 함께 근무하는 사람은 회원 연결 중에만 표시합니다. 투명 배경에서는 휴대폰 배경과 대비되는 글자색을 고르세요. **기본값**은 설정 화면을 초기 값으로 돌립니다. 실제 적용은 **저장**을 눌러야 합니다. 여러 위젯의 월 이동과 모양은 각각 유지됩니다. 모든 위젯에 적용하면 기존 개별 모양도 함께 바뀝니다.
|
||||
음력은 앱의 음력 옵션도 켜져 있어야 보입니다. 함께 근무하는 사람은 회원 연결 중에만 표시합니다. 투명 배경에서는 휴대폰 배경과 대비되는 글자색을 고르세요. **기본값**은 설정 화면을 초기 값으로 돌립니다. 실제 적용은 **저장**을 눌러야 합니다. 여러 위젯의 월이나 기간 이동과 모양은 각각 유지됩니다. 모든 위젯에 적용하면 기존 개별 모양도 함께 바뀝니다.
|
||||
|
||||
## 일정과 알바 시간표
|
||||
|
||||
|
||||
+20
-4
@@ -1,6 +1,6 @@
|
||||
# Android Studio로 당직근무 만들기
|
||||
|
||||
제작자 블리어 (이창현) · 0.10.0
|
||||
제작자 블리어 (이창현) · 0.11.0
|
||||
|
||||
## 준비할 환경
|
||||
|
||||
@@ -46,7 +46,8 @@ APK: `app/build/outputs/apk/debug/app-debug.apk`
|
||||
|
||||
Device Manager에서 API 36 가상 기기를 만들고 앱을 실행합니다. 근무 기준일과 배열을 저장한 뒤 홈 화면에 위젯을 추가합니다. 아래 항목은 실제 화면에서 확인합니다.
|
||||
|
||||
- 월 이동과 오늘 복귀 및 날짜를 눌렀을 때 앱의 선택 날짜
|
||||
- 위젯 목록의 4×4·4×2·2×4·2×2 네 항목과 실제 기본 칸 수
|
||||
- 월 이동과 14일·7일 이동 및 오늘 복귀와 날짜를 눌렀을 때 앱의 선택 날짜
|
||||
- 투명도 0%와 100% 및 어두운 글자·밝은 글자
|
||||
- 80%와 120% 글자 크기 및 작은 위젯의 간단한 배치
|
||||
- 여러 위젯에서 월과 모양이 서로 영향을 주지 않는지
|
||||
@@ -61,7 +62,7 @@ adb install -r app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
|
||||
adb shell am instrument -w -e widgetCheck true kr.co.itosm.dutycalendar.test/kr.co.itosm.dutycalendar.StorageSyncCheck
|
||||
```
|
||||
|
||||
검사 코드는 위젯 모양을 바꾸어 검사한 뒤 원래 값을 복원합니다. 다른 저장 검사에는 미연결 기기나 별도 검증 서버가 필요한 항목이 있습니다. 운영 계정을 검사 계정으로 사용하지 마세요.
|
||||
검사 코드는 네 공급자 등록과 기본 칸 수 및 작은 위젯의 최소 크기에서 글자 80%·100%·120%의 실제 RemoteViews 높이를 확인합니다. 홈에 놓인 가로형과 세로형 위젯이 있으면 기간 이동도 검사합니다. 검사 중 바꾼 위젯 모양과 기간은 원래 값으로 복원합니다. 다른 저장 검사에는 미연결 기기나 별도 검증 서버가 필요한 항목이 있습니다. 운영 계정을 검사 계정으로 사용하지 마세요.
|
||||
|
||||
## 주요 수정 위치
|
||||
|
||||
@@ -71,7 +72,9 @@ adb shell am instrument -w -e widgetCheck true kr.co.itosm.dutycalendar.test/kr.
|
||||
| 버전 이름과 번호 | `app/build.gradle.kts` |
|
||||
| 앱 화면과 옵션 진입 | `MainActivity.kt` |
|
||||
| 근무 계산과 색상 | `Schedule.kt` |
|
||||
| 홈 위젯 달력 | `DutyWidget.kt`와 `res/layout/duty_widget.xml` |
|
||||
| 월간 위젯과 갱신 | `DutyWidget.kt`와 `res/layout/duty_widget.xml` |
|
||||
| 위젯 네 종류 등록 | `WidgetKind.kt`와 `AndroidManifest.xml` 및 `res/xml`과 `res/xml-v31` |
|
||||
| 작은 위젯 표시 | `CompactWidgetViews.kt`와 `duty_widget_wide.xml` 및 `duty_widget_tall.xml`과 `duty_widget_today.xml` |
|
||||
| 위젯 모양 저장과 편집 | `WidgetStyle.kt` |
|
||||
| 서버 기본 주소 | `SyncClient.kt`의 `WEB_URL` |
|
||||
| 개인 일정과 반복 | `PlannerStore.kt`와 `PlannerDialogs.kt` |
|
||||
@@ -84,3 +87,16 @@ Kotlin 파일은 `app/src/main/java/kr/co/itosm/dutycalendar`에 있습니다.
|
||||
공식 APK와 직접 빌드한 APK는 같은 소스여도 서명이 다를 수 있습니다. Android는 업데이트 때 앱 식별자와 서명을 확인합니다. 앱을 배포하기로 했다면 본인의 서명 키를 별도로 만들고 안전하게 보관하세요. 키와 비밀번호는 Git이나 공개 ZIP에 넣지 않습니다. 자세한 절차는 [앱 서명 공식 문서](https://developer.android.com/studio/publish/app-signing)에 있습니다.
|
||||
|
||||
공식 미리보기 앱의 자료를 보존하려면 공식 업데이트를 기존 앱 위에 설치합니다. 서명 충돌을 피하려고 앱을 삭제하면 기기 자료가 사라질 수 있습니다. 본인 실험용 앱은 별도 applicationId와 가상 기기를 사용하는 편이 좋습니다.
|
||||
|
||||
## 위젯 크기 구현
|
||||
|
||||
| 크기 · 가로×세로 | 표시 내용 |
|
||||
| --- | --- |
|
||||
| 4×4 월간 달력 | 한 달 전체와 월 이동 |
|
||||
| 4×2 두 주 달력 | 이번 주와 다음 주의 14일 근무 |
|
||||
| 2×4 근무 목록 | 오늘부터 7일간 날짜와 근무를 세로로 표시 |
|
||||
| 2×2 오늘 근무 | 오늘 근무와 내일 근무를 크게 표시 |
|
||||
|
||||
각 종류는 별도 AppWidgetProvider로 등록합니다. 기존 `DutyWidget` 이름은 유지해 이미 배치한 월간 위젯이 사라지지 않게 했습니다. Android 12 이상에서는 `targetCellWidth`와 `targetCellHeight`로 기본 칸 수를 지정합니다. 이전 버전은 최소 dp 크기를 사용합니다. 홈 화면의 칸 간격에 따라 실제 외곽 크기는 달라집니다.
|
||||
|
||||
홈 화면이 전달하는 크기 목록마다 RemoteViews를 준비합니다. 작은 위젯의 글자는 크기에 맞춰 상한을 두므로 120%를 골라도 최소 높이에서 두 줄이 잘리지 않습니다. 다른 홈 화면 앱과 큰 시스템 글자 설정은 별도로 확인해야 합니다. [Android 위젯 크기 공식 문서](https://developer.android.com/develop/ui/views/appwidgets/layouts)를 참고하세요.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# 당직근무 웹 서버 설치와 회원 관리
|
||||
|
||||
제작자 블리어 (이창현) · 0.10.0
|
||||
제작자 블리어 (이창현) · 0.11.0
|
||||
|
||||
## 구성과 설치 전 확인
|
||||
|
||||
|
||||
+1
-1
@@ -604,7 +604,7 @@ company.setup(app, identity, payload, db, throttle, changed, snapshot)
|
||||
|
||||
@app.get(PREFIX + "/health")
|
||||
async def health():
|
||||
return {"status": "ok", "version": "0.10.0"}
|
||||
return {"status": "ok", "version": "0.11.0"}
|
||||
|
||||
|
||||
@app.get(PREFIX + "/download")
|
||||
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"appVersion": "0.10.0",
|
||||
"appVersionCode": 14,
|
||||
"webVersion": "2026-11-20.10",
|
||||
"apkFile": "duty-calendar-0.10.0.apk",
|
||||
"appVersion": "0.11.0",
|
||||
"appVersionCode": 15,
|
||||
"webVersion": "2026-11-21.1",
|
||||
"apkFile": "duty-calendar-0.11.0.apk",
|
||||
"notes": [
|
||||
"위젯 배경 투명도와 밝은·어두운 색상 및 글자 크기를 조절할 수 있습니다.",
|
||||
"위젯마다 모양을 따로 저장하거나 모든 위젯에 함께 적용합니다.",
|
||||
"작은 위젯의 간단한 배치와 음력·공휴일·함께 근무·기념일 표시를 선택합니다.",
|
||||
"공식 앱과 소스 및 제작 매뉴얼은 포럼의 웹·앱 자료실 → 당직근무에서 제공합니다."
|
||||
"홈 화면에서 4×4 월간 달력과 4×2 두 주 달력 및 2×4 근무 목록과 2×2 오늘 근무를 선택합니다.",
|
||||
"앱의 홈 화면에 달력 추가에서도 원하는 크기를 고를 수 있습니다. 크기는 가로×세로 기준입니다.",
|
||||
"작은 위젯은 크기에 맞춰 글자와 배치를 조절하며 날짜를 누르면 해당 날짜를 엽니다.",
|
||||
"투명도와 색상 및 글자 크기는 위젯마다 따로 저장합니다. 기존 월간 위젯과 일정은 유지됩니다."
|
||||
],
|
||||
"apkBytes": 1040735,
|
||||
"apkSha256": "a1e5f0da7b2d82d4a7be2a533bb79480947407b70339bf0d7242b424cbe2b977"
|
||||
"apkBytes": 1059979,
|
||||
"apkSha256": "2b0e93cf04ef94cd3f66ee699bd0cf556ee7a06cb9d636659b9255ea5773c11f"
|
||||
}
|
||||
@@ -3,18 +3,18 @@ const fs=require('node:fs'),vm=require('node:vm'),assert=require('node:assert/st
|
||||
const source=fs.readFileSync(__dirname+'/web/updates.js','utf8');
|
||||
async function setup(seen=''){
|
||||
const storage=new Map([['duty-web-update-seen',seen]]),nodes=new Map();
|
||||
let release={webVersion:'2026-11-20.10',appVersion:'0.10.0',notes:['검증']},reloaded=0,editing=false;
|
||||
let release={webVersion:'2026-11-21.1',appVersion:'0.11.0',notes:['검증']},reloaded=0,editing=false;
|
||||
const node=id=>{if(!nodes.has(id))nodes.set(id,{textContent:'',open:false,showModal(){this.open=true;},close(){this.open=false;},addEventListener(){}});return nodes.get(id);};
|
||||
const context={console,$:node,localStorage:{getItem:k=>storage.get(k)||null,setItem:(k,v)=>storage.set(k,v),removeItem:k=>storage.delete(k)},document:{visibilityState:'visible',querySelector:()=>editing||node('update-dialog').open,addEventListener(){}},pending:[],saving:false,connected:false,notify(){},setInterval(){},location:{reload(){reloaded++;}},fetch:async()=>({ok:true,json:async()=>release})};
|
||||
vm.createContext(context);vm.runInContext(source,context);await new Promise(setImmediate);
|
||||
return {context,node,storage,setRelease:v=>release=v,setEditing:v=>editing=v,reloaded:()=>reloaded,check:async()=>{await vm.runInContext('checkWebVersion()',context);}};
|
||||
}
|
||||
(async()=>{
|
||||
const first=await setup();assert.equal(first.node('update-dialog').open,true);assert.equal(first.node('update-apply').textContent,'확인');first.node('update-apply').onclick();assert.equal(first.reloaded(),0);assert.equal(first.storage.get('duty-web-update-seen'),'2026-11-20.10');
|
||||
const first=await setup();assert.equal(first.node('update-dialog').open,true);assert.equal(first.node('update-apply').textContent,'확인');first.node('update-apply').onclick();assert.equal(first.reloaded(),0);assert.equal(first.storage.get('duty-web-update-seen'),'2026-11-21.1');
|
||||
const returning=await setup('2026-11-20.4');assert.equal(returning.node('update-dialog').open,true);
|
||||
const latest=await setup('2026-11-20.10');assert.equal(latest.node('update-dialog').open,false);
|
||||
latest.setEditing(true);latest.setRelease({webVersion:'2026-11-20.11',appVersion:'0.10.0',notes:['검증']});await latest.check();assert.equal(latest.node('update-dialog').open,false);
|
||||
const latest=await setup('2026-11-21.1');assert.equal(latest.node('update-dialog').open,false);
|
||||
latest.setEditing(true);latest.setRelease({webVersion:'2026-11-21.2',appVersion:'0.11.0',notes:['검증']});await latest.check();assert.equal(latest.node('update-dialog').open,false);
|
||||
latest.setEditing(false);await latest.check();assert.equal(latest.node('update-dialog').open,true);assert.equal(latest.node('update-apply').textContent,'업데이트 적용');latest.node('update-later').onclick();await latest.check();assert.equal(latest.node('update-dialog').open,false);
|
||||
latest.storage.delete('duty-web-update-later');await latest.check();latest.node('update-apply').onclick();assert.equal(latest.reloaded(),1);assert.equal(latest.storage.get('duty-web-update-seen'),'2026-11-20.11');
|
||||
latest.storage.delete('duty-web-update-later');await latest.check();latest.node('update-apply').onclick();assert.equal(latest.reloaded(),1);assert.equal(latest.storage.get('duty-web-update-seen'),'2026-11-21.2');
|
||||
console.log('웹 업데이트: 첫 안내, 재접속, 현재 버전, 편집 보호, 나중에, 동의 후 적용 통과');
|
||||
})().catch(error=>{console.error(error);process.exitCode=1;});
|
||||
@@ -6,7 +6,7 @@
|
||||
<main>
|
||||
<section id="welcome" class="welcome">
|
||||
<div class="welcome-hero">
|
||||
<div class="welcome-copy"><p class="eyebrow">당직 · 교대근무 · 개인 일정</p><h1>다음 당직,<br>달력에서 바로.</h1><p class="intro">내 근무 순서대로 채워지는 달력.<br>휴대폰을 켜면 홈 화면에서 바로 확인하세요.</p><div class="welcome-actions"><a class="download-button" href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12m-5-5 5 5 5-5M5 16v5h14v-5"/></svg>안드로이드 앱 받기</a><a class="install-link" href="#install-guide">설치 안내</a></div><p class="download-meta"><a href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47">공식 배포 · 소스 · 제작 매뉴얼</a><br>Android 8.0 이상 · 미리보기 0.10.0</p><div class="welcome-caption"><strong>내 달력은 로그인 없이.</strong><p>함께 보는 근무표와 소속 공유는<br>회원 로그인 후 이용할 수 있습니다.</p></div></div>
|
||||
<div class="welcome-copy"><p class="eyebrow">당직 · 교대근무 · 개인 일정</p><h1>다음 당직,<br>달력에서 바로.</h1><p class="intro">내 근무 순서대로 채워지는 달력.<br>휴대폰을 켜면 홈 화면에서 바로 확인하세요.</p><div class="welcome-actions"><a class="download-button" href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12m-5-5 5 5 5-5M5 16v5h14v-5"/></svg>안드로이드 앱 받기</a><a class="install-link" href="#install-guide">설치 안내</a></div><p class="download-meta"><a href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47">공식 배포 · 소스 · 제작 매뉴얼</a><br>Android 8.0 이상 · 미리보기 0.11.0</p><div class="welcome-caption"><strong>내 달력은 로그인 없이.</strong><p>함께 보는 근무표와 소속 공유는<br>회원 로그인 후 이용할 수 있습니다.</p></div></div>
|
||||
<figure class="calendar-preview" aria-label="3당직근무 화면 예시">
|
||||
<figcaption><span>홈 화면에 두는 나의 근무표</span><span>화면 예시</span></figcaption>
|
||||
<div class="calendar-paper"><div class="paper-heading"><div><span class="paper-year">2026</span><strong>11<span>월</span></strong></div><div class="paper-note"><b>당직근무</b><span>당직 · 비번 · 일반근무</span></div></div><div class="sample-week"><span>일</span><span>월</span><span>화</span><span>수</span><span>목</span><span>금</span><span>토</span></div><div class="sample-grid"><div class="sample-day sun"><span>1</span><em class="off">비번</em></div><div class="sample-day"><span>2</span><em class="regular">일반</em></div><div class="sample-day"><span>3</span><em class="duty">당직</em></div><div class="sample-day"><span>4</span><em class="off">비번</em></div><div class="sample-day"><span>5</span><em class="regular">일반</em></div><div class="sample-day"><span>6</span><em class="duty">당직</em></div><div class="sample-day sat"><span>7</span><em class="off">비번</em></div><div class="sample-day sun"><span>8</span><em class="regular">일반</em></div><div class="sample-day"><span>9</span><em class="duty">당직</em></div><div class="sample-day"><span>10</span><em class="off">비번</em></div><div class="sample-day"><span>11</span><em class="regular">일반</em></div><div class="sample-day"><span>12</span><em class="duty">당직</em></div><div class="sample-day"><span>13</span><em class="off">비번</em></div><div class="sample-day sat"><span>14</span><em class="regular">일반</em></div><div class="sample-day sun"><span>15</span><em class="duty">당직</em></div><div class="sample-day"><span>16</span><em class="off">비번</em></div><div class="sample-day"><span>17</span><em class="regular">일반</em></div><div class="sample-day"><span>18</span><em class="duty">당직</em></div><div class="sample-day"><span>19</span><em class="off">비번</em></div><div class="sample-day"><span>20</span><em class="regular">일반</em></div><div class="sample-day sat picked"><span>21</span><em class="duty">당직</em></div><div class="sample-day sun"><span>22</span><em class="off">비번</em></div><div class="sample-day"><span>23</span><em class="regular">일반</em></div><div class="sample-day"><span>24</span><em class="duty">당직</em></div><div class="sample-day"><span>25</span><em class="off">비번</em></div><div class="sample-day"><span>26</span><em class="regular">일반</em></div><div class="sample-day"><span>27</span><em class="duty">당직</em></div><div class="sample-day sat"><span>28</span><em class="off">비번</em></div><div class="sample-day sun"><span>29</span><em class="regular">일반</em></div><div class="sample-day"><span>30</span><em class="duty">당직</em></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div></div><div class="paper-footer"><span><i></i>선택한 날 · 11월 21일 당직</span><span>3일 반복</span></div></div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
const WEB_BUILD = '2026-11-20.10';
|
||||
const WEB_BUILD = '2026-11-21.1';
|
||||
let offeredRelease=null, versionChecking=false;
|
||||
const versionDeferKey='duty-web-update-later';
|
||||
const versionSeenKey='duty-web-update-seen';
|
||||
|
||||
Reference in new issue
Block a user