모든 위젯 크기에서 한 달 전체를 축소하는 선택 추가
2×2·2×4·4×2·4×4에서도 한 달 전체를 확인할 수 있도록 위젯별 monthFit 선택과 크기 맞춤 월간 배치를 추가했다. 작은 칸은 날짜를 우선 배치하고 여유 높이에 따라 근무와 이름 및 음력 등을 표시한다. 기존 기본 배치와 개인 근무 설정을 유지한다. 주요 파일은 WidgetStyle과 DutyWidget 및 MonthWidgetViews와 월간 축소 레이아웃이다. 사용 설명서와 Android 제작 매뉴얼 및 변경 기록과 설치 번호를 함께 갱신했다. 앱 단위 42개와 빌드 및 정적 검사 통과. 정적 오류 0개와 경고 86개. API 36에서 네 종류와 두 주 시작 및 세 배율과 최소·확장 크기의 42칸과 마지막 주 및 글자 생략 없음 확인. 연말 월 이동과 오늘 복귀 및 구버전 설정 보존 확인. 실제 홈 화면에서 선택 저장과 월 이동을 확인했다. 공개 ZIP 별도 폴더 빌드 통과. 0.13.1 설치 번호 18을 운영에 반영했다. DB 구조 변경과 자료 이전은 없다. 기존 회원·근무·소속 자료와 월요일 시작 및 다른 서비스와 원격 세션을 보존했다. 변경 전 소스와 DB는 비공개 20261121-widget-month 백업에 보관했다. APK와 전체 소스는 당직근무 포럼에 게시한다. 실물 휴대폰과 제조사별 홈 화면은 미확인이다. 작은 위젯은 날짜 우선 표시이며 글자 배율은 영역에 맞춰 제한된다. 기존 개발용 서명을 유지한다.
This commit is contained in:
1 parent
45ca9f675e
commit
1fc9243c63
15 files changed
+328
-34
No files matched your search
@@ -1,3 +1,9 @@
|
||||
# 0.13.1 · 2026년 11월 21일
|
||||
|
||||
- 모든 위젯 크기에서 한 달 전체를 축소하는 선택을 추가했습니다.
|
||||
- 작은 칸은 날짜를 우선 표시하고 공간에 맞춰 근무와 추가 정보를 보여 줍니다.
|
||||
- 월 이동과 현재 달 복귀 및 위젯별 저장을 지원합니다. 기존 모양과 근무 자료는 유지합니다.
|
||||
|
||||
# 변경 기록
|
||||
|
||||
## 0.13.0 · 2026년 11월 21일
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 당직근무
|
||||
|
||||
제작자 블리어 (이창현) · 미리보기 0.13.0 · Android 8.0 이상
|
||||
제작자 블리어 (이창현) · 미리보기 0.13.1 · Android 8.0 이상
|
||||
|
||||
당직과 교대근무를 달력으로 확인하고 홈 화면에 계속 놓아두는 앱입니다. 본인의 근무표는 로그인 없이 사용할 수 있습니다. 서버가 잠시 멈춰도 기기에 저장한 근무와 일정 및 기념일은 그대로 사용합니다.
|
||||
|
||||
@@ -56,3 +56,13 @@ JDK 21과 Android SDK 36을 설치한 뒤 프로젝트를 Android Studio에서
|
||||
|
||||
|
||||
변경 사항은 검증을 마친 기능과 배포 단위로 Gitea와 포럼에 기록합니다. 변경 이유와 사용법 및 검사 결과와 남은 제한을 함께 남깁니다.
|
||||
|
||||
## 작은 위젯에서도 한 달 전체 보기
|
||||
|
||||
0.13.1부터 2×2·2×4·4×2·4×4 위젯에서 한 달 전체 표시를 선택할 수 있습니다. **위젯의 꾸미기 → 위젯에 보여 줄 화면 → 한 달 전체 · 크기에 맞춰 축소 → 저장** 순서로 선택합니다. 앱의 **옵션 → 위젯 꾸미기**에서도 위젯 하나 또는 전체에 적용할 수 있습니다.
|
||||
|
||||
7열과 6주를 유지하며 실제 홈 화면 크기에 맞춰 글자를 조절합니다. 아주 작은 크기에서는 날짜만 보이고 당직 칸에 옅은 배경을 표시합니다. 높이가 늘어나면 근무가 나타나며 좁은 칸은 당·비·근·주·오·야·휴로 줄여 표시합니다. 충분한 공간에서는 이름과 공휴일 및 음력·기념일 중 한 항목을 추가합니다. 일반근무 아래 이름을 가장 먼저 표시합니다. 세부 내용은 날짜를 눌러 확인합니다.
|
||||
|
||||
이전·다음은 한 달씩 이동합니다. 오늘은 현재 달로 돌아옵니다. 월요일·일요일 주 시작과 날짜 색상 및 배경 투명도는 기존 선택을 따릅니다. 글자 확대를 선택해도 날짜가 잘리지 않도록 작은 크기에서는 배율의 상한을 적용합니다. 실제 크기는 홈 화면 앱의 격자와 여백에 따라 달라집니다.
|
||||
|
||||
**종류 기본 표시**로 바꾸면 기존 월간·두 주·근무 목록·오늘 배치로 돌아갑니다. 업데이트만으로 기존 배치를 바꾸지 않습니다. 위젯 모양은 기기별 설정이며 서버의 개인 근무표와 다른 기기는 변경하지 않습니다.
|
||||
@@ -10,8 +10,8 @@ android {
|
||||
applicationId = "kr.co.itosm.dutycalendar"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 17
|
||||
versionName = "0.13.0"
|
||||
versionCode = 18
|
||||
versionName = "0.13.1"
|
||||
testInstrumentationRunner = "kr.co.itosm.dutycalendar.StorageSyncCheck"
|
||||
}
|
||||
// 빌드 도구는 JDK 21로 실행하지만 앱의 Java와 Kotlin 바이트코드 대상은 17로 통일한다.
|
||||
|
||||
@@ -93,6 +93,54 @@ object WidgetAppearanceCheck {
|
||||
check(Color.alpha((root.background as ColorDrawable).color)==128)
|
||||
}
|
||||
}
|
||||
// 예전 저장 자료는 기존 배치로 열고 새 선택은 위젯별로 보관한다.
|
||||
check(!WidgetStyle.parse("{}").monthFit)
|
||||
check(WidgetStyle.parse(WidgetStyle(monthFit=true).json().toString()).monthFit)
|
||||
// 최소 크기와 넓힌 크기에서 윤곽만 맞는 것이 아니라 42칸의 실제 글줄과
|
||||
// 모든 날짜 및 마지막 주가 잘리지 않는지 측정한다. 주 시작도 각각 검사한다.
|
||||
for(start in 0..1) for(kind in WidgetKind.entries) for(scale in listOf(80,100,120)) {
|
||||
val current=ScheduleStore.load(app)
|
||||
ScheduleStore.saveDisplay(app,current.dutyAsWeekday,current.showLunar,current.offAsHoliday,start,fromSync=true)
|
||||
for(dimensions in listOf(kind.width to kind.height,320 to 440)) {
|
||||
val (width,height)=dimensions
|
||||
positions.edit().putString("month_99004","2026-08").commit()
|
||||
WidgetStyle.save(app,99004,WidgetStyle(monthFit=true,scale=scale,transparency=50))
|
||||
val options=Bundle().apply {
|
||||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,width);putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,width)
|
||||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,height);putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,height)
|
||||
}
|
||||
val root=DutyWidget.buildViews(app,99004,options,kind).apply(app,FrameLayout(app))
|
||||
root.measure(View.MeasureSpec.makeMeasureSpec((width*density).toInt(),View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec((height*density).toInt(),View.MeasureSpec.EXACTLY))
|
||||
root.layout(0,0,root.measuredWidth,root.measuredHeight)
|
||||
check(Color.alpha((root.background as ColorDrawable).color)==128)
|
||||
check(root.findViewById<TextView>(R.id.widget_sun).text==if(start==1)"월" else "일")
|
||||
val dates=calendarDays(java.time.YearMonth.of(2026,8),start)
|
||||
DutyWidget.DAY_IDS.forEachIndexed { index,cellId ->
|
||||
val cell=root.findViewById<TextView>(cellId)
|
||||
check(cell.text.toString().lineSequence().first().removeSuffix("+")==dates[index].dayOfMonth.toString())
|
||||
check(cell.layout!=null&&cell.layout.height<=cell.height){"월간 ${kind.title} $width×$height $scale 날짜 $index 높이 초과 ${cell.layout.height}/${cell.height}"}
|
||||
check((0 until cell.layout.lineCount).all{cell.layout.getEllipsisCount(it)==0}){"월간 날짜 $index 생략 발생"}
|
||||
val rect=android.graphics.Rect();cell.getDrawingRect(rect);(root as android.view.ViewGroup).offsetDescendantRectToMyCoords(cell,rect)
|
||||
check(rect.top>=0&&rect.bottom<=root.height&&rect.left>=0&&rect.right<=root.width){"마지막 주 또는 날짜 칸이 위젯 밖입니다."}
|
||||
}
|
||||
check(dates.count{it.monthValue==8}==31)
|
||||
}
|
||||
}
|
||||
// 각 제공자의 월 이동은 월간 선택을 따르며 기존 목록의 주 이동 값은 건드리지 않는다.
|
||||
for(kind in WidgetKind.entries) {
|
||||
val id=manager.getAppWidgetIds(kind.component(app)).firstOrNull()?:continue
|
||||
WidgetStyle.save(app,id,WidgetStyle(monthFit=true))
|
||||
positions.edit().putString("month_$id","2026-12").putInt("offset_$id",14).commit()
|
||||
val receiver=kind.receiver.getDeclaredConstructor().newInstance()
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.NEXT).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(positions.getString("month_$id",null)=="2027-01")
|
||||
check(positions.getInt("offset_$id",0)==14)
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.PREVIOUS).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(positions.getString("month_$id",null)=="2026-12")
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.TODAY).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(!positions.contains("month_$id")&&!positions.contains("offset_$id"))
|
||||
WidgetStyle.save(app,id,WidgetStyle())
|
||||
}
|
||||
// 실제 홈 화면에 배치된 새 종류는 자신의 날짜 범위만 이동하고 오늘로 돌아와야 한다.
|
||||
for(kind in listOf(WidgetKind.WIDE,WidgetKind.TALL)) {
|
||||
val id=manager.getAppWidgetIds(kind.component(app)).firstOrNull()?:continue
|
||||
@@ -107,7 +155,7 @@ object WidgetAppearanceCheck {
|
||||
}
|
||||
failure?.let{throw it}
|
||||
success=true
|
||||
message="월요일·일요일 시작 저장과 월간 머리글·첫 날짜 및 두 주 위젯의 시작과 일요일 색상 확인. 네 위젯의 기본 칸 수와 최소 글자 높이 및 기간 이동과 개별 설정 확인."
|
||||
message="네 종류의 기본 배치와 한 달 전체 선택 확인. 월·일 시작과 80·100·120% 및 최소·확장 크기에서 42칸과 모든 날짜 및 마지막 주의 글자 높이와 생략 없음 확인. 월 이동과 연말 넘김 및 오늘 복귀와 개별 저장 및 구버전 설정 보존 확인."
|
||||
} catch(error:Throwable) {message=error.stackTraceToString()}
|
||||
finally {
|
||||
val scheduleRestore=schedulePrefs.edit()
|
||||
|
||||
@@ -15,9 +15,9 @@ 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,
|
||||
|
||||
@@ -48,7 +48,7 @@ open class DutyWidget : AppWidgetProvider() {
|
||||
val prefs = context.getSharedPreferences("widget", Context.MODE_PRIVATE)
|
||||
val editor = prefs.edit()
|
||||
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 if(kind==WidgetKind.MONTH||WidgetStyle.load(context,id).monthFit)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))
|
||||
@@ -68,7 +68,7 @@ open class DutyWidget : AppWidgetProvider() {
|
||||
internal const val TODAY = "kr.co.itosm.dutycalendar.TODAY"
|
||||
// 날짜 칸의 리소스 참조를 명시해 코드와 42칸 레이아웃의 순서를 맞춘다.
|
||||
// 문자열로 리소스를 찾지 않으므로 이름 변경이나 리소스 축소 때도 참조 관계를 추적할 수 있다.
|
||||
private val DAY_IDS = intArrayOf(
|
||||
internal val DAY_IDS = intArrayOf(
|
||||
R.id.day_0, R.id.day_1, R.id.day_2, R.id.day_3, R.id.day_4, R.id.day_5, R.id.day_6,
|
||||
R.id.day_7, R.id.day_8, R.id.day_9, R.id.day_10, R.id.day_11, R.id.day_12, R.id.day_13,
|
||||
R.id.day_14, R.id.day_15, R.id.day_16, R.id.day_17, R.id.day_18, R.id.day_19, R.id.day_20,
|
||||
@@ -77,7 +77,7 @@ open class DutyWidget : AppWidgetProvider() {
|
||||
R.id.day_35, R.id.day_36, R.id.day_37, R.id.day_38, R.id.day_39, R.id.day_40, R.id.day_41
|
||||
)
|
||||
// 저장된 월을 읽지 못해도 위젯을 비워 두지 않는다. 현재 달로 복구해 정상적인 표시를 유지한다.
|
||||
private fun selectedMonth(context: Context, id: Int): YearMonth = runCatching {
|
||||
internal fun selectedMonth(context: Context, id: Int): YearMonth = runCatching {
|
||||
YearMonth.parse(context.getSharedPreferences("widget", Context.MODE_PRIVATE).getString("month_$id", YearMonth.now().toString()))
|
||||
}.getOrDefault(YearMonth.now())
|
||||
|
||||
@@ -108,6 +108,7 @@ open class DutyWidget : AppWidgetProvider() {
|
||||
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,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(style.monthFit)return MonthWidgetViews.build(context,id,kind,width,height,style)
|
||||
if(kind!=WidgetKind.MONTH)return CompactWidgetViews.build(context,id,kind,width,height)
|
||||
val compact=style.compact(height)
|
||||
val density=context.resources.displayMetrics.density
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package kr.co.itosm.dutycalendar
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
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.RelativeSizeSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.util.TypedValue
|
||||
import android.widget.RemoteViews
|
||||
import java.time.LocalDate
|
||||
import java.time.YearMonth
|
||||
|
||||
/** 한 달 전체를 고른 위젯은 종류에 관계없이 같은 7열과 6주를 표시한다.
|
||||
* 홈 화면이 알려 준 실제 폭과 높이에서 제목과 이동 버튼의 공간을 먼저 뺀다.
|
||||
* 남은 칸에 날짜를 우선 배치하고 근무와 추가 정보는 들어갈 때만 붙인다.
|
||||
* 작은 위젯을 기존 큰 달력의 고정 여백으로 채우거나 마지막 주를 잘라 내지 않는다.
|
||||
*/
|
||||
object MonthWidgetViews {
|
||||
fun build(context:Context,id:Int,kind:WidgetKind,width:Int,height:Int,style:WidgetStyle):RemoteViews {
|
||||
val density=context.resources.displayMetrics.density
|
||||
val padding=if(width<180||height<180)3 else 8
|
||||
val short=height<180
|
||||
val header=if(short)18 else 28
|
||||
val weekday=if(short)12 else 20
|
||||
val footer=if(short)18 else 26
|
||||
val cellWidth=(width-padding*2)/7f
|
||||
val cellHeight=(height-padding*2-header-weekday-footer)/6f
|
||||
val showShift=cellHeight>=24f
|
||||
val showExtra=cellHeight>=47f&&cellWidth>=28f&&style.detail!="COMPACT"
|
||||
val lines=if(showExtra)3 else if(showShift)2 else 1
|
||||
// 글자 확대보다 한 달 전체를 지키는 것이 이 배치의 목적이다. 여유가 있는 크기에서는
|
||||
// 선택한 배율을 적용하고 좁은 칸에서는 폭과 높이의 상한을 함께 적용한다.
|
||||
// DIP 단위로 정한 실제 글자 크기는 휴대폰의 글꼴 배율이 커져도 날짜 칸을 넘지 않는다.
|
||||
val limit=minOf((cellWidth-2)/(if(showExtra)3.0f else if(showShift&&cellWidth>=24)2.2f else 1.85f),cellHeight/(lines*1.4f))
|
||||
val font=minOf(16f*style.scale/100f,limit).coerceAtLeast(1f)
|
||||
val month=DutyWidget.selectedMonth(context,id)
|
||||
val schedule=ScheduleStore.load(context)
|
||||
val today=LocalDate.now()
|
||||
val views=RemoteViews(context.packageName,R.layout.duty_widget_month_fit)
|
||||
views.setInt(R.id.widget_root,"setBackgroundColor",style.background)
|
||||
views.setViewPadding(R.id.widget_root,(padding*density).toInt(),(padding*density).toInt(),(padding*density).toInt(),(padding*density).toInt())
|
||||
val open=PendingIntent.getActivity(context,0,Intent(context,MainActivity::class.java),PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
views.setOnClickPendingIntent(R.id.widget_root,open)
|
||||
views.setTextViewText(R.id.widget_title,if(width<180)"${month.year}.${month.monthValue}" else "${month.year}년 ${month.monthValue}월")
|
||||
val titleFont=if(width<180||short)11f else 17f
|
||||
for(control in listOf(R.id.widget_title,R.id.widget_customize)) {
|
||||
views.setInt(control,"setHeight",(header*density).toInt())
|
||||
views.setTextColor(control,style.ink)
|
||||
views.setTextViewTextSize(control,TypedValue.COMPLEX_UNIT_DIP,if(control==R.id.widget_title)titleFont else 9f)
|
||||
}
|
||||
val customize=Intent(context,MainActivity::class.java).setData(Uri.parse("dutycalendar://widget/$id/style")).putExtra("widgetStyleId",id)
|
||||
views.setOnClickPendingIntent(R.id.widget_customize,PendingIntent.getActivity(context,id,customize,PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
|
||||
val headers=intArrayOf(R.id.widget_sun,R.id.widget_mon,R.id.widget_tue,R.id.widget_wed,R.id.widget_thu,R.id.widget_fri,R.id.widget_saturday)
|
||||
calendarWeekdays(schedule.weekStart).forEachIndexed { index,day ->
|
||||
val control=headers[index]
|
||||
views.setTextViewText(control,listOf("일","월","화","수","목","금","토")[day])
|
||||
views.setInt(control,"setHeight",(weekday*density).toInt())
|
||||
views.setTextViewTextSize(control,TypedValue.COMPLEX_UNIT_DIP,if(short)8f else 10f)
|
||||
views.setTextColor(control,when(day){0->style.color(0xFFBD5163.toInt());6->style.color(schedule.saturdayColor);else->style.muted})
|
||||
}
|
||||
listOf(R.id.widget_previous to DutyWidget.PREVIOUS,R.id.widget_today to DutyWidget.TODAY,R.id.widget_next to DutyWidget.NEXT).forEach { (control,action) ->
|
||||
views.setInt(control,"setHeight",(footer*density).toInt())
|
||||
views.setTextColor(control,style.ink)
|
||||
views.setTextViewTextSize(control,TypedValue.COMPLEX_UNIT_DIP,if(short)9f else 11f)
|
||||
// 같은 월간 모양이라도 원래 등록된 제공자로 보내야 작은 위젯의 이동 요청이 거절되지 않는다.
|
||||
val intent=Intent(context,kind.receiver).setAction(action).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id)
|
||||
views.setOnClickPendingIntent(control,PendingIntent.getBroadcast(context,id,intent,PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
|
||||
}
|
||||
val people=if(style.people)People.all(context) else emptyList()
|
||||
calendarDays(month,schedule.weekStart).forEachIndexed { index,date ->
|
||||
val shift=schedule.shiftOn(date)
|
||||
val holiday=Holidays.name(context,date)
|
||||
val events=PlannerStore.eventsOn(context,date)
|
||||
val anniversaries=Anniversaries.on(context,date)
|
||||
val names=if(style.people)WorkNames.on(context,date,schedule) else emptyList()
|
||||
val colleagues=People.onDuty(people,date)
|
||||
val lunar=if(style.lunar&&schedule.showLunar)LunarDates.label(context,date) else null
|
||||
val extra=names.firstOrNull()?.name
|
||||
?:holiday?.takeIf{style.holidays}
|
||||
?:lunar
|
||||
?:anniversaries.firstOrNull()?.takeIf{style.anniversaries}?.getJSONObject("data")?.getString("title")
|
||||
?:colleagues.firstOrNull()?.name
|
||||
val mark=style.eventMark&&(events.isNotEmpty()||anniversaries.isNotEmpty())
|
||||
val number=date.dayOfMonth.toString()+if(mark&&cellWidth>=24)"+" else ""
|
||||
val shiftLabel=if(cellWidth>=24)shift.shortTitle else when(shift){Shift.REGULAR->"근";else->shift.shortTitle.take(1)}
|
||||
// 음력의 마지막 숫자를 자르면 16일이 1일처럼 보인다. 이름은 줄일 수 있지만
|
||||
// 날짜 정보는 전체를 유지한다. 숫자 폭이 좁아 여섯 글자 음력도 같은 칸에 들어간다.
|
||||
val extraLabel=if(extra==lunar)extra else extra?.take(4)
|
||||
val label=number+(if(showShift)"\n$shiftLabel" else "")+(if(showExtra&&!extraLabel.isNullOrBlank())"\n$extraLabel" else "")
|
||||
val text=SpannableString(label)
|
||||
text.setSpan(StyleSpan(Typeface.BOLD),0,number.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
text.setSpan(ForegroundColorSpan(style.color(schedule.dateColor(date,holiday!=null))),0,number.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
if(showShift) {
|
||||
val end=number.length+1+shiftLabel.length
|
||||
text.setSpan(ForegroundColorSpan(style.color(schedule.shiftColor(date))),number.length+1,end,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
text.setSpan(RelativeSizeSpan(0.85f),number.length+1,end,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
if(end<label.length) {
|
||||
text.setSpan(RelativeSizeSpan(0.7f),end+1,label.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
text.setSpan(ForegroundColorSpan(names.firstOrNull()?.let{style.color(it.color)}?:style.muted),end+1,label.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
}
|
||||
}
|
||||
val outside=YearMonth.from(date)!=month
|
||||
if(outside)text.setSpan(ForegroundColorSpan(style.muted),0,label.length,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
val cell=DutyWidget.DAY_IDS[index]
|
||||
views.setTextViewText(cell,text)
|
||||
views.setTextViewTextSize(cell,TypedValue.COMPLEX_UNIT_DIP,font)
|
||||
views.setInt(cell,"setMaxLines",lines)
|
||||
views.setTextColor(cell,style.ink)
|
||||
// 날짜만 표시할 만큼 낮은 위젯은 당직 칸의 옅은 바탕으로 근무를 구분한다.
|
||||
// 오늘 강조와 날짜의 빨간색 선택은 각각 유지한다. 완전 투명 배경도 그대로 지원한다.
|
||||
val background=when {
|
||||
style.today&&date==today->if(style.dark)0x665679A1 else 0x5594ABC8
|
||||
!showShift&&shift==Shift.DUTY&&!outside->if(style.dark)0x665E3E29 else 0x44D18451
|
||||
else->Color.TRANSPARENT
|
||||
}
|
||||
views.setInt(cell,"setBackgroundColor",background)
|
||||
views.setContentDescription(cell,"${date.year}년 ${date.monthValue}월 ${date.dayOfMonth}일 ${shift.title}. ${holiday.orEmpty()} ${lunar.orEmpty()}. 이름 ${names.joinToString{it.name}}. 함께 당직 ${colleagues.joinToString{it.name}}. 일정 ${events.size}개. 기념일 ${anniversaries.joinToString{it.getJSONObject("data").getString("title")}}")
|
||||
val intent=Intent(context,MainActivity::class.java).setData(Uri.parse("dutycalendar://date/$date")).putExtra("selectedDate",date.toString())
|
||||
views.setOnClickPendingIntent(cell,PendingIntent.getActivity(context,id*1000+index+1,intent,PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
|
||||
}
|
||||
return views
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,8 @@ import org.json.JSONObject
|
||||
data class WidgetStyle(
|
||||
val transparency:Int=0, val dark:Boolean=false, val scale:Int=100, val detail:String="AUTO",
|
||||
val lunar:Boolean=true, val holidays:Boolean=true, val people:Boolean=true,
|
||||
val anniversaries:Boolean=true, val eventMark:Boolean=true, val today:Boolean=true
|
||||
val anniversaries:Boolean=true, val eventMark:Boolean=true, val today:Boolean=true,
|
||||
val monthFit:Boolean=false
|
||||
) {
|
||||
init { require(transparency in 0..100 && scale in listOf(80,100,120) && detail in listOf("AUTO","COMPACT","FULL")) }
|
||||
val background:Int get()=(((255*(100-transparency)+50)/100) shl 24) or (if(dark)0x182333 else 0xFFFEFA)
|
||||
@@ -31,9 +32,9 @@ data class WidgetStyle(
|
||||
return Color.rgb(bright(Color.red(original)),bright(Color.green(original)),bright(Color.blue(original)))
|
||||
}
|
||||
fun json()=JSONObject().put("transparency",transparency).put("dark",dark).put("scale",scale).put("detail",detail)
|
||||
.put("lunar",lunar).put("holidays",holidays).put("people",people).put("anniversaries",anniversaries).put("eventMark",eventMark).put("today",today)
|
||||
.put("lunar",lunar).put("holidays",holidays).put("people",people).put("anniversaries",anniversaries).put("eventMark",eventMark).put("today",today).put("monthFit",monthFit)
|
||||
companion object {
|
||||
fun parse(value:String)=JSONObject(value).let{WidgetStyle(it.optInt("transparency",0),it.optBoolean("dark",false),it.optInt("scale",100),it.optString("detail","AUTO"),it.optBoolean("lunar",true),it.optBoolean("holidays",true),it.optBoolean("people",true),it.optBoolean("anniversaries",true),it.optBoolean("eventMark",true),it.optBoolean("today",true))}
|
||||
fun parse(value:String)=JSONObject(value).let{WidgetStyle(it.optInt("transparency",0),it.optBoolean("dark",false),it.optInt("scale",100),it.optString("detail","AUTO"),it.optBoolean("lunar",true),it.optBoolean("holidays",true),it.optBoolean("people",true),it.optBoolean("anniversaries",true),it.optBoolean("eventMark",true),it.optBoolean("today",true),it.optBoolean("monthFit",false))}
|
||||
fun load(context:Context,id:Int?=null):WidgetStyle {
|
||||
val prefs=context.getSharedPreferences("widget_style",0)
|
||||
return runCatching{parse(prefs.getString(if(id!=null&&prefs.contains("style_$id"))"style_$id" else "default","{}")!!)}.getOrDefault(WidgetStyle())
|
||||
@@ -64,6 +65,8 @@ object WidgetStyleDialog {
|
||||
fun label(value:String)=TextView(activity).apply{text=value;textSize=13f;setPadding(0,dp(12),0,dp(5));form.addView(this)}
|
||||
fun spinner(title:String,values:List<String>,choice:Int):Spinner {label(title);return Spinner(activity).apply{adapter=ArrayAdapter(activity,android.R.layout.simple_spinner_dropdown_item,values);setSelection(choice);contentDescription=title;form.addView(this)}}
|
||||
label(if(id==null)"이 휴대폰의 모든 위젯에 적용합니다. 회원의 근무표와 다른 기기의 설정은 바뀌지 않습니다." else "선택한 위젯 하나에만 적용합니다. 다른 위젯의 모양은 유지합니다.")
|
||||
val monthFit=spinner("위젯에 보여 줄 화면",listOf("종류 기본 표시 · 월간·두 주·목록·오늘","한 달 전체 · 크기에 맞춰 축소"),if(original.monthFit)1 else 0)
|
||||
label("한 달 전체는 2×2·2×4·4×2·4×4에서 모두 선택할 수 있습니다. 작은 크기는 날짜를 우선 표시하고 공간이 늘어나면 근무와 추가 정보를 함께 보여 줍니다. 날짜를 누르면 상세 내용이 열립니다.")
|
||||
// 완전히 투명한 배경에서도 밝은 글자를 확인할 수 있도록 중간 명도의 미리보기 바탕을 둔다.
|
||||
val previewFrame=FrameLayout(activity).apply{setBackgroundColor(0xFF69798A.toInt());form.addView(this,LinearLayout.LayoutParams(-1,dp(86)))}
|
||||
val preview=TextView(activity).apply{text="2026년 11월\n20 당직 21 비번 22 일반";setPadding(dp(12),dp(12),dp(12),dp(12));previewFrame.addView(this,FrameLayout.LayoutParams(-1,-1))}
|
||||
@@ -82,16 +85,16 @@ object WidgetStyleDialog {
|
||||
val marks=choice("일정과 기념일의 + 표시",original.eventMark)
|
||||
val today=choice("오늘 날짜 배경 강조",original.today)
|
||||
label("간단한 배치는 추가 글줄을 숨깁니다. 날짜를 누르면 앱에서 전체 내용을 볼 수 있습니다. 투명한 배경에는 바탕화면과 대비되는 글자 색상을 선택하세요.")
|
||||
fun value()=WidgetStyle(opacity.progress,theme.selectedItemPosition==1,listOf(80,100,120)[size.selectedItemPosition],listOf("AUTO","COMPACT","FULL")[details.selectedItemPosition],lunar.isChecked,holidays.isChecked,people.isChecked,anniversaries.isChecked,marks.isChecked,today.isChecked)
|
||||
fun updatePreview(){val style=value();preview.setBackgroundColor(style.background);preview.setTextColor(style.ink);preview.textSize=16*style.scale/100f;opacityLabel.text="배경 투명도 ${style.transparency}%"}
|
||||
fun value()=WidgetStyle(opacity.progress,theme.selectedItemPosition==1,listOf(80,100,120)[size.selectedItemPosition],listOf("AUTO","COMPACT","FULL")[details.selectedItemPosition],lunar.isChecked,holidays.isChecked,people.isChecked,anniversaries.isChecked,marks.isChecked,today.isChecked,monthFit.selectedItemPosition==1)
|
||||
fun updatePreview(){val style=value();preview.setBackgroundColor(style.background);preview.setTextColor(style.ink);preview.textSize=16*style.scale/100f;preview.text=if(style.monthFit)"한 달 전체\n날짜 우선 · 크기에 맞춰 근무 표시" else "2026년 11월\n20 당직 21 비번 22 일반";opacityLabel.text="배경 투명도 ${style.transparency}%"}
|
||||
val listener=object:AdapterView.OnItemSelectedListener{override fun onNothingSelected(parent:AdapterView<*>?){};override fun onItemSelected(parent:AdapterView<*>?,view:View?,position:Int,rowId:Long){updatePreview()}}
|
||||
theme.onItemSelectedListener=listener;size.onItemSelectedListener=listener
|
||||
theme.onItemSelectedListener=listener;size.onItemSelectedListener=listener;monthFit.onItemSelectedListener=listener
|
||||
opacity.setOnSeekBarChangeListener(object:SeekBar.OnSeekBarChangeListener{override fun onStartTrackingTouch(bar:SeekBar){};override fun onStopTrackingTouch(bar:SeekBar){};override fun onProgressChanged(bar:SeekBar,progress:Int,fromUser:Boolean){updatePreview()}})
|
||||
val dialog=AlertDialog.Builder(activity).setTitle("위젯 꾸미기").setView(ScrollView(activity).apply{addView(form)})
|
||||
.setNegativeButton("취소",null).setNeutralButton("기본값",null).setPositiveButton("저장",null).create()
|
||||
dialog.setOnShowListener{
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener{runCatching{WidgetStyle.save(activity,id,value())}.onSuccess{dialog.dismiss();Toast.makeText(activity,"위젯 모양을 저장했습니다.",Toast.LENGTH_SHORT).show()}.onFailure{Toast.makeText(activity,it.message,Toast.LENGTH_LONG).show()}}
|
||||
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener{opacity.progress=0;theme.setSelection(0);size.setSelection(1);details.setSelection(0);listOf(lunar,holidays,people,anniversaries,marks,today).forEach{it.isChecked=true};updatePreview()}
|
||||
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener{opacity.progress=0;theme.setSelection(0);size.setSelection(1);details.setSelection(0);monthFit.setSelection(0);listOf(lunar,holidays,people,anniversaries,marks,today).forEach{it.isChecked=true};updatePreview()}
|
||||
}
|
||||
dialog.show();updatePreview()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 실제 높이를 여섯 주에 나누어 한 달 전체를 표시한다. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget_root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" >
|
||||
<TextView android:id="@+id/widget_title" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_customize" android:layout_width="32dp" android:layout_height="wrap_content" android:text="@string/widget_customize" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" >
|
||||
<TextView android:id="@+id/widget_sun" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/week_sun" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_mon" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/week_mon" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_tue" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/week_tue" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_wed" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/week_wed" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_thu" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/week_thu" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_fri" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/week_fri" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_saturday" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/week_sat" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/day_0" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_1" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_2" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_3" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_4" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_5" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_6" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/day_7" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_8" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_9" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_10" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_11" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_12" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_13" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/day_14" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_15" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_16" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_17" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_18" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_19" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_20" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/day_21" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_22" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_23" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_24" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_25" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_26" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_27" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/day_28" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_29" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_30" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_31" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_32" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_33" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_34" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<TextView android:id="@+id/day_35" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_36" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_37" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_38" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_39" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_40" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/day_41" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:text="" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" >
|
||||
<TextView android:id="@+id/widget_previous" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/widget_previous" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_today" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/widget_today" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
<TextView android:id="@+id/widget_next" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/widget_next" android:gravity="center" android:includeFontPadding="false" android:maxLines="1" android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -17,10 +17,10 @@
|
||||
<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_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>
|
||||
|
||||
+11
-1
@@ -1,6 +1,6 @@
|
||||
# 당직근무 설치와 사용법
|
||||
|
||||
제작자 블리어 (이창현) · 0.13.0
|
||||
제작자 블리어 (이창현) · 0.13.1
|
||||
|
||||
## 설치와 처음 설정
|
||||
|
||||
@@ -130,3 +130,13 @@
|
||||
앱은 기기에 저장한 근무와 일정 및 기념일을 계속 보여 줍니다. 새로 입력한 내용도 먼저 기기에 저장하고 연결이 돌아오면 전송합니다. 월별 수신은 30일 기준이며 **새로 불러오기**나 실제 변경이 확인된 경우에도 갱신합니다. 앱을 열어 둔 동안에는 변경 표식을 기다립니다. 앱이 닫힌 상태의 즉시 푸시 방식은 아닙니다.
|
||||
|
||||
공휴일 제공처가 응답하지 않으면 서버의 마지막 정상 DB를 사용합니다. 앱이 서버에 연결할 수 없으면 기기에 보관한 자료를 사용합니다. 임시공휴일은 제공처에 반영된 뒤 갱신됩니다.
|
||||
|
||||
## 작은 위젯에서도 한 달 전체 보기
|
||||
|
||||
0.13.1부터 2×2·2×4·4×2·4×4 위젯에서 한 달 전체 표시를 선택할 수 있습니다. **위젯의 꾸미기 → 위젯에 보여 줄 화면 → 한 달 전체 · 크기에 맞춰 축소 → 저장** 순서로 선택합니다. 앱의 **옵션 → 위젯 꾸미기**에서도 위젯 하나 또는 전체에 적용할 수 있습니다.
|
||||
|
||||
7열과 6주를 유지하며 실제 홈 화면 크기에 맞춰 글자를 조절합니다. 아주 작은 크기에서는 날짜만 보이고 당직 칸에 옅은 배경을 표시합니다. 높이가 늘어나면 근무가 나타나며 좁은 칸은 당·비·근·주·오·야·휴로 줄여 표시합니다. 충분한 공간에서는 이름과 공휴일 및 음력·기념일 중 한 항목을 추가합니다. 일반근무 아래 이름을 가장 먼저 표시합니다. 세부 내용은 날짜를 눌러 확인합니다.
|
||||
|
||||
이전·다음은 한 달씩 이동합니다. 오늘은 현재 달로 돌아옵니다. 월요일·일요일 주 시작과 날짜 색상 및 배경 투명도는 기존 선택을 따릅니다. 글자 확대를 선택해도 날짜가 잘리지 않도록 작은 크기에서는 배율의 상한을 적용합니다. 실제 크기는 홈 화면 앱의 격자와 여백에 따라 달라집니다.
|
||||
|
||||
**종류 기본 표시**로 바꾸면 기존 월간·두 주·근무 목록·오늘 배치로 돌아갑니다. 업데이트만으로 기존 배치를 바꾸지 않습니다. 위젯 모양은 기기별 설정이며 서버의 개인 근무표와 다른 기기는 변경하지 않습니다.
|
||||
+13
-1
@@ -1,6 +1,6 @@
|
||||
# Android Studio로 당직근무 만들기
|
||||
|
||||
제작자 블리어 (이창현) · 0.13.0
|
||||
제작자 블리어 (이창현) · 0.13.1
|
||||
|
||||
## 준비할 환경
|
||||
|
||||
@@ -116,3 +116,15 @@ Android `CalendarMirror`는 사용자 선택 달력에 지난 30일부터 앞으
|
||||
서버 `calendar_export.py`는 같은 자료를 RFC 5545 형식으로 만든다. 하루 종일 일정은 종료일을 하루 뒤로 쓰고 시간 일정은 한국 시간을 UTC로 변환한다. 한글은 UTF-8 75바이트 이내로 줄을 접으며 제목과 메모의 줄바꿈 및 구분 문자를 이스케이프한다. UID는 원본과 회차 날짜로 고정하고 내용이 바뀌면 SEQUENCE와 ETag를 갱신한다. 구독 응답 전 회원 활성 상태와 공유 범위를 다시 확인한다.
|
||||
|
||||
관련 기준: [Android Calendar Provider](https://developer.android.com/identity/providers/calendar-provider) · [iCalendar RFC 5545](https://www.rfc-editor.org/rfc/rfc5545.html)
|
||||
|
||||
## 0.13.1 위젯의 크기 맞춤 월간 배치
|
||||
|
||||
WidgetStyle의 monthFit은 기기별 위젯 모양에 저장하며 기본값은 false다. 값이 없는 이전 저장본은 기존 모양을 유지한다. DutyWidget은 크기 정보를 받은 뒤 이 값이 켜져 있으면 제공자의 종류와 관계없이 MonthWidgetViews로 전달한다. 등록된 네 제공자와 기존 위젯 번호는 유지한다.
|
||||
|
||||
duty_widget_month_fit.xml은 고정된 7열과 6개의 가중치 행을 갖는다. 실제 높이에서 제목과 요일 및 이동 버튼을 빼고 날짜 칸의 높이와 폭으로 글줄 수와 글자 크기를 정한다. 휴대폰 글꼴 배율이 커도 날짜가 영역 밖으로 나가지 않도록 실제 크기에 맞춘 DIP 단위를 사용한다. 위젯의 80·100·120% 선택은 가능한 범위 안에서 적용한다.
|
||||
|
||||
월 이동은 monthFit도 월간으로 판단한다. PendingIntent는 실제 등록된 제공자로 보내고 위젯 번호별 month 키를 사용한다. 목록 배치의 offset 키와 분리해 다른 위젯의 날짜를 바꾸지 않는다. 오늘 버튼은 두 키를 지우고 현재 달로 돌아간다.
|
||||
|
||||
WidgetAppearanceCheck는 실제 RemoteViews를 펼쳐 네 종류와 주 시작 두 가지 및 세 배율과 최소·확장 크기에서 42칸의 날짜와 글자 높이 및 생략 여부를 검사한다. 31일과 마지막 주 및 연말 월 이동과 기존 설정 복원도 확인한다.
|
||||
|
||||
기준 문서: [Android 위젯의 유연한 크기와 배치](https://developer.android.com/develop/ui/views/appwidgets/layouts)
|
||||
+1
-1
@@ -614,7 +614,7 @@ company.setup(app, identity, payload, db, throttle, changed, snapshot)
|
||||
|
||||
@app.get(PREFIX + "/health")
|
||||
async def health():
|
||||
return {"status": "ok", "version": "0.13.0"}
|
||||
return {"status": "ok", "version": "0.13.1"}
|
||||
|
||||
|
||||
@app.get(PREFIX + "/download")
|
||||
|
||||
+8
-10
@@ -1,15 +1,13 @@
|
||||
{
|
||||
"appVersion": "0.13.0",
|
||||
"appVersionCode": 17,
|
||||
"appVersion": "0.13.1",
|
||||
"appVersionCode": 18,
|
||||
"webVersion": "2026-11-21.3",
|
||||
"apkFile": "duty-calendar-0.13.0.apk",
|
||||
"apkFile": "duty-calendar-0.13.1.apk",
|
||||
"notes": [
|
||||
"설정을 당직 기초와 달력 표시 및 이름 표시와 일정·알림 및 달력 연동·공유와 위젯 꾸미기로 나눴습니다.",
|
||||
"일반근무 아래 이름을 작게 표시합니다. 다른 사람의 당직 주기와 선택 요일 및 며칠 간격을 설정할 수 있습니다.",
|
||||
"선택한 휴대폰 기본 달력에 근무와 일정을 자동 반영합니다. 로그인 없이도 나의 근무표를 보낼 수 있습니다.",
|
||||
"회원은 공유 범위를 골라 다른 달력의 구독 주소를 만들거나 ICS 파일로 내보낼 수 있습니다.",
|
||||
"다가오는 일정과 기념일을 제목이나 메모로 찾을 수 있습니다."
|
||||
"2×2·2×4·4×2·4×4 위젯에서 한 달 전체를 크기에 맞춰 축소하는 표시를 선택할 수 있습니다.",
|
||||
"위젯 꾸미기의 보여 줄 화면에서 한 달 전체를 선택하세요. 작은 크기는 날짜를 우선 표시하고 여유 공간에는 근무와 추가 정보가 나타납니다.",
|
||||
"주 시작과 날짜 색상 및 투명도를 유지하며 위젯별로 이전 달과 다음 달 및 오늘 이동을 지원합니다."
|
||||
],
|
||||
"apkBytes": 1097859,
|
||||
"apkSha256": "c2434c725cf7571637d020bd08ee122191fb57b58b02acec262ac7a856a17485"
|
||||
"apkBytes": 1331507,
|
||||
"apkSha256": "fe52a6fddee65f0ae33a4b83f0591f990de8b17b51591e50ce69cc6641280be9"
|
||||
}
|
||||
@@ -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.13.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.13.1</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>
|
||||
|
||||
Reference in new issue
Block a user