mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Crash fixes
This commit is contained in:
parent
5029e4a28c
commit
d8ac35d259
@ -427,9 +427,9 @@ class CatalogueFragment : BaseRxFragment<CataloguePresenter>(), FlexibleViewHold
|
||||
* @return true if the item should be selected, false otherwise.
|
||||
*/
|
||||
override fun onListItemClick(position: Int): Boolean {
|
||||
val selectedManga = adapter.getItem(position)
|
||||
val item = adapter.getItem(position) ?: return false
|
||||
|
||||
val intent = MangaActivity.newIntent(activity, selectedManga)
|
||||
val intent = MangaActivity.newIntent(activity, item)
|
||||
intent.putExtra(MangaActivity.FROM_CATALOGUE, true)
|
||||
startActivity(intent)
|
||||
return false
|
||||
|
@ -162,13 +162,12 @@ class LibraryCategoryFragment : BaseFragment(), FlexibleViewHolder.OnListItemCli
|
||||
*/
|
||||
override fun onListItemClick(position: Int): Boolean {
|
||||
// If the action mode is created and the position is valid, toggle the selection.
|
||||
if (position == -1) {
|
||||
return false
|
||||
} else if (libraryFragment.actionMode != null) {
|
||||
val item = adapter.getItem(position) ?: return false
|
||||
if (libraryFragment.actionMode != null) {
|
||||
toggleSelection(position)
|
||||
return true
|
||||
} else {
|
||||
openManga(adapter.getItem(position))
|
||||
openManga(item)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -359,11 +359,12 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
}
|
||||
|
||||
override fun onListItemClick(position: Int): Boolean {
|
||||
val item = adapter.getItem(position) ?: return false
|
||||
if (actionMode != null && adapter.mode == FlexibleAdapter.MODE_MULTI) {
|
||||
toggleSelection(position)
|
||||
return true
|
||||
} else {
|
||||
openChapter(adapter.getItem(position))
|
||||
openChapter(item)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user