Skip to content

Commit

Permalink
Fixed MediaListener not working on some devices
Browse files Browse the repository at this point in the history
  • Loading branch information
shub39 committed Jul 18, 2024
1 parent cccf740 commit 2f479e1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified app/release/app-release.apk
Binary file not shown.
Binary file modified app/release/baselineProfiles/0/app-release.dm
Binary file not shown.
Binary file modified app/release/baselineProfiles/1/app-release.dm
Binary file not shown.
3 changes: 3 additions & 0 deletions app/src/main/java/com/shub39/rush/RushApplication.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.shub39.rush

import android.app.Application
import com.shub39.rush.listener.MediaListener
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
Expand All @@ -14,6 +15,8 @@ class RushApplication: Application() {
androidContext(this@RushApplication)
modules(rushModules)
}

MediaListener.init(this)
}

}
26 changes: 26 additions & 0 deletions app/src/main/java/com/shub39/rush/page/LyricsPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.FloatingActionButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -61,6 +62,8 @@ fun LyricsPage(
val context = LocalContext.current
var isSharePageVisible by remember { mutableStateOf(false) }
var source by remember { mutableStateOf("") }
// var syncedLyrics by remember { mutableStateOf(false) }
// var syncLyrics by remember { mutableStateOf(false) }
var selectedLines by remember { mutableStateOf<Map<Int, String>>(emptyMap()) }
val maxLinesFlow by SettingsDataStore.getMaxLinesFlow(context).collectAsState(initial = 6)
val coroutineScope = rememberCoroutineScope()
Expand Down Expand Up @@ -114,6 +117,12 @@ fun LyricsPage(
} else if (nonNullSong.geniusLyrics != null) {
source = "Genius"
}
// if (nonNullSong.syncedLyrics != null && NotificationListener.canAccessNotifications(
// context
// )
// ) {
// syncedLyrics = true
// }
}

Card(
Expand Down Expand Up @@ -160,6 +169,23 @@ fun LyricsPage(
)
}
Row {
// val iconColor = if (syncLyrics) {
// IconButtonDefaults.iconButtonColors()
// } else {
// IconButtonDefaults.filledIconButtonColors()
// }
//
// if (syncedLyrics) {
// IconButton(
// onClick = { syncLyrics = !syncLyrics },
// colors = iconColor
// ) {
// Icon(
// painter = painterResource(id = R.drawable.round_sync_24),
// contentDescription = null
// )
// }
// }
IconButton(
onClick = {
openLinkInBrowser(
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/round_sync_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M12,4L12,2.21c0,-0.45 -0.54,-0.67 -0.85,-0.35l-2.8,2.79c-0.2,0.2 -0.2,0.51 0,0.71l2.79,2.79c0.32,0.31 0.86,0.09 0.86,-0.36L12,6c3.31,0 6,2.69 6,6 0,0.79 -0.15,1.56 -0.44,2.25 -0.15,0.36 -0.04,0.77 0.23,1.04 0.51,0.51 1.37,0.33 1.64,-0.34 0.37,-0.91 0.57,-1.91 0.57,-2.95 0,-4.42 -3.58,-8 -8,-8zM12,18c-3.31,0 -6,-2.69 -6,-6 0,-0.79 0.15,-1.56 0.44,-2.25 0.15,-0.36 0.04,-0.77 -0.23,-1.04 -0.51,-0.51 -1.37,-0.33 -1.64,0.34C4.2,9.96 4,10.96 4,12c0,4.42 3.58,8 8,8v1.79c0,0.45 0.54,0.67 0.85,0.35l2.79,-2.79c0.2,-0.2 0.2,-0.51 0,-0.71l-2.79,-2.79c-0.31,-0.31 -0.85,-0.09 -0.85,0.36L12,18z"/>

</vector>

0 comments on commit 2f479e1

Please sign in to comment.