사용자 지시(2026-11-26): 연차는 숫자가 빨간색으로 나오고 반차는 파란색으로, +는 지우기. - 하루를 쉬는 휴가와 병가(Shift.fullLeave · WorkPlan.fullLeave)를 쓴 날은 날짜 숫자가 빨간색이다. 요일과 공휴일 및 표시 선택보다 우선한다. 앱 달력·위젯·근무표 그림·웹 달력이 같다. - 반차(HALF_LEAVE)를 더했다. 반나절 근무로 세어 예정시간 기본값은 4시간이고 날짜 숫자는 파란색이다. 근무 순서 이름은 연차처럼 남는다. - 위젯의 날짜 옆 + 표시를 뺐다. 꾸미기 칸(eventMark)은 목록·오늘 위젯의 일정 개수 글자만 켜고 끈다. - 기기 시험 WidgetAppearanceCheck에 + 없음과 숫자 색 단계를 더하고 기기에 남은 날짜별 변경을 비우고 시험한다. - 앱 0.15.7 / 설치 번호 31. APK 877582바이트, SHA-256 9ac008956635a19e0ffae5c5ab79ccdcc6c3967da6533bc739c360372477c6bb
288 lines
25 KiB
Kotlin
288 lines
25 KiB
Kotlin
package kr.co.itosm.dutycalendar
|
||
|
||
import android.app.Activity
|
||
import android.app.Instrumentation
|
||
import android.appwidget.AppWidgetManager
|
||
import android.graphics.Color
|
||
import android.graphics.drawable.ColorDrawable
|
||
import android.os.Bundle
|
||
import android.view.View
|
||
import android.widget.FrameLayout
|
||
import android.widget.TextView
|
||
|
||
/** 홈 화면이 사용하는 RemoteViews를 실제 기기에서 펼쳐 확인한다.
|
||
* 개별 설정과 전체 적용을 바꾼 뒤에는 기존 값을 복원해 검증이 사용자의 위젯에 남지 않게 한다.
|
||
*/
|
||
object WidgetAppearanceCheck {
|
||
fun run(checker:Instrumentation) {
|
||
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()
|
||
val schedulePrefs=app.getSharedPreferences("schedule",0)
|
||
val originalWeekStart=schedulePrefs.all["weekStart"]
|
||
val originalRegularName=schedulePrefs.all["regularName"]
|
||
val originalHideRegular=schedulePrefs.all["hideRegular"]
|
||
val originalNames=schedulePrefs.all["names"]
|
||
val originalNameDisplay=schedulePrefs.all["nameDisplay"]
|
||
val originalNameModes=schedulePrefs.all["nameModes"]
|
||
val originalWorkPlan=schedulePrefs.all["workPlan"]
|
||
val plannerPrefs=app.getSharedPreferences("planner",0)
|
||
val originalPlanner=plannerPrefs.all.toMap()
|
||
var success=false
|
||
var message=""
|
||
try {
|
||
// 기기에 남은 날짜별 변경(연차 등)이 있으면 이름 표시가 달라지므로 시험 동안 비우고 끝나면 되돌린다.
|
||
check(schedulePrefs.edit().remove("workPlan").commit());ScheduleStore.load(app)
|
||
val dark=WidgetStyle(transparency=100,dark=true,scale=120,detail="COMPACT",today=false)
|
||
WidgetStyle.save(app,99001,dark)
|
||
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 {
|
||
fun render(id:Int,height:Int):View {
|
||
val options=Bundle().apply { putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,height);putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,height) }
|
||
return DutyWidget.buildViews(app,id,options).apply(app,FrameLayout(app))
|
||
}
|
||
val small=render(99001,250)
|
||
check(Color.alpha((small.background as ColorDrawable).color)==0)
|
||
check(small.findViewById<TextView>(R.id.day_0).maxLines==2)
|
||
check(small.findViewById<TextView>(R.id.widget_title).currentTextColor==dark.ink)
|
||
check(small.findViewById<TextView>(R.id.day_0).text.toString().lines().size==2)
|
||
check(Color.alpha((small.findViewById<View>(R.id.day_20).background as ColorDrawable).color)==0)
|
||
val full=render(99002,500)
|
||
check(Color.alpha((full.background as ColorDrawable).color)==153)
|
||
check(full.findViewById<TextView>(R.id.day_0).maxLines==7)
|
||
WidgetStyle.save(app,null,WidgetStyle())
|
||
check(!prefs.contains("style_99001")&&!prefs.contains("style_99002"))
|
||
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)
|
||
// 주 시작이 달라지면 머리글과 날짜가 함께 이동해야 한다. 주말 색은 실제 요일에 둔다.
|
||
for(start in 0..1) {
|
||
val current=ScheduleStore.load(app)
|
||
ScheduleStore.saveDisplay(app,current.dutyAsWeekday,current.showLunar,current.offAsHoliday,start,fromSync=true)
|
||
check(ScheduleStore.load(app).weekStart==start)
|
||
val month=render(99001,500)
|
||
check(month.findViewById<TextView>(R.id.widget_sun).text==if(start==1)"월" else "일")
|
||
check(month.findViewById<TextView>(R.id.widget_saturday).text==if(start==1)"일" else "토")
|
||
val first=calendarDays(java.time.YearMonth.now(),start).first()
|
||
check(month.findViewById<TextView>(R.id.day_0).contentDescription.startsWith("${first.monthValue}월 ${first.dayOfMonth}일"))
|
||
positions.edit().remove("offset_99003").commit()
|
||
check(CompactWidgetViews.start(app,99003,WidgetKind.WIDE).dayOfWeek.value==if(start==1)1 else 7)
|
||
val sunHeader=month.findViewById<TextView>(if(start==1)R.id.widget_saturday else R.id.widget_sun)
|
||
check(sunHeader.currentTextColor==WidgetStyle().color(0xFFBD5163.toInt()))
|
||
}
|
||
// 0.15.3부터 옛 '일반근무 이름' 값이 남아 있어도 위젯 칸은 기본 이름(일반)이다. 숨기기는 그대로 쓴다.
|
||
if(ScheduleStore.isConfigured(app)) for((name,hide) in listOf("사무실" to false,"사무실" to true,"" to false)) {
|
||
val current=ScheduleStore.load(app)
|
||
ScheduleStore.saveDisplay(app,current.dutyAsWeekday,current.showLunar,current.offAsHoliday,current.weekStart,fromSync=true,regularName=name,hideRegular=hide)
|
||
val schedule=ScheduleStore.load(app)
|
||
val month=render(99001,500)
|
||
val dates=calendarDays(java.time.YearMonth.now(),schedule.weekStart)
|
||
val expected="일반"
|
||
DutyWidget.DAY_IDS.forEachIndexed { index,cellId ->
|
||
val shift=schedule.shiftOn(dates[index])
|
||
val lines=month.findViewById<TextView>(cellId).text.toString().lines()
|
||
// 근무 순서 이름 줄을 '이름만'으로 고른 날은 근무 글자 자리에 이름(칸 폭에 맞게 앞 글자)이 보인다.
|
||
val slot=ShiftNames.slotView(schedule,dates[index])
|
||
if(slot.nameOnly) { check(lines.any{it.isNotBlank()&&slot.name.startsWith(it)}){"위젯 이름만 칸: $lines (기대 ${slot.name})"}; continue }
|
||
if(hide&&shift==Shift.REGULAR) {
|
||
// 숨기기를 켜면 근무 글자 없이 빈 줄만 남아 날짜 칸 높이가 그대로다.
|
||
check(expected !in lines && " " in lines){"위젯 일반근무 숨기기: $lines"}
|
||
continue
|
||
}
|
||
check(shift.shortTitle in lines){"위젯 날짜 $index 근무 이름: $lines (기대 ${shift.shortTitle})"}
|
||
if(shift==Shift.REGULAR)check(expected in lines){"위젯 일반근무 이름: $lines (기대 $expected)"}
|
||
}
|
||
}
|
||
// 근무 순서 자리 이름: 둘 다면 근무 아래 이름 줄, 이름만이면 근무 자리에 이름, 근무만이면 이름 없음.
|
||
if(ScheduleStore.isConfigured(app)) {
|
||
val current=ScheduleStore.load(app)
|
||
val names=List(current.pattern.size){"가$it"}
|
||
// 먼저 줄마다 고른 값 없이 예전 공통 선택 세 가지를 본다.
|
||
ScheduleStore.save(app,current.copy(names=names,nameModes=emptyList()),fromSync=true)
|
||
for(mode in ShiftNames.NAME_DISPLAYS) {
|
||
val now=ScheduleStore.load(app)
|
||
ScheduleStore.saveDisplay(app,now.dutyAsWeekday,now.showLunar,now.offAsHoliday,now.weekStart,fromSync=true,nameDisplay=mode)
|
||
val schedule=ScheduleStore.load(app)
|
||
val month=render(99001,500)
|
||
val dates=calendarDays(java.time.YearMonth.now(),schedule.weekStart)
|
||
DutyWidget.DAY_IDS.forEachIndexed { index,cellId ->
|
||
val lines=month.findViewById<TextView>(cellId).text.toString().lines()
|
||
val name=schedule.nameOn(dates[index])
|
||
if(name.isEmpty())return@forEachIndexed
|
||
when(mode) {
|
||
"both"->check(schedule.shiftOn(dates[index]).shortTitle in lines && name in lines){"위젯 순서 이름(둘 다): $lines"}
|
||
"name"->check(name in lines && schedule.shiftOn(dates[index]).shortTitle !in lines){"위젯 순서 이름(이름만): $lines"}
|
||
else->check(name !in lines){"위젯 순서 이름(근무만): $lines"}
|
||
}
|
||
}
|
||
}
|
||
// 0.15.4: 이름 줄마다 고른 표시가 예전 공통 선택보다 앞선다.
|
||
val now=ScheduleStore.load(app)
|
||
ScheduleStore.saveDisplay(app,now.dutyAsWeekday,now.showLunar,now.offAsHoliday,now.weekStart,fromSync=true,nameDisplay="both")
|
||
ScheduleStore.save(app,ScheduleStore.load(app).copy(nameModes=List(now.pattern.size){ShiftNames.NAME_DISPLAYS[it%3]}),fromSync=true)
|
||
val perRow=ScheduleStore.load(app)
|
||
val rowMonth=render(99001,500)
|
||
val rowDates=calendarDays(java.time.YearMonth.now(),perRow.weekStart)
|
||
val seen=mutableSetOf<String>()
|
||
DutyWidget.DAY_IDS.forEachIndexed { index,cellId ->
|
||
val lines=rowMonth.findViewById<TextView>(cellId).text.toString().lines()
|
||
val name=perRow.nameOn(rowDates[index])
|
||
if(name.isEmpty())return@forEachIndexed
|
||
val mode=perRow.nameModeOn(rowDates[index]); seen+=mode
|
||
when(mode) {
|
||
"both"->check(perRow.shiftOn(rowDates[index]).shortTitle in lines && name in lines){"위젯 줄마다 표시(둘 다): $lines"}
|
||
"name"->check(name in lines && perRow.shiftOn(rowDates[index]).shortTitle !in lines){"위젯 줄마다 표시(이름만): $lines"}
|
||
else->check(name !in lines){"위젯 줄마다 표시(근무만): $lines"}
|
||
}
|
||
}
|
||
if(perRow.pattern.size>=3)check(seen.size==3){"줄마다 표시 세 가지가 모두 나오지 않음: $seen"}
|
||
}
|
||
// 제공자 등록만 확인하지 않고 최소 크기의 실제 글줄이 영역 안에 들어오는지도 확인한다.
|
||
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 rowIds=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)
|
||
for(cellId in when(kind){WidgetKind.TODAY->intArrayOf(R.id.compact_shift);WidgetKind.TALL->rowIds.copyOf(7);else->rowIds}) {
|
||
val cell=root.findViewById<TextView>(cellId)
|
||
check(cell.layout!=null&&cell.layout.height<=cell.height) { "${kind.title} 배율 $scale 글자 높이 초과: ${cell.layout.height}/${cell.height} ${cell.text}" }
|
||
}
|
||
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()==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)
|
||
}
|
||
}
|
||
// 0.15.7: 일정이 있는 날도 날짜 뒤에 + 를 붙이지 않는다. 휴가를 쓴 날의 숫자는 빨강, 반차는 파랑이다.
|
||
run {
|
||
val month=java.time.YearMonth.now();val leave=month.atDay(10);val half=month.atDay(11)
|
||
val now=ScheduleStore.load(app)
|
||
ScheduleStore.save(app,now.copy(workPlan=WorkPlan(overrides=mapOf(leave to DayOverride(Shift.LEAVE),half to DayOverride(Shift.HALF_LEAVE)))),fromSync=true)
|
||
PlannerStore.put(app,java.util.UUID.randomUUID().toString(),"event",org.json.JSONObject().put("title","표시 검증").put("notes","").put("category","GENERAL").put("date",month.atDay(1).toString()).put("endDate",month.plusMonths(1).atEndOfMonth().toString()).put("allDay",true).put("startTime","09:00").put("endTime","10:00").put("repeat","NONE").put("repeatUntil","").put("reminderMinutes",-1))
|
||
val schedule=ScheduleStore.load(app);val dates=calendarDays(month,schedule.weekStart)
|
||
check(CalendarSnapshot.load(app).eventsOn(leave).isNotEmpty())
|
||
for(fit in listOf(false,true))for(kind in WidgetKind.entries) {
|
||
WidgetStyle.save(app,99005,WidgetStyle(monthFit=fit))
|
||
val options=Bundle().apply {
|
||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,320);putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,320)
|
||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,440);putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,440)
|
||
}
|
||
val root=DutyWidget.buildViews(app,99005,options,kind).apply(app,FrameLayout(app))
|
||
val dayIds=DutyWidget.DAY_IDS+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)
|
||
for(cellId in dayIds){val cell=root.findViewById<TextView>(cellId)?:continue;check('+' !in cell.text){"${kind.title} 날짜 옆 + 표시 남음: ${cell.text}"}}
|
||
if(fit||kind==WidgetKind.MONTH)for((day,color) in listOf(leave to 0xFFBD5163.toInt(),half to 0xFF365FAD.toInt())) {
|
||
val text=root.findViewById<TextView>(DutyWidget.DAY_IDS[dates.indexOf(day)]).text as android.text.Spanned
|
||
val actual=text.getSpans(0,1,android.text.style.ForegroundColorSpan::class.java).map{it.foregroundColor}
|
||
check(actual==listOf(color)){"${kind.title} $day 숫자 색: ${actual.map{Integer.toHexString(it)}}"}
|
||
}
|
||
}
|
||
}
|
||
// 각 제공자의 월 이동은 월간 선택을 따르며 기존 목록의 주 이동 값은 건드리지 않는다.
|
||
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
|
||
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="근무 순서 이름 세 가지 표시와 줄마다 표시 및 옛 일반근무 이름 무시와 일반근무 글자 숨기기 확인. 네 종류의 기본 배치와 한 달 전체 선택 확인. 월·일 시작과 80·100·120% 및 최소·확장 크기에서 42칸과 모든 날짜 및 마지막 주의 글자 높이와 생략 없음 확인. 날짜 옆 + 없음과 연차 빨강·반차 파랑 숫자 확인. 월 이동과 연말 넘김 및 오늘 복귀와 개별 저장 및 구버전 설정 보존 확인."
|
||
} catch(error:Throwable) {message=error.stackTraceToString()}
|
||
finally {
|
||
val scheduleRestore=schedulePrefs.edit()
|
||
if(originalWeekStart is Int)scheduleRestore.putInt("weekStart",originalWeekStart) else scheduleRestore.remove("weekStart")
|
||
if(originalRegularName is String)scheduleRestore.putString("regularName",originalRegularName) else scheduleRestore.remove("regularName")
|
||
if(originalHideRegular is Boolean)scheduleRestore.putBoolean("hideRegular",originalHideRegular) else scheduleRestore.remove("hideRegular")
|
||
if(originalNames is String)scheduleRestore.putString("names",originalNames) else scheduleRestore.remove("names")
|
||
if(originalNameDisplay is String)scheduleRestore.putString("nameDisplay",originalNameDisplay) else scheduleRestore.remove("nameDisplay")
|
||
if(originalNameModes is String)scheduleRestore.putString("nameModes",originalNameModes) else scheduleRestore.remove("nameModes")
|
||
if(originalWorkPlan is String)scheduleRestore.putString("workPlan",originalWorkPlan) else scheduleRestore.remove("workPlan")
|
||
check(scheduleRestore.commit());ScheduleStore.load(app)
|
||
val plannerRestore=plannerPrefs.edit().clear()
|
||
originalPlanner.forEach{(key,value)->when(value){is String->plannerRestore.putString(key,value);is Boolean->plannerRestore.putBoolean(key,value);is Int->plannerRestore.putInt(key,value);is Long->plannerRestore.putLong(key,value);is Float->plannerRestore.putFloat(key,value)}}
|
||
check(plannerRestore.commit())
|
||
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)})
|
||
}
|
||
}
|