Skip to content

Commit

Permalink
remove: upscayl function
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Aug 12, 2024
1 parent 6e668b6 commit d7bfa8f
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 54 deletions.
4 changes: 1 addition & 3 deletions app/src/main/kotlin/com/muedsa/jcytv/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")
3 changes: 0 additions & 3 deletions app/src/main/kotlin/com/muedsa/jcytv/model/AppSettingModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import com.muedsa.jcytv.KEY_DANMAKU_ENABLE
import com.muedsa.jcytv.KEY_DANMAKU_MERGE_ENABLE
import com.muedsa.jcytv.KEY_DANMAKU_SCREEN_PART
import com.muedsa.jcytv.KEY_DANMAKU_SIZE_SCALE
import com.muedsa.jcytv.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 @@ -26,7 +24,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
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,13 @@ import com.muedsa.jcytv.ui.RankFontColor
import com.muedsa.jcytv.ui.RankIconColor
import com.muedsa.jcytv.ui.nav.NavigationItems
import com.muedsa.jcytv.ui.nav.navigate
import com.muedsa.jcytv.util.Upscayl
import com.muedsa.jcytv.viewmodel.AnimeDetailViewModel
import com.muedsa.jcytv.viewmodel.AppSettingViewModel
import com.muedsa.model.LazyType
import com.muedsa.uitl.LogUtil

@Composable
fun AnimeDetailScreen(
viewModel: AnimeDetailViewModel = hiltViewModel(),
appSettingViewModel: AppSettingViewModel = hiltViewModel()
viewModel: AnimeDetailViewModel = hiltViewModel()
) {
val context = LocalContext.current
val configuration = LocalConfiguration.current
Expand All @@ -95,8 +92,6 @@ fun AnimeDetailScreen(
val danSearchAnimeListLD by viewModel.danSearchAnimeListLDSF.collectAsState()
val danAnimeInfoLD by viewModel.danAnimeInfoLDSF.collectAsState()

val settingLD by appSettingViewModel.settingLDSF.collectAsState()

val episodeRelationMap = remember { mutableStateMapOf<String, Long>() }

val backgroundState = rememberScreenBackgroundState(
Expand All @@ -108,11 +103,7 @@ fun AnimeDetailScreen(
errorMsgBoxController.error(animeDetailLD.error)
} else if (animeDetailLD.type == LazyType.SUCCESS) {
if (animeDetailLD.data != null) {
if (settingLD.data?.upscaylCoverImageEnable == true) {
backgroundState.url = Upscayl.url(animeDetailLD.data!!.imageUrl)
} else {
backgroundState.url = animeDetailLD.data!!.imageUrl
}
backgroundState.url = animeDetailLD.data!!.imageUrl
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,26 +227,6 @@ fun AppSettingScreen(
}
}

Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 20.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = "UPSCAYL",
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.titleMedium
)
FocusScaleSwitch(
checked = settingModel.upscaylCoverImageEnable,
onCheckedChange = {
viewModel.changeUpscaylCoverImageEnable(it)
}
)
}

HorizontalDivider()

Row(
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/kotlin/com/muedsa/jcytv/util/Upscayl.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.muedsa.jcytv.KEY_DANMAKU_ENABLE
import com.muedsa.jcytv.KEY_DANMAKU_MERGE_ENABLE
import com.muedsa.jcytv.KEY_DANMAKU_SCREEN_PART
import com.muedsa.jcytv.KEY_DANMAKU_SIZE_SCALE
import com.muedsa.jcytv.KEY_UPSCAYL_COVER_IMAGE_ENABLE
import com.muedsa.jcytv.model.AppSettingModel
import com.muedsa.jcytv.repository.DataStoreRepo
import com.muedsa.model.LazyData
Expand Down Expand Up @@ -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
}
}
}

}

0 comments on commit d7bfa8f

Please sign in to comment.