NewPlayer/app/src/main/java/net/newpipe/newplayer/PlayerFragment.kt

33 lines
No EOL
1,021 B
Kotlin

package net.newpipe.newplayer
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.material3.MaterialTheme
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.fragment.app.Fragment
import androidx.compose.material3.Text
class PlayerFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.player_framgent, container, false)
val composeView = view.findViewById<ComposeView>(R.id.player_copose_view)
composeView.apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
MaterialTheme {
Text("hello world")
}
}
}
return view
}
}