-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add error handling and reload functionality to MediaStore
Added error handling and reload functionality to the MediaStore page. - Displayed a loading page while fetching songs from the MediaStore. - Showed an error page if an error occurred while fetching songs. - Added a reload button to the error page to allow users to retry fetching songs. Other changes: - Updated the date format for albums in the Spotify metadata details screen. - Removed unnecessary progress indicator from the metadata editor page. - Updated dependencies to include kotlinx.collections.immutable. - Added a safeDrawingPadding modifier to the LoadingPage composable. - Updated the PermissionNotGrantedDialog composable to use PersistentList for neededPermissions. Signed-off-by: Bobby Espinoza <[email protected]> Signed-off-by: Gabriel Fontán <[email protected]>
- Loading branch information
Showing
11 changed files
with
125 additions
and
61 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/bobbyesp/metadator/ext/ReleaseDate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.bobbyesp.metadator.ext | ||
|
||
import com.adamratzman.spotify.models.ReleaseDate | ||
|
||
fun ReleaseDate.format(precision: String?): String { | ||
return when (precision) { | ||
"year" -> { | ||
"$year" | ||
} | ||
|
||
"month" -> { | ||
"$month - $year" | ||
} | ||
|
||
"day" -> { | ||
"$day-$month-$year" | ||
} | ||
|
||
else -> { | ||
"Unknown" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 29 additions & 16 deletions
45
app/ui/src/main/java/com/bobbyesp/ui/common/pages/LoadingPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
package com.bobbyesp.ui.common.pages | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.systemBarsPadding | ||
import androidx.compose.material3.CircularProgressIndicator | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.safeDrawingPadding | ||
import androidx.compose.material3.LinearProgressIndicator | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun LoadingPage() { | ||
Column( | ||
modifier = Modifier | ||
fun LoadingPage( | ||
modifier: Modifier = Modifier, | ||
text: String | ||
) { | ||
Box( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.padding(16.dp) | ||
.systemBarsPadding(), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
.safeDrawingPadding(), | ||
contentAlignment = Alignment.Center | ||
) { | ||
CircularProgressIndicator( | ||
modifier = Modifier | ||
.size(48.dp) | ||
.align(Alignment.CenterHorizontally) | ||
) | ||
Column( | ||
modifier = Modifier.fillMaxWidth(), | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Text( | ||
text = text, | ||
style = MaterialTheme.typography.bodyMedium, | ||
fontWeight = FontWeight.SemiBold | ||
) | ||
LinearProgressIndicator( | ||
modifier = Modifier.fillMaxWidth(0.7f) | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.