Add no title grid option
This commit is contained in:
parent
5fee3ac05a
commit
a5c10dbf28
@ -28,6 +28,9 @@ object PreferenceValues {
|
|||||||
enum class DisplayMode {
|
enum class DisplayMode {
|
||||||
COMPACT_GRID,
|
COMPACT_GRID,
|
||||||
COMFORTABLE_GRID,
|
COMFORTABLE_GRID,
|
||||||
|
// SY -->
|
||||||
|
NO_TITLE_GRID,
|
||||||
|
// SY <--
|
||||||
LIST,
|
LIST,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,6 +431,9 @@ open class BrowseSourceController(bundle: Bundle) :
|
|||||||
val displayItem = when (preferences.sourceDisplayMode().get()) {
|
val displayItem = when (preferences.sourceDisplayMode().get()) {
|
||||||
DisplayMode.COMPACT_GRID -> R.id.action_compact_grid
|
DisplayMode.COMPACT_GRID -> R.id.action_compact_grid
|
||||||
DisplayMode.COMFORTABLE_GRID -> R.id.action_comfortable_grid
|
DisplayMode.COMFORTABLE_GRID -> R.id.action_comfortable_grid
|
||||||
|
// SY -->
|
||||||
|
DisplayMode.NO_TITLE_GRID -> R.id.action_no_title_grid
|
||||||
|
// SY <--
|
||||||
DisplayMode.LIST -> R.id.action_list
|
DisplayMode.LIST -> R.id.action_list
|
||||||
}
|
}
|
||||||
menu.findItem(displayItem).isChecked = true
|
menu.findItem(displayItem).isChecked = true
|
||||||
@ -464,6 +467,9 @@ open class BrowseSourceController(bundle: Bundle) :
|
|||||||
R.id.action_search -> expandActionViewFromInteraction = true
|
R.id.action_search -> expandActionViewFromInteraction = true
|
||||||
R.id.action_compact_grid -> setDisplayMode(DisplayMode.COMPACT_GRID)
|
R.id.action_compact_grid -> setDisplayMode(DisplayMode.COMPACT_GRID)
|
||||||
R.id.action_comfortable_grid -> setDisplayMode(DisplayMode.COMFORTABLE_GRID)
|
R.id.action_comfortable_grid -> setDisplayMode(DisplayMode.COMFORTABLE_GRID)
|
||||||
|
// SY -->
|
||||||
|
R.id.action_no_title_grid -> setDisplayMode(DisplayMode.NO_TITLE_GRID)
|
||||||
|
// SY <--
|
||||||
R.id.action_list -> setDisplayMode(DisplayMode.LIST)
|
R.id.action_list -> setDisplayMode(DisplayMode.LIST)
|
||||||
R.id.action_open_in_web_view -> openInWebView()
|
R.id.action_open_in_web_view -> openInWebView()
|
||||||
// SY -->
|
// SY -->
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.ui.browse.source.browse
|
package eu.kanade.tachiyomi.ui.browse.source.browse
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -20,7 +21,7 @@ import kotlinx.android.synthetic.main.source_comfortable_grid_item.title
|
|||||||
* @param adapter the adapter handling this holder.
|
* @param adapter the adapter handling this holder.
|
||||||
* @constructor creates a new catalogue holder.
|
* @constructor creates a new catalogue holder.
|
||||||
*/
|
*/
|
||||||
class SourceComfortableGridHolder(private val view: View, private val adapter: FlexibleAdapter<*>) :
|
class SourceComfortableGridHolder(private val view: View, private val adapter: FlexibleAdapter<*> /* SY --> */, private val hasTitle: Boolean /* SY <-- */) :
|
||||||
SourceGridHolder(view, adapter) {
|
SourceGridHolder(view, adapter) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,6 +33,9 @@ class SourceComfortableGridHolder(private val view: View, private val adapter: F
|
|||||||
override fun onSetValues(manga: Manga) {
|
override fun onSetValues(manga: Manga) {
|
||||||
// Set manga title
|
// Set manga title
|
||||||
title.text = manga.title
|
title.text = manga.title
|
||||||
|
// SY -->
|
||||||
|
title.isVisible = hasTitle
|
||||||
|
// SY <--
|
||||||
|
|
||||||
// Set alpha of thumbnail.
|
// Set alpha of thumbnail.
|
||||||
thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
||||||
|
@ -24,7 +24,7 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
|
|||||||
override fun getLayoutRes(): Int {
|
override fun getLayoutRes(): Int {
|
||||||
return /* SY --> */ if (metadata == null) /* SY <-- */ when (displayMode.get()) {
|
return /* SY --> */ if (metadata == null) /* SY <-- */ when (displayMode.get()) {
|
||||||
DisplayMode.COMPACT_GRID -> R.layout.source_compact_grid_item
|
DisplayMode.COMPACT_GRID -> R.layout.source_compact_grid_item
|
||||||
DisplayMode.COMFORTABLE_GRID -> R.layout.source_comfortable_grid_item
|
DisplayMode.COMFORTABLE_GRID, /* SY --> */ DisplayMode.NO_TITLE_GRID /* SY <-- */ -> R.layout.source_comfortable_grid_item
|
||||||
DisplayMode.LIST -> R.layout.source_list_item
|
DisplayMode.LIST -> R.layout.source_list_item
|
||||||
} /* SY --> */ else R.layout.source_enhanced_ehentai_list_item /* SY <-- */
|
} /* SY --> */ else R.layout.source_enhanced_ehentai_list_item /* SY <-- */
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
|
|||||||
}
|
}
|
||||||
SourceGridHolder(view, adapter)
|
SourceGridHolder(view, adapter)
|
||||||
}
|
}
|
||||||
DisplayMode.COMFORTABLE_GRID -> {
|
DisplayMode.COMFORTABLE_GRID /* SY --> */, DisplayMode.NO_TITLE_GRID /* SY <-- */ -> {
|
||||||
val parent = adapter.recyclerView as AutofitRecyclerView
|
val parent = adapter.recyclerView as AutofitRecyclerView
|
||||||
val coverHeight = parent.itemWidth / 3 * 4
|
val coverHeight = parent.itemWidth / 3 * 4
|
||||||
view.apply {
|
view.apply {
|
||||||
@ -55,7 +55,7 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
|
|||||||
MATCH_PARENT, coverHeight
|
MATCH_PARENT, coverHeight
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
SourceComfortableGridHolder(view, adapter)
|
SourceComfortableGridHolder(view, adapter, displayMode.get() != DisplayMode.NO_TITLE_GRID)
|
||||||
}
|
}
|
||||||
DisplayMode.LIST -> {
|
DisplayMode.LIST -> {
|
||||||
SourceListHolder(view, adapter)
|
SourceListHolder(view, adapter)
|
||||||
|
@ -32,7 +32,10 @@ import reactivecircus.flowbinding.android.view.clicks
|
|||||||
*/
|
*/
|
||||||
class LibraryComfortableGridHolder(
|
class LibraryComfortableGridHolder(
|
||||||
private val view: View,
|
private val view: View,
|
||||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||||
|
// SY -->
|
||||||
|
private val hasTitle: Boolean
|
||||||
|
// SY <--
|
||||||
) : LibraryCompactGridHolder(view, adapter) {
|
) : LibraryCompactGridHolder(view, adapter) {
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
@ -57,6 +60,9 @@ class LibraryComfortableGridHolder(
|
|||||||
// SY <--
|
// SY <--
|
||||||
// Update the title of the manga.
|
// Update the title of the manga.
|
||||||
title.text = item.manga.title
|
title.text = item.manga.title
|
||||||
|
// SY -->
|
||||||
|
title.isVisible = hasTitle
|
||||||
|
// SY <--
|
||||||
|
|
||||||
// For rounded corners
|
// For rounded corners
|
||||||
badges.clipToOutline = true
|
badges.clipToOutline = true
|
||||||
|
@ -51,7 +51,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryDisplayMode: Prefe
|
|||||||
override fun getLayoutRes(): Int {
|
override fun getLayoutRes(): Int {
|
||||||
return when (libraryDisplayMode.get()) {
|
return when (libraryDisplayMode.get()) {
|
||||||
DisplayMode.COMPACT_GRID -> R.layout.source_compact_grid_item
|
DisplayMode.COMPACT_GRID -> R.layout.source_compact_grid_item
|
||||||
DisplayMode.COMFORTABLE_GRID -> R.layout.source_comfortable_grid_item
|
DisplayMode.COMFORTABLE_GRID /* SY --> */, DisplayMode.NO_TITLE_GRID /* SY <-- */ -> R.layout.source_comfortable_grid_item
|
||||||
DisplayMode.LIST -> R.layout.source_list_item
|
DisplayMode.LIST -> R.layout.source_list_item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryDisplayMode: Prefe
|
|||||||
}
|
}
|
||||||
LibraryCompactGridHolder(view, adapter)
|
LibraryCompactGridHolder(view, adapter)
|
||||||
}
|
}
|
||||||
DisplayMode.COMFORTABLE_GRID -> {
|
DisplayMode.COMFORTABLE_GRID /* SY --> */, DisplayMode.NO_TITLE_GRID /* SY <-- */ -> {
|
||||||
val parent = adapter.recyclerView as AutofitRecyclerView
|
val parent = adapter.recyclerView as AutofitRecyclerView
|
||||||
val coverHeight = parent.itemWidth / 3 * 4
|
val coverHeight = parent.itemWidth / 3 * 4
|
||||||
view.apply {
|
view.apply {
|
||||||
@ -77,7 +77,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryDisplayMode: Prefe
|
|||||||
MATCH_PARENT, coverHeight
|
MATCH_PARENT, coverHeight
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
LibraryComfortableGridHolder(view, adapter)
|
LibraryComfortableGridHolder(view, adapter, libraryDisplayMode.get() != DisplayMode.NO_TITLE_GRID)
|
||||||
}
|
}
|
||||||
DisplayMode.LIST -> {
|
DisplayMode.LIST -> {
|
||||||
LibraryListHolder(view, adapter)
|
LibraryListHolder(view, adapter)
|
||||||
|
@ -263,16 +263,22 @@ class LibrarySettingsSheet(
|
|||||||
|
|
||||||
private val compactGrid = Item.Radio(R.string.action_display_grid, this)
|
private val compactGrid = Item.Radio(R.string.action_display_grid, this)
|
||||||
private val comfortableGrid = Item.Radio(R.string.action_display_comfortable_grid, this)
|
private val comfortableGrid = Item.Radio(R.string.action_display_comfortable_grid, this)
|
||||||
|
// SY -->
|
||||||
|
private val noTitleGrid = Item.Radio(R.string.action_display_no_title_grid, this)
|
||||||
|
// SY <--
|
||||||
private val list = Item.Radio(R.string.action_display_list, this)
|
private val list = Item.Radio(R.string.action_display_list, this)
|
||||||
|
|
||||||
override val header = Item.Header(R.string.action_display_mode)
|
override val header = Item.Header(R.string.action_display_mode)
|
||||||
override val items = listOf(compactGrid, comfortableGrid, list)
|
override val items = listOf(compactGrid, comfortableGrid, /* SY --> */ noTitleGrid /* SY <-- */, list)
|
||||||
override val footer = null
|
override val footer = null
|
||||||
|
|
||||||
override fun initModels() {
|
override fun initModels() {
|
||||||
val mode = preferences.libraryDisplayMode().get()
|
val mode = preferences.libraryDisplayMode().get()
|
||||||
compactGrid.checked = mode == DisplayMode.COMPACT_GRID
|
compactGrid.checked = mode == DisplayMode.COMPACT_GRID
|
||||||
comfortableGrid.checked = mode == DisplayMode.COMFORTABLE_GRID
|
comfortableGrid.checked = mode == DisplayMode.COMFORTABLE_GRID
|
||||||
|
// SY -->
|
||||||
|
noTitleGrid.checked = mode == DisplayMode.NO_TITLE_GRID
|
||||||
|
// SY <--
|
||||||
list.checked = mode == DisplayMode.LIST
|
list.checked = mode == DisplayMode.LIST
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,6 +293,9 @@ class LibrarySettingsSheet(
|
|||||||
when (item) {
|
when (item) {
|
||||||
compactGrid -> DisplayMode.COMPACT_GRID
|
compactGrid -> DisplayMode.COMPACT_GRID
|
||||||
comfortableGrid -> DisplayMode.COMFORTABLE_GRID
|
comfortableGrid -> DisplayMode.COMFORTABLE_GRID
|
||||||
|
// SY -->
|
||||||
|
noTitleGrid -> DisplayMode.NO_TITLE_GRID
|
||||||
|
// SY <--
|
||||||
list -> DisplayMode.LIST
|
list -> DisplayMode.LIST
|
||||||
else -> throw NotImplementedError("Unknown display mode")
|
else -> throw NotImplementedError("Unknown display mode")
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/action_comfortable_grid"
|
android:id="@+id/action_comfortable_grid"
|
||||||
android:title="@string/action_display_comfortable_grid" />
|
android:title="@string/action_display_comfortable_grid" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_no_title_grid"
|
||||||
|
android:title="@string/action_display_no_title_grid" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_list"
|
android:id="@+id/action_list"
|
||||||
android:title="@string/action_display_list" />
|
android:title="@string/action_display_list" />
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<string name="action_copy_now">Copy now</string>
|
<string name="action_copy_now">Copy now</string>
|
||||||
<string name="clean_titles">Clean titles</string>
|
<string name="clean_titles">Clean titles</string>
|
||||||
<string name="action_start_reading_button">Start reading button</string>
|
<string name="action_start_reading_button">Start reading button</string>
|
||||||
|
<string name="action_display_no_title_grid">No title grid</string>
|
||||||
|
|
||||||
<!-- Library fragment -->
|
<!-- Library fragment -->
|
||||||
<string name="buttons_header">Buttons</string>
|
<string name="buttons_header">Buttons</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user