Skip to content

Commit

Permalink
linter -_-
Browse files Browse the repository at this point in the history
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
  • Loading branch information
rapterjet2004 committed Feb 4, 2025
1 parent 2749c98 commit 09d469e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ class MediaPlayerManager : LifecycleAwareManager {
@JvmStatic
private val manager: MediaPlayerManager = MediaPlayerManager()

fun sharedInstance(preferences: AppPreferences): MediaPlayerManager = manager.apply {
appPreferences = preferences
}
fun sharedInstance(preferences: AppPreferences): MediaPlayerManager =
manager.apply {
appPreferences = preferences
}
}

lateinit var appPreferences: AppPreferences
Expand All @@ -74,8 +75,8 @@ class MediaPlayerManager : LifecycleAwareManager {
private val playQueue = mutableListOf<Pair<String, ChatMessage>>()

val mediaPlayerSeekBarPositionMsg: Flow<ChatMessage>
get() = _mediaPlayerSeekBarPositionPair
private val _mediaPlayerSeekBarPositionPair: MutableSharedFlow<ChatMessage> = MutableSharedFlow()
get() = _mediaPlayerSeekBarPositionMsg
private val _mediaPlayerSeekBarPositionMsg: MutableSharedFlow<ChatMessage> = MutableSharedFlow()

val mediaPlayerSeekBarPosition: Flow<Int>
get() = _mediaPlayerSeekBarPosition
Expand Down Expand Up @@ -194,7 +195,7 @@ class MediaPlayerManager : LifecycleAwareManager {
it.voiceMessageSeekbarProgress = progressI
it.voiceMessagePlayedSeconds = seconds
if (progressI >= IS_PLAYED_CUTOFF) it.wasPlayedVoiceMessage = true
_mediaPlayerSeekBarPositionPair.emit(it)
_mediaPlayerSeekBarPositionMsg.emit(it)
}
}

Expand Down Expand Up @@ -286,7 +287,7 @@ class MediaPlayerManager : LifecycleAwareManager {
it.isPlayingVoiceMessage = false
}
runBlocking {
_mediaPlayerSeekBarPositionPair.emit(currentCycledMessage!!)
_mediaPlayerSeekBarPositionMsg.emit(currentCycledMessage!!)
}
currentCycledMessage = null
loop = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,10 @@ class ChatViewModel @Inject constructor(

fun startCyclingMediaPlayer() = audioRequest(true, mediaPlayerManager::startCycling)

fun pauseMediaPlayer(notifyUI: Boolean) = audioRequest(false) {
mediaPlayerManager.pause(notifyUI)
fun pauseMediaPlayer(notifyUI: Boolean) {
audioRequest(false) {
mediaPlayerManager.pause(notifyUI)
}
}

fun seekToMediaPlayer(progress: Int) = mediaPlayerManager.seekTo(progress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ import javax.inject.Inject
class BackgroundVoiceMessageCard(
val name: String,
val duration: Int,
val offset: Float,
val imageURI: String,
val conversationImageURI: String
private val offset: Float,
private val imageURI: String,
private val conversationImageURI: String
) {

@Inject
Expand All @@ -62,7 +62,7 @@ class BackgroundVoiceMessageCard(
@Inject
lateinit var context: Context

private val progressState = mutableFloatStateOf(0.01f)
private val progressState = mutableFloatStateOf(0.0f)
private val animator = ValueAnimator.ofFloat(offset, 1.0f)

init {
Expand All @@ -75,6 +75,11 @@ class BackgroundVoiceMessageCard(
animator.start()
}

companion object {
private const val ACCOUNT_WEIGHT = .8f
}

@Suppress("FunctionNaming", "LongMethod")
@Composable
fun GetView(onPlayPaused: (isPaused: Boolean) -> Unit, onClosed: () -> Unit) {
MaterialTheme(colorScheme = viewThemeUtils.getColorScheme(context)) {
Expand Down Expand Up @@ -130,7 +135,7 @@ class BackgroundVoiceMessageCard(

Box(
modifier = Modifier
.weight(.8f)
.weight(ACCOUNT_WEIGHT)
.align(Alignment.CenterVertically),
contentAlignment = Alignment.Center
) {
Expand Down

0 comments on commit 09d469e

Please sign in to comment.