diff --git a/app/src/main/kotlin/com/muedsa/agetv/Perfs.kt b/app/src/main/kotlin/com/muedsa/agetv/Perfs.kt index bc806ca..34e8ace 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/Perfs.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/Perfs.kt @@ -11,6 +11,4 @@ val KEY_DANMAKU_SIZE_SCALE = intPreferencesKey("danmaku_size_scale") val KEY_DANMAKU_ALPHA = intPreferencesKey("danmaku_alpha") -val KEY_DANMAKU_SCREEN_PART = intPreferencesKey("danmaku_size_part") - -val KEY_UPSCAYL_COVER_IMAGE_ENABLE = booleanPreferencesKey("upscayl_cover_image_enable") \ No newline at end of file +val KEY_DANMAKU_SCREEN_PART = intPreferencesKey("danmaku_size_part") \ No newline at end of file diff --git a/app/src/main/kotlin/com/muedsa/agetv/model/AppSettingModel.kt b/app/src/main/kotlin/com/muedsa/agetv/model/AppSettingModel.kt index 7cbd8e8..45522af 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/model/AppSettingModel.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/model/AppSettingModel.kt @@ -6,7 +6,6 @@ import com.muedsa.agetv.KEY_DANMAKU_ENABLE import com.muedsa.agetv.KEY_DANMAKU_MERGE_ENABLE import com.muedsa.agetv.KEY_DANMAKU_SCREEN_PART import com.muedsa.agetv.KEY_DANMAKU_SIZE_SCALE -import com.muedsa.agetv.KEY_UPSCAYL_COVER_IMAGE_ENABLE data class AppSettingModel( val danmakuEnable: Boolean, @@ -14,7 +13,6 @@ data class AppSettingModel( val danmakuSizeScale: Int, val danmakuAlpha: Int, val danmakuScreenPart: Int, - val upscaylCoverImageEnable: Boolean ) { companion object { @@ -25,7 +23,6 @@ data class AppSettingModel( danmakuSizeScale = prefs[KEY_DANMAKU_SIZE_SCALE] ?: 140, danmakuAlpha = prefs[KEY_DANMAKU_ALPHA] ?: 100, danmakuScreenPart = prefs[KEY_DANMAKU_SCREEN_PART] ?: 100, - upscaylCoverImageEnable = prefs[KEY_UPSCAYL_COVER_IMAGE_ENABLE] ?: false ) } diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/home/catalog/CatalogScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/home/catalog/CatalogScreen.kt index b072927..b4c0b11 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/home/catalog/CatalogScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/home/catalog/CatalogScreen.kt @@ -32,8 +32,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusProperties import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.tv.material3.ButtonDefaults @@ -88,6 +88,7 @@ fun CatalogScreen( Column(modifier = Modifier.padding(start = ScreenPaddingLeft)) { Row( modifier = Modifier + .testTag("catalogScreen_options") .fillMaxWidth() .offset(x = -ScreenPaddingLeft) .padding(vertical = 30.dp), @@ -242,7 +243,6 @@ fun CatalogScreen( } } } else { - val gridFocusRequester = remember { FocusRequester() } LazyVerticalGrid( columns = GridCells.Adaptive(AgePosterSize.width + ImageCardRowCardPadding), @@ -250,20 +250,7 @@ fun CatalogScreen( top = ImageCardRowCardPadding, bottom = ImageCardRowCardPadding ), - modifier = Modifier - .focusRequester(gridFocusRequester) - .focusProperties { - exit = { gridFocusRequester.saveFocusedChild(); FocusRequester.Default } - enter = { - if (gridFocusRequester.restoreFocusedChild()) { - LogUtil.d("grid restoreFocusedChild") - FocusRequester.Cancel - } else { - LogUtil.d("grid focused default child") - FocusRequester.Default - } - } - } + modifier = Modifier.testTag("catalogScreen_grid") ) { itemsIndexed( items = searchAnimeLP.list, diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/home/favorites/FavoritesScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/home/favorites/FavoritesScreen.kt index 129caea..fcb1414 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/home/favorites/FavoritesScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/home/favorites/FavoritesScreen.kt @@ -23,6 +23,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusDirection import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.tv.material3.ButtonDefaults @@ -83,6 +84,7 @@ fun FavoritesScreen( LazyVerticalGrid( modifier = Modifier + .testTag("favoritesScreen_grid") .padding(start = 0.dp, top = 20.dp, end = 20.dp, bottom = 20.dp), columns = GridCells.Adaptive(AgePosterSize.width + ImageCardRowCardPadding), contentPadding = PaddingValues( diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/home/latest/LatestUpdateScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/home/latest/LatestUpdateScreen.kt index e0c3ce5..29e0231 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/home/latest/LatestUpdateScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/home/latest/LatestUpdateScreen.kt @@ -20,8 +20,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusProperties import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.tv.material3.Card @@ -54,8 +54,6 @@ fun LatestUpdateScreen( val latestUpdateLP by viewModel.latestUpdateLPSF.collectAsState() - val gridFocusRequester = remember { FocusRequester() } - LaunchedEffect(key1 = latestUpdateLP) { if (latestUpdateLP.type == LazyType.FAILURE) { toastController.error(latestUpdateLP.error) @@ -71,20 +69,8 @@ fun LatestUpdateScreen( LazyVerticalGrid( modifier = Modifier - .padding(start = 0.dp, top = 20.dp, end = 20.dp, bottom = 20.dp) - .focusRequester(gridFocusRequester) - .focusProperties { - exit = { gridFocusRequester.saveFocusedChild(); FocusRequester.Default } - enter = { - if (gridFocusRequester.restoreFocusedChild()) { - LogUtil.d("grid restoreFocusedChild") - FocusRequester.Cancel - } else { - LogUtil.d("grid focused default child") - FocusRequester.Default - } - } - }, + .testTag("latestUpdateScreen_grid") + .padding(start = 0.dp, top = 20.dp, end = 20.dp, bottom = 20.dp), columns = GridCells.Adaptive(AgePosterSize.width + ImageCardRowCardPadding), contentPadding = PaddingValues( top = ImageCardRowCardPadding, diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/MainScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/MainScreen.kt index 10e9d02..87624f5 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/MainScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/MainScreen.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.tv.material3.MaterialTheme @@ -115,6 +116,7 @@ fun MainScreen( .height(screenHeight - firstRowHeight - tabHeight) ) ImageCardsRow( + modifier = Modifier.testTag("mainScreen_row_1"), title = "最近更新", modelList = latestList, imageFn = { _, item -> @@ -142,6 +144,7 @@ fun MainScreen( // 每日推荐 item { StandardImageCardsRow( + modifier = Modifier.testTag("mainScreen_row_2"), title = "每日推荐", modelList = recommendList, imageFn = { _, item -> diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/WeekAnimeListWidget.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/WeekAnimeListWidget.kt index 555b165..d380e86 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/WeekAnimeListWidget.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/home/main/WeekAnimeListWidget.kt @@ -2,6 +2,8 @@ package com.muedsa.agetv.screens.home.main import androidx.compose.foundation.layout.Column import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.testTag import com.muedsa.agetv.model.age.WeekAnimeModel import com.muedsa.agetv.theme.WeekCardColorList import com.muedsa.compose.tv.model.ContentModel @@ -21,6 +23,7 @@ fun WeekAnimeListWidget( val dayList = model[key] ?: emptyList() ImageCardsRow( + modifier = Modifier.testTag("mainScreen_week_$index"), title = "每周放送 · ${WeekNameList[index]}", modelList = dayList, imageFn = { _, _ -> "" }, diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/home/rank/RankScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/home/rank/RankScreen.kt index b7fdfe1..3010ac5 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/home/rank/RankScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/home/rank/RankScreen.kt @@ -20,6 +20,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.testTag import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -127,7 +128,7 @@ fun RankScreen( color = MaterialTheme.colorScheme.onBackground, style = MaterialTheme.typography.titleLarge ) - LazyColumn { + LazyColumn(modifier = Modifier.testTag("rankScreen_col_week")) { items(dayList) { RankAnimeWidget( model = it, @@ -158,7 +159,7 @@ fun RankScreen( color = MaterialTheme.colorScheme.onBackground, style = MaterialTheme.typography.titleLarge ) - LazyColumn { + LazyColumn(modifier = Modifier.testTag("rankScreen_col_month")) { items(weekList) { RankAnimeWidget( model = it, @@ -190,7 +191,7 @@ fun RankScreen( style = MaterialTheme.typography.titleLarge ) - LazyColumn { + LazyColumn(modifier = Modifier.testTag("rankScreen_col_all")) { items(totalList) { RankAnimeWidget( model = it, diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/home/recommend/RecommendScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/home/recommend/RecommendScreen.kt index de423c3..2dd5cb2 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/home/recommend/RecommendScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/home/recommend/RecommendScreen.kt @@ -10,12 +10,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import androidx.compose.runtime.remember import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusProperties -import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.tv.material3.MaterialTheme @@ -65,24 +62,11 @@ fun RecommendScreen( if (!recommendLD.data.isNullOrEmpty()) { val recommendList = recommendLD.data!! - val gridFocusRequester = remember { FocusRequester() } LazyVerticalGrid( modifier = Modifier - .padding(start = 0.dp, top = 20.dp, end = 20.dp, bottom = 20.dp) - .focusRequester(gridFocusRequester) - .focusProperties { - exit = { gridFocusRequester.saveFocusedChild(); FocusRequester.Default } - enter = { - if (gridFocusRequester.restoreFocusedChild()) { - LogUtil.d("grid restoreFocusedChild") - FocusRequester.Cancel - } else { - LogUtil.d("grid focused default child") - FocusRequester.Default - } - } - }, + .testTag("recommendScreen_grid") + .padding(start = 0.dp, top = 20.dp, end = 20.dp, bottom = 20.dp), columns = GridCells.Adaptive(AgePosterSize.width + ImageCardRowCardPadding), contentPadding = PaddingValues( top = ImageCardRowCardPadding, diff --git a/app/src/main/kotlin/com/muedsa/agetv/screens/setting/AppSettingViewModel.kt b/app/src/main/kotlin/com/muedsa/agetv/screens/setting/AppSettingViewModel.kt index cd29ed4..f7155ed 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/screens/setting/AppSettingViewModel.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/screens/setting/AppSettingViewModel.kt @@ -8,7 +8,6 @@ import com.muedsa.agetv.KEY_DANMAKU_ENABLE import com.muedsa.agetv.KEY_DANMAKU_MERGE_ENABLE import com.muedsa.agetv.KEY_DANMAKU_SCREEN_PART import com.muedsa.agetv.KEY_DANMAKU_SIZE_SCALE -import com.muedsa.agetv.KEY_UPSCAYL_COVER_IMAGE_ENABLE import com.muedsa.agetv.model.AppSettingModel import com.muedsa.agetv.model.LazyData import com.muedsa.agetv.repository.DataStoreRepo @@ -90,12 +89,4 @@ class AppSettingViewModel @Inject constructor( } } - fun changeUpscaylCoverImageEnable(enable: Boolean) { - viewModelScope.launch(Dispatchers.IO) { - repo.dataStore.edit { - it[KEY_UPSCAYL_COVER_IMAGE_ENABLE] = enable - } - } - } - } \ No newline at end of file diff --git a/scripts/year.kts b/scripts/year.kts index ae23f24..436551e 100644 --- a/scripts/year.kts +++ b/scripts/year.kts @@ -1,3 +1,3 @@ -for (year in 2023 downTo 2000) { +for (year in 2024 downTo 2000) { println(String.format("data object Year%d : AgeSearchOption(\"%d\", \"%d\")", year, year, year)) } \ No newline at end of file