diff --git a/CHANGELOG.md b/CHANGELOG.md index f0d47c38f..f14fdece8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## dev + +#### What's Fixed +- Fixed crash that would occur in music folders dialog when user does not have a working +file manager + ## 3.0.1 #### What's New diff --git a/app/src/main/java/org/oxycblt/auxio/detail/DetailViewModel.kt b/app/src/main/java/org/oxycblt/auxio/detail/DetailViewModel.kt index 2f7a404e0..71ec1a6a8 100644 --- a/app/src/main/java/org/oxycblt/auxio/detail/DetailViewModel.kt +++ b/app/src/main/java/org/oxycblt/auxio/detail/DetailViewModel.kt @@ -173,8 +173,8 @@ class DetailViewModel(application: Application) : } /** - * Set a new [currentSong] from it's [Music.UID]. If the [Music.UID] differs, [currentSong] - * and [songProperties] will be updated to align with the new [Song]. + * Set a new [currentSong] from it's [Music.UID]. If the [Music.UID] differs, [currentSong] and + * [songProperties] will be updated to align with the new [Song]. * @param uid The UID of the [Song] to load. Must be valid. */ fun setSongUid(uid: Music.UID) { diff --git a/app/src/main/java/org/oxycblt/auxio/music/Date.kt b/app/src/main/java/org/oxycblt/auxio/music/Date.kt index f6f7b1221..2e05ef5a4 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/Date.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/Date.kt @@ -140,8 +140,7 @@ class Date private constructor(private val tokens: List) : Comparable min.resolveDate(context) } - override fun equals(other: Any?) = - other is Range && min == other.min && max == other.max + override fun equals(other: Any?) = other is Range && min == other.min && max == other.max override fun hashCode() = 31 * max.hashCode() + min.hashCode() diff --git a/app/src/main/java/org/oxycblt/auxio/music/filesystem/MusicDirsDialog.kt b/app/src/main/java/org/oxycblt/auxio/music/filesystem/MusicDirsDialog.kt index 441cb7cbe..e294b7915 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/filesystem/MusicDirsDialog.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/filesystem/MusicDirsDialog.kt @@ -17,6 +17,7 @@ package org.oxycblt.auxio.music.filesystem +import android.content.ActivityNotFoundException import android.net.Uri import android.os.Bundle import android.os.storage.StorageManager @@ -84,10 +85,16 @@ class MusicDirsDialog : val dialog = it as AlertDialog dialog.getButton(AlertDialog.BUTTON_NEUTRAL)?.setOnClickListener { logD("Opening launcher") - requireNotNull(openDocumentTreeLauncher) { - "Document tree launcher was not available" - } - .launch(null) + val launcher = requireNotNull(openDocumentTreeLauncher) { + "Document tree launcher was not available" + } + + try { + launcher.launch(null) + } catch (e: ActivityNotFoundException) { + // User doesn't have a capable file manager. + requireContext().showToast(R.string.err_no_app) + } } } @@ -97,7 +104,6 @@ class MusicDirsDialog : } var dirs = Settings(context).getMusicDirs(storageManager) - if (savedInstanceState != null) { val pendingDirs = savedInstanceState.getStringArrayList(KEY_PENDING_DIRS) if (pendingDirs != null) { diff --git a/app/src/main/java/org/oxycblt/auxio/playback/replaygain/ReplayGainAudioProcessor.kt b/app/src/main/java/org/oxycblt/auxio/playback/replaygain/ReplayGainAudioProcessor.kt index 98450a763..7346ac7eb 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/replaygain/ReplayGainAudioProcessor.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/replaygain/ReplayGainAudioProcessor.kt @@ -191,7 +191,7 @@ class ReplayGainAudioProcessor(private val context: Context) : // Opus has it's own "r128_*_gain" ReplayGain specification, which requires dividing the // adjustment by 256 to get the gain. This is used alongside the base adjustment // intrinsic to the format to create the normalized adjustment. That base adjustment - // is already handled by the media framework, so we just need to apply the more + // is already handled by the media framework, so we just need to apply the more // specific adjustments. tags.vorbis[TAG_R128_TRACK_GAIN] ?.run { first().parseReplayGainAdjustment() }