Skip to content

Commit

Permalink
Merge branch 'dependabot/gradle/kotlin-2.0.20' into dependabot/gradle…
Browse files Browse the repository at this point in the history
…/com.google.devtools.ksp-2.0.20-1.0.25
  • Loading branch information
muedsa authored Sep 19, 2024
2 parents bac8630 + aa7fee8 commit 84ac9f5
Show file tree
Hide file tree
Showing 28 changed files with 71,822 additions and 144 deletions.
12 changes: 7 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import java.io.FileInputStream
import java.util.Properties

Expand All @@ -12,6 +11,7 @@ plugins {
alias(libs.plugins.firebaseCrashlytics)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.androidRoom)
alias(libs.plugins.baselineProfile)
}

val keystorePropertiesFile: File = rootProject.file("keystore.properties")
Expand All @@ -22,14 +22,14 @@ if (keystorePropertiesFile.exists() && keystorePropertiesFile.canRead()) {

android {
namespace = "com.muedsa.agetv"
compileSdk = 34
compileSdk = 35

defaultConfig {
applicationId = "com.muedsa.agetv"
minSdk = 24
targetSdk = 34
versionCode = 6
versionName = "0.0.1-alpha06"
targetSdk = 35
versionCode = 7
versionName = "1.0.0-rc01"
}

signingConfigs {
Expand Down Expand Up @@ -109,6 +109,8 @@ dependencies {
implementation(libs.lifecycle.runtime.compose)
implementation(libs.lifecycle.viewmodel.compose)
implementation(libs.hilt.android)
implementation(libs.profile.installer)
"baselineProfile"(project(":benchmark"))
ksp(libs.hilt.compiler)
implementation(libs.activity.compose)
implementation(platform(libs.compose.bom))
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/kotlin/com/muedsa/agetv/Perfs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
val KEY_DANMAKU_SCREEN_PART = intPreferencesKey("danmaku_size_part")
1 change: 1 addition & 0 deletions app/src/main/kotlin/com/muedsa/agetv/PlaybackActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class PlaybackActivity : ComponentActivity() {
TvTheme {
Scaffold(
holdBack = false,
enableDrawer = false,
colors = SurfaceDefaults.colors(
containerColor = Color.Black,
contentColor = MaterialTheme.colorScheme.onBackground
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/kotlin/com/muedsa/agetv/model/AppSettingModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ 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,
val danmakuMergeEnable: Boolean,
val danmakuSizeScale: Int,
val danmakuAlpha: Int,
val danmakuScreenPart: Int,
val upscaylCoverImageEnable: Boolean
) {
companion object {

Expand All @@ -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
)

}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/muedsa/agetv/screens/AppNavigation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ fun buildRoute(
return route
}

fun NavHostController.navigate(
fun NavHostController.nav(
navItem: NavigationItems,
pathParams: List<String>?
pathParams: List<String>? = null
) {
navigate(buildRoute(navItem, pathParams))
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.Lifecycle
Expand All @@ -53,7 +54,7 @@ import com.muedsa.agetv.PlaybackActivity
import com.muedsa.agetv.model.LazyType
import com.muedsa.agetv.room.model.FavoriteAnimeModel
import com.muedsa.agetv.screens.NavigationItems
import com.muedsa.agetv.screens.navigate
import com.muedsa.agetv.screens.nav
import com.muedsa.agetv.theme.AgePosterSize
import com.muedsa.agetv.theme.FavoriteIconColor
import com.muedsa.agetv.theme.RankFontColor
Expand Down Expand Up @@ -368,7 +369,7 @@ fun AnimeDetailScreen(
Spacer(modifier = Modifier.width(25.dp))
OutlinedButton(
onClick = {
navController.navigate(NavigationItems.Setting, null)
navController.nav(NavigationItems.Setting)
}
) {
Text(text = "设置")
Expand All @@ -380,6 +381,7 @@ fun AnimeDetailScreen(
// 剧集列表
item {
EpisodeListWidget(
modifier = Modifier.testTag("animeDetailScreen_episodeListWidget"),
episodeList = selectedPlaySourceList,
danEpisodeList = danAnimeInfoLD.data?.episodes ?: emptyList(),
episodeProgressMap = watchedEpisodeTitleMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ class AnimeDetailViewModel @Inject constructor(
private val _watchedEpisodeTitleSetRefreshSF = MutableStateFlow(0)
val watchedEpisodeTitleMapSF =
animeDetailLDSF.combine(_watchedEpisodeTitleSetRefreshSF) { animeDetailLD, _ ->
(if (animeDetailLD.type == LazyType.SUCCESS) {
animeDetailLD.data?.video?.id?.let {
episodeProgressDao.getListByAid(it)
}
} else null)?.associateBy({ it.title }, { it }) ?: emptyMap()
}.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5000),
(if (animeDetailLD.type == LazyType.SUCCESS) {
animeDetailLD.data?.video?.id?.let {
episodeProgressDao.getListByAid(it)
}
} else null)?.associateBy({ it.title }, { it }) ?: emptyMap()
}.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5000),
initialValue = emptyMap()
)
)

private fun animeDetail(aid: Int) {
viewModelScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
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
Expand All @@ -46,7 +45,7 @@ import com.muedsa.agetv.model.LazyType
import com.muedsa.agetv.model.age.AgeCatalogOption
import com.muedsa.agetv.screens.NavigationItems
import com.muedsa.agetv.screens.home.useLocalHomeScreenBackgroundState
import com.muedsa.agetv.screens.navigate
import com.muedsa.agetv.screens.nav
import com.muedsa.agetv.theme.AgePosterSize
import com.muedsa.agetv.theme.GirdLastItemHeight
import com.muedsa.compose.tv.model.ContentModel
Expand All @@ -59,7 +58,6 @@ import com.muedsa.compose.tv.widget.ImageContentCard
import com.muedsa.compose.tv.widget.ScreenBackgroundType
import com.muedsa.uitl.LogUtil

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun CatalogScreen(
viewModel: CatalogViewModel = hiltViewModel()
Expand Down Expand Up @@ -88,6 +86,7 @@ fun CatalogScreen(
Column(modifier = Modifier.padding(start = ScreenPaddingLeft)) {
Row(
modifier = Modifier
.testTag("catalogScreen_options")
.fillMaxWidth()
.offset(x = -ScreenPaddingLeft)
.padding(vertical = 30.dp),
Expand Down Expand Up @@ -242,28 +241,14 @@ fun CatalogScreen(
}
}
} else {
val gridFocusRequester = remember { FocusRequester() }

LazyVerticalGrid(
columns = GridCells.Adaptive(AgePosterSize.width + ImageCardRowCardPadding),
contentPadding = PaddingValues(
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,
Expand All @@ -290,7 +275,7 @@ fun CatalogScreen(
},
onItemClick = {
LogUtil.d("Click $item")
navController.navigate(
navController.nav(
NavigationItems.Detail,
listOf(item.id.toString())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,7 +33,7 @@ import androidx.tv.material3.OutlinedButton
import androidx.tv.material3.Text
import com.muedsa.agetv.screens.NavigationItems
import com.muedsa.agetv.screens.home.useLocalHomeScreenBackgroundState
import com.muedsa.agetv.screens.navigate
import com.muedsa.agetv.screens.nav
import com.muedsa.agetv.theme.AgePosterSize
import com.muedsa.compose.tv.model.ContentModel
import com.muedsa.compose.tv.theme.ImageCardRowCardPadding
Expand Down Expand Up @@ -69,9 +70,10 @@ fun FavoritesScreen(
style = MaterialTheme.typography.headlineMedium
)
Spacer(modifier = Modifier.width(30.dp))
OutlinedButton(onClick = {
deleteMode = !deleteMode
}) {
OutlinedButton(
modifier = Modifier.testTag("favoritesScreen_deleteModeButton"),
onClick = { deleteMode = !deleteMode }
) {
Text(if (deleteMode) "退出" else "删除模式")
Spacer(modifier = Modifier.width(ButtonDefaults.IconSpacing))
Icon(
Expand All @@ -83,6 +85,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(
Expand Down Expand Up @@ -117,7 +120,7 @@ fun FavoritesScreen(
}
viewModel.remove(item)
} else {
navController.navigate(
navController.nav(
NavigationItems.Detail,
listOf(item.id.toString())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
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
Expand All @@ -30,7 +29,7 @@ import androidx.tv.material3.Text
import com.muedsa.agetv.model.LazyType
import com.muedsa.agetv.screens.NavigationItems
import com.muedsa.agetv.screens.home.useLocalHomeScreenBackgroundState
import com.muedsa.agetv.screens.navigate
import com.muedsa.agetv.screens.nav
import com.muedsa.agetv.theme.AgePosterSize
import com.muedsa.agetv.theme.GirdLastItemHeight
import com.muedsa.compose.tv.model.ContentModel
Expand All @@ -43,7 +42,6 @@ import com.muedsa.compose.tv.widget.ImageContentCard
import com.muedsa.compose.tv.widget.ScreenBackgroundType
import com.muedsa.uitl.LogUtil

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun LatestUpdateScreen(
viewModel: LatestUpdateViewModel = hiltViewModel()
Expand All @@ -54,8 +52,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)
Expand All @@ -71,20 +67,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,
Expand Down Expand Up @@ -115,7 +99,7 @@ fun LatestUpdateScreen(
},
onItemClick = {
LogUtil.d("Click $item")
navController.navigate(NavigationItems.Detail, listOf(item.aid.toString()))
navController.nav(NavigationItems.Detail, listOf(item.aid.toString()))
}
)

Expand Down
Loading

0 comments on commit 84ac9f5

Please sign in to comment.