mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 20:57:24 +01:00
parent
09e7d56ff2
commit
f30622424a
@ -124,6 +124,15 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
|
|
||||||
subscriptions += controller.selectionRelay
|
subscriptions += controller.selectionRelay
|
||||||
.subscribe { onSelectionChanged(it) }
|
.subscribe { onSelectionChanged(it) }
|
||||||
|
|
||||||
|
subscriptions += controller.selectAllRelay
|
||||||
|
.filter { it == category.id }
|
||||||
|
.subscribe {
|
||||||
|
adapter.currentItems.forEach { item ->
|
||||||
|
controller.setSelection(item.manga, true)
|
||||||
|
}
|
||||||
|
controller.invalidateActionMode()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onRecycle() {
|
fun onRecycle() {
|
||||||
|
@ -94,6 +94,11 @@ class LibraryController(
|
|||||||
*/
|
*/
|
||||||
val libraryMangaRelay: BehaviorRelay<LibraryMangaEvent> = BehaviorRelay.create()
|
val libraryMangaRelay: BehaviorRelay<LibraryMangaEvent> = BehaviorRelay.create()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relay to notify the library's viewpager to select all manga
|
||||||
|
*/
|
||||||
|
val selectAllRelay: PublishRelay<Int> = PublishRelay.create()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of manga per row in grid mode.
|
* Number of manga per row in grid mode.
|
||||||
*/
|
*/
|
||||||
@ -409,6 +414,7 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
R.id.action_move_to_category -> showChangeMangaCategoriesDialog()
|
R.id.action_move_to_category -> showChangeMangaCategoriesDialog()
|
||||||
R.id.action_delete -> showDeleteMangaDialog()
|
R.id.action_delete -> showDeleteMangaDialog()
|
||||||
|
R.id.action_select_all -> selectAllCategoryManga()
|
||||||
else -> return false
|
else -> return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -496,6 +502,12 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun selectAllCategoryManga() {
|
||||||
|
adapter?.categories?.getOrNull(library_pager.currentItem)?.id?.let {
|
||||||
|
selectAllRelay.call(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
if (requestCode == REQUEST_IMAGE_OPEN) {
|
if (requestCode == REQUEST_IMAGE_OPEN) {
|
||||||
if (data == null || resultCode != Activity.RESULT_OK) return
|
if (data == null || resultCode != Activity.RESULT_OK) return
|
||||||
|
@ -18,4 +18,9 @@
|
|||||||
android:icon="@drawable/ic_delete_white_24dp"
|
android:icon="@drawable/ic_delete_white_24dp"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
|
<item android:id="@+id/action_select_all"
|
||||||
|
android:title="@string/action_select_all"
|
||||||
|
android:icon="@drawable/ic_select_all_white_24dp"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
Loading…
Reference in New Issue
Block a user