Compare commits
5 Commits
2818828c3c
...
880ce7c38c
Author | SHA1 | Date |
---|---|---|
|
880ce7c38c | 1 year ago |
|
af3ff9dacc | 1 year ago |
![]() |
5cfc57e864 | 1 year ago |
![]() |
b69f2bf3ea | 1 year ago |
![]() |
2d231a4402 | 1 year ago |
@ -1,11 +0,0 @@
|
||||
package com.example.veraxapplication.data
|
||||
/*
|
||||
data class Article(
|
||||
var Title : String,
|
||||
var Description : String,
|
||||
var Image : String,
|
||||
var Author : String,
|
||||
var Content : List<Paragraph>,
|
||||
var LectureTime : String
|
||||
)
|
||||
*/
|
@ -1,6 +0,0 @@
|
||||
package com.example.veraxapplication.data
|
||||
/*
|
||||
data class Paragraph(
|
||||
var Content : String,
|
||||
)
|
||||
*/
|
@ -0,0 +1,44 @@
|
||||
package com.example.veraxapplication.navigation
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import androidx.navigation.navArgument
|
||||
import com.example.veraxapplication.articles.IArticlesDataManager
|
||||
import com.example.veraxapplication.articles.StubArticles
|
||||
//import com.example.veraxapplication.HomeScreen
|
||||
|
||||
//https://codefirst.iut.uca.fr/git/Kotlin_Android/Android_TP_2/src/branch/master/app/src/main/java/fr/iut/tp2/navigation/TP2NavHost.kt
|
||||
@Composable
|
||||
fun NavHost(){
|
||||
val navController = rememberNavController()
|
||||
val dataManager : IArticlesDataManager = StubArticles()
|
||||
var articles = dataManager.getDerniersArticles(4)
|
||||
|
||||
NavHost(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
navController = navController,
|
||||
startDestination = "home"
|
||||
) {
|
||||
|
||||
composable(route = "home") {
|
||||
/* HomeScreen(
|
||||
//article = , //recup l article cliqué
|
||||
goToArticle = {
|
||||
navController.navigate("articleALaUne/${it.id}")
|
||||
}
|
||||
)
|
||||
}
|
||||
composable(
|
||||
route = "articleALaUne/{articleId}",
|
||||
arguments = navArgument("articleALaUne") { type = NavType.LongType })
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.example.veraxapplication.ui.article
|
||||
|
||||
import android.graphics.drawable.Icon
|
||||
import android.media.browse.MediaBrowser
|
||||
import android.net.Uri // pas sur de l'import
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
|
||||
@Composable
|
||||
fun VideoPlayer(videoUri : Uri){
|
||||
val context = LocalContext.current
|
||||
val exoPlayer = remember {
|
||||
SimpleExoPlayer.Builder(context).build().apply {
|
||||
setMediaItem(MediaBrowser.MediaItem.fromUri(videoUri))
|
||||
prepare()
|
||||
}
|
||||
}
|
||||
val playbackState by exoPlayer.rememberPlaybackState()
|
||||
val isPlaying = playbackState?.isPlaying ?: false
|
||||
|
||||
AndroidView(
|
||||
factory = { context ->
|
||||
PlayerView(context).apply {
|
||||
player = exoPlayer
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
if (isPlaying) {
|
||||
exoPlayer.pause()
|
||||
} else {
|
||||
exoPlayer.play()
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(16.dp)
|
||||
) {
|
||||
/*Icon(
|
||||
imageVector = if (isPlaying) Icons.Filled.Pause else Icons.Filled.PlayArrow,
|
||||
contentDescription = if (isPlaying) "Pause" else "Play",
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(48.dp)
|
||||
)*/
|
||||
}
|
||||
}
|
Loading…
Reference in new issue