feat: 워치 페이스 푸시로 앱 설치 때 날씨각 스킨 같이 적용(Wear OS 6+), 앱 첫 장을 오늘 남은 시간→주변 축제 순으로
Play 스토어 심사에 낸 1(0.1) 빌드와 같은 코드 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee46a101db
commit
e270261e32
9 files changed
+203
-87
No files matched your search
@@ -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
|
||||
|
||||
@@ -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(">
|
||||
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>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
Reference in new issue
Block a user