-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.kt
More file actions
52 lines (48 loc) · 1.67 KB
/
Copy pathMainActivity.kt
File metadata and controls
52 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.example.muzecode
import android.media.session.MediaController
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.example.muzecode.ui.theme.MuZeCodeTheme
class MainActivity : ComponentActivity() {
private lateinit var mediaController: MediaController
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MuZeCodeTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
val songslll = listOf(
Song("Song 1", "Artist 1"),
Song("Song 2", "Artist 2"),
Song("Song 3", "Artist 3"),
Song("Song 4", "Artist 4"),
Song("Song 5", "Artist 5")
)
SongList(songslll)
}
}
}
}
}
data class Song(val title: String, val artist: String)
@Composable
fun SongList(songsList: List<Song>)
{
LazyColumn(modifier = Modifier.padding(16.dp))
{
items(songsList) { song ->
Text(text = "${song.title} - ${song.artist}")
}
}
}