mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 16:45:06 +01:00
Added "Add/Edit" Categories" button in library display sheet
People please. Just make some categories
This commit is contained in:
parent
0586ef846a
commit
b38327c58a
@ -55,6 +55,7 @@ import eu.kanade.tachiyomi.data.preference.getOrDefault
|
|||||||
import eu.kanade.tachiyomi.source.LocalSource
|
import eu.kanade.tachiyomi.source.LocalSource
|
||||||
import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet
|
import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
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.category.ManageCategoryDialog
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryGroup.BY_DEFAULT
|
import eu.kanade.tachiyomi.ui.library.LibraryGroup.BY_DEFAULT
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryGroup.BY_SOURCE
|
import eu.kanade.tachiyomi.ui.library.LibraryGroup.BY_SOURCE
|
||||||
@ -173,6 +174,7 @@ class LibraryController(
|
|||||||
var searchItem = SearchGlobalItem()
|
var searchItem = SearchGlobalItem()
|
||||||
|
|
||||||
var snack: Snackbar? = null
|
var snack: Snackbar? = null
|
||||||
|
var displaySheet: TabbedLibraryDisplaySheet? = null
|
||||||
|
|
||||||
private var scrollDistance = 0f
|
private var scrollDistance = 0f
|
||||||
private val scrollDistanceTilHidden = 1000.dpToPx
|
private val scrollDistanceTilHidden = 1000.dpToPx
|
||||||
@ -510,7 +512,10 @@ class LibraryController(
|
|||||||
FilterBottomSheet.ACTION_REFRESH -> onRefresh()
|
FilterBottomSheet.ACTION_REFRESH -> onRefresh()
|
||||||
FilterBottomSheet.ACTION_FILTER -> onFilterChanged()
|
FilterBottomSheet.ACTION_FILTER -> onFilterChanged()
|
||||||
FilterBottomSheet.ACTION_HIDE_FILTER_TIP -> showFilterTip()
|
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_EXPAND_COLLAPSE_ALL -> presenter.toggleAllCategoryVisibility()
|
||||||
FilterBottomSheet.ACTION_GROUP_BY -> {
|
FilterBottomSheet.ACTION_GROUP_BY -> {
|
||||||
val groupItems = mutableListOf(BY_DEFAULT, BY_TAG, BY_SOURCE, BY_STATUS)
|
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.
|
* Destroys the action mode.
|
||||||
*/
|
*/
|
||||||
|
@ -24,5 +24,8 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
auto_hide_hopper.bindToPreference(preferences.autohideHopper()) {
|
auto_hide_hopper.bindToPreference(preferences.autohideHopper()) {
|
||||||
controller.resetHopperY()
|
controller.resetHopperY()
|
||||||
}
|
}
|
||||||
|
add_categories_button.setOnClickListener {
|
||||||
|
controller.showCategoriesController()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
|||||||
import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog
|
import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog
|
||||||
import kotlinx.android.synthetic.main.tabbed_bottom_sheet.*
|
import kotlinx.android.synthetic.main.tabbed_bottom_sheet.*
|
||||||
|
|
||||||
open class TabbedLibraryDisplaySheet(controller: LibraryController) :
|
open class TabbedLibraryDisplaySheet(val controller: LibraryController) :
|
||||||
TabbedBottomSheetDialog(controller.activity!!) {
|
TabbedBottomSheetDialog(controller.activity!!) {
|
||||||
|
|
||||||
private val displayView: LibraryDisplayView = inflate(controller.activity!!, R.layout.library_display_layout, null) as LibraryDisplayView
|
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(
|
override fun getTabViews(): List<View> = listOf(
|
||||||
displayView,
|
displayView,
|
||||||
badgesView,
|
badgesView,
|
||||||
|
@ -41,5 +41,12 @@
|
|||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:text="@string/hide_hopper_on_scroll" />
|
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>
|
</LinearLayout>
|
||||||
</eu.kanade.tachiyomi.ui.library.display.LibraryCategoryView>
|
</eu.kanade.tachiyomi.ui.library.display.LibraryCategoryView>
|
@ -81,6 +81,7 @@
|
|||||||
default category.</string>
|
default category.</string>
|
||||||
<string name="already_in_category">Manga already in category</string>
|
<string name="already_in_category">Manga already in category</string>
|
||||||
<string name="add_categories">Add categories</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="edit_categories">Edit categories</string>
|
||||||
<string name="manage_category">Manage category</string>
|
<string name="manage_category">Manage category</string>
|
||||||
<string name="rename_category">Rename category</string>
|
<string name="rename_category">Rename category</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user