Added "Add/Edit" Categories" button in library display sheet

People please. Just make some categories
This commit is contained in:
Jays2Kings 2021-03-26 14:28:29 -04:00
parent 0586ef846a
commit b38327c58a
5 changed files with 28 additions and 2 deletions

View File

@ -55,6 +55,7 @@ import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet
import eu.kanade.tachiyomi.ui.base.controller.BaseController
import eu.kanade.tachiyomi.ui.category.CategoryController
import eu.kanade.tachiyomi.ui.category.ManageCategoryDialog
import eu.kanade.tachiyomi.ui.library.LibraryGroup.BY_DEFAULT
import eu.kanade.tachiyomi.ui.library.LibraryGroup.BY_SOURCE
@ -173,6 +174,7 @@ class LibraryController(
var searchItem = SearchGlobalItem()
var snack: Snackbar? = null
var displaySheet: TabbedLibraryDisplaySheet? = null
private var scrollDistance = 0f
private val scrollDistanceTilHidden = 1000.dpToPx
@ -510,7 +512,10 @@ class LibraryController(
FilterBottomSheet.ACTION_REFRESH -> onRefresh()
FilterBottomSheet.ACTION_FILTER -> onFilterChanged()
FilterBottomSheet.ACTION_HIDE_FILTER_TIP -> showFilterTip()
FilterBottomSheet.ACTION_DISPLAY -> TabbedLibraryDisplaySheet(this).show()
FilterBottomSheet.ACTION_DISPLAY -> {
displaySheet = TabbedLibraryDisplaySheet(this)
displaySheet?.show()
}
FilterBottomSheet.ACTION_EXPAND_COLLAPSE_ALL -> presenter.toggleAllCategoryVisibility()
FilterBottomSheet.ACTION_GROUP_BY -> {
val groupItems = mutableListOf(BY_DEFAULT, BY_TAG, BY_SOURCE, BY_STATUS)
@ -1427,6 +1432,11 @@ class LibraryController(
}
}
fun showCategoriesController() {
router.pushController(CategoryController().withFadeTransaction())
displaySheet?.dismiss()
}
/**
* Destroys the action mode.
*/

View File

@ -24,5 +24,8 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
auto_hide_hopper.bindToPreference(preferences.autohideHopper()) {
controller.resetHopperY()
}
add_categories_button.setOnClickListener {
controller.showCategoriesController()
}
}
}

View File

@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.util.view.withFadeTransaction
import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog
import kotlinx.android.synthetic.main.tabbed_bottom_sheet.*
open class TabbedLibraryDisplaySheet(controller: LibraryController) :
open class TabbedLibraryDisplaySheet(val controller: LibraryController) :
TabbedBottomSheetDialog(controller.activity!!) {
private val displayView: LibraryDisplayView = inflate(controller.activity!!, R.layout.library_display_layout, null) as LibraryDisplayView
@ -38,6 +38,11 @@ open class TabbedLibraryDisplaySheet(controller: LibraryController) :
}
}
override fun dismiss() {
super.dismiss()
controller.displaySheet = null
}
override fun getTabViews(): List<View> = listOf(
displayView,
badgesView,

View File

@ -41,5 +41,12 @@
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:text="@string/hide_hopper_on_scroll" />
<com.google.android.material.button.MaterialButton
android:id="@+id/add_categories_button"
style="@style/Theme.Widget.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/add_edit_categories" />
</LinearLayout>
</eu.kanade.tachiyomi.ui.library.display.LibraryCategoryView>

View File

@ -81,6 +81,7 @@
default category.</string>
<string name="already_in_category">Manga already in category</string>
<string name="add_categories">Add categories</string>
<string name="add_edit_categories">Add/Edit categories</string>
<string name="edit_categories">Edit categories</string>
<string name="manage_category">Manage category</string>
<string name="rename_category">Rename category</string>