diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
index d05e0189a..f780fd542 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
@@ -197,6 +197,8 @@ object PreferenceKeys {
const val unreadBadge = "display_unread_badge"
+ const val languageBadge = "display_language_badge"
+
const val localBadge = "display_local_badge"
const val categoryTabs = "display_category_tabs"
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
index 40d3b6a31..48b145d01 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
@@ -253,6 +253,8 @@ class PreferencesHelper(val context: Context) {
fun unreadBadge() = flowPrefs.getBoolean(Keys.unreadBadge, true)
+ fun languageBadge() = flowPrefs.getBoolean(Keys.languageBadge, false)
+
fun categoryTabs() = flowPrefs.getBoolean(Keys.categoryTabs, true)
fun categoryNumberOfItems() = flowPrefs.getBoolean(Keys.categoryNumberOfItems, false)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceComfortableGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceComfortableGridHolder.kt
index 6bbe76b8c..b3dd99071 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceComfortableGridHolder.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceComfortableGridHolder.kt
@@ -39,7 +39,8 @@ class SourceComfortableGridHolder(private val view: View, private val adapter: F
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
// For rounded corners
- binding.badges.clipToOutline = true
+ binding.leftBadges.clipToOutline = true
+ binding.rightBadges.clipToOutline = true
// Set favorite badge
binding.favoriteText.isVisible = manga.favorite
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceGridHolder.kt
index 38b536371..f0cc03385 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceGridHolder.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceGridHolder.kt
@@ -39,7 +39,8 @@ open class SourceGridHolder(private val view: View, private val adapter: Flexibl
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
// For rounded corners
- binding.badges.clipToOutline = true
+ binding.leftBadges.clipToOutline = true
+ binding.rightBadges.clipToOutline = true
// Set favorite badge
binding.favoriteText.isVisible = manga.favorite
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryComfortableGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryComfortableGridHolder.kt
index 41095d928..518e2ae29 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryComfortableGridHolder.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryComfortableGridHolder.kt
@@ -36,7 +36,8 @@ class LibraryComfortableGridHolder(
binding.title.text = item.manga.title
// For rounded corners
- binding.badges.clipToOutline = true
+ binding.leftBadges.clipToOutline = true
+ binding.rightBadges.clipToOutline = true
// Update the unread count and its visibility.
with(binding.unreadText) {
@@ -48,6 +49,11 @@ class LibraryComfortableGridHolder(
isVisible = item.downloadCount > 0
text = item.downloadCount.toString()
}
+ // Update the source language and its visibility
+ with(binding.languageText) {
+ isVisible = item.sourceLanguage.isNotEmpty()
+ text = item.sourceLanguage
+ }
// set local visibility if its local manga
binding.localText.isVisible = item.isLocal
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCompactGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCompactGridHolder.kt
index 71b0bd186..45c8349f8 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCompactGridHolder.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCompactGridHolder.kt
@@ -34,7 +34,8 @@ open class LibraryCompactGridHolder(
binding.title.text = item.manga.title
// For rounded corners
- binding.badges.clipToOutline = true
+ binding.leftBadges.clipToOutline = true
+ binding.rightBadges.clipToOutline = true
// Update the unread count and its visibility.
with(binding.unreadText) {
@@ -46,6 +47,11 @@ open class LibraryCompactGridHolder(
isVisible = item.downloadCount > 0
text = item.downloadCount.toString()
}
+ // Update the source language and its visibility
+ with(binding.languageText) {
+ isVisible = item.sourceLanguage.isNotEmpty()
+ text = item.sourceLanguage
+ }
// set local visibility if its local manga
binding.localText.isVisible = item.isLocal
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt
index 8d9c669bd..e90a49999 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt
@@ -34,6 +34,7 @@ class LibraryItem(
var downloadCount = -1
var unreadCount = -1
var isLocal = false
+ var sourceLanguage = ""
private fun getDisplayMode(): DisplayModeSetting {
return if (shouldSetFromCategory.get() && manga.category != 0) {
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt
index 9de429c25..c6500ef6a 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt
@@ -46,6 +46,11 @@ class LibraryListHolder(
isVisible = item.downloadCount > 0
text = "${item.downloadCount}"
}
+ // Update the source language and its visibility
+ with(binding.languageText) {
+ isVisible = item.sourceLanguage.isNotEmpty()
+ text = item.sourceLanguage
+ }
// show local text badge if local manga
binding.localText.isVisible = item.isLocal
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt
index 65c0ff660..b2409562b 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt
@@ -200,6 +200,7 @@ class LibraryPresenter(
val showDownloadBadges = preferences.downloadBadge().get()
val showUnreadBadges = preferences.unreadBadge().get()
val showLocalBadges = preferences.localBadge().get()
+ val showLanguageBadges = preferences.languageBadge().get()
for ((_, itemList) in map) {
for (item in itemList) {
@@ -223,6 +224,13 @@ class LibraryPresenter(
// Hide / Unset local badge if not enabled
false
}
+
+ item.sourceLanguage = if (showLanguageBadges) {
+ sourceManager.getOrStub(item.manga.source).lang.uppercase()
+ } else {
+ // Unset source language if not enabled
+ ""
+ }
}
}
}
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsSheet.kt
index 267701af4..e3ff3b741 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsSheet.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsSheet.kt
@@ -367,15 +367,17 @@ class LibrarySettingsSheet(
private val downloadBadge = Item.CheckboxGroup(R.string.action_display_download_badge, this)
private val unreadBadge = Item.CheckboxGroup(R.string.action_display_unread_badge, this)
private val localBadge = Item.CheckboxGroup(R.string.action_display_local_badge, this)
+ private val languageBadge = Item.CheckboxGroup(R.string.action_display_language_badge, this)
override val header = Item.Header(R.string.badges_header)
- override val items = listOf(downloadBadge, unreadBadge, localBadge)
+ override val items = listOf(downloadBadge, unreadBadge, localBadge, languageBadge)
override val footer = null
override fun initModels() {
downloadBadge.checked = preferences.downloadBadge().get()
unreadBadge.checked = preferences.unreadBadge().get()
localBadge.checked = preferences.localBadge().get()
+ languageBadge.checked = preferences.languageBadge().get()
}
override fun onItemClicked(item: Item) {
@@ -385,6 +387,7 @@ class LibrarySettingsSheet(
downloadBadge -> preferences.downloadBadge().set((item.checked))
unreadBadge -> preferences.unreadBadge().set((item.checked))
localBadge -> preferences.localBadge().set((item.checked))
+ languageBadge -> preferences.languageBadge().set((item.checked))
}
adapter.notifyItemChanged(item)
}
diff --git a/app/src/main/res/layout/source_comfortable_grid_item.xml b/app/src/main/res/layout/source_comfortable_grid_item.xml
index 6178796d2..91f570f5b 100644
--- a/app/src/main/res/layout/source_comfortable_grid_item.xml
+++ b/app/src/main/res/layout/source_comfortable_grid_item.xml
@@ -37,74 +37,109 @@
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp"
- android:background="@drawable/rounded_rectangle">
+ android:layout_marginEnd="4dp">
-
+ android:background="@drawable/rounded_rectangle">
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+ android:background="@drawable/rounded_rectangle">
+
+
+
+ android:layout_marginEnd="4dp">
-
+ android:background="@drawable/rounded_rectangle">
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+ android:background="@drawable/rounded_rectangle">
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index bfd1b67c3..f7a8ba2f9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -93,6 +93,7 @@
Download badges
Unread badges
Local badges
+ Language badges
Show category tabs
Show number of items
Disable