switch to kotlin 2.0 and add parcelable to kotlin
This commit is contained in:
parent
fa9c4f6647
commit
0290eaf9ea
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.0" />
|
||||
<option name="version" value="2.0.20-Beta2" />
|
||||
</component>
|
||||
</project>
|
|
@ -25,6 +25,8 @@ plugins {
|
|||
alias(libs.plugins.jetbrains.kotlin.android)
|
||||
alias(libs.plugins.kotlinAndroidKsp)
|
||||
alias(libs.plugins.androidHilt)
|
||||
alias(libs.plugins.kotlinParcelize)
|
||||
alias(libs.plugins.composeCompiler)
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package net.newpipe.newplayer.model
|
||||
|
||||
import android.app.Application
|
||||
import android.os.Parcelable
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.viewModelScope
|
||||
|
@ -37,13 +38,17 @@ import kotlinx.coroutines.flow.asStateFlow
|
|||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import net.newpipe.newplayer.utils.VideoSize
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
val VIDEOPLAYER_UI_STATE = "video_player_ui_state"
|
||||
|
||||
@Parcelize
|
||||
data class VideoPlayerUIState(
|
||||
val playing: Boolean,
|
||||
var fullscreen: Boolean,
|
||||
var uiVissible: Boolean,
|
||||
var contentRatio: Float
|
||||
) {
|
||||
) : Parcelable {
|
||||
companion object {
|
||||
val DEFAULT = VideoPlayerUIState(
|
||||
playing = false, fullscreen = false, uiVissible = false, 0F
|
||||
|
@ -182,10 +187,6 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
|||
//listener?.switchToFullscreen()
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
}
|
||||
|
||||
companion object {
|
||||
val dummy = object : VideoPlayerViewModel {
|
||||
override val player = null
|
||||
|
|
|
@ -42,6 +42,7 @@ import androidx.lifecycle.Lifecycle
|
|||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import net.newpipe.newplayer.VideoPlayerActivity
|
||||
import net.newpipe.newplayer.model.VIDEOPLAYER_UI_STATE
|
||||
import net.newpipe.newplayer.model.VideoPlayerViewModel
|
||||
import net.newpipe.newplayer.model.VideoPlayerViewModelImpl
|
||||
import net.newpipe.newplayer.ui.theme.VideoPlayerTheme
|
||||
|
@ -81,6 +82,7 @@ fun VideoPlayerUI(
|
|||
VideoPlayerViewModel.Events.SwitchToFullscreen -> {
|
||||
val fullscreen_activity_intent =
|
||||
Intent(activity!!.findActivity(), VideoPlayerActivity::class.java)
|
||||
fullscreen_activity_intent.putExtra(VIDEOPLAYER_UI_STATE, viewModel.uiState.value)
|
||||
activity.startActivity(fullscreen_activity_intent)
|
||||
|
||||
}
|
||||
|
|
|
@ -23,4 +23,6 @@ plugins {
|
|||
alias(libs.plugins.jetbrains.kotlin.android) apply false
|
||||
alias(libs.plugins.androidHilt) apply false
|
||||
alias(libs.plugins.kotlinAndroidKsp) apply false
|
||||
alias(libs.plugins.kotlinParcelize) apply false
|
||||
alias(libs.plugins.composeCompiler) apply false
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
[versions]
|
||||
agp = "8.5.0"
|
||||
kotlin = "1.9.0"
|
||||
kotlin = "2.0.0"
|
||||
coreKtx = "1.13.1"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.2.1"
|
||||
|
@ -37,10 +37,10 @@ hiltCompiler = "1.2.0"
|
|||
hiltNavigationCompose = "1.2.0"
|
||||
lifecycleViewmodelCompose = "2.8.3"
|
||||
kspVersion = "1.9.0-1.0.13"
|
||||
runtimeLivedata = "1.7.0-beta04"
|
||||
fragmentKtx = "1.8.1"
|
||||
lifecycleRuntimeKtx = "2.8.3"
|
||||
composeBom = "2024.04.01"
|
||||
kotlinParcelize = "2.0.20-Beta2"
|
||||
|
||||
[libraries]
|
||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
|
@ -72,9 +72,11 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin
|
|||
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
androidHilt = { id = "com.google.dagger.hilt.android", version.ref = "hiltAndroid" }
|
||||
kotlinAndroidKsp = { id = "com.google.devtools.ksp", version.ref = "kspVersion" }
|
||||
|
||||
kotlinParcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlinParcelize" }
|
Loading…
Reference in New Issue