Added Material List view, removed old grid

And more layout fixes of course
This commit is contained in:
Jay 2020-02-13 22:49:32 -08:00
parent f124dbdd58
commit dc1fe311f8
33 changed files with 539 additions and 772 deletions

View File

@ -17,7 +17,6 @@ import com.f2prateek.rx.preferences.Preference
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.snackbar.Snackbar
import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents
import com.jakewharton.rxbinding.view.visible
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
@ -239,7 +238,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
(layoutManager as androidx.recyclerview.widget.GridLayoutManager).spanSizeLookup = object : androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return when (adapter?.getItemViewType(position)) {
R.layout.catalogue_mat_grid_item, null -> 1
R.layout.catalogue_grid_item, null -> 1
else -> spanCount
}
}

View File

@ -1,51 +1,63 @@
package eu.kanade.tachiyomi.ui.catalogue.browse
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.signature.ObjectKey
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.ui.library.LibraryCategoryAdapter
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.catalogue_grid_item.*
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.items.IFlexible
/**
* Class used to hold the displayed data of a manga in the catalogue, like the cover or the title.
* Class used to hold the displayed data of a manga in the library, like the cover or the title.
* All the elements from the layout file "item_catalogue_grid" are available in this class.
*
* @param view the inflated view for this holder.
* @param adapter the adapter handling this holder.
* @constructor creates a new catalogue holder.
* @param listener a listener to react to single tap and long tap events.
* @constructor creates a new library holder.
*/
class CatalogueGridHolder(private val view: View, private val adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) :
CatalogueHolder(view, adapter) {
class CatalogueGridHolder(
private val view: View,
private val adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) :
CatalogueHolder(view, adapter) {
/**
* Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this
* Method called from [LibraryCategoryAdapter.onBindViewHolder]. It updates the data for this
* holder with the given manga.
*
* @param manga the manga to bind.
* @param manga the manga item to bind.
*/
override fun onSetValues(manga: Manga) {
// Set manga title
title.text = manga.originalTitle()
// Update the title of the manga.
title.text = manga.currentTitle()
subtitle.gone()
// Set alpha of thumbnail.
thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
bookmark_text.visibility = if (manga.favorite) View.VISIBLE else View.GONE
// Update the cover.
setImage(manga)
}
override fun setImage(manga: Manga) {
GlideApp.with(view.context).clear(thumbnail)
if (!manga.thumbnail_url.isNullOrEmpty()) {
if (manga.thumbnail_url == null)
Glide.with(view.context).clear(cover_thumbnail)
else {
GlideApp.with(view.context)
.load(manga)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.centerCrop()
.placeholder(android.R.color.transparent)
.into(StateImageViewTarget(thumbnail, progress))
.load(manga)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.centerCrop()
.placeholder(android.R.color.transparent)
.transition(DrawableTransitionOptions.withCrossFade())
.into(StateImageViewTarget(cover_thumbnail, progress))
}
}
}

View File

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.ui.catalogue.browse
import android.view.Gravity
import android.view.View
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
@ -13,10 +12,8 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import kotlinx.android.synthetic.main.catalogue_grid_item.view.*
import kotlinx.android.synthetic.main.catalogue_mat_grid_item.view.*
class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Boolean>) :
AbstractFlexibleItem<CatalogueHolder>() {
@ -25,7 +22,7 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
return if (catalogueAsList.getOrDefault())
R.layout.catalogue_list_item
else
R.layout.catalogue_mat_grid_item
R.layout.catalogue_grid_item
}
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): CatalogueHolder {
@ -37,7 +34,7 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
cover_thumbnail.adjustViewBounds = false
cover_thumbnail.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)
}
CatalogueMatGridHolder(view, adapter)
CatalogueGridHolder(view, adapter)
} else {
CatalogueListHolder(view, adapter)
}

View File

