Fix crashes on home screen shortcuts and going to artist page

This commit is contained in:
h4h13 2019-03-05 08:10:57 +05:30
parent 240874f312
commit 263620310f
38 changed files with 214 additions and 222 deletions

View file

@ -98,7 +98,7 @@ class BlacklistFolderChooserDialog : DialogFragment() {
return MaterialDialog(activity!!).show {
title(text = parentFolder!!.absolutePath)
listItems(items = contentsArray(), waitForPositiveButton = false) { dialog, index, text ->
onSelection(dialog, index, text)
onSelection(index)
}
noAutoDismiss()
positiveButton(R.string.add_action) {
@ -111,7 +111,7 @@ class BlacklistFolderChooserDialog : DialogFragment() {
}
}
private fun onSelection(materialDialog: MaterialDialog, i: Int, s: String) {
private fun onSelection(i: Int) {
if (canGoUp && i == 0) {
parentFolder = parentFolder!!.parentFile
if (parentFolder!!.absolutePath == "/storage/emulated") {
@ -139,7 +139,7 @@ class BlacklistFolderChooserDialog : DialogFragment() {
dialog?.apply {
setTitle(parentFolder!!.absolutePath)
listItems(items = contentsArray()) { dialog, index, text ->
onSelection(dialog, index, text)
onSelection(index)
}
}
}

View file

@ -56,7 +56,9 @@ class RemoveFromPlaylistDialog : RoundedBottomSheetDialogFragment() {
text = content
setTextColor(ThemeStore.textColorSecondary(context))
setOnClickListener {
PlaylistsUtil.removeFromPlaylist(activity!!, songs as ArrayList<PlaylistSong>)
val playlistSongs = ArrayList<PlaylistSong>()
playlistSongs.addAll(songs as ArrayList<PlaylistSong>)
PlaylistsUtil.removeFromPlaylist(activity!!, playlistSongs)
dismiss()
}
}

View file

@ -39,9 +39,9 @@ class SongShareDialog : RoundedBottomSheetDialogFragment() {
@SuppressLint("StringFormatInvalid")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val song = arguments!!.getParcelable<Song>("song")
dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
val song: Song = arguments!!.getParcelable("song") ?: return
dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
audioText.apply {
text = getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName)
setTextColor(ThemeStore.textColorSecondary(context!!))