diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0ff39fa..b27a28d 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -12,7 +12,6 @@
-
@@ -25,7 +24,7 @@
-
-
- val contentResolver: ContentResolver = context.contentResolver
- val uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
- val projection = arrayOf(
- MediaStore.Audio.Media._ID,
- MediaStore.Audio.Albums.ALBUM,
- MediaStore.Audio.Albums.ARTIST,
- //MediaStore.Audio.Media.DATE_ADDED,
- //MediaStore.Audio.Media.YEAR
- )
- val cursor: Cursor? = contentResolver.query(
- uri,
- projection,
- //"${MediaStore.Audio.Media.DATA} LIKE ?",
- "${MediaStore.Audio.Media.DATA} LIKE ?" +
- " OR ${MediaStore.Audio.Media.DATA} LIKE ?"
- .repeat(LocalProviderManager.getAllFolders().size - 1),
- LocalProviderManager.getAllFolders().map {
- "%$it%"
- }.toTypedArray(),
- sortOrder
- )
-
- when {
- cursor == null -> {
- // query failed, handle error.
- }
-
- !cursor.moveToFirst() -> {
- // no media on the device
- }
-
- else -> {
- val idColumn: Int = cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums._ID)
- val albumColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Albums.ALBUM)
- val artistColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Albums.ARTIST)
- //val dateAddedColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Media.DATE_ADDED)
- //val yearColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Media.YEAR)
-
- do {
- val thisId = cursor.getLongOrNull(idColumn) ?: 0
- val thisAlbum = cursor.getStringOrNull(albumColumn) ?: "Unknown"
- val thisArtist = cursor.getStringOrNull(artistColumn) ?: "Unknown"
- //val thisDateAdded = cursor.getString(dateAddedColumn)
- //val thisYear = cursor.getInt(yearColumn)
-
- val imageUri: String = try {
- "content://media/external/audio/media/$thisId/albumart"
- } catch (_: FileNotFoundException) {
- println("No Album Art!")
- }.toString()
-
- val album = MediaData.Album(
- navidromeID = "Local_$thisId",
- name = thisAlbum,
- album = thisAlbum,
- title = thisAlbum,
- artist = thisArtist,
- coverArt = imageUri,
- songCount = 0,
- duration = 0,
- artistId = "",
- )
+ applicationContext?.let { context ->
+ val contentResolver: ContentResolver = context.contentResolver
+ val uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
+ val projection = arrayOf(
+ MediaStore.Audio.Media._ID,
+ MediaStore.Audio.Albums.ALBUM,
+ MediaStore.Audio.Albums.ARTIST,
+ )
+ val cursor: Cursor? = contentResolver.query(
+ uri,
+ projection,
+ "${MediaStore.Audio.Media.DATA} LIKE ?" +
+ " OR ${MediaStore.Audio.Media.DATA} LIKE ?"
+ .repeat(LocalProviderManager.getAllFolders().size - 1),
+ LocalProviderManager.getAllFolders().map {
+ "%$it%"
+ }.toTypedArray(),
+ sortOrder
+ )
- if (!albums.contains(album))
- albums.add(album)
- } while (cursor.moveToNext())
- }
+ when {
+ cursor == null -> {
+ // query failed, handle error.
}
- cursor?.close()
+ !cursor.moveToFirst() -> {
+ // no media on the device
+ }
+
+ else -> {
+ val idColumn: Int = cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums._ID)
+ val albumColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Albums.ALBUM)
+ val artistColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Albums.ARTIST)
+ //val dateAddedColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Media.DATE_ADDED)
+ //val yearColumn: Int = cursor.getColumnIndex(MediaStore.Audio.Media.YEAR)
+
+ do {
+ val thisId = cursor.getLongOrNull(idColumn) ?: 0
+ val thisAlbum = cursor.getStringOrNull(albumColumn) ?: "Unknown"
+ val thisArtist = cursor.getStringOrNull(artistColumn) ?: "Unknown"
+ //val thisDateAdded = cursor.getString(dateAddedColumn)
+ //val thisYear = cursor.getInt(yearColumn)
+
+ val imageUri: String = try {
+ "content://media/external/audio/media/$thisId/albumart"
+ } catch (_: FileNotFoundException) {
+ println("No Album Art!")
+ }.toString()
+
+ val album = MediaData.Album(
+ navidromeID = "Local_$thisId",
+ name = thisAlbum,
+ album = thisAlbum,
+ title = thisAlbum,
+ artist = thisArtist,
+ coverArt = imageUri,
+ songCount = 0,
+ duration = 0,
+ artistId = "",
+ )
+
+ if (!albums.contains(album))
+ albums.add(album)
+ } while (cursor.moveToNext())
+ }
}
- //}
+
+ cursor?.close()
+ }
return albums
}
diff --git a/app/src/main/java/com/craftworks/music/ui/elements/SongCard.kt b/app/src/main/java/com/craftworks/music/ui/elements/SongCard.kt
index 65cd02a..ec6feca 100755
--- a/app/src/main/java/com/craftworks/music/ui/elements/SongCard.kt
+++ b/app/src/main/java/com/craftworks/music/ui/elements/SongCard.kt
@@ -39,6 +39,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
@@ -56,6 +57,7 @@ import com.craftworks.music.R
import com.craftworks.music.data.MediaData
import com.craftworks.music.data.radioList
import com.craftworks.music.formatMilliseconds
+import com.craftworks.music.managers.NavidromeManager
import com.craftworks.music.providers.navidrome.downloadNavidromeSong
import com.craftworks.music.ui.elements.dialogs.showAddSongToPlaylistDialog
import com.craftworks.music.ui.elements.dialogs.songToAddToPlaylist
@@ -149,7 +151,7 @@ fun HorizontalSongCard(song: MediaData.Song, onClick: () -> Unit) {
onClick = { onClick(); Log.d("Play", "Clicked Song: " + song.title) },
shape = RoundedCornerShape(12.dp),
colors = CardDefaults.cardColors(
- containerColor = MaterialTheme.colorScheme.background,
+ containerColor = Color.Transparent,
contentColor = MaterialTheme.colorScheme.onBackground,
disabledContainerColor = MaterialTheme.colorScheme.tertiaryContainer,
disabledContentColor = MaterialTheme.colorScheme.onTertiaryContainer
@@ -268,6 +270,7 @@ fun HorizontalSongCard(song: MediaData.Song, onClick: () -> Unit) {
}
)
DropdownMenuItem(
+ enabled = NavidromeManager.checkActiveServers(),
text = {
Text(stringResource(R.string.Action_Download))
},
diff --git a/app/src/main/java/com/craftworks/music/ui/playing/NowPlayingElements.kt b/app/src/main/java/com/craftworks/music/ui/playing/NowPlayingElements.kt
index 346abb0..85fe2c3 100755
--- a/app/src/main/java/com/craftworks/music/ui/playing/NowPlayingElements.kt
+++ b/app/src/main/java/com/craftworks/music/ui/playing/NowPlayingElements.kt
@@ -387,7 +387,9 @@ fun DownloadButton(color: Color, size: Dp) {
.bounceClick(),
contentPadding = PaddingValues(0.dp),
colors = ButtonDefaults.buttonColors(
- containerColor = Color.Transparent
+ containerColor = Color.Transparent,
+ disabledContainerColor = Color.Transparent,
+ disabledContentColor = color.copy(alpha = 0.25f)
)
) {
Icon(
diff --git a/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsAppearance.kt b/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsAppearance.kt
index b201740..97e9941 100755
--- a/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsAppearance.kt
+++ b/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsAppearance.kt
@@ -415,6 +415,6 @@ private fun SettingsSwitch(
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Start
)
- Switch(checked = selected, onCheckedChange = {})
+ Switch(checked = selected, onCheckedChange = { toggleEvent() })
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsPlayback.kt b/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsPlayback.kt
index c9e05f4..de5a223 100755
--- a/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsPlayback.kt
+++ b/app/src/main/java/com/craftworks/music/ui/screens/settings/SettingsPlayback.kt
@@ -5,6 +5,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.clickable
import androidx.compose.foundation.indication
+import androidx.compose.foundation.interaction.Interaction
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
diff --git a/app/src/main/res/drawable/ic_banner_background.xml b/app/src/main/res/drawable/ic_banner_background.xml
new file mode 100644
index 0000000..8ccd51f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_banner_background.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_banner_foreground.xml b/app/src/main/res/drawable/ic_banner_foreground.xml
new file mode 100644
index 0000000..592ad2b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_banner_foreground.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_banner.xml b/app/src/main/res/mipmap-anydpi-v26/ic_banner.xml
new file mode 100644
index 0000000..ad2c4c5
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_banner.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file