handle sorting differently per tab

This commit is contained in:
tibbi 2020-10-24 19:04:35 +02:00
parent 4aa873cff6
commit 7003269daa
6 changed files with 15 additions and 6 deletions

View file

@ -23,14 +23,12 @@ import com.simplemobiletools.commons.models.Release
import com.simplemobiletools.musicplayer.BuildConfig
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.adapters.ViewPagerAdapter
import com.simplemobiletools.musicplayer.dialogs.ChangeSortingDialog
import com.simplemobiletools.musicplayer.dialogs.SleepTimerCustomDialog
import com.simplemobiletools.musicplayer.extensions.config
import com.simplemobiletools.musicplayer.extensions.queueDAO
import com.simplemobiletools.musicplayer.extensions.sendIntent
import com.simplemobiletools.musicplayer.fragments.MyViewPagerFragment
import com.simplemobiletools.musicplayer.helpers.INIT_QUEUE
import com.simplemobiletools.musicplayer.helpers.REFRESH_LIST
import com.simplemobiletools.musicplayer.helpers.START_SLEEP_TIMER
import com.simplemobiletools.musicplayer.helpers.STOP_SLEEP_TIMER
import com.simplemobiletools.musicplayer.models.Events
@ -92,7 +90,6 @@ class MainActivity : SimpleActivity() {
menu.apply {
findItem(R.id.sleep_timer).isVisible = false
findItem(R.id.sort).isVisible = false
}
updateMenuItemColors(menu)
@ -217,9 +214,7 @@ class MainActivity : SimpleActivity() {
}
private fun showSortingDialog() {
ChangeSortingDialog(this) {
sendIntent(REFRESH_LIST)
}
getCurrentFragment()?.onSortOpen(this)
}
private fun updateCurrentTrackBar() {

View file

@ -73,4 +73,7 @@ class AlbumsFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
(albums_list.adapter as? AlbumsAdapter)?.updateItems(albumsIgnoringSearch)
albums_placeholder.beGoneIf(albumsIgnoringSearch.isNotEmpty())
}
override fun onSortOpen(activity: SimpleActivity) {
}
}

View file

@ -61,4 +61,7 @@ class ArtistsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
(artists_list.adapter as? ArtistsAdapter)?.updateItems(artistsIgnoringSearch)
artists_placeholder.beGoneIf(artistsIgnoringSearch.isNotEmpty())
}
override fun onSortOpen(activity: SimpleActivity) {
}
}

View file

@ -15,4 +15,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
abstract fun onSearchOpened()
abstract fun onSearchClosed()
abstract fun onSortOpen(activity: SimpleActivity)
}

View file

@ -71,4 +71,7 @@ class PlaylistsFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
playlists_placeholder.beGoneIf(playlistsIgnoringSearch.isNotEmpty())
playlists_placeholder_2.beGoneIf(playlistsIgnoringSearch.isNotEmpty())
}
override fun onSortOpen(activity: SimpleActivity) {
}
}

View file

@ -87,4 +87,7 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
(tracks_list.adapter as? TracksAdapter)?.updateItems(tracksIgnoringSearch)
tracks_placeholder.beGoneIf(tracksIgnoringSearch.isNotEmpty())
}
override fun onSortOpen(activity: SimpleActivity) {
}
}