@ -6,10 +6,12 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.getResourceColor
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail
import kotlinx.android.synthetic.main.catalogue_list_item.title
import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.catalogue_list_item.*
/**
* Class used to hold the displayed data of a manga in the catalogue, like the cover or the title.
@ -22,9 +24,6 @@ import kotlinx.android.synthetic.main.catalogue_list_item.title
class CatalogueListHolder(private val view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) :
CatalogueHolder(view, adapter) {
private val favoriteColor = view.context.getResourceColor(android.R.attr.textColorHint)
private val unfavoriteColor = view.context.getResourceColor(android.R.attr.textColorPrimary)
/**
* Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this
* holder with the given manga.
@ -33,22 +32,26 @@ class CatalogueListHolder(private val view: View, adapter: FlexibleAdapter<IFlex
*/
override fun onSetValues(manga: Manga) {
title.text = manga.originalTitle()
title.setTextColor(if (manga.favorite) favoriteColor else unfavoriteColor)
with(subtitle) {
visibility = if (manga.favorite) View.VISIBLE else View.GONE
text = view.resources.getString(R.string.in_library)
setTextColor(view.context.getResourceColor(android.R.attr.colorAccent))
}
setImage(manga)
}
override fun setImage(manga: Manga) {
GlideApp.with(view.context).clear(thumbnail)
if (!manga.thumbnail_url.isNullOrEmpty()) {
if (manga.thumbnail_url.isNullOrEmpty()) {
GlideApp.with(view.context).clear(contentView)
} else {
GlideApp.with(view.context)
.load(manga)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.centerCrop()
.circleCrop()
.dontAnimate()
.placeholder(android.R.color.transparent)
.into(thumbnail)
.load(manga)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.dontAnimate()
.placeholder(android.R.color.transparent)
.transition(DrawableTransitionOptions.withCrossFade())
.into(StateImageViewTarget(cover_thumbnail, progress))
}
}

View File

@ -1,63 +0,0 @@
package eu.kanade.tachiyomi.ui.catalogue.browse
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.signature.ObjectKey
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.ui.library.LibraryCategoryAdapter
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.catalogue_mat_grid_item.*
/**
* Class used to hold the displayed data of a manga in the library, like the cover or the title.
* All the elements from the layout file "item_catalogue_grid" are available in this class.
*
* @param view the inflated view for this holder.
* @param adapter the adapter handling this holder.
* @param listener a listener to react to single tap and long tap events.
* @constructor creates a new library holder.
*/
class CatalogueMatGridHolder(
private val view: View,
private val adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) :
CatalogueHolder(view, adapter) {
/**
* Method called from [LibraryCategoryAdapter.onBindViewHolder]. It updates the data for this
* holder with the given manga.
*
* @param manga the manga item to bind.
*/
override fun onSetValues(manga: Manga) {
// Update the title of the manga.
title.text = manga.currentTitle()
subtitle.gone()
bookmark_text.visibility = if (manga.favorite) View.VISIBLE else View.GONE
// Update the cover.
setImage(manga)
}
override fun setImage(manga: Manga) {
if (manga.thumbnail_url == null)
Glide.with(view.context).clear(cover_thumbnail)
else {
GlideApp.with(view.context)
.load(manga)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.centerCrop()
.placeholder(android.R.color.transparent)
.transition(DrawableTransitionOptions.withCrossFade())
.into(StateImageViewTarget(cover_thumbnail, progress))
}
}
}

View File

@ -245,6 +245,11 @@ class LibraryController(
}
}
override fun onActivityPaused(activity: Activity) {
super.onActivityPaused(activity)
presenter.onDestroy()
}
override fun onDestroy() {
presenter.onDestroy()
super.onDestroy()

View File

@ -1,18 +1,17 @@
package eu.kanade.tachiyomi.ui.library
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.core.content.ContextCompat
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.signature.ObjectKey
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.system.getResourceColor
import kotlinx.android.synthetic.main.catalogue_grid_item.*
import kotlinx.android.synthetic.main.catalogue_grid_item.view.*
/**
* Class used to hold the displayed data of a manga in the library, like the cover or the title.
@ -24,9 +23,10 @@ import kotlinx.android.synthetic.main.catalogue_grid_item.*
* @constructor creates a new library holder.
*/
class LibraryGridHolder(
private val view: View,
adapter: LibraryCategoryAdapter
private val view: View,
adapter: LibraryCategoryAdapter,
var width:Int,
var fixedSize: Boolean
) : LibraryHolder(view, adapter) {
/**
@ -37,35 +37,70 @@ class LibraryGridHolder(
*/
override fun onSetValues(item: LibraryItem) {
// Update the title of the manga.
with(title) {
visibility = if (item.manga.hide_title) View.GONE else View.VISIBLE
text = item.manga.currentTitle()
}
gradient.visibility = if (item.manga.hide_title) View.GONE else View.VISIBLE
title.text = item.manga.currentTitle()
// Update the unread count and its visibility.
with(unread_text) {
visibility =
if (item.manga.unread > 0 && item.unreadType == 1) View.VISIBLE else View.GONE
text = item.manga.unread.toString()
val unread = item.manga.unread
// Update the subtitle of the manga with artist or the unread count
with(subtitle) {
text = when {
item.manga.unread > 0 -> when (item.unreadType) {
1 -> view.resources.getQuantityString(R.plurals.unread_count, unread, unread)
0 -> view.resources.getString(R.string.new_chapter)
else -> item.manga.originalAuthor()
}
else -> item.manga.originalAuthor()
}
setTextColor(
view.context.getResourceColor(
if (item.manga.unread > 0 && item.unreadType > -1) android.R.attr.colorAccent
else android.R.attr.textColorSecondary
)
)
}
// Update the download count and its visibility.
unread_badge.visibility =
if (item.manga.unread > 0 && item.unreadType == 0) View.VISIBLE else View.GONE
play_layout.visibility = if (unread > 0) View.VISIBLE else View.GONE
play_layout.setOnClickListener { playButtonClicked() }
// Update the download count or local status and its visibility.
with(download_text) {
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
text = item.downloadCount.toString()
visibility = if (item.downloadCount > -1 && (item.downloadCount > 0 || item.manga
.source == LocalSource.ID))
View.VISIBLE else View.GONE
text = if (item.manga.source == LocalSource.ID)
itemView.resources.getString(R.string.local_source_badge)
else item.downloadCount.toString()
backgroundTintList = ContextCompat.getColorStateList(itemView.context,
if (item.manga.source == LocalSource.ID) R.color.md_teal_500
else R.color.md_red_500)
}
//set local visibility if its local manga
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
// Update the cover.
if (item.manga.thumbnail_url == null)
GlideApp.with(view.context).clear(thumbnail)
else GlideApp.with(view.context).load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(item.manga.id!!).toString()))
.centerCrop().into(thumbnail)
if (item.manga.thumbnail_url == null) Glide.with(view.context).clear(cover_thumbnail)
else {
val id = item.manga.id ?: return
var glide = GlideApp.with(view.context).load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString()))
glide = if (fixedSize) glide.centerCrop() else glide.override(width)
glide.into(cover_thumbnail)
}
}
private fun playButtonClicked() {
adapter.libraryListener.startReading(adapterPosition)
}
override fun onActionStateChanged(position: Int, actionState: Int) {
super.onActionStateChanged(position, actionState)
if (actionState == 2) {
view.card.isDragged = true
}
}
override fun onItemReleased(position: Int) {
super.onItemReleased(position)
view.card.isDragged = false
}
}

