feat: 워치 스킨에 기온·비 칩, 링을 누르면 그 각 상세로 열기, 앱 첫 장 제거

- 스킨 아래 기온·비 소식 칩, 날짜는 시계 밑으로. 빗줄기·눈송이는 비 소식 문구 기준
- 링·가운데 1위 탭 → 앱이 새로 열리며 그 각 상세 장부터
- 앱 첫 장(해 구슬·링)은 스킨과 겹쳐 삭제, 앱은 오늘의 각부터

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HyeongBaeYangandClaude Opus 5.5 committed 2026-10-06 15:19:13 +09:00
1 parent b72206f7ee
commit 7671dbeb19
11 files changed
+117 -237

No files matched your search

@@ -24,6 +24,9 @@ import kotlinx.coroutines.delay
import java.time.Instant
import kotlin.concurrent.thread
/** 컴플리케이션 탭이 실어 보내는 각 코드 */
const val EXTRA_GAK = "gak"
class MainActivity : ComponentActivity() {
private var summary by mutableStateOf<Summary?>(null)
private var loading by mutableStateOf(true)
@@ -32,7 +35,8 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { MaterialTheme { App(summary, loading) { load(force = true) } } }
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)
}
@@ -46,10 +50,10 @@ class MainActivity : ComponentActivity() {
}
}
private enum class Page { HERO, TOP, PICKS, SUNSET, HOURS }
private enum class Page { DETAIL, TOP, PICKS, SUNSET, HOURS }
@Composable
private fun App(s: Summary?, loading: Boolean, onRetry: () -> Unit) {
private fun App(s: Summary?, loading: Boolean, opened: String?, onRetry: () -> Unit) {
var now by remember { mutableStateOf(Instant.now()) }
LaunchedEffect(Unit) {
while (true) {
@@ -61,28 +65,31 @@ private fun App(s: Summary?, loading: Boolean, onRetry: () -> Unit) {
StatePage(loading, onRetry)
return
}
// 받은 재료가 있는 장만
// 스킨에서 누른 각이 있으면 그 상세부터, 아래로 넘기면 나머지 장
val detail = opened?.let { c -> (s.top + s.picks).firstOrNull { it.code == c } }
val pages = buildList {
add(Page.HERO)
if (detail != null) add(Page.DETAIL)
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)
}
if (pages.isEmpty()) {
StatePage(loading = false, onRetry)
return
}
val state = rememberPagerState { pages.size }
Box(Modifier.fillMaxSize()) {
VerticalPager(state = state, modifier = Modifier.fillMaxSize()) { i ->
when (pages[i]) {
Page.HERO -> HeroPage(s, now)
Page.DETAIL -> DetailPage(detail!!, now)
Page.TOP -> GakListPage("오늘의 각", s.top.take(3), bgButter, medals = true, now)
Page.PICKS -> GakListPage("내 각", s.picks, bgMint, medals = false, now)
Page.SUNSET -> SunsetPage(s.sunset!!, now)
Page.HOURS -> HoursPage(s, now)
}
}
val page = pages[state.currentPage]
val light = page == Page.SUNSET || (page == Page.HERO && isDark(s.mode))
val dot = if (light) Color.White else Tok.ink
val dot = if (pages[state.currentPage] == Page.SUNSET) Color.White else Tok.ink
VerticalPageIndicator(pagerState = state, selectedColor = dot, unselectedColor = dot.copy(alpha = 0.35f), backgroundColor = Color.Transparent)
}
}