Compare commits

...
5 Commits
15 changed files with 399 additions and 96 deletions

No files matched your search

+154
View File
@@ -3730,5 +3730,159 @@
"sort_order": 51,
"priority": 3,
"months": []
},
{
"code": "umbrella_lost",
"name": "우산분실각",
"icon": "umbrella",
"category": 4,
"is_fun": false,
"is_core": false,
"has_detail": true,
"description": "오전 9시~밤 10시, 비가 그쳐서 우산을 두고 오기 쉬운 정도",
"windows": [
{
"from": 9,
"to": 11
},
{
"from": 11,
"to": 13
},
{
"from": 13,
"to": 15
},
{
"from": 15,
"to": 17
},
{
"from": 17,
"to": 19
},
{
"from": 19,
"to": 22
}
],
"weight_temp": 0,
"weight_rain": 80,
"weight_wind": 0,
"weight_humidity": 0,
"weight_air": 0,
"weight_uv": 0,
"weight_sun": 0,
"weight_view": 0,
"weight_time": 20,
"factor_rules": {
"temp": {
"type": "range",
"lo": 0,
"hi": 40
},
"rain": {
"dir": "dry"
},
"wind": {
"type": "ignore"
},
"humidity": {
"type": "ignore"
},
"time": {
"type": "fixed",
"value": 100
}
},
"zero_rules": [
{
"field": "rain_before",
"op": "==",
"value": "no"
},
{
"field": "rain",
"op": "==",
"value": "yes"
}
],
"limit_description": "비가 언제 그칠지는 예보만큼만 맞아요",
"sentences": {
"0": "우산 두고 올 일 없는 날이에요.",
"30": "비가 오락가락해요. 우산 손에 꼭 쥐어요.",
"60": "비가 그쳤어요. 카페·버스에 우산 두고 오기 딱 좋아요.",
"80": "비 끝, 하늘 맑음! 일어날 때 우산부터 챙겨요 ☂️"
},
"sort_order": 52,
"priority": 2,
"months": []
},
{
"code": "traffic",
"name": "교통체증각",
"icon": "drive",
"category": 4,
"is_fun": false,
"is_core": false,
"has_detail": true,
"description": "출퇴근길 비·눈·추위로 차가 막히는 정도",
"windows": [
{
"from": 7,
"to": 10
},
{
"from": 17,
"to": 20
}
],
"weight_temp": 10,
"weight_rain": 70,
"weight_wind": 0,
"weight_humidity": 0,
"weight_air": 0,
"weight_uv": 0,
"weight_sun": 0,
"weight_view": 0,
"weight_time": 20,
"factor_rules": {
"temp": {
"type": "lower",
"zero": 10,
"full": -5
},
"rain": {
"dir": "wet"
},
"wind": {
"type": "ignore"
},
"humidity": {
"type": "ignore"
},
"time": {
"type": "weekday",
"mon": 100,
"tue": 100,
"wed": 100,
"thu": 100,
"fri": 100,
"sat": 40,
"sun": 40,
"holiday": 30
}
},
"zero_rules": [],
"limit_description": "사고·공사·행사로 막히는 건 반영하지 못해요",
"sentences": {
"0": "길이 수월해요. 평소처럼 나가요.",
"30": "조금 더뎌 수 있어요. 10분 일찍!",
"60": "빗길에 차가 막혀요. 대중교통이 나아요.",
"80": "출퇴근길 주차장 예상! 30분 일찍 나서요 🚗"
},
"sort_order": 53,
"priority": 2,
"months": []
}
]
+6 -1
View File
@@ -56,6 +56,7 @@ class Context:
lookahead_rain_prob: int
moon_note: str = "" # 별보기각 근거 문구: 그날 밤 달 모양·보이는 시간
sunrise_score: Optional[int] = None # 그날 아침 일출 하늘 점수 (해돋이각)
rain_hours: frozenset[int] = frozenset() # 그날 비 오는 시각(0~23). 우산분실각의 '앞서 비가 왔는지'
@dataclass(frozen=True)
@@ -262,6 +263,8 @@ def _cond(r: dict) -> tuple[str, str, str]:
return "눈 소식이 없어", "눈 소식이 없거나", "눈 소식이 없으면"
if r["field"] == "rain":
return "비 소식이 있어", "비 소식이 있거나", "비 소식이 있으면"
if r["field"] == "rain_before":
return "앞서 내린 비가 없어", "앞서 내린 비가 없거나", "앞서 내린 비가 없으면"
base = f"{_FIELD_TEXT[r['field']]} {r['value']}{_UNIT[r['field']]} {'이상' if r['op'] == '>=' else '미만'}"
return f"{base}이라", f"{base}이거나", f"{base}이면"
@@ -344,6 +347,7 @@ def evaluate(definition, windows: list[list[Hour]], ctx: Context) -> Optional[Re
"gust_ms": max(gusts, default=None), "ground_c": max(grounds, default=None),
"snow": "yes" if any(h.rain_type in (RainType.SNOW, RainType.SLEET) for h in hours) else "no",
"rain": "yes" if raining else "no", "humidity": round(mean(h.humidity for h in hours)),
"rain_before": "yes" if any(h < hours[0].hour for h in ctx.rain_hours) else "no",
}
reason, cap = _zero(definition.zero_rules, agg)
if reason is not None:
@@ -393,7 +397,8 @@ def estimate(definition, fc: DayForecast, windows: list[list[int]], ctx: Context
notes = {a: n for a, (_, n) in scored.items()}
score = _weighted(factors, weights)
# 중기예보엔 눈 여부가 없어서, 눈이 와야 하는 각은 0점으로 둔다
known = {"rain_prob": max_prob, "snow": "no"}
# 하루 예보로는 비가 언제 그치는지 몰라 '앞서 비 옴'은 없는 것으로 본다
known = {"rain_prob": max_prob, "snow": "no", "rain_before": "no"}
reason, cap = _zero([r for r in definition.zero_rules if r["field"] in known], known)
if reason is not None:
score = min(score, cap)
+8 -2
View File
@@ -193,6 +193,12 @@ def _shown_parts(parts: dict[str, int], cur: str) -> dict[str, int]:
return {k: shown[k] for k in SLOTS if k in shown}
def rain_hours(by_at: dict[datetime, WeatherHourly], day: date) -> frozenset[int]:
"""그날 비·눈 오는 시각(0~23)."""
start = kst_midnight(day)
return frozenset(h for h in range(24) if (r := by_at.get(start + timedelta(hours=h))) is not None and r.rain_type != RainType.NONE.value)
def slot_results(
defn, day: date, region: Region, by_at: dict[datetime, WeatherHourly], by_om: dict[datetime, OpenMeteoHourly], ctx: Context, sunset_at: datetime,
now: Optional[datetime] = None,
@@ -388,7 +394,7 @@ class IndexService:
air_label=GRADE_LABEL[AirGrade(air.grade)] if air and air.grade else None,
wind_warning=any(w.warning_type is WarningType.WIND for w in warnings or []),
)
today_ctx = Context(day=today, is_holiday=False, moon=0, sunset_score=None, lookahead_rain_prob=0, **base_ctx)
today_ctx = Context(day=today, is_holiday=False, moon=0, sunset_score=None, lookahead_rain_prob=0, rain_hours=rain_hours(by_at, today), **base_ctx)
sunset_at = sun_times(today, float(region.lat), float(region.lon)).sunset_at
weather_parts = {k: r.score for k, r in slot_results(WEATHER_SCORE_DEF, today, region, by_at, by_om, today_ctx, sunset_at, now).items()}
@@ -419,7 +425,7 @@ class IndexService:
m = night(day, float(region.lat), float(region.lon))
ctx = Context(
day=day, is_holiday=day in (holidays or set()), moon=m.lit * up_ratio(m, _STARS_HOURS), moon_note=f"{m.name}, {view_line(m, None)}",
sunset_score=sunset.get(day), sunrise_score=sunrise.get(day), lookahead_rain_prob=0, **base_ctx,
sunset_score=sunset.get(day), sunrise_score=sunrise.get(day), lookahead_rain_prob=0, rain_hours=rain_hours(by_at, day), **base_ctx,
)
for d in defs:
result = day_result(d, day, region, by_at, daily, ctx, short=day < today + timedelta(days=DAYS), by_om=by_om)
+10
View File
@@ -308,3 +308,13 @@ def test_humidity_cap():
def test_axis_label_can_be_overridden():
assert axis_label("temp", {"temp": {"type": "higher", "label": "덜 추움"}}) == "덜 추움"
def test_umbrella_lost_needs_rain_that_stopped():
"""우산분실각: 앞서 비가 왔다가 그친 시간대만 점수가 난다. 비가 안 온 날, 아직 비가 오는 시간대는 0점."""
defn = _defn(weight_temp=0, weight_rain=80, weight_wind=0, weight_humidity=0, weight_air=0, weight_time=20,
zero_rules=[{"field": "rain_before", "op": "==", "value": "no"}, {"field": "rain", "op": "==", "value": "yes"}])
after_rain = replace(CTX, rain_hours=frozenset({9, 10}))
assert evaluate(defn, [[_h(13), _h(14)]], after_rain).score >= 80
assert evaluate(defn, [[_h(13), _h(14)]], CTX).zero_reason == "앞서 내린 비가 없어 0점"
assert evaluate(defn, [[_h(10, rain=RainType.RAIN)]], replace(CTX, rain_hours=frozenset({9, 10}))).score == 0
+8
View File
@@ -202,5 +202,13 @@
{
"name": "싱잉인더레인각",
"description": "비 오는 날 우산 쓰고 노래하며 걷기 좋은 정도"
},
{
"name": "우산분실각",
"description": "오전 9시~밤 10시, 비가 그쳐서 우산을 두고 오기 쉬운 정도"
},
{
"name": "교통체증각",
"description": "출퇴근길 비·눈·추위로 차가 막히는 정도"
}
]
+10 -6
View File
@@ -48,17 +48,17 @@ function TopBar() {
const tab = TABS.find((t) => t.to !== '/' && pathname.startsWith(t.to))
return (
<header className="sticky top-0 z-20 flex h-[calc(54px+env(safe-area-inset-top,0px))] items-center justify-between gap-2.5 px-4 pt-[env(safe-area-inset-top,0px)]">
<header className="sticky top-0 z-20 flex h-[calc(54px+env(safe-area-inset-top,0px))] items-center justify-between gap-2 px-4 pt-[env(safe-area-inset-top,0px)]">
{tab?.title ? <h1 className="shrink-0 font-jua text-[22px] font-normal">{tab.title}</h1> : <h1 className="shrink-0 font-jua text-[25px] font-normal text-(--orange)">날씨각</h1>}
<SeasonChip />
<button
type="button"
onClick={() => open({ type: 'region' })}
aria-label={`위치 바꾸기, 지금 ${region.name}`}
className="ml-auto flex cursor-pointer items-center gap-1 rounded-full bg-white px-3 pt-1 pb-2 text-[13.5px] font-bold shadow-[inset_0_-4px_0_var(--shade),0_6px_12px_rgb(40_48_74/0.07)]"
className="ml-auto flex shrink-0 cursor-pointer items-center gap-1 rounded-full bg-white px-3 pt-1 pb-2 text-[13.5px] font-bold shadow-[inset_0_-4px_0_var(--shade),0_6px_12px_rgb(40_48_74/0.07)]"
>
<PinIcon className="size-3.5" />
{locateStatus === 'locating' ? <Skel className="w-[72px]" /> : region.name}
<PinIcon className="size-3.5 shrink-0" />
{locateStatus === 'locating' ? <Skel className="w-[72px]" /> : <span className="truncate whitespace-nowrap"><span className="max-[399px]:hidden">{region.name}</span><span className="min-[400px]:hidden">{region.name.split(' ').at(-1)}</span></span>}
</button>
{mePending ? (
<Skel shape className="size-9 shrink-0 rounded-full" />
@@ -208,6 +208,10 @@ function Shell() {
useEffect(() => {
window.scrollTo({ top: 0 })
}, [pathname])
// 지금 보고 있는 탭을 다시 누르면 맨 위로
const toTopIfHere = (to: string) => () => {
if (pathname === to) window.scrollTo({ top: 0, behavior: 'smooth' })
}
useEffect(() => {
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', NOTCH_BG[kind])
}, [kind])
@@ -228,14 +232,14 @@ function Shell() {
{TABS.map((t) =>
t.key === 'today' ? (
// 메인 탭: 막대 위로 솟은 큰 주황 동그라미
<NavLink key={t.key} to={t.to} end className={({ isActive }) => cx('b-tab-main relative -mt-6 flex flex-col items-center gap-1 text-[12px] font-extrabold', isActive ? 'text-(--orange)' : 'text-(--ink3)')}>
<NavLink key={t.key} to={t.to} end onClick={toTopIfHere(t.to)} className={({ isActive }) => cx('b-tab-main relative -mt-6 flex flex-col items-center gap-1 text-[12px] font-extrabold', isActive ? 'text-(--orange)' : 'text-(--ink3)')}>
<span className="b-keep-bg grid size-[60px] place-items-center rounded-full bg-[linear-gradient(160deg,#ffb067,var(--orange)_55%,var(--orange-deep))] text-white shadow-[0_8px_18px_rgb(255_122_69/0.45),inset_0_-4px_0_rgb(0_0_0/0.12)] ring-4 ring-white/85 [&_svg]:stroke-[2.6]">
<TabIcon name={t.key} className="size-[30px]" />
</span>
{t.label}
</NavLink>
) : (
<NavLink key={t.key} to={t.to} className={({ isActive }) => cx('flex flex-col items-center gap-0.5 text-[11px] font-extrabold', isActive ? 'text-(--ink) [&_svg]:stroke-[2.4]' : 'text-(--ink3) [&_svg]:stroke-[1.9]')}>
<NavLink key={t.key} to={t.to} onClick={toTopIfHere(t.to)} className={({ isActive }) => cx('flex flex-col items-center gap-0.5 text-[11px] font-extrabold', isActive ? 'text-(--ink) [&_svg]:stroke-[2.4]' : 'text-(--ink3) [&_svg]:stroke-[1.9]')}>
<TabIcon name={t.key} className="size-[25px]" />
{t.label}
</NavLink>
+49 -2
View File
@@ -1,3 +1,15 @@
import com.google.android.wearable.watchface.validator.client.DwfValidatorFactory
// 스킨 APK 검증·토큰 발급기 (Watch Face Push). 의존성 하나가 jitpack 에만 있다
buildscript {
repositories {
google()
mavenCentral()
maven("https://jitpack.io") { content { includeGroup("com.github.xgouchet") } }
}
dependencies { classpath("com.google.android.wearable.watchface.validator:validator-push:1.0.0-alpha09") }
}
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.plugin.compose")
@@ -9,10 +21,13 @@ android {
defaultConfig {
applicationId = "kr.o2o.nalssigak"
minSdk = 30
targetSdk = 34
// Wear OS 6+ 만. 앱 설치 때 스킨을 같이 깔고 시계 화면으로 바꾸는 Watch Face Push 가 API 36 부터다
minSdk = 36
targetSdk = 36
versionCode = 1
versionName = "0.1"
// 앱에 실은 스킨 버전. 워치에 깔린 스킨이 이보다 낮으면 앱이 바꿔 끼운다 (MainActivity.useSkin)
buildConfigField("int", "SKIN_VERSION", providers.gradleProperty("NALSSIGAK_SKIN_VERSION").get())
}
buildTypes {
// 에뮬레이터에서 본 맥의 로컬 백엔드 (compose 포트 9810)
@@ -38,4 +53,36 @@ dependencies {
implementation("androidx.wear.tiles:tiles:1.6.2")
implementation("androidx.concurrent:concurrent-futures:1.3.0")
implementation("androidx.wear.watchface:watchface-complications-data-source-ktx:1.3.0")
implementation("androidx.wear.watchfacepush:watchfacepush:1.0.0")
}
// 앱을 깔면 스킨(:watchface)도 같이 깔리게 한다 (Wear OS 6+ 기본 워치 페이스).
// 같은 빌드 타입의 스킨 APK 를 assets/default_watchface.apk 로 싣고, 검증 토큰을 문자열 리소스로 만든다
androidComponents.onVariants { variant ->
val name = variant.name.replaceFirstChar(Char::titlecase)
val skinApks = project(":watchface").layout.buildDirectory.dir("outputs/apk/${variant.name}")
val assetsDir = layout.buildDirectory.dir("generated/skinAssets/${variant.name}")
val resDir = layout.buildDirectory.dir("generated/skinToken/${variant.name}")
val appId = variant.applicationId
variant.sources.assets?.addStaticSourceDirectory(assetsDir.get().asFile.path)
variant.sources.res?.addStaticSourceDirectory(resDir.get().asFile.path)
val bundle = tasks.register("bundleSkin$name") {
dependsOn(":watchface:assemble$name")
inputs.dir(skinApks)
outputs.dirs(assetsDir, resDir)
doLast {
val apk = skinApks.get().asFile.listFiles { f -> f.extension == "apk" }!!.single()
// 서명 없는 스킨은 워치가 설치를 거부한다. 업로드 키 설정은 루트 build.gradle.kts 참고
if (apk.name.endsWith("-unsigned.apk")) throw GradleException("스킨 APK 가 서명되지 않았습니다. ~/.gradle/gradle.properties 에 NALSSIGAK_STORE_* 를 넣고 다시 빌드하세요")
val result = DwfValidatorFactory.create().validate(apk, appId.get())
if (result.failures().isNotEmpty()) throw GradleException("스킨 검증 실패: ${result.failures()}")
apk.copyTo(assetsDir.get().file("default_watchface.apk").asFile, overwrite = true)
resDir.get().file("values/skin_token.xml").asFile.apply { parentFile.mkdirs() }
.writeText(
"""<resources xmlns:tools="http://schemas.android.com/tools">""" +
"""<string name="default_wf_token" translatable="false" tools:ignore="Typos">${result.validationToken()}</string></resources>""" + "\n"
)
}
}
afterEvaluate { tasks.named("pre${name}Build") { dependsOn(bundle) } }
}
+10 -2
View File
@@ -4,6 +4,9 @@
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 앱과 같이 깔리는 날씨각 스킨을 시계 화면으로 바꾸는 권한 (Watch Face Push) -->
<uses-permission android:name="com.google.wear.permission.PUSH_WATCH_FACES" />
<uses-permission android:name="com.google.wear.permission.SET_PUSHED_WATCH_FACE_AS_ACTIVE" />
<application
android:icon="@drawable/ic_gak"
@@ -13,6 +16,11 @@
<!-- 폰 앱 없이 워치에서 단독으로 동작 -->
<meta-data android:name="com.google.android.wearable.standalone" android:value="true" />
<!-- 앱 설치 때 assets/default_watchface.apk(스킨)도 같이 설치된다. 토큰은 빌드가 만든다 (build.gradle.kts) -->
<meta-data
android:name="com.google.android.wearable.marketplace.DEFAULT_WATCHFACE_VALIDATION_TOKEN"
android:value="@string/default_wf_token" />
<activity android:name=".MainActivity" android:exported="true" android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -126,7 +134,7 @@
<meta-data android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" android:value="1800" />
</service>
<!-- 워치 스킨 숨은 칸용: 비·눈 여부 -->
<!-- 워치 스킨 숨은 칸용: 날씨(비·눈·천둥)·기온·가운데 1위 -->
<service
android:name=".RainComplicationService"
android:exported="true"
@@ -136,7 +144,7 @@
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" />
</intent-filter>
<meta-data android:name="android.support.wearable.complications.SUPPORTED_TYPES" android:value="SHORT_TEXT" />
<meta-data android:name="android.support.wearable.complications.SUPPORTED_TYPES" android:value="RANGED_VALUE" />
<meta-data android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" android:value="1800" />
</service>
@@ -3,6 +3,8 @@ package kr.o2o.nalssigak
import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.ParcelFileDescriptor
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
@@ -16,29 +18,85 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.lifecycle.lifecycleScope
import androidx.wear.compose.foundation.pager.VerticalPager
import androidx.wear.compose.foundation.pager.rememberPagerState
import androidx.wear.compose.material3.MaterialTheme
import androidx.wear.compose.material3.VerticalPageIndicator
import androidx.wear.watchfacepush.WatchFacePushManager
import androidx.wear.watchfacepush.WatchFacePushManagerFactory
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.time.Instant
import kotlin.concurrent.thread
/** 컴플리케이션 탭이 실어 보내는 각 코드 */
const val EXTRA_GAK = "gak"
/** 앱과 같이 깔린 스킨을 시계 화면으로 바꾸는 권한. 사용자가 한 번 거절하면 다시 묻지 못한다 */
private const val SET_SKIN = "com.google.wear.permission.SET_PUSHED_WATCH_FACE_AS_ACTIVE"
private const val TAG = "MainActivity"
class MainActivity : ComponentActivity() {
private var summary by mutableStateOf<Summary?>(null)
private var loading by mutableStateOf(true)
private val askLocation = registerForActivityResult(ActivityResultContracts.RequestPermission()) { load() }
private val askPermissions = registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) {
load()
useSkin()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val opened = intent.getStringExtra(EXTRA_GAK)
setContent { MaterialTheme { App(summary, loading, opened) { load(force = true) } } }
if (checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) load()
else askLocation.launch(Manifest.permission.ACCESS_COARSE_LOCATION)
// 위치와 스킨 적용을 한 번에 묻는다
val missing = listOf(Manifest.permission.ACCESS_COARSE_LOCATION, SET_SKIN).filter { checkSelfPermission(it) != PackageManager.PERMISSION_GRANTED }
if (missing.isEmpty()) {
load()
useSkin()
} else askPermissions.launch(missing.toTypedArray())
}
/**
* 앱 설치 때 같이 깔린 날씨각 스킨을 챙긴다.
* 앱 업데이트로 새 스킨이 실려 왔으면 바꿔 끼우고(기본 스킨은 처음 설치 때만 깔린다), 허락받았으면 시계 화면으로 바꾼다(시스템이 앱마다 한 번만 허락한다).
*/
private fun useSkin() {
lifecycleScope.launch {
val push = WatchFacePushManagerFactory.createWatchFacePushManager(this@MainActivity)
try {
// 기본 스킨 설치가 아직 안 끝났으면 다음 실행 때 다시 본다
val skin = push.listWatchFaces().installedWatchFaceDetails.firstOrNull() ?: return@launch
if (skin.versionCode < BuildConfig.SKIN_VERSION) updateSkin(push, skin.slotId)
if (checkSelfPermission(SET_SKIN) == PackageManager.PERMISSION_GRANTED && !push.isWatchFaceActive(skin.packageName)) {
push.setWatchFaceAsActive(skin.slotId)
}
} catch (e: WatchFacePushManager.ListWatchFacesException) {
Log.w(TAG, "스킨 목록을 못 읽음", e)
} catch (e: WatchFacePushManager.UpdateWatchFaceException) {
Log.w(TAG, "스킨을 새 버전으로 못 바꿈", e)
} catch (e: WatchFacePushManager.IsWatchFaceActiveException) {
Log.w(TAG, "스킨 사용 여부를 못 읽음", e)
} catch (e: WatchFacePushManager.SetWatchFaceAsActiveException) {
// 이미 한 번 바꾼 뒤 사용자가 다른 화면으로 옮긴 경우. 다시 바꾸지 않는다
Log.i(TAG, "스킨을 시계 화면으로 바꾸지 않음", e)
}
}
}
/** 앱에 실은 스킨(assets/default_watchface.apk)으로 바꿔 끼운다. 검증 토큰은 빌드가 만든 것 (build.gradle.kts) */
private suspend fun updateSkin(push: WatchFacePushManager, slotId: String) {
val apk = File(cacheDir, "skin.apk")
try {
withContext(Dispatchers.IO) { assets.open("default_watchface.apk").use { input -> apk.outputStream().use { input.copyTo(it) } } }
ParcelFileDescriptor.open(apk, ParcelFileDescriptor.MODE_READ_ONLY).use { push.updateWatchFace(slotId, it, getString(R.string.default_wf_token)) }
} finally {
apk.delete()
}
}
private fun load(force: Boolean = false) {
@@ -50,7 +108,7 @@ class MainActivity : ComponentActivity() {
}
}
private enum class Page { DETAIL, EVENTS, TOP, PICKS, SUNSET, HOURS }
private enum class Page { DETAIL, HOURS, EVENTS, TOP, PICKS, SUNSET }
@Composable
private fun App(s: Summary?, loading: Boolean, opened: String?, onRetry: () -> Unit) {
@@ -65,15 +123,15 @@ private fun App(s: Summary?, loading: Boolean, opened: String?, onRetry: () -> U
StatePage(loading, onRetry)
return
}
// 스킨 링에서 누른 각이 있으면 그 상세부터, 아니면 주변 축제부터 (축제가 없으면 오늘의 각부터)
// 스킨 링에서 누른 각이 있으면 그 상세부터, 아니면 오늘 남은 시간 → 주변 축제 → 각 순서
val detail = opened?.let { c -> (s.top + s.picks).firstOrNull { it.code == c } }
val pages = buildList {
if (detail != null) add(Page.DETAIL)
if (s.slots.isNotEmpty()) add(Page.HOURS)
if (s.events.isNotEmpty()) add(Page.EVENTS)
if (s.top.isNotEmpty()) add(Page.TOP)
if (s.picks.isNotEmpty()) add(Page.PICKS)
if (s.sunset != null) add(Page.SUNSET)
if (s.slots.isNotEmpty()) add(Page.HOURS)
}
val state = rememberPagerState { pages.size }
Box(Modifier.fillMaxSize()) {
@@ -1,27 +1,45 @@
package kr.o2o.nalssigak
import android.app.PendingIntent
import android.content.Intent
import androidx.wear.watchface.complications.data.ComplicationData
import androidx.wear.watchface.complications.data.ComplicationType
import androidx.wear.watchface.complications.data.PlainComplicationText
import androidx.wear.watchface.complications.data.ShortTextComplicationData
import androidx.wear.watchface.complications.data.RangedValueComplicationData
import androidx.wear.watchface.complications.datasource.ComplicationRequest
import androidx.wear.watchface.complications.datasource.SuspendingComplicationDataSourceService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlin.math.roundToInt
/** 워치 스킨 아래 칩: 글자 = 지금 기온, 제목 = 비 소식. 스킨은 제목("비 와요"·"곧 비"·"천둥 쳐요"·"눈 와요")을 보고 빗줄기·눈송이와 가운데 구름도 그린다. */
/**
* 워치 스킨 날씨 칸 + 가운데 1위. 스킨 칸이 8개까지라 한 칸에 몰아 준다.
* 값 = 날씨 코드(0 맑음·1 비·2 천둥·3 눈) × 1000 + 1위 점수, 글자 = 지금 기온, 제목 = 1위 이름(없으면 빈 글자).
*/
class RainComplicationService : SuspendingComplicationDataSourceService() {
override suspend fun onComplicationRequest(request: ComplicationRequest): ComplicationData? {
val s = withContext(Dispatchers.IO) { SummaryRepo.load(this@RainComplicationService) } ?: return null
return data(s.tempC?.let { "${it.roundToInt()}°" } ?: "-°", s.rainLabel)
val code = when (s.rainLabel) {
"비 와요", "곧 비" -> 1
"천둥 쳐요" -> 2
"눈 와요" -> 3
else -> 0
}
val top = s.top.firstOrNull()
return data(code, top?.score ?: 0, s.tempC?.let { "${it.roundToInt()}°" } ?: "-°", top?.name ?: "")
}
override fun getPreviewData(type: ComplicationType): ComplicationData = data("20°", "비 없음")
override fun getPreviewData(type: ComplicationType): ComplicationData = data(0, 88, "20°", "산책각")
private fun data(temp: String, rain: String) = ShortTextComplicationData.Builder(
PlainComplicationText.Builder(temp).build(),
PlainComplicationText.Builder("$temp $rain").build(),
).setTitle(PlainComplicationText.Builder(rain).build()).build()
private fun data(code: Int, score: Int, temp: String, name: String): ComplicationData {
// 가운데 구슬을 누르면 앱 첫 장
val open = PendingIntent.getActivity(this, 0, Intent(this, MainActivity::class.java)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK), PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
return RangedValueComplicationData.Builder(code * 1000f + score, 0f, 3100f, PlainComplicationText.Builder("$name $score, $temp").build())
.setText(PlainComplicationText.Builder(temp).build())
.setTitle(PlainComplicationText.Builder(name).build())
.setTapAction(open)
.build()
}
}
@@ -60,7 +60,7 @@ data class Summary(
else -> null
}
/** 스킨 칩의 비 소식. 스킨은 이 글자를 보고 가운데를 비구름·천둥 구름·눈구름으로 바꾼다 */
/** 비 소식. 스킨 날씨 칸(RainComplicationService)이 이 글자로 날씨 코드를 정한다 */
val rainLabel: String get() = when {
precip == "snow" -> "눈 와요"
thunder == true -> "천둥 쳐요"
+2
View File
@@ -1,2 +1,4 @@
org.gradle.jvmargs=-Xmx2g
android.useAndroidX=true
# 워치 스킨 버전. 스킨(watchface.xml·리소스)을 바꾸면 1 올린다. 앱은 깔린 스킨이 이보다 낮으면 앱에 실은 스킨으로 바꿔 끼운다
NALSSIGAK_SKIN_VERSION=2
+5 -4
View File
@@ -9,15 +9,16 @@ android {
compileSdk = 37
defaultConfig {
applicationId = "kr.o2o.nalssigak.watchface"
// 앱(:app)이 Watch Face Push 로 같이 설치하려면 "<앱 패키지>.watchfacepush.<이름>" 이어야 한다
applicationId = "kr.o2o.nalssigak.watchfacepush.skin"
// WFF 버전 2 는 Wear OS 5(API 34)부터
minSdk = 34
targetSdk = 34
versionCode = 1
versionCode = providers.gradleProperty("NALSSIGAK_SKIN_VERSION").get().toInt()
versionName = "0.1"
}
buildTypes.getByName("release") {
// 스킨 번들엔 dex 가 없어야 한다. R8 이 R 클래스까지 다 걷어내게
// 스킨 APK 엔 dex 가 없어야 한다 (Play 번들, 앱에 싣는 Watch Face Push 둘 다). R8 이 R 클래스까지 다 걷어내게
buildTypes.all {
isMinifyEnabled = true
// 스킨 XML 이 이름으로만 부르는 아이콘·글꼴을 안 쓰는 걸로 보고 지운다. 켜지 말 것
isShrinkResources = false
+26 -27
View File
@@ -117,21 +117,19 @@ def text(x, y, w, h, family, size, color, expr, amb=False):
<Text align="CENTER" ellipsis="TRUE"><Font family="{family}" size="{size}" color="{color}"><Template><![CDATA[%s]]><Parameter expression="{expr}"/></Template></Font></Text>
</PartText>'''
def orb_slot():
def orb_text():
"""해 구슬 위 1위 점수·이름. 날씨 칸 값: 값 = 날씨 코드 × 1000 + 1위 점수, 제목 = 1위 이름 (1위가 없으면 빈 제목)"""
x, y = CX - ORB // 2, CY - ORB // 2
body = text(0, int(ORB * .19), ORB, int(ORB * .45), "bagel_fat_one", 50, "#FFFFFFFF", "[COMPLICATION.TEXT]") + text(14, int(ORB * .62), ORB - 28, 28, "jua", 19, "#FFFFFFFF", "[COMPLICATION.TITLE]")
return f'''<ComplicationSlot slotId="0" x="{x}" y="{y}" width="{ORB}" height="{ORB}" displayName="slot_rank1" supportedTypes="RANGED_VALUE SHORT_TEXT EMPTY" isCustomizable="TRUE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="{APP}/{APP}.Rank1ComplicationService" primaryProviderType="RANGED_VALUE"/>
<BoundingOval x="0" y="0" width="{ORB}" height="{ORB}"/>
<Complication type="RANGED_VALUE">
body = (text(x, y + int(ORB * .19), ORB, int(ORB * .45), "bagel_fat_one", 50, "#FFFFFFFF", f"round({VALUE} % 1000)")
+ text(x + 14, y + int(ORB * .62), ORB - 28, 28, "jua", 19, "#FFFFFFFF", "[COMPLICATION.TITLE]"))
return f'''<Condition>
<Expressions><Expression name="ranked"><![CDATA[[COMPLICATION.TITLE] != ""]]></Expression></Expressions>
<Compare expression="ranked">
{body}
</Complication>
<Complication type="SHORT_TEXT">
{body}
</Complication>
<Complication type="EMPTY"/>
</ComplicationSlot>'''
</Compare>
</Condition>'''
VALUE = "[COMPLICATION.RANGED_VALUE_VALUE]"
PROGRESS = "clamp([COMPLICATION.RANGED_VALUE_VALUE], [COMPLICATION.RANGED_VALUE_MIN], [COMPLICATION.RANGED_VALUE_MAX]) / ([COMPLICATION.RANGED_VALUE_MAX] - [COMPLICATION.RANGED_VALUE_MIN]) * 360"
def icon_by_title(x, y, size):
@@ -182,10 +180,11 @@ def chip(x, w, icon, expr):
{text(x + 32, CHIP_Y + 5, w - 38, 30, "jua", 21, INK, expr, amb=True)}'''
def precip_slot():
"""화면 전체를 덮는 숨은 칸. 날씨각 앱(RainComplicationService)이 글자 = 기온, 제목 = 비 소식을 주면
아래에 기온·비 칩을 그리고, 비 소식이 "비 와요"·"곧 비"면 빗줄기와 비구름, "천둥 쳐요"면 빗줄기와 번개 구름,
"눈 와요"면 눈송이와 눈구름을 가운데 해 자리에 그린다. 날씨 값은 이 칸 안에서만 읽혀서 맑을 때 해·달 구슬도 여기서 그린다.
터치는 막지 않게 BoundingOval 을 1px 로 둔다. 주기는 60 의 약수여야 분이 바뀔 때 튀지 않는다."""
"""화면 전체를 덮는 숨은 칸. WFF 는 칸이 8개까지라 날씨와 1위를 이 칸 하나로 받는다.
날씨각 앱(RainComplicationService)이 값 = 날씨 코드 × 1000 + 1위 점수, 글자 = 기온, 제목 = 1위 이름을 준다.
날씨 코드 1(비·곧 비)이면 빗줄기와 비구름, 2(천둥)면 빗줄기와 번개 구름, 3(눈)이면 눈송이와 눈구름을 가운데 해 자리에 그리고,
그 위에 1위 점수·이름, 아래에 기온 칩을 그린다. 날씨 값은 이 칸 안에서만 읽혀서 맑을 때 해·달 구슬도 여기서 그린다.
터치는 가운데 구슬만 받는다(누르면 앱). 주기는 60 의 약수여야 분이 바뀔 때 튀지 않는다."""
import random
r = random.Random(7)
drops, flakes = [], []
@@ -207,15 +206,16 @@ def precip_slot():
<Transform target="x" value="{x} + 9 * sin(rad(360 * fract([SECOND_MILLISECOND] / 3 + {ph:.2f})))"/>
</PartDraw>''')
shade = lambda c: f'<PartDraw x="0" y="0" width="{W}" height="{W}">{AMB0}<Rectangle x="0" y="0" width="{W}" height="{W}"><Fill color="{c}"/></Rectangle></PartDraw>'
return f'''<ComplicationSlot slotId="7" x="0" y="0" width="{W}" height="{W}" displayName="slot_precip" supportedTypes="SHORT_TEXT EMPTY" isCustomizable="FALSE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="{APP}/{APP}.RainComplicationService" primaryProviderType="SHORT_TEXT"/>
<BoundingOval x="0" y="0" width="1" height="1"/>
<Complication type="SHORT_TEXT">
mode = f"floor({VALUE} / 1000)"
return f'''<ComplicationSlot slotId="7" x="0" y="0" width="{W}" height="{W}" displayName="slot_precip" supportedTypes="RANGED_VALUE EMPTY" isCustomizable="FALSE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="{APP}/{APP}.RainComplicationService" primaryProviderType="RANGED_VALUE"/>
<BoundingOval x="0" y="0" width="{W}" height="{W}"/>
<Complication type="RANGED_VALUE">
<Condition>
<Expressions>
<Expression name="thunder"><![CDATA[[COMPLICATION.TITLE] == "천둥 쳐요"]]></Expression>
<Expression name="rain"><![CDATA[[COMPLICATION.TITLE] == "비 와요" || [COMPLICATION.TITLE] == "곧 비"]]></Expression>
<Expression name="snow"><![CDATA[[COMPLICATION.TITLE] == "눈 와요"]]></Expression>
<Expression name="thunder"><![CDATA[{mode} == 2]]></Expression>
<Expression name="rain"><![CDATA[{mode} == 1]]></Expression>
<Expression name="snow"><![CDATA[{mode} == 3]]></Expression>
<Expression name="night"><![CDATA[{NIGHT_EXPR}]]></Expression>
</Expressions>
<Compare expression="thunder">
@@ -235,8 +235,8 @@ def precip_slot():
</Compare>
{sun_or_moon()}
</Condition>
{chip(108, 104, "thermo", "[COMPLICATION.TEXT]")}
{chip(220, 122, "umbrella", "[COMPLICATION.TITLE]")}
{chip(CX - 52, 104, "thermo", "[COMPLICATION.TEXT]")}
{orb_text()}
</Complication>
<Complication type="EMPTY">
<Condition>
@@ -273,7 +273,7 @@ exprs = "\n ".join(f'<Expression name="{k}"><![CDATA[{v[0].replace("&gt
compares = "\n ".join(f'<Compare expression="{k}">\n {mode_block(v[1], v[2], v[3])}\n </Compare>' for k, v in MODES.items())
xml = f'''<?xml version="1.0" encoding="UTF-8"?>
<!-- 날씨각 워치 스킨: 시간대 하늘, 해 구슬(1위, 비·눈·천둥이면 구름), 둘레 링(2~7위), 날짜 밑 근처 축제 한 줄, 아래 기온·비 칩. 링을 누르면 앱이 그 각 상세로 열린다. 점수는 날씨각 앱의 RankNComplicationService 가 공급한다.
<!-- 날씨각 워치 스킨: 시간대 하늘, 해 구슬(1위, 비·눈·천둥이면 구름), 둘레 링(2~7위), 날짜 밑 근처 축제 한 줄, 아래 기온 칩. 링을 누르면 앱이 그 각 상세로 열린다. 점수는 날씨각 앱의 RankNComplicationService 가 공급한다.
직접 고치지 말고 watch/watchface/gen_watchface.py 를 고친 뒤 다시 만든다: python3 gen_watchface.py src/main/res/raw/watchface.xml -->
<WatchFace width="{W}" height="{W}">
<Metadata key="CLOCK_TYPE" value="DIGITAL"/>
@@ -293,7 +293,6 @@ xml = f'''<?xml version="1.0" encoding="UTF-8"?>
<!-- 가운데 해·달·구름은 날씨 칸 안에서 비 막 위에 그린다 -->
{precip_slot()}
{clock("#FFFFFFFF", ambient_visible=True)}
{orb_slot()}
{"".join(ring_slot(i, a) for i, a in enumerate(ANGLES))}
{event_slot()}
</Scene>
+20 -37
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 날씨각 워치 스킨: 시간대 하늘, 해 구슬(1위, 비·눈·천둥이면 구름), 둘레 링(2~7위), 날짜 밑 근처 축제 한 줄, 아래 기온·비 칩. 링을 누르면 앱이 그 각 상세로 열린다. 점수는 날씨각 앱의 RankNComplicationService 가 공급한다.
<!-- 날씨각 워치 스킨: 시간대 하늘, 해 구슬(1위, 비·눈·천둥이면 구름), 둘레 링(2~7위), 날짜 밑 근처 축제 한 줄, 아래 기온 칩. 링을 누르면 앱이 그 각 상세로 열린다. 점수는 날씨각 앱의 RankNComplicationService 가 공급한다.
직접 고치지 말고 watch/watchface/gen_watchface.py 를 고친 뒤 다시 만든다: python3 gen_watchface.py src/main/res/raw/watchface.xml -->
<WatchFace width="450" height="450">
<Metadata key="CLOCK_TYPE" value="DIGITAL"/>
@@ -148,15 +148,15 @@
</Condition>
<!-- 주의: 칸(ComplicationSlot) 순서·slotId 를 바꿔 덮어 설치하면 기존 기기에서 공급원이 한 칸씩 밀린다 (에뮬레이터에서 확인). 새 칸은 맨 뒤에 붙인다 -->
<!-- 가운데 해·달·구름은 날씨 칸 안에서 비 막 위에 그린다 -->
<ComplicationSlot slotId="7" x="0" y="0" width="450" height="450" displayName="slot_precip" supportedTypes="SHORT_TEXT EMPTY" isCustomizable="FALSE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="kr.o2o.nalssigak/kr.o2o.nalssigak.RainComplicationService" primaryProviderType="SHORT_TEXT"/>
<BoundingOval x="0" y="0" width="1" height="1"/>
<Complication type="SHORT_TEXT">
<ComplicationSlot slotId="7" x="0" y="0" width="450" height="450" displayName="slot_precip" supportedTypes="RANGED_VALUE EMPTY" isCustomizable="FALSE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="kr.o2o.nalssigak/kr.o2o.nalssigak.RainComplicationService" primaryProviderType="RANGED_VALUE"/>
<BoundingOval x="0" y="0" width="450" height="450"/>
<Complication type="RANGED_VALUE">
<Condition>
<Expressions>
<Expression name="thunder"><![CDATA[[COMPLICATION.TITLE] == "천둥 쳐요"]]></Expression>
<Expression name="rain"><![CDATA[[COMPLICATION.TITLE] == "비 와요" || [COMPLICATION.TITLE] == "곧 비"]]></Expression>
<Expression name="snow"><![CDATA[[COMPLICATION.TITLE] == "눈 와요"]]></Expression>
<Expression name="thunder"><![CDATA[floor([COMPLICATION.RANGED_VALUE_VALUE] / 1000) == 2]]></Expression>
<Expression name="rain"><![CDATA[floor([COMPLICATION.RANGED_VALUE_VALUE] / 1000) == 1]]></Expression>
<Expression name="snow"><![CDATA[floor([COMPLICATION.RANGED_VALUE_VALUE] / 1000) == 3]]></Expression>
<Expression name="night"><![CDATA[[HOUR_0_23] < 5 || [HOUR_0_23] >= 21]]></Expression>
</Expressions>
<Compare expression="thunder">
@@ -495,22 +495,24 @@
<Ellipse x="16" y="84" width="21" height="12"><Fill color="#73FF7A8A"/></Ellipse><Ellipse x="97" y="84" width="21" height="12"><Fill color="#73FF7A8A"/></Ellipse>
</PartDraw></Default>
</Condition>
<PartDraw x="108" y="366" width="104" height="40"><Variant mode="AMBIENT" target="alpha" value="0"/>
<PartDraw x="173" y="366" width="104" height="40"><Variant mode="AMBIENT" target="alpha" value="0"/>
<RoundRectangle x="0" y="0" width="104" height="40" cornerRadiusX="20" cornerRadiusY="20"><Fill color="#B8FFFFFF"/></RoundRectangle>
<RoundRectangle x="0" y="35" width="104" height="5" cornerRadiusX="2" cornerRadiusY="2"><Fill color="#E6D9E5F4"/></RoundRectangle>
</PartDraw>
<PartImage x="116" y="372" width="26" height="26"><Variant mode="AMBIENT" target="alpha" value="0"/><Image resource="e_thermo"/></PartImage>
<PartText x="140" y="371" width="66" height="30"><Variant mode="AMBIENT" target="alpha" value="0"/>
<PartImage x="181" y="372" width="26" height="26"><Variant mode="AMBIENT" target="alpha" value="0"/><Image resource="e_thermo"/></PartImage>
<PartText x="205" y="371" width="66" height="30"><Variant mode="AMBIENT" target="alpha" value="0"/>
<Text align="CENTER" ellipsis="TRUE"><Font family="jua" size="21" color="#FF28304A"><Template><![CDATA[%s]]><Parameter expression="[COMPLICATION.TEXT]"/></Template></Font></Text>
</PartText>
<PartDraw x="220" y="366" width="122" height="40"><Variant mode="AMBIENT" target="alpha" value="0"/>
<RoundRectangle x="0" y="0" width="122" height="40" cornerRadiusX="20" cornerRadiusY="20"><Fill color="#B8FFFFFF"/></RoundRectangle>
<RoundRectangle x="0" y="35" width="122" height="5" cornerRadiusX="2" cornerRadiusY="2"><Fill color="#E6D9E5F4"/></RoundRectangle>
</PartDraw>
<PartImage x="228" y="372" width="26" height="26"><Variant mode="AMBIENT" target="alpha" value="0"/><Image resource="e_umbrella"/></PartImage>
<PartText x="252" y="371" width="84" height="30"><Variant mode="AMBIENT" target="alpha" value="0"/>
<Text align="CENTER" ellipsis="TRUE"><Font family="jua" size="21" color="#FF28304A"><Template><![CDATA[%s]]><Parameter expression="[COMPLICATION.TITLE]"/></Template></Font></Text>
<Condition>
<Expressions><Expression name="ranked"><![CDATA[[COMPLICATION.TITLE] != ""]]></Expression></Expressions>
<Compare expression="ranked">
<PartText x="157" y="209" width="136" height="61">
<Text align="CENTER" ellipsis="TRUE"><Font family="bagel_fat_one" size="50" color="#FFFFFFFF"><Template><![CDATA[%s]]><Parameter expression="round([COMPLICATION.RANGED_VALUE_VALUE] % 1000)"/></Template></Font></Text>
</PartText><PartText x="171" y="268" width="108" height="28">
<Text align="CENTER" ellipsis="TRUE"><Font family="jua" size="19" color="#FFFFFFFF"><Template><![CDATA[%s]]><Parameter expression="[COMPLICATION.TITLE]"/></Template></Font></Text>
</PartText>
</Compare>
</Condition>
</Complication>
<Complication type="EMPTY">
<Condition>
@@ -535,25 +537,6 @@
<Font family="bagel_fat_one" size="68" color="#FFFFFFFF"/>
</TimeText>
</DigitalClock>
<ComplicationSlot slotId="0" x="157" y="184" width="136" height="136" displayName="slot_rank1" supportedTypes="RANGED_VALUE SHORT_TEXT EMPTY" isCustomizable="TRUE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="kr.o2o.nalssigak/kr.o2o.nalssigak.Rank1ComplicationService" primaryProviderType="RANGED_VALUE"/>
<BoundingOval x="0" y="0" width="136" height="136"/>
<Complication type="RANGED_VALUE">
<PartText x="0" y="25" width="136" height="61">
<Text align="CENTER" ellipsis="TRUE"><Font family="bagel_fat_one" size="50" color="#FFFFFFFF"><Template><![CDATA[%s]]><Parameter expression="[COMPLICATION.TEXT]"/></Template></Font></Text>
</PartText><PartText x="14" y="84" width="108" height="28">
<Text align="CENTER" ellipsis="TRUE"><Font family="jua" size="19" color="#FFFFFFFF"><Template><![CDATA[%s]]><Parameter expression="[COMPLICATION.TITLE]"/></Template></Font></Text>
</PartText>
</Complication>
<Complication type="SHORT_TEXT">
<PartText x="0" y="25" width="136" height="61">
<Text align="CENTER" ellipsis="TRUE"><Font family="bagel_fat_one" size="50" color="#FFFFFFFF"><Template><![CDATA[%s]]><Parameter expression="[COMPLICATION.TEXT]"/></Template></Font></Text>
</PartText><PartText x="14" y="84" width="108" height="28">
<Text align="CENTER" ellipsis="TRUE"><Font family="jua" size="19" color="#FFFFFFFF"><Template><![CDATA[%s]]><Parameter expression="[COMPLICATION.TITLE]"/></Template></Font></Text>
</PartText>
</Complication>
<Complication type="EMPTY"/>
</ComplicationSlot>
<ComplicationSlot slotId="1" x="71" y="149" width="68" height="68" displayName="slot_ring" supportedTypes="RANGED_VALUE SHORT_TEXT EMPTY" isCustomizable="TRUE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="kr.o2o.nalssigak/kr.o2o.nalssigak.Rank2ComplicationService" primaryProviderType="RANGED_VALUE"/>
<BoundingOval x="0" y="0" width="68" height="68"/>