View File

@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.data.database.models.LibraryManga
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import kotlinx.android.synthetic.main.catalogue_mat_grid_item.view.*
import kotlinx.android.synthetic.main.catalogue_grid_item.view.*
import uy.kohesive.injekt.injectLazy
class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference<Boolean>,
@ -29,7 +29,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
return if (libraryAsList.getOrDefault())
R.layout.catalogue_list_item
else
R.layout.catalogue_mat_grid_item
R.layout.catalogue_grid_item
}
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): LibraryHolder {
@ -51,7 +51,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
cover_thumbnail.maxHeight = (parent.itemWidth / 3f * 6f).toInt()
}
}
LibraryMatGridHolder(view, adapter as LibraryCategoryAdapter, parent.itemWidth, fixedSize)
LibraryGridHolder(view, adapter as LibraryCategoryAdapter, parent.itemWidth, fixedSize)
} else {
LibraryListHolder(view, adapter as LibraryCategoryAdapter)

View File

@ -1,22 +1,21 @@
package eu.kanade.tachiyomi.ui.library
import android.text.Html
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.text.HtmlCompat
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource
import kotlinx.android.synthetic.main.catalogue_list_item.*
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.signature.ObjectKey
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import kotlinx.android.synthetic.main.catalogue_grid_item.*
import kotlinx.android.synthetic.main.catalogue_list_item.download_text
import kotlinx.android.synthetic.main.catalogue_list_item.local_text
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail
import eu.kanade.tachiyomi.util.system.getResourceColor
import kotlinx.android.synthetic.main.catalogue_list_item.subtitle
import kotlinx.android.synthetic.main.catalogue_list_item.title
import kotlinx.android.synthetic.main.catalogue_list_item.unread_badge
import kotlinx.android.synthetic.main.catalogue_list_item.unread_text
import kotlinx.android.synthetic.main.catalogue_list_item.view.*
/**
* Class used to hold the displayed data of a manga in the library, like the cover or the title.
@ -44,37 +43,89 @@ class LibraryListHolder(
title.text = item.manga.currentTitle()
// Update the unread count and its visibility.
with(unread_text) {
visibility = if (item.manga.unread > 0 && item.unreadType == 1) View.VISIBLE else
View.GONE
text = item.manga.unread.toString()
}
unread_badge.visibility =
if (item.manga.unread > 0 && item.unreadType == 0) View.VISIBLE else View.GONE
// Update the download count and its visibility.
with(download_text) {
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
text = "${item.downloadCount}"
}
//show local text badge if local manga
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
val unread = item.manga.unread
// Create thumbnail onclick to simulate long click
thumbnail.setOnClickListener {
// Simulate long click on this view to enter selection mode
onLongClick(itemView)
// Update the subtitle of the manga with artist or the unread count and download count
"<font color=#cc0029>First Color</font>"
val subtitleText = when {
unread > 0 -> when (item.unreadType) {
1 -> view.resources.getQuantityString(R.plurals.unread_count, unread, unread)
0 -> view.resources.getString(R.string.new_chapter)
else -> item.manga.originalAuthor()
}
else -> item.manga.originalAuthor()
}
// Update the download count or local status and its visibility.
val downloadText =
if (item.manga.source == LocalSource.ID)
itemView.resources.getString(R.string.local_source_badge)
else view.resources.getQuantityString(R.plurals.download_count,
item.downloadCount, item.downloadCount)
// Combine the 2 above using html
val subText = if (item.downloadCount > 0 || item.manga.source == LocalSource.ID) {
val downloadColor = convertColor(ContextCompat.getColor(itemView.context,
if (item.manga.source == LocalSource.ID) R.color.md_teal_500
else R.color.md_red_500))
val unreadColor = convertColor(itemView.context.getResourceColor(R.attr.colorAccent))
when {
unread > 0 && item.unreadType > -1 -> "<font color=" +
"#$downloadColor>$downloadText</font> | " +
"<font color=#$unreadColor>$subtitleText</font>"
subtitleText != null -> "<font color=#$downloadColor>$downloadText</font> | " +
subtitleText
else -> "<font color=#$downloadColor>$downloadText</font>"
}
}
else {
subtitleText
}
with(subtitle) {
text = HtmlCompat.fromHtml(subText ?: "", HtmlCompat.FROM_HTML_MODE_LEGACY)
setTextColor(
view.context.getResourceColor(
if (item.manga.unread > 0 && item.unreadType > -1 && item.downloadCount <= 0
&& item.manga.source != LocalSource.ID)
android.R.attr.colorAccent
else android.R.attr.textColorSecondary
)
)
}
play_layout.visibility = if (unread > 0) View.VISIBLE else View.GONE
play_layout.setOnClickListener { playButtonClicked() }
// Update the cover.
GlideApp.with(itemView.context).clear(thumbnail)
GlideApp.with(itemView.context)
.load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(item.manga.id!!).toString()))
.centerCrop()
.circleCrop()
.dontAnimate()
.into(thumbnail)
if (item.manga.thumbnail_url == null) Glide.with(view.context).clear(cover_thumbnail)
else {
val id = item.manga.id ?: return
val height = itemView.context.resources.getDimensionPixelSize(R.dimen
.material_component_lists_single_line_with_avatar_height)
GlideApp.with(view.context).load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString()))
.override(height)
.into(cover_thumbnail)
}
}
private fun convertColor(color: Int):String {
return Integer.toHexString(color and 0x00ffffff)
}
private fun playButtonClicked() {
adapter.libraryListener.startReading(adapterPosition)
}
override fun onActionStateChanged(position: Int, actionState: Int) {
super.onActionStateChanged(position, actionState)
if (actionState == 2) {
view.card.isDragged = true
}
}
override fun onItemReleased(position: Int) {
super.onItemReleased(position)
view.card.isDragged = false
}
}

View File

@ -1,100 +0,0 @@
package eu.kanade.tachiyomi.ui.library
import android.view.View
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.signature.ObjectKey
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.util.system.getResourceColor
import kotlinx.android.synthetic.main.catalogue_mat_grid_item.*
import kotlinx.android.synthetic.main.catalogue_mat_grid_item.view.*
/**
* Class used to hold the displayed data of a manga in the library, like the cover or the title.
* All the elements from the layout file "item_catalogue_grid" are available in this class.
*
* @param view the inflated view for this holder.
* @param adapter the adapter handling this holder.
* @param listener a listener to react to single tap and long tap events.
* @constructor creates a new library holder.
*/
class LibraryMatGridHolder(
private val view: View,
adapter: LibraryCategoryAdapter,
var width:Int,
var fixedSize: Boolean
) : LibraryHolder(view, adapter) {
/**
* Method called from [LibraryCategoryAdapter.onBindViewHolder]. It updates the data for this
* holder with the given manga.
*
* @param item the manga item to bind.
*/
override fun onSetValues(item: LibraryItem) {
// Update the title of the manga.
title.text = item.manga.currentTitle()
// Update the unread count and its visibility.
val unread = item.manga.unread
// Update the subtitle of the manga with artist or the unread count
with(subtitle) {
text = when {
item.manga.unread > 0 -> when (item.unreadType) {
1 -> view.resources.getQuantityString(R.plurals.unread_count, unread, unread)
0 -> view.resources.getString(R.string.new_chapter)
else -> item.manga.originalAuthor()
}
else -> item.manga.originalAuthor()
}
setTextColor(
view.context.getResourceColor(
if (item.manga.unread > 0 && item.unreadType > -1) android.R.attr.colorAccent
else android.R.attr.textColorSecondary
)
)
}
play_layout.visibility = if (unread > 0) View.VISIBLE else View.GONE
play_layout.setOnClickListener { playButtonClicked() }
// Update the download count and its visibility.
with(download_text) {
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
text = item.downloadCount.toString()
}
// Set local visibility if its local manga
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
// Update the cover.
if (item.manga.thumbnail_url == null) Glide.with(view.context).clear(cover_thumbnail)
else {
val id = item.manga.id ?: return
var glide = GlideApp.with(view.context).load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString()))
glide = if (fixedSize) glide.centerCrop() else glide.override(width)
glide.into(cover_thumbnail)
}
}
private fun playButtonClicked() {
adapter.libraryListener.startReading(adapterPosition)
}
override fun onActionStateChanged(position: Int, actionState: Int) {
super.onActionStateChanged(position, actionState)
if (actionState == 2) {
view.card.isDragged = true
}
}
override fun onItemReleased(position: Int) {
super.onItemReleased(position)
view.card.isDragged = false
}
}

View File

@ -84,8 +84,6 @@ class LibraryPresenter(
private var currentMangaMap:LibraryMap? = null
private var readerSubscription: Subscription? = null
fun isDownloading() = downloadManager.hasQueue()
fun onDestroy() {

View File

@ -19,20 +19,20 @@ class MangaHolder(
title.text = item.manga.currentTitle()
// Create thumbnail onclick to simulate long click
thumbnail.setOnClickListener {
cover_thumbnail.setOnClickListener {
// Simulate long click on this view to enter selection mode
onLongClick(itemView)
}
// Update the cover.
GlideApp.with(itemView.context).clear(thumbnail)
GlideApp.with(itemView.context).clear(cover_thumbnail)
GlideApp.with(itemView.context)
.load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.centerCrop()
.circleCrop()
// .centerCrop()
// .circleCrop()
.dontAnimate()
.into(thumbnail)
.into(cover_thumbnail)
}
}

View File

@ -52,6 +52,13 @@ class SettingsLibraryController : SettingsController() {
}
}
switchPreference {
key = Keys.libraryGridFixed
titleRes = R.string.pref_fixed_grid
summaryRes = R.string.pref_fixed_grid_summary
defaultValue = false
}
switchPreference {
key = Keys.removeArticles
titleRes = R.string.pref_remove_articles
@ -59,12 +66,6 @@ class SettingsLibraryController : SettingsController() {
defaultValue = false
}
switchPreference {
key = Keys.libraryGridFixed
titleRes = R.string.pref_fixed_grid
summaryRes = R.string.pref_fixed_grid_summary
defaultValue = false
}
}
val dbCategories = db.getCategories().executeAsBlocking()

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/rippleColor">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/rippleColor" />
</item>
<item android:drawable="@color/rippleColor" android:state_focused="true"/>
<item android:drawable="@color/rippleColor" android:state_pressed="true"/>
<item android:drawable="@color/rippleColor" android:state_activated="true"/>
<item android:drawable="@color/darkPrimaryColor"/>
<item>
<color android:color="@color/dialog" />
</item>
</selector>
</item>
</ripple>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/selectorColor">
android:color="@color/fullRippleColor">
<item android:id="@android:id/mask"
android:top="0dp"
android:bottom="12dp"
@ -8,7 +8,7 @@
android:right="4dp">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="@color/selectorColor" />
<solid android:color="@color/fullRippleColor" />
</shape>
</item>
<item
@ -20,14 +20,14 @@
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="@color/selectorColor" />
<solid android:color="@color/fullRippleColor" />
</shape>
</item>
<item android:state_activated="true">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="@color/selectorColor" />
<solid android:color="@color/fullRippleColor" />
</shape>
</item>
</selector>

View File

@ -1,18 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/rippleColor">
android:color="@color/fullRippleColor">
<item android:id="@android:id/mask">
<color android:color="@color/fullRippleColor" />
</item>
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/rippleColor" />
<color android:color="@color/fullRippleColor" />
</item>
<item android:state_activated="true">
<color android:color="@color/rippleColor" />
<color android:color="@color/fullRippleColor" />
</item>
<item>
<color android:color="@color/dialog" />
<item android:id="@android:id/mask">
<color android:color="?android:attr/colorBackground" />
</item>
</selector>
</item>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/rippleColor">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/rippleColor" />
</item>
<item android:state_activated="true">
<color android:color="@color/rippleColor" />
</item>
<item>
<color android:color="@color/md_black_1000" />
</item>
</selector>
</item>
</ripple>

View File

@ -7,14 +7,16 @@
<color android:color="@color/rippleColor" />
</item>
<item android:drawable="@color/rippleColor" android:state_focused="true"/>
<item android:drawable="@color/rippleColor" android:state_pressed="true"/>
<item android:drawable="@color/rippleColor" android:state_activated="true"/>
<item android:drawable="@color/darkPrimaryColor"/>
<item
android:drawable="@color/rippleColor"
android:state_focused="true" />
<item
android:drawable="@color/rippleColor"
android:state_pressed="true" />
<item
android:drawable="@color/rippleColor"
android:state_activated="true" />
<item>
<color android:color="@color/dialog" />
</item>
</selector>
</item>
</ripple>

View File

@ -193,7 +193,7 @@
android:focusable="true"
android:gravity="start|center"
android:padding="5dp"
android:text="@string/action_display_unread_badge"
android:text="@string/action_display_unread_text"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="15sp"

View File

@ -193,7 +193,7 @@
android:focusable="true"
android:gravity="start|center"
android:padding="5dp"
android:text="@string/action_display_unread_badge"
android:text="@string/action_display_unread_text"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="15sp"

View File

@ -1,132 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/manga_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectable_library_drawable">
android:layout_gravity="bottom">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="220dp"
android:id="@+id/card"
android:background="@drawable/card_background">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/library_item_selector"
android:minHeight="200dp"
android:orientation="vertical">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
tools:background="?android:attr/colorBackground"
tools:src="@mipmap/ic_launcher"
tools:ignore="ContentDescription" />
<View
android:id="@+id/gradient"
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/gradient_shape"/>
android:layout_marginTop="2dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
app:layout_constraintBottom_toTopOf="@+id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/badge_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="7dp"
tools:layout_editor_absoluteX="7dp">
<TextView
android:id="@+id/unread_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content"
<ImageView
android:id="@+id/cover_thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:textColor="@color/md_white_1000"
android:visibility="gone"
tools:visibility="visible"
tools:text="120"
app:layout_constraintStart_toEndOf="@+id/download_text"
android:layout_marginStart="4dp"
android:adjustViewBounds="true"
android:background="?android:attr/colorBackground"
android:maxHeight="250dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="4dp"/>
tools:background="?android:attr/colorBackground"
tools:ignore="ContentDescription"
tools:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/download_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/md_red_500"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:visibility="gone"
tools:visibility="visible"
tools:text="120"
android:layout_marginStart="-10dp"
android:layout_marginTop="-10dp"
android:background="@drawable/dialog_rounded_background"
android:backgroundTint="@color/md_red_500"
android:gravity="start|center"
android:paddingStart="14dp"
android:paddingTop="10dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/md_white_1000"
app:layout_constraintStart_toEndOf="@+id/local_text"
android:layout_marginStart="4dp"
android:textSize="13sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="4dp"/>
tools:text="1" />
<TextView
android:id="@+id/local_text"
android:id="@+id/bookmark_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/md_teal_500"
android:layout_marginStart="-10dp"
android:layout_marginTop="-10dp"
android:background="@drawable/dialog_rounded_background"
android:backgroundTint="@color/md_blue_A400_87"
android:gravity="start|center"
android:paddingStart="14dp"
android:paddingTop="10dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/in_library"
android:textColor="@color/md_white_1000"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:textSize="13sp"
android:visibility="gone"
tools:visibility="visible"
android:text="@string/local_source_badge"
android:layout_marginStart="4dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="4dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
tools:visibility="visible" />
<eu.kanade.tachiyomi.widget.PTSansTextView
<FrameLayout
android:id="@+id/play_layout"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="end|bottom"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/play_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="end|bottom"
android:layout_marginEnd="6dp"
android:layout_marginBottom="6dp"
android:padding="3dp"
android:background="@drawable/round_play_background"
android:contentDescription="@string/start_reading"
android:src="@drawable/ic_play_arrow_white_24dp"
android:tint="@android:color/white" />
</FrameLayout>
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.Body1.Light"
app:typeface="ptsansNarrowBold"
android:layout_width="match_parent"
android:textColor="@color/md_white_1000"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:ellipsize="end"
android:lineSpacingExtra="-4dp"
android:maxLines="2"
android:padding="8dp"
android:shadowColor="@color/md_black_1000_87"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="4"
tools:text="Sample name"/>
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/subtitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="Sample name" />
<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
<com.google.android.material.textview.MaterialTextView
android:id="@+id/subtitle"
style="@style/TextAppearance.Regular.Body1.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleSmall"
android:visibility="gone"
android:layout_gravity="center"/>
android:layout_marginBottom="14dp"
android:ellipsize="end"
android:lineSpacingExtra="-4dp"
android:layout_marginStart="6dp"
android:paddingEnd="6dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="Sample artist" />
</FrameLayout>
<ImageView
android:id="@+id/unread_badge"
android:layout_width="20dp"
android:layout_height="20dp"
android:visibility="gone"
tools:visibility="visible"
android:layout_gravity="end"
android:src="@drawable/unread_circle_badge"/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

View File

@ -1,132 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?attr/selectable_list_drawable"
tools:layout_editor_absoluteY="25dp"
tools:layout_editor_absoluteX="0dp">
android:minHeight="@dimen/material_component_lists_single_line_with_avatar_height"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="25dp">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height"
android:layout_gravity="center_vertical"
tools:src="@mipmap/ic_launcher"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_marginStart="8dp"/>
<TextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="0dp"
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
app:layout_constrainedHeight="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
<ImageView
android:id="@+id/cover_thumbnail"
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:background="?android:attr/colorBackground"
android:maxHeight="150dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="?android:attr/colorBackground"
tools:ignore="ContentDescription"
tools:src="@mipmap/ic_launcher" />
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.Body1.SemiBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="6dp"
android:ellipsize="end"
android:maxLines="3"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/extras_layout"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/card"
app:layout_constraintTop_toTopOf="parent"
tools:text="Manga title" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/subtitle"
style="@style/TextAppearance.Regular.Body1.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:layout_marginBottom="14dp"
android:ellipsize="end"
android:maxLines="1"
tools:text="Manga title"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintStart_toEndOf="@+id/thumbnail"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toStartOf="@+id/local_text"
android:layout_marginEnd="8dp"
app:layout_constraintVertical_bias="0.523"
app:layout_constraintHorizontal_bias="0.007"/>
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/extras_layout"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/title"
app:layout_constraintTop_toBottomOf="@+id/title"
app:layout_constraintVertical_bias="0.0"
tools:text="Manga artist" />
<TextView
android:id="@+id/local_text"
style="@style/TextAppearance.Regular.Caption.Light"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/extras_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/md_teal_500"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:layout_centerVertical="true"
android:maxLines="1"
android:text="@string/local_source_badge"
android:visibility="gone"
android:textColor="@color/md_white_1000"
tools:visibility="visible"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toStartOf="@+id/download_text"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"/>
<TextView
android:id="@+id/download_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:textColor="@color/md_white_1000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/md_red_500"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/unread_text"
android:maxLines="1"
android:visibility="gone"
tools:text="122"
tools:visibility="visible"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toStartOf="@+id/unread_text"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"/>
<TextView
android:id="@+id/unread_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:textColor="@color/md_white_1000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:maxLines="1"
android:visibility="gone"
tools:text="130"
tools:visibility="visible"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/unread_badge"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/unread_badge"
android:layout_width="10dp"
android:layout_height="10dp"
android:visibility="gone"
tools:visibility="visible"
android:layout_gravity="end"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:src="@drawable/unread_circle_badge"/>
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/play_layout"
android:layout_width="55dp"
android:layout_height="match_parent"
android:layout_gravity="end|bottom"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
<ImageView
android:id="@+id/play_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="end|center"
android:layout_marginEnd="12dp"
android:background="@drawable/round_play_background"
android:contentDescription="@string/start_reading"
android:padding="3dp"
android:src="@drawable/ic_play_arrow_white_24dp"
android:tint="@android:color/white" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/bottom_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:orientation="horizontal"
app:barrierDirection="bottom"
app:constraint_referenced_ids="card,subtitle" />
<View
android:id="@+id/padding"
android:layout_width="0dp"
android:layout_height="6dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bottom_line" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,197 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/manga_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/library_item_selector"
android:minHeight="200dp"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
app:layout_constraintBottom_toTopOf="@+id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0">
<ImageView
android:id="@+id/cover_thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:background="?android:attr/colorBackground"
android:maxHeight="250dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="?android:attr/colorBackground"
tools:ignore="ContentDescription"
tools:src="@mipmap/ic_launcher" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/badge_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp">
<TextView
android:id="@+id/local_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/md_teal_500"
android:paddingStart="3dp"
android:paddingTop="1dp"
android:paddingEnd="3dp"
android:paddingBottom="1dp"
android:text="@string/local_source_badge"
android:textColor="@color/md_white_1000"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/download_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="-10dp"
android:layout_marginTop="-10dp"
android:background="@drawable/dialog_rounded_background"
android:backgroundTint="@color/md_red_500"
android:gravity="start|center"
android:paddingStart="14dp"
android:paddingTop="10dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/md_white_1000"
android:textSize="13sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/local_text"
app:layout_constraintTop_toTopOf="parent"
tools:text="1" />
<TextView
android:id="@+id/bookmark_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="-10dp"
android:layout_marginTop="-10dp"
android:background="@drawable/dialog_rounded_background"
android:backgroundTint="@color/md_blue_A400_87"
android:gravity="start|center"
android:paddingStart="14dp"
android:paddingTop="10dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/in_library"
android:textColor="@color/md_white_1000"
android:textSize="13sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/local_text"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<FrameLayout
android:id="@+id/play_layout"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="end|bottom"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/play_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="end|bottom"
android:layout_marginEnd="6dp"
android:layout_marginBottom="6dp"
android:padding="3dp"
android:background="@drawable/round_play_background"
android:contentDescription="@string/start_reading"
android:src="@drawable/ic_play_arrow_white_24dp"
android:tint="@android:color/white" />
</FrameLayout>
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.Body1.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:ellipsize="end"
android:lineSpacingExtra="-4dp"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/subtitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="Sample name\nsdf" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/subtitle"
style="@style/TextAppearance.Regular.Body1.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="14dp"
android:ellipsize="end"
android:lineSpacingExtra="-4dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="Sample artist" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

View File

@ -8,4 +8,4 @@
android:layout_height="match_parent"
android:columnWidth="140dp"
android:clipToPadding="false"
tools:listitem="@layout/catalogue_mat_grid_item" />
tools:listitem="@layout/catalogue_grid_item" />

View File

@ -190,7 +190,7 @@
android:focusable="true"
android:gravity="start|center"
android:padding="5dp"
android:text="@string/action_display_unread_badge"
android:text="@string/action_display_unread_text"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="15sp"

View File

@ -31,7 +31,7 @@
<View
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_height="24dp"
android:background="@drawable/shape_gradient_top_shadow"
android:paddingBottom="10dp"
app:layout_anchorGravity="top"

View File

@ -178,7 +178,7 @@
android:layout_marginTop="16dp"
android:entries="@array/color_filter_modes"
app:layout_constraintTop_toBottomOf="@id/seekbar_color_filter_alpha"
app:layout_constraintStart_toEndOf="@id/verticalcenter"
app:layout_constraintStart_toEndOf="@id/bottom_line"
app:layout_constraintEnd_toEndOf="@id/spinner_end" />
<!-- Brightness -->
@ -228,7 +228,7 @@
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/verticalcenter"
android:id="@+id/bottom_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"

View File

@ -52,7 +52,7 @@
android:layout_height="wrap_content"
android:text="@string/viewer_for_this_series"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/verticalcenter"
app:layout_constraintEnd_toStartOf="@id/bottom_line"
app:layout_constraintBaseline_toBaselineOf="@id/viewer" />
<androidx.appcompat.widget.AppCompatSpinner
@ -62,7 +62,7 @@
android:layout_marginTop="16dp"
android:entries="@array/viewers_selector"
app:layout_constraintTop_toBottomOf="@id/general_prefs"
app:layout_constraintStart_toEndOf="@id/verticalcenter"
app:layout_constraintStart_toEndOf="@id/bottom_line"
app:layout_constraintEnd_toEndOf="@id/spinner_end" />
<TextView
@ -71,7 +71,7 @@
android:layout_marginTop="16dp"
android:text="@string/pref_rotation_type"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/verticalcenter"
app:layout_constraintEnd_toStartOf="@id/bottom_line"
app:layout_constraintBaseline_toBaselineOf="@id/rotation_mode" />
<androidx.appcompat.widget.AppCompatSpinner
@ -81,7 +81,7 @@
android:layout_marginTop="16dp"
android:entries="@array/rotation_type"
app:layout_constraintTop_toBottomOf="@id/viewer"
app:layout_constraintStart_toEndOf="@id/verticalcenter"
app:layout_constraintStart_toEndOf="@id/bottom_line"
app:layout_constraintEnd_toEndOf="@id/spinner_end" />
<TextView
@ -99,7 +99,7 @@
android:layout_marginTop="16dp"
android:entries="@array/reader_themes"
app:layout_constraintTop_toBottomOf="@id/rotation_mode"
app:layout_constraintStart_toEndOf="@id/verticalcenter"
app:layout_constraintStart_toEndOf="@id/bottom_line"
app:layout_constraintEnd_toEndOf="@id/spinner_end" />
<androidx.appcompat.widget.SwitchCompat
@ -174,7 +174,7 @@
android:id="@+id/zoom_start_text"
android:text="@string/pref_image_scale_type"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/verticalcenter"
app:layout_constraintEnd_toStartOf="@id/bottom_line"
app:layout_constraintBaseline_toBaselineOf="@id/scale_type"/>
<androidx.appcompat.widget.AppCompatSpinner
@ -183,7 +183,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:entries="@array/image_scale_type"
app:layout_constraintStart_toEndOf="@id/verticalcenter"
app:layout_constraintStart_toEndOf="@id/bottom_line"
app:layout_constraintEnd_toEndOf="@id/spinner_end"
app:layout_constraintTop_toBottomOf="@id/pager_prefs"/>
@ -193,7 +193,7 @@
android:layout_height="wrap_content"
android:text="@string/pref_zoom_start"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/verticalcenter"
app:layout_constraintEnd_toStartOf="@id/bottom_line"
app:layout_constraintBaseline_toBaselineOf="@id/zoom_start"/>
<androidx.appcompat.widget.AppCompatSpinner
@ -203,7 +203,7 @@
android:entries="@array/zoom_start"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/scale_type"
app:layout_constraintStart_toEndOf="@id/verticalcenter"
app:layout_constraintStart_toEndOf="@id/bottom_line"
app:layout_constraintEnd_toEndOf="@id/spinner_end" />
<androidx.appcompat.widget.SwitchCompat
@ -266,7 +266,7 @@
app:constraint_referenced_ids="webtoon_prefs,crop_borders_webtoon" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/verticalcenter"
android:id="@+id/bottom_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"

View File

@ -4,12 +4,14 @@
<color name="colorPrimary">#212121</color>
<color name="colorPrimaryDark">#212121</color>
<color name="drawerHighlight">@color/md_white_1000_12</color>
<color name="drawerPrimary">#3399FF</color>
<color name="oldNavBarBackground">#B3000000</color>
<color name="snackbarBackground">#FFFFFF</color>
<color name="cardBackground">#212121</color>
<color name="rippleColor">@color/md_white_1000_20</color>
<color name="fullRippleColor">#707070</color>
<color name="dialogBackground">@color/md_grey_800</color>
<color name="colorAccent">#3399FF</color>
<color name="purePrimary">#212121</color>

View File

@ -31,7 +31,7 @@
<item name="snackbar_text">@color/textColorPrimary</item>
<!-- Custom Attributes-->
<item name="selectable_list_drawable">@drawable/list_item_selector_amoled</item>
<item name="selectable_list_drawable">@drawable/list_item_selector</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_amoled</item>
<item name="background_card">@color/dialog_amoled</item>

View File

@ -13,6 +13,7 @@
<color name="snackbarBackground">#323232</color>
<color name="trueSnackbarBackground">#323232</color>
<color name="dialogBackground">@color/md_white_1000</color>
<color name="fullRippleColor">#C2C2C2</color>
<color name="rippleColor">@color/md_black_1000_12</color>
<color name="colorAccent">@color/md_blue_A400</color>
<color name="actionModeShadow">@color/md_black_1000_38</color>

View File

@ -97,7 +97,7 @@
<string name="action_display_grid">Grid</string>
<string name="action_display_list">List</string>
<string name="action_display_download_badge">Download badges</string>
<string name="action_display_unread_badge">Unread badges</string>
<string name="action_display_unread_text">Unread text</string>
<string name="action_display_all_unread">All unread</string>
<string name="action_display_any_unread">Any unread</string>
<string name="action_display_hide_unread">Hide unread</string>
@ -197,8 +197,7 @@
<string name="pref_auto_update_manga_sync">Sync chapters after reading</string>
<string name="pref_remove_articles">Sort by ignoring articles</string>
<string name="pref_fixed_grid">Fixed grid size in library</string>
<string name="pref_fixed_grid_summary">Show all covers as the same height by cropping (improves
fast scrolling performance)</string>
<string name="pref_fixed_grid_summary">Show all covers as the same height by cropping</string>
<string name="pref_remove_articles_summary">When sorting alphabetically, sort ignoring
articles (a, an, the) at the start of manga titles</string>
<string name="pref_skip_pre_migration">Skip pre-migration</string>
@ -414,10 +413,14 @@
<string name="confirm_manga_deletion">Remove from library?</string>
<plurals name="unread_count">
<item quantity="one">New chapter</item>
<item quantity="other">%d Unread</item>
<item quantity="other">%d unread</item>
</plurals>
<string name="new_chapter">New</string>
<string name="start_reading">Start Reading</string>
<plurals name="download_count">
<item quantity="one">1 downloaded</item>
<item quantity="other">%d downloaded</item>
</plurals>
<!-- Catalogue fragment -->
<string name="source_search_options">Search filters</string>

View File

@ -56,6 +56,10 @@
<item name="android:textStyle">bold</item>
</style>
<style name="TextAppearance.Regular.Body1.SemiBold">
<item name="android:fontFamily">sans-serif-medium</item>
</style>
<style name="TextAppearance.Regular.Body1.Light">
<item name="android:textColor">@color/textColorPrimary</item>
</style>