Add special view for browsing E/Exhentai! All the important info is now in front of your face when browsing, it is on by default and can be toggled off in the E-Hentai settings. Let me know if you find any errors

This commit is contained in:
Jobobby04
2020-07-28 16:55:33 -04:00
parent 032504f128
commit a6cba5c87d
24 changed files with 463 additions and 141 deletions
@@ -14,6 +14,7 @@ import exh.metadata.EX_DATE_FORMAT
import exh.metadata.humanReadableByteCount
import exh.metadata.metadata.EHentaiSearchMetadata
import exh.ui.metadata.MetadataViewController
import exh.util.SourceTagsUtil
import java.util.Date
import kotlin.math.roundToInt
import kotlinx.coroutines.CoroutineScope
@@ -50,16 +51,16 @@ class EHentaiDescriptionAdapter(
val genre = meta.genre
if (genre != null) {
val pair = when (genre) {
"doujinshi" -> Pair("#fc4e4e", R.string.doujinshi)
"manga" -> Pair("#e78c1a", R.string.manga)
"artistcg" -> Pair("#dde500", R.string.artist_cg)
"gamecg" -> Pair("#05bf0b", R.string.game_cg)
"western" -> Pair("#14e723", R.string.western)
"non-h" -> Pair("#08d7e2", R.string.non_h)
"imageset" -> Pair("#5f5fff", R.string.image_set)
"cosplay" -> Pair("#9755f5", R.string.cosplay)
"asianporn" -> Pair("#fe93ff", R.string.asian_porn)
"misc" -> Pair("#9e9e9e", R.string.misc)
"doujinshi" -> Pair(SourceTagsUtil.DOUJINSHI_COLOR, R.string.doujinshi)
"manga" -> Pair(SourceTagsUtil.MANGA_COLOR, R.string.manga)
"artistcg" -> Pair(SourceTagsUtil.ARTIST_CG_COLOR, R.string.artist_cg)
"gamecg" -> Pair(SourceTagsUtil.GAME_CG_COLOR, R.string.game_cg)
"western" -> Pair(SourceTagsUtil.WESTERN_COLOR, R.string.western)
"non-h" -> Pair(SourceTagsUtil.NON_H_COLOR, R.string.non_h)
"imageset" -> Pair(SourceTagsUtil.IMAGE_SET_COLOR, R.string.image_set)
"cosplay" -> Pair(SourceTagsUtil.COSPLAY_COLOR, R.string.cosplay)
"asianporn" -> Pair(SourceTagsUtil.ASIAN_PORN_COLOR, R.string.asian_porn)
"misc" -> Pair(SourceTagsUtil.MISC_COLOR, R.string.misc)
else -> Pair("", 0)
}
@@ -80,7 +81,7 @@ class EHentaiDescriptionAdapter(
binding.uploader.text = meta.uploader ?: itemView.context.getString(R.string.unknown)
binding.size.text = humanReadableByteCount(meta.size ?: 0, true)
binding.pages.text = itemView.context.getString(R.string.num_pages, meta.length ?: 0)
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.length ?: 0, meta.length ?: 0)
val language = meta.language ?: itemView.context.getString(R.string.unknown)
binding.language.text = if (meta.translated == true) {
itemView.context.getString(R.string.language_translated, language)
@@ -41,7 +41,7 @@ class HBrowseDescriptionAdapter(
val meta = controller.presenter.meta
if (meta == null || meta !is HBrowseSearchMetadata) return
binding.pages.text = itemView.context.getString(R.string.num_pages, meta.length ?: 0)
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.length ?: 0, meta.length ?: 0)
binding.moreInfo.clicks()
.onEach {
@@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
import exh.metadata.EX_DATE_FORMAT
import exh.metadata.metadata.HitomiSearchMetadata
import exh.ui.metadata.MetadataViewController
import exh.util.SourceTagsUtil
import java.util.Date
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -47,16 +48,16 @@ class HitomiDescriptionAdapter(
val genre = meta.type
if (genre != null) {
val pair = when (genre) {
"doujinshi" -> Pair("#fc4e4e", R.string.doujinshi)
"manga" -> Pair("#e78c1a", R.string.manga)
"artist CG" -> Pair("#dde500", R.string.artist_cg)
"game CG" -> Pair("#05bf0b", R.string.game_cg)
"western" -> Pair("#14e723", R.string.western)
"non-H" -> Pair("#08d7e2", R.string.non_h)
"image Set" -> Pair("#5f5fff", R.string.image_set)
"cosplay" -> Pair("#9755f5", R.string.cosplay)
"asian Porn" -> Pair("#fe93ff", R.string.asian_porn)
"misc" -> Pair("#9e9e9e", R.string.misc)
"doujinshi" -> Pair(SourceTagsUtil.DOUJINSHI_COLOR, R.string.doujinshi)
"manga" -> Pair(SourceTagsUtil.MANGA_COLOR, R.string.manga)
"artist CG" -> Pair(SourceTagsUtil.ARTIST_CG_COLOR, R.string.artist_cg)
"game CG" -> Pair(SourceTagsUtil.GAME_CG_COLOR, R.string.game_cg)
"western" -> Pair(SourceTagsUtil.WESTERN_COLOR, R.string.western)
"non-H" -> Pair(SourceTagsUtil.NON_H_COLOR, R.string.non_h)
"image Set" -> Pair(SourceTagsUtil.IMAGE_SET_COLOR, R.string.image_set)
"cosplay" -> Pair(SourceTagsUtil.COSPLAY_COLOR, R.string.cosplay)
"asian Porn" -> Pair(SourceTagsUtil.ASIAN_PORN_COLOR, R.string.asian_porn)
"misc" -> Pair(SourceTagsUtil.MISC_COLOR, R.string.misc)
else -> Pair("", 0)
}
@@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
import exh.metadata.EX_DATE_FORMAT
import exh.metadata.metadata.NHentaiSearchMetadata
import exh.ui.metadata.MetadataViewController
import exh.util.SourceTagsUtil
import java.util.Date
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -54,16 +55,16 @@ class NHentaiDescriptionAdapter(
if (category != null) {
val pair = when (category) {
"doujinshi" -> Pair("#fc4e4e", R.string.doujinshi)
"manga" -> Pair("#e78c1a", R.string.manga)
"artistcg" -> Pair("#dde500", R.string.artist_cg)
"gamecg" -> Pair("#05bf0b", R.string.game_cg)
"western" -> Pair("#14e723", R.string.western)
"non-h" -> Pair("#08d7e2", R.string.non_h)
"imageset" -> Pair("#5f5fff", R.string.image_set)
"cosplay" -> Pair("#9755f5", R.string.cosplay)
"asianporn" -> Pair("#fe93ff", R.string.asian_porn)
"misc" -> Pair("#9e9e9e", R.string.misc)
"doujinshi" -> Pair(SourceTagsUtil.DOUJINSHI_COLOR, R.string.doujinshi)
"manga" -> Pair(SourceTagsUtil.MANGA_COLOR, R.string.manga)
"artistcg" -> Pair(SourceTagsUtil.ARTIST_CG_COLOR, R.string.artist_cg)
"gamecg" -> Pair(SourceTagsUtil.GAME_CG_COLOR, R.string.game_cg)
"western" -> Pair(SourceTagsUtil.WESTERN_COLOR, R.string.western)
"non-h" -> Pair(SourceTagsUtil.NON_H_COLOR, R.string.non_h)
"imageset" -> Pair(SourceTagsUtil.IMAGE_SET_COLOR, R.string.image_set)
"cosplay" -> Pair(SourceTagsUtil.COSPLAY_COLOR, R.string.cosplay)
"asianporn" -> Pair(SourceTagsUtil.ASIAN_PORN_COLOR, R.string.asian_porn)
"misc" -> Pair(SourceTagsUtil.MISC_COLOR, R.string.misc)
else -> Pair("", 0)
}
@@ -85,7 +86,7 @@ class NHentaiDescriptionAdapter(
binding.whenPosted.text = EX_DATE_FORMAT.format(Date((meta.uploadDate ?: 0) * 1000))
binding.pages.text = itemView.context.getString(R.string.num_pages, meta.pageImageTypes.size)
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.pageImageTypes.size, meta.pageImageTypes.size)
@SuppressLint("SetTextI18n")
binding.id.text = "#" + (meta.nhId ?: 0)
@@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.manga.MangaController
import exh.metadata.metadata.PervEdenSearchMetadata
import exh.ui.metadata.MetadataViewController
import exh.util.SourceTagsUtil
import java.util.Locale
import kotlin.math.roundToInt
import kotlinx.coroutines.CoroutineScope
@@ -47,11 +48,11 @@ class PervEdenDescriptionAdapter(
val genre = meta.type
if (genre != null) {
val pair = when (genre) {
"Doujinshi" -> Pair("#fc4e4e", R.string.doujinshi)
"Japanese Manga" -> Pair("#e78c1a", R.string.manga)
"Korean Manhwa" -> Pair("#dde500", R.string.manhwa)
"Chinese Manhua" -> Pair("#05bf0b", R.string.manhua)
"Comic" -> Pair("#14e723", R.string.comic)
"Doujinshi" -> Pair(SourceTagsUtil.DOUJINSHI_COLOR, R.string.doujinshi)
"Japanese Manga" -> Pair(SourceTagsUtil.MANGA_COLOR, R.string.manga)
"Korean Manhwa" -> Pair(SourceTagsUtil.ARTIST_CG_COLOR, R.string.manhwa)
"Chinese Manhua" -> Pair(SourceTagsUtil.GAME_CG_COLOR, R.string.manhua)
"Comic" -> Pair(SourceTagsUtil.WESTERN_COLOR, R.string.comic)
else -> Pair("", 0)
}
@@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
import exh.metadata.metadata.PururinSearchMetadata
import exh.metadata.metadata.PururinSearchMetadata.Companion.TAG_NAMESPACE_CATEGORY
import exh.ui.metadata.MetadataViewController
import exh.util.SourceTagsUtil
import kotlin.math.roundToInt
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -47,12 +48,12 @@ class PururinDescriptionAdapter(
val genre = meta.tags.find { it.namespace == TAG_NAMESPACE_CATEGORY }
if (genre != null) {
val pair = when (genre.name) {
"doujinshi" -> Pair("#fc4e4e", R.string.doujinshi)
"manga" -> Pair("#e78c1a", R.string.manga)
"artist-cg" -> Pair("#dde500", R.string.artist_cg)
"game-cg" -> Pair("#05bf0b", R.string.game_cg)
"artbook" -> Pair("#5f5fff", R.string.artbook)
"webtoon" -> Pair("#5f5fff", R.string.webtoon)
"doujinshi" -> Pair(SourceTagsUtil.DOUJINSHI_COLOR, R.string.doujinshi)
"manga" -> Pair(SourceTagsUtil.MANGA_COLOR, R.string.manga)
"artist-cg" -> Pair(SourceTagsUtil.ARTIST_CG_COLOR, R.string.artist_cg)
"game-cg" -> Pair(SourceTagsUtil.GAME_CG_COLOR, R.string.game_cg)
"artbook" -> Pair(SourceTagsUtil.IMAGE_SET_COLOR, R.string.artbook)
"webtoon" -> Pair(SourceTagsUtil.NON_H_COLOR, R.string.webtoon)
else -> Pair("", 0)
}
@@ -64,7 +65,7 @@ class PururinDescriptionAdapter(
binding.uploader.text = meta.uploaderDisp ?: meta.uploader ?: ""
binding.size.text = meta.fileSize ?: itemView.context.getString(R.string.unknown)
binding.pages.text = itemView.context.getString(R.string.num_pages, meta.pages ?: 0)
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.pages ?: 0, meta.pages ?: 0)
val ratingFloat = meta.averageRating?.toFloat()
val name = when (((ratingFloat ?: 100F) * 2).roundToInt()) {
@@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.util.system.getResourceColor
import exh.metadata.metadata.TsuminoSearchMetadata
import exh.ui.metadata.MetadataViewController
import exh.util.SourceTagsUtil
import java.util.Date
import kotlin.math.roundToInt
import kotlinx.coroutines.CoroutineScope
@@ -48,11 +49,11 @@ class TsuminoDescriptionAdapter(
val genre = meta.category
if (genre != null) {
val pair = when (genre) {
"Doujinshi" -> Pair("#fc4e4e", R.string.doujinshi)
"Manga" -> Pair("#e78c1a", R.string.manga)
"Artist CG" -> Pair("#dde500", R.string.artist_cg)
"Game CG" -> Pair("#05bf0b", R.string.game_cg)
"Video" -> Pair("#14e723", R.string.video)
"Doujinshi" -> Pair(SourceTagsUtil.DOUJINSHI_COLOR, R.string.doujinshi)
"Manga" -> Pair(SourceTagsUtil.MANGA_COLOR, R.string.manga)
"Artist CG" -> Pair(SourceTagsUtil.ARTIST_CG_COLOR, R.string.artist_cg)
"Game CG" -> Pair(SourceTagsUtil.GAME_CG_COLOR, R.string.game_cg)
"Video" -> Pair(SourceTagsUtil.WESTERN_COLOR, R.string.video)
else -> Pair("", 0)
}
@@ -70,7 +71,7 @@ class TsuminoDescriptionAdapter(
binding.whenPosted.text = TsuminoSearchMetadata.TSUMINO_DATE_FORMAT.format(Date(meta.uploadDate ?: 0))
binding.uploader.text = meta.uploader ?: itemView.context.getString(R.string.unknown)
binding.pages.text = itemView.context.getString(R.string.num_pages, meta.length ?: 0)
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.length ?: 0, meta.length ?: 0)
val name = when (((meta.averageRating ?: 100F) * 2).roundToInt()) {
0 -> R.string.rating0