-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscratch_diff.patch
More file actions
111 lines (108 loc) · 12.7 KB
/
Copy pathscratch_diff.patch
File metadata and controls
111 lines (108 loc) · 12.7 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff --git a/app/src/main/kotlin/com/noxwizard/resonix/ui/screens/HomeScreen.kt b/app/src/main/kotlin/com/noxwizard/resonix/ui/screens/HomeScreen.kt
index 2ffa4eb..1f7bd00 100644
--- a/app/src/main/kotlin/com/noxwizard/resonix/ui/screens/HomeScreen.kt
+++ b/app/src/main/kotlin/com/noxwizard/resonix/ui/screens/HomeScreen.kt
@@ -33,6 +33,8 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
+import androidx.compose.material3.ListItem
+import androidx.compose.foundation.clickable
import com.noxwizard.resonix.ui.component.IconButton
import com.noxwizard.resonix.ui.component.MeshGradientBackground
@@ -138,6 +140,9 @@ import com.noxwizard.resonix.constants.DynamicThemeKey
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.noxwizard.resonix.ui.component.LocalCategoryAccentCallback
+import com.noxwizard.resonix.ui.component.UtilityFab
+import com.noxwizard.resonix.ui.component.ListDialog
+import com.noxwizard.resonix.ui.utils.isScrollingUp
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
@@ -570,57 +575,43 @@ fun HomeScreen(
}
}
- // ÔöÇÔöÇ Shuffle FAB ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇ
- HideOnScrollFAB(
- visible = allLocalItems.isNotEmpty() || allYtItems.isNotEmpty(),
- lazyListState = lazylistState,
- icon = R.drawable.shuffle,
- onClick = {
- val local = when {
- allLocalItems.isNotEmpty() && allYtItems.isNotEmpty() -> Random.nextFloat() < 0.5
- allLocalItems.isNotEmpty() -> true
- else -> false
- }
- scope.launch(Dispatchers.Main) {
- if (local) {
- when (val luckyItem = allLocalItems.random()) {
- is Song -> playerConnection.playQueue(YouTubeQueue.radio(luckyItem.toMediaMetadata()))
- is Album -> {
- val albumWithSongs = withContext(Dispatchers.IO) {
- database.albumWithSongs(luckyItem.id).first()
- }
- albumWithSongs?.let {
- playerConnection.playQueue(LocalAlbumRadio(it))
- }
- }
- is Artist -> {}
- is Playlist -> {}
+ // ÔöÇÔöÇ Utility FAB (Listen Together + Mic) ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇ
+ UtilityFab(
+ visible = true,
+ lazyListScrollingUp = lazylistState.isScrollingUp(),
+ onRecognition = { navController.navigate("recognition") },
+ onListenTogether = { navController.navigate("listen_together") },
+ onListenTogetherLongPress = {
+ menuState.show {
+ ListDialog(
+ onDismiss = menuState::dismiss,
+ ) {
+ item {
+ ListItem(
+ headlineContent = { Text("Invite users") },
+ leadingContent = { Icon(painterResource(R.drawable.share), contentDescription = null) },
+ modifier = Modifier.clickable { menuState.dismiss() }
+ )
}
- } else {
- when (val luckyItem = allYtItems.random()) {
- is SongItem -> playerConnection.playQueue(YouTubeQueue.radio(luckyItem.toMediaMetadata()))
- is AlbumItem -> playerConnection.playQueue(YouTubeAlbumRadio(luckyItem.playlistId))
- is ArtistItem -> luckyItem.radioEndpoint?.let {
- playerConnection.playQueue(YouTubeQueue(it))
- }
- is PlaylistItem -> luckyItem.playEndpoint?.let {
- playerConnection.playQueue(YouTubeQueue(it))
- }
+ item {
+ ListItem(
+ headlineContent = { Text("Copy session code") },
+ leadingContent = { Icon(painterResource(R.drawable.link), contentDescription = null) },
+ modifier = Modifier.clickable { menuState.dismiss() }
+ )
+ }
+ item {
+ ListItem(
+ headlineContent = { Text("Leave session", color = MaterialTheme.colorScheme.error) },
+ leadingContent = { Icon(painterResource(R.drawable.logout), contentDescription = null, tint = MaterialTheme.colorScheme.error) },
+ modifier = Modifier.clickable { menuState.dismiss() }
+ )
}
}
}
}
)
- // ÔöÇÔöÇ Mic / Recognition FAB ÔÇö sits above shuffle ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇ
- HideOnScrollFAB(
- visible = true,
- lazyListState = lazylistState,
- icon = R.drawable.mic_24,
- offsetY = 76.dp,
- onClick = { navController.navigate("recognition") }
- )
-
Indicator(
isRefreshing = isRefreshing,
state = pullRefreshState,