diff --git a/app/build.gradle b/app/build.gradle index b33dbf77..735c78a2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,7 +70,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:4c83ec8740' + implementation 'com.github.SimpleMobileTools:Simple-Commons:42733f39a4' implementation 'org.greenrobot:eventbus:3.3.1' implementation 'androidx.media:media:1.6.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt index 90ba2528..6dd51dec 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt @@ -86,7 +86,7 @@ class AlbumsActivity : SimpleActivity() { } } } else { - PermissionRequiredDialog(this, R.string.allow_notifications_music_player) + PermissionRequiredDialog(this, R.string.allow_notifications_music_player, { openNotificationSettings() }) } } } @@ -108,7 +108,7 @@ class AlbumsActivity : SimpleActivity() { startActivity(this) } } else { - PermissionRequiredDialog(this, R.string.allow_notifications_music_player) + PermissionRequiredDialog(this, R.string.allow_notifications_music_player, { openNotificationSettings() }) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt index e8471ab3..b24b05e0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt @@ -200,7 +200,7 @@ class MainActivity : SimpleActivity() { startActivity(this) } } else { - PermissionRequiredDialog(this, R.string.allow_notifications_music_player) + PermissionRequiredDialog(this, R.string.allow_notifications_music_player, { openNotificationSettings() }) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt index f8711175..16af7870 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.musicplayer.activities import android.app.Activity import android.app.SearchManager import android.content.ActivityNotFoundException -import android.content.ContentUris import android.content.Context import android.content.Intent import android.os.Bundle @@ -32,7 +31,7 @@ import com.simplemobiletools.musicplayer.helpers.M3uExporter.ExportResult import com.simplemobiletools.musicplayer.models.* import com.simplemobiletools.musicplayer.services.MusicService import kotlinx.android.synthetic.main.activity_tracks.* -import kotlinx.android.synthetic.main.view_current_track_bar.* +import kotlinx.android.synthetic.main.view_current_track_bar.current_track_bar import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode @@ -86,7 +85,7 @@ class TracksActivity : SimpleActivity() { startActivity(this) } } else { - PermissionRequiredDialog(this, R.string.allow_notifications_music_player) + PermissionRequiredDialog(this, R.string.allow_notifications_music_player, { openNotificationSettings() }) } } } @@ -218,6 +217,7 @@ class TracksActivity : SimpleActivity() { tracks.addAll(playlistTracks) listItems.addAll(tracks) } + TYPE_ALBUM -> { val albumTracks = tracksDAO.getTracksFromAlbum(album.id).distinctBy { "${it.path}/${it.mediaStoreId}" } as ArrayList albumTracks.sortWith(compareBy({ it.trackId }, { it.title.lowercase() })) @@ -227,6 +227,7 @@ class TracksActivity : SimpleActivity() { listItems.add(header) listItems.addAll(tracks) } + else -> { val folderTracks = tracksDAO.getTracksFromFolder(folder ?: "") .distinctBy { "${it.path}/${it.mediaStoreId}" } @@ -403,7 +404,7 @@ class TracksActivity : SimpleActivity() { } } else { - PermissionRequiredDialog(this, R.string.allow_notifications_music_player) + PermissionRequiredDialog(this, R.string.allow_notifications_music_player, { openNotificationSettings() }) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt index b7d7d816..53a2b68e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt @@ -15,12 +15,17 @@ import com.simplemobiletools.musicplayer.activities.SimpleActivity import com.simplemobiletools.musicplayer.activities.TrackActivity import com.simplemobiletools.musicplayer.adapters.TracksAdapter import com.simplemobiletools.musicplayer.dialogs.ChangeSortingDialog -import com.simplemobiletools.musicplayer.extensions.* +import com.simplemobiletools.musicplayer.extensions.config +import com.simplemobiletools.musicplayer.extensions.mediaScanner +import com.simplemobiletools.musicplayer.extensions.resetQueueItems +import com.simplemobiletools.musicplayer.extensions.tracksDAO import com.simplemobiletools.musicplayer.helpers.RESTART_PLAYER import com.simplemobiletools.musicplayer.helpers.TAB_TRACKS import com.simplemobiletools.musicplayer.helpers.TRACK import com.simplemobiletools.musicplayer.models.Track -import kotlinx.android.synthetic.main.fragment_tracks.view.* +import kotlinx.android.synthetic.main.fragment_tracks.view.tracks_fastscroller +import kotlinx.android.synthetic.main.fragment_tracks.view.tracks_list +import kotlinx.android.synthetic.main.fragment_tracks.view.tracks_placeholder // Artists -> Albums -> Tracks class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { @@ -62,7 +67,7 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager } } else { if (context is Activity) { - PermissionRequiredDialog(activity, R.string.allow_notifications_music_player) + PermissionRequiredDialog(activity, R.string.allow_notifications_music_player, { activity.openNotificationSettings() }) } } }