Skip to content

Commit

Permalink
Merge pull request #4095 from twistios/fix_scrolling_long_text
Browse files Browse the repository at this point in the history
Fixes scrolling of long text
  • Loading branch information
fast4x authored Oct 23, 2024
2 parents db79188 + a9495d7 commit 5526136
Show file tree
Hide file tree
Showing 52 changed files with 706 additions and 401 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fun AlbumsItemGridMenu(
onPlayNext: (() -> Unit)? = null,
onEnqueue: (() -> Unit)? = null,
onAddToPlaylist: ((PlaylistPreview) -> Unit)? = null,

disableScrollingText: Boolean
) {
val density = LocalDensity.current

Expand Down Expand Up @@ -260,7 +260,8 @@ fun AlbumsItemGridMenu(
album = album,
thumbnailSizePx = thumbnailSizePx,
thumbnailSizeDp = thumbnailSizeDp,
yearCentered = false
yearCentered = false,
disableScrollingText = disableScrollingText
)
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fun AlbumsItemMenu(
onPlayNext: (() -> Unit)? = null,
onEnqueue: (() -> Unit)? = null,
onAddToPlaylist: ((PlaylistPreview) -> Unit)? = null,
disableScrollingText: Boolean
) {
val density = LocalDensity.current

Expand Down Expand Up @@ -104,7 +105,8 @@ fun AlbumsItemMenu(
onDownloadAlbumCover = onDownloadAlbumCover,
onPlayNext = onPlayNext,
onEnqueue = onEnqueue,
onAddToPlaylist = onAddToPlaylist
onAddToPlaylist = onAddToPlaylist,
disableScrollingText = disableScrollingText
)
} else {
AnimatedContent(
Expand Down Expand Up @@ -278,7 +280,8 @@ fun AlbumsItemMenu(
album = album,
thumbnailSizePx = thumbnailSizePx,
thumbnailSizeDp = thumbnailSizeDp,
yearCentered = false
yearCentered = false,
disableScrollingText = disableScrollingText
)

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.annotation.SuppressLint
import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -34,6 +35,7 @@ import it.fast4x.rimusic.enums.UiType
import it.fast4x.rimusic.ui.styling.Dimensions
import it.fast4x.rimusic.ui.styling.shimmer
import it.fast4x.rimusic.utils.bold
import it.fast4x.rimusic.utils.conditional
import it.fast4x.rimusic.utils.medium
import it.fast4x.rimusic.utils.semiBold
import me.knighthat.colorPalette
Expand All @@ -45,6 +47,7 @@ fun Header(
title: String,
modifier: Modifier = Modifier,
actionsContent: @Composable RowScope.() -> Unit = {},
disableScrollingText: Boolean
) {
Header(
modifier = modifier,
Expand All @@ -53,7 +56,8 @@ fun Header(
text = title,
style = typography().xxl.medium,
maxLines = 1,
overflow = TextOverflow.Ellipsis
overflow = TextOverflow.Ellipsis,
modifier = Modifier.conditional(!disableScrollingText) { basicMarquee(iterations = Int.MAX_VALUE) }
)
},
actionsContent = actionsContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ fun NonQueuedMediaItemGridMenu(
onHideFromDatabase: (() -> Unit)? = null,
onRemoveFromQuickPicks: (() -> Unit)? = null,
onDownload: (() -> Unit)? = null,
disableScrollingText: Boolean
) {
val binder = LocalPlayerServiceBinder.current
val context = LocalContext.current
Expand All @@ -129,7 +130,8 @@ fun NonQueuedMediaItemGridMenu(
onRemoveFromPlaylist = onRemoveFromPlaylist,
onHideFromDatabase = onHideFromDatabase,
onRemoveFromQuickPicks = onRemoveFromQuickPicks,
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}

Expand All @@ -153,6 +155,7 @@ fun BaseMediaItemGridMenu(
onClosePlayer: (() -> Unit)? = null,
onGoToPlaylist: ((Long) -> Unit)? = null,
onAddToPreferites: (() -> Unit)? = null,
disableScrollingText: Boolean
) {
//val context = LocalContext.current

Expand Down Expand Up @@ -213,7 +216,8 @@ fun BaseMediaItemGridMenu(
onGoToPlaylist = {
navController.navigate(route = "${NavRoutes.localPlaylist.name}/$it")
},
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}

Expand All @@ -224,8 +228,8 @@ fun MiniMediaItemGridMenu(
mediaItem: MediaItem,
onGoToPlaylist: ((Long) -> Unit)? = null,
onAddToPreferites: (() -> Unit)? = null,

modifier: Modifier = Modifier,
disableScrollingText: Boolean
) {

MediaItemGridMenu(
Expand All @@ -252,7 +256,8 @@ fun MiniMediaItemGridMenu(
}
},
onAddToPreferites = onAddToPreferites,
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}

Expand All @@ -279,7 +284,8 @@ fun MediaItemGridMenu (
onGoToAlbum: ((String) -> Unit)? = null,
onGoToArtist: ((String) -> Unit)? = null,
onRemoveFromQuickPicks: (() -> Unit)? = null,
onGoToPlaylist: ((Long) -> Unit)?
onGoToPlaylist: ((Long) -> Unit)?,
disableScrollingText: Boolean
) {
val binder = LocalPlayerServiceBinder.current
val uriHandler = LocalUriHandler.current
Expand Down Expand Up @@ -424,7 +430,8 @@ fun MediaItemGridMenu (
thumbnailSizeDp = thumbnailSizeDp,
modifier = Modifier
.weight(1f),
mediaId = mediaItem.mediaId
mediaId = mediaItem.mediaId,
disableScrollingText = disableScrollingText
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import it.fast4x.rimusic.utils.addNext
import it.fast4x.rimusic.utils.addToPipedPlaylist
import it.fast4x.rimusic.utils.asMediaItem
import it.fast4x.rimusic.cleanPrefix
import it.fast4x.rimusic.utils.disableScrollingTextKey
import it.fast4x.rimusic.utils.downloadedStateMedia
import it.fast4x.rimusic.utils.enqueue
import it.fast4x.rimusic.utils.forcePlay
Expand Down Expand Up @@ -129,7 +130,8 @@ fun InHistoryMediaItemMenu(
song: Song,
onHideFromDatabase: (() -> Unit)? = {},
onDeleteFromDatabase: (() -> Unit)? = {},
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
disableScrollingText: Boolean
) {
//val binder = LocalPlayerServiceBinder.current

Expand Down Expand Up @@ -165,7 +167,8 @@ fun InHistoryMediaItemMenu(
Database.like(song.id, System.currentTimeMillis())
}
},
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}

Expand All @@ -180,7 +183,8 @@ fun InPlaylistMediaItemMenu(
playlistId: Long,
positionInPlaylist: Int,
song: Song,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
disableScrollingText: Boolean
) {
val isPipedEnabled by rememberPreference(isPipedEnabledKey, false)
val coroutineScope = rememberCoroutineScope()
Expand Down Expand Up @@ -213,7 +217,8 @@ fun InPlaylistMediaItemMenu(
Database.like(song.id, System.currentTimeMillis())
}
},
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}

Expand All @@ -229,6 +234,7 @@ fun NonQueuedMediaItemMenuLibrary(
onRemoveFromPlaylist: (() -> Unit)? = null,
onRemoveFromQuickPicks: (() -> Unit)? = null,
onDownload: (() -> Unit)? = null,
disableScrollingText: Boolean
) {
val binder = LocalPlayerServiceBinder.current
val context = LocalContext.current
Expand Down Expand Up @@ -289,7 +295,8 @@ fun NonQueuedMediaItemMenuLibrary(
)
}
},
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
} else {

Expand Down Expand Up @@ -321,7 +328,8 @@ fun NonQueuedMediaItemMenuLibrary(
)
}
},
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}
}
Expand All @@ -340,7 +348,8 @@ fun NonQueuedMediaItemMenu(
onDeleteFromDatabase: (() -> Unit)? = null,
onRemoveFromQuickPicks: (() -> Unit)? = null,
onDownload: (() -> Unit)? = null,
onAddToPreferites: (() -> Unit)? = null
onAddToPreferites: (() -> Unit)? = null,
disableScrollingText: Boolean
) {
val binder = LocalPlayerServiceBinder.current
val context = LocalContext.current
Expand Down Expand Up @@ -375,7 +384,8 @@ fun NonQueuedMediaItemMenu(
onDeleteFromDatabase = onDeleteFromDatabase,
onRemoveFromQuickPicks = onRemoveFromQuickPicks,
onAddToPreferites = onAddToPreferites,
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
} else {

Expand All @@ -401,7 +411,8 @@ fun NonQueuedMediaItemMenu(
onDeleteFromDatabase = onDeleteFromDatabase,
onRemoveFromQuickPicks = onRemoveFromQuickPicks,
onAddToPreferites = onAddToPreferites,
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}
}
Expand All @@ -416,7 +427,8 @@ fun QueuedMediaItemMenu(
onDownload: (() -> Unit)?,
mediaItem: MediaItem,
indexInQueue: Int?,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
disableScrollingText: Boolean
) {
val binder = LocalPlayerServiceBinder.current
val context = LocalContext.current
Expand Down Expand Up @@ -458,6 +470,7 @@ fun QueuedMediaItemMenu(
)
}
},
disableScrollingText = disableScrollingText
)
} else {
BaseMediaItemMenu(
Expand Down Expand Up @@ -491,6 +504,7 @@ fun QueuedMediaItemMenu(
)
}
},
disableScrollingText = disableScrollingText
)
}
}
Expand All @@ -517,7 +531,8 @@ fun BaseMediaItemMenu(
onRemoveFromQuickPicks: (() -> Unit)? = null,
onClosePlayer: (() -> Unit)? = null,
onGoToPlaylist: ((Long) -> Unit)? = null,
onAddToPreferites: (() -> Unit)?
onAddToPreferites: (() -> Unit)?,
disableScrollingText: Boolean
) {
val context = LocalContext.current

Expand Down Expand Up @@ -596,7 +611,8 @@ fun BaseMediaItemMenu(
onGoToPlaylist = {
navController.navigate(route = "${NavRoutes.localPlaylist.name}/$it")
},
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}

Expand All @@ -611,6 +627,7 @@ fun MiniMediaItemMenu(
onGoToPlaylist: ((Long) -> Unit)? = null,
onAddToPreferites: (() -> Unit)?,
modifier: Modifier = Modifier,
disableScrollingText: Boolean
) {
val context = LocalContext.current

Expand Down Expand Up @@ -650,7 +667,8 @@ fun MiniMediaItemMenu(
context.startActivity(Intent.createChooser(sendIntent, null))
},
onAddToPreferites = onAddToPreferites,
modifier = modifier
modifier = modifier,
disableScrollingText = disableScrollingText
)
}

Expand All @@ -662,6 +680,7 @@ fun FolderItemMenu(
thumbnailSizeDp: Dp,
onDismiss: () -> Unit,
onEnqueue: () -> Unit,
disableScrollingText: Boolean
) {
val density = LocalDensity.current

Expand Down Expand Up @@ -691,7 +710,7 @@ fun FolderItemMenu(
modifier = Modifier
.padding(end = 12.dp)
) {
FolderItem(folder, thumbnailSizeDp)
FolderItem(folder, thumbnailSizeDp, disableScrollingText = disableScrollingText)

}

Expand Down Expand Up @@ -737,7 +756,8 @@ fun MediaItemMenu(
onGoToArtist: ((String) -> Unit)? = null,
onRemoveFromQuickPicks: (() -> Unit)? = null,
onShare: () -> Unit,
onGoToPlaylist: ((Long) -> Unit)? = null
onGoToPlaylist: ((Long) -> Unit)? = null,
disableScrollingText: Boolean
) {
val density = LocalDensity.current

Expand Down Expand Up @@ -1109,7 +1129,8 @@ fun MediaItemMenu(
thumbnailSizeDp = thumbnailSizeDp,
modifier = Modifier
.weight(1f),
mediaId = mediaItem.mediaId
mediaId = mediaItem.mediaId,
disableScrollingText = disableScrollingText
)


Expand Down
Loading

0 comments on commit 5526136

Please sign in to comment.