Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.lighttigerxiv.simple.mp.compose.data.data_classes.Song
import com.lighttigerxiv.simple.mp.compose.data.data_classes.SongsData
import com.lighttigerxiv.simple.mp.compose.data.mongodb.getMongoRealm
import com.lighttigerxiv.simple.mp.compose.data.mongodb.queries.CacheQueries
import com.lighttigerxiv.simple.mp.compose.data.variables.SMALL_SPACING
import com.lighttigerxiv.simple.mp.compose.data.variables.Settings
import com.lighttigerxiv.simple.mp.compose.data.workers.SyncSongsWorker
import com.lighttigerxiv.simple.mp.compose.functions.Permissions
Expand Down Expand Up @@ -623,18 +624,23 @@ class MainVM(application: Application) : AndroidViewModel(application) {

val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT


val navigationHeight = 55.dp
// Navigation + Toolbar + Spacing Spacer TOP + SheetDraggingBar + Spacing Bottom
val peekPlayerHeight = 60.dp + SMALL_SPACING + 5.dp

smpService?.let {
if (isPortrait && !smpService!!.isMusicPlayingOrPaused()) {
_miniPlayerPeekHeight.update { 55.dp }
_miniPlayerPeekHeight.update { navigationHeight }
}
if (isPortrait && smpService!!.isMusicPlayingOrPaused()) {
_miniPlayerPeekHeight.update { 115.dp }
_miniPlayerPeekHeight.update { navigationHeight + peekPlayerHeight }
}
if (!isPortrait && !smpService!!.isMusicPlayingOrPaused()) {
_miniPlayerPeekHeight.update { 0.dp }
}
if (!isPortrait && smpService!!.isMusicPlayingOrPaused()) {
_miniPlayerPeekHeight.update { 55.dp }
_miniPlayerPeekHeight.update { peekPlayerHeight }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.lighttigerxiv.simple.mp.compose.data.variables.SMALL_SPACING
import com.lighttigerxiv.simple.mp.compose.activities.main.MainVM
import com.lighttigerxiv.simple.mp.compose.data.variables.ImageSizes
import com.lighttigerxiv.simple.mp.compose.ui.composables.spacers.SmallHorizontalSpacer
import com.lighttigerxiv.simple.mp.compose.ui.composables.SheetDraggingBar
import com.lighttigerxiv.simple.mp.compose.functions.getImage
import com.lighttigerxiv.simple.mp.compose.screens.main.playlists.playlist.modifyIf

Expand All @@ -39,79 +40,85 @@ fun MiniPlayer(
} else {
remember { getImage(context, R.drawable.play, ImageSizes.SMALL) }
}

Row(
Column(
modifier = Modifier
.fillMaxWidth()
.height(60.dp)
.background(MaterialTheme.colorScheme.surfaceVariant)
.padding(SMALL_SPACING)
.clickable { onClick() }
) {
SheetDraggingBar()

if (song != null) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(60.dp)
.background(MaterialTheme.colorScheme.surfaceVariant)
.padding(SMALL_SPACING)
.clickable { onClick() }
) {

val artistName = mainVM.getSongArtist(song).name
if (song != null) {

Image(
bitmap = (art ?: getImage(context, R.drawable.cd, ImageSizes.SMALL)).asImageBitmap(),
colorFilter = if (art == null) ColorFilter.tint(MaterialTheme.colorScheme.primary) else null,
contentDescription = "Song Album Art",
modifier = Modifier
.fillMaxHeight()
.clip(RoundedCornerShape(7.dp))
.modifyIf(art == null) {
background(surfaceColor)
}
.modifyIf(art == null) {
padding(5.dp)
}
)
val artistName = mainVM.getSongArtist(song).name

SmallHorizontalSpacer()
Image(
bitmap = (art ?: getImage(context, R.drawable.cd, ImageSizes.SMALL)).asImageBitmap(),
colorFilter = if (art == null) ColorFilter.tint(MaterialTheme.colorScheme.primary) else null,
contentDescription = "Song Album Art",
modifier = Modifier
.fillMaxHeight()
.clip(RoundedCornerShape(7.dp))
.modifyIf(art == null) {
background(surfaceColor)
}
.modifyIf(art == null) {
padding(5.dp)
}
)

Column(
modifier = Modifier
.fillMaxHeight()
.weight(1f, fill = true),
verticalArrangement = Arrangement.Top
) {
SmallHorizontalSpacer()

CustomText(
text = song.title,
weight = FontWeight.Bold,
color = MaterialTheme.colorScheme.primary
)
Column(
modifier = Modifier
.fillMaxHeight()
.weight(1f, fill = true),
verticalArrangement = Arrangement.Top
) {

CustomText(
text = artistName
)
}
CustomText(
text = song.title,
weight = FontWeight.Bold,
color = MaterialTheme.colorScheme.primary
)

SmallHorizontalSpacer()
CustomText(
text = artistName
)
}

Column(
modifier = Modifier
.fillMaxHeight(),
verticalArrangement = Arrangement.Center
) {
SmallHorizontalSpacer()

Image(
Column(
modifier = Modifier
.height(20.dp)
.width(20.dp)
.clip(RoundedCornerShape(2.dp))
.clickable {
mainVM.pauseResumeMusic()
},
bitmap = playPauseIcon.asImageBitmap(),
contentDescription = "Play/Pause button",
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary)
)
}
.fillMaxHeight(),
verticalArrangement = Arrangement.Center
) {

Image(
modifier = Modifier
.height(20.dp)
.width(20.dp)
.clip(RoundedCornerShape(2.dp))
.clickable {
mainVM.pauseResumeMusic()
},
bitmap = playPauseIcon.asImageBitmap(),
contentDescription = "Play/Pause button",
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary)
)
}

SmallHorizontalSpacer()
SmallHorizontalSpacer()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

@Preview
@Composable
fun SheetDraggingBar(){
Row(
Expand Down