diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaChapter.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaChapter.kt index 6af71788ae5..d8944b66c08 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaChapter.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaChapter.kt @@ -13,6 +13,7 @@ data class MangaChapter( var description: String? = null, var sChapter: SChapter, val scanlator: String? = null, + val date: Long? = null, var progress: String? = "" ) : Serializable { constructor(chapter: MangaChapter) : this( @@ -21,7 +22,8 @@ data class MangaChapter( chapter.title, chapter.description, chapter.sChapter, - chapter.scanlator + chapter.scanlator, + chapter.date ) private val images = mutableListOf() diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt index 6cad3b9053d..1dff742fd06 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt @@ -1,5 +1,6 @@ package ani.dantotsu.media.manga +import android.annotation.SuppressLint import android.app.AlertDialog import android.util.TypedValue import android.view.LayoutInflater @@ -16,6 +17,9 @@ import ani.dantotsu.databinding.ItemChapterListBinding import ani.dantotsu.databinding.ItemEpisodeCompactBinding import ani.dantotsu.media.Media import ani.dantotsu.setAnimation +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -258,6 +262,7 @@ class MangaChapterAdapter( } } + @SuppressLint("SetTextI18n") override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { when (holder) { is ChapterCompactViewHolder -> { @@ -290,6 +295,23 @@ class MangaChapterAdapter( holder.bind(ep.number, ep.progress) setAnimation(fragment.requireContext(), holder.binding.root) binding.itemChapterNumber.text = ep.number + + if (ep.date != null) { + binding.itemChapterDateLayout.visibility = View.VISIBLE + val time = Date(ep.date) + val dateFormat = SimpleDateFormat("MMM/dd/yyyy", Locale.ENGLISH).format(time) + binding.itemChapterDate.text = + if (dateFormat != "Jan/01/1970") "$dateFormat • " else "" + } + if (ep.scanlator != null) { + binding.itemChapterDateLayout.visibility = View.VISIBLE + binding.itemChapterScan.text = ep.scanlator.replaceFirstChar { + if (it.isLowerCase()) it.titlecase( + Locale.ROOT + ) else it.toString() + } + } + if (ep.progress.isNullOrEmpty()) { binding.itemChapterTitle.visibility = View.GONE } else binding.itemChapterTitle.visibility = View.VISIBLE diff --git a/app/src/main/java/ani/dantotsu/parsers/AniyomiAdapter.kt b/app/src/main/java/ani/dantotsu/parsers/AniyomiAdapter.kt index 761bd949482..7ec22cdb5c3 100644 --- a/app/src/main/java/ani/dantotsu/parsers/AniyomiAdapter.kt +++ b/app/src/main/java/ani/dantotsu/parsers/AniyomiAdapter.kt @@ -633,7 +633,8 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() { sChapter.name, null, sChapter.scanlator, - sChapter + sChapter, + sChapter.date_upload ) } diff --git a/app/src/main/java/ani/dantotsu/parsers/MangaParser.kt b/app/src/main/java/ani/dantotsu/parsers/MangaParser.kt index 8948d4952b8..cd757307f91 100644 --- a/app/src/main/java/ani/dantotsu/parsers/MangaParser.kt +++ b/app/src/main/java/ani/dantotsu/parsers/MangaParser.kt @@ -81,6 +81,7 @@ data class MangaChapter( val description: String? = null, val scanlator: String? = null, val sChapter: SChapter, + val date: Long? = null, ) data class MangaImage( diff --git a/app/src/main/res/layout/item_chapter_list.xml b/app/src/main/res/layout/item_chapter_list.xml index fe263d018a9..f97656c8b03 100644 --- a/app/src/main/res/layout/item_chapter_list.xml +++ b/app/src/main/res/layout/item_chapter_list.xml @@ -32,7 +32,7 @@ android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" android:textColor="?attr/colorOnBackground" android:textSize="16sp" - tools:text="1" /> + tools:text="Chapter: 1" /> + + + + + +