feat: Now Playing screen MVP (nb. layout xml and Compose UI are two different sources)
This commit is contained in:
43
app/src/main/java/at/lockstep/player/MainActivity.kt
Normal file
43
app/src/main/java/at/lockstep/player/MainActivity.kt
Normal file
@@ -0,0 +1,43 @@
|
||||
package at.lockstep.player
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableFloatStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import at.lockstep.player.ui.NowPlayingScreen
|
||||
import at.lockstep.player.ui.NowPlayingUiState
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
MaterialTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize()) {
|
||||
var progress by remember { mutableFloatStateOf(0f) }
|
||||
var playing by remember { mutableStateOf(false) }
|
||||
NowPlayingScreen(
|
||||
state = NowPlayingUiState(
|
||||
title = "No track",
|
||||
artist = "—",
|
||||
progress = progress,
|
||||
durationSeconds = 180,
|
||||
isPlaying = playing,
|
||||
),
|
||||
onProgressChange = { progress = it },
|
||||
onPrevious = { /* TODO: service / JNI */ },
|
||||
onTogglePlayPause = { playing = !playing },
|
||||
onNext = { /* TODO: service / JNI */ },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user