당직근무 0.10.0 소스와 위젯 꾸미기 및 제작 매뉴얼 공개
위젯별 투명도와 밝은·어두운 색상 및 글자 크기와 표시 항목을 추가했다. 모든 위젯에 함께 적용하는 기본값과 개별 설정을 구분하고 크기에 따라 배치를 바꾼다. 포럼에 APK와 전체 소스 및 사용법과 제작 매뉴얼을 함께 배포한다. 앱 단위 검사 34개와 서버 검사 63개 및 웹 날짜·업데이트 검사 통과. 공개 소스에서 APK 빌드와 정적 검사 오류 0개 확인. 경고는 69개다. Android 16 가상 기기에서 기존 앱 위에 설치하고 투명 위젯과 큰 글자 및 RemoteViews 검사를 확인했다. 실제 휴대폰과 다른 홈 화면 앱의 절전·크기 동작은 별도 확인이 필요하다. 회원 DB와 인증 정보 및 배포 서명 키와 내부 운영 기록은 공개 자료에 포함하지 않았다.
This commit is contained in:
commit
8112721fa8
96 files changed
+7495
No files matched your search
@@ -0,0 +1,63 @@
|
||||
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()
|
||||
var success=false
|
||||
var message=""
|
||||
try {
|
||||
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)
|
||||
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)
|
||||
} catch(error:Throwable){failure=error}
|
||||
}
|
||||
failure?.let{throw it}
|
||||
success=true
|
||||
message="위젯별 설정 분리와 전체 적용 및 투명도 100%·40% 확인. 실제 RemoteViews의 색상과 간단·자세한 배치 및 크기 자동 전환 확인."
|
||||
} 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)
|
||||
}
|
||||
checker.finish(if(success)Activity.RESULT_OK else Activity.RESULT_CANCELED,Bundle().apply{putString("stream",message)})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user