mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Combine chapter date/scanlator lines
This commit is contained in:
		| @@ -6,12 +6,9 @@ import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| import eu.kanade.tachiyomi.data.download.model.Download | ||||
| import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder | ||||
| import eu.kanade.tachiyomi.util.view.gone | ||||
| import java.util.Date | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_date | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_description | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_menu | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_pages | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_scanlator | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_title | ||||
| import kotlinx.android.synthetic.main.chapters_item.download_text | ||||
|  | ||||
| @@ -39,30 +36,29 @@ class ChapterHolder( | ||||
|         } | ||||
|  | ||||
|         // Set correct text color | ||||
|         chapter_title.setTextColor(if (chapter.read) adapter.readColor else adapter.unreadColor) | ||||
|         if (chapter.bookmark) chapter_title.setTextColor(adapter.bookmarkedColor) | ||||
|         val chapterColor = if (chapter.read) adapter.readColor else adapter.unreadColor | ||||
|         chapter_title.setTextColor(chapterColor) | ||||
|         chapter_description.setTextColor(chapterColor) | ||||
|         if (chapter.bookmark) { | ||||
|             chapter_title.setTextColor(adapter.bookmarkedColor) | ||||
|         } | ||||
|  | ||||
|         val descriptions = mutableListOf<String>() | ||||
|  | ||||
|         if (chapter.date_upload > 0) { | ||||
|             chapter_date.text = adapter.dateFormat.format(Date(chapter.date_upload)) | ||||
|             chapter_date.setTextColor(if (chapter.read) adapter.readColor else adapter.unreadColor) | ||||
|         } else { | ||||
|             chapter_date.text = "" | ||||
|             descriptions.add(adapter.dateFormat.format(Date(chapter.date_upload))) | ||||
|         } | ||||
|         if (!chapter.scanlator.isNullOrBlank()) { | ||||
|             descriptions.add(chapter.scanlator!!) | ||||
|         } | ||||
|         if (!chapter.read && chapter.last_page_read > 0) { | ||||
|             descriptions.add(itemView.context.getString(R.string.chapter_progress, chapter.last_page_read + 1)) | ||||
|         } | ||||
|  | ||||
|         // add scanlator if exists | ||||
|         chapter_scanlator.text = chapter.scanlator | ||||
|         // allow longer titles if there is no scanlator (most sources) | ||||
|         if (chapter_scanlator.text.isNullOrBlank()) { | ||||
|             chapter_title.maxLines = 2 | ||||
|             chapter_scanlator.gone() | ||||
|         if (descriptions.isNotEmpty()) { | ||||
|             chapter_description.text = descriptions.joinToString(" • ") | ||||
|         } else { | ||||
|             chapter_title.maxLines = 1 | ||||
|         } | ||||
|  | ||||
|         chapter_pages.text = if (!chapter.read && chapter.last_page_read > 0) { | ||||
|             itemView.context.getString(R.string.chapter_progress, chapter.last_page_read + 1) | ||||
|         } else { | ||||
|             "" | ||||
|             chapter_description.text = "" | ||||
|         } | ||||
|  | ||||
|         notifyStatus(item.status) | ||||
|   | ||||
| @@ -21,41 +21,17 @@ | ||||
|         tools:text="Title" /> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/chapter_scanlator" | ||||
|         style="@style/TextAppearance.Regular.Caption.Hint" | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginStart="16dp" | ||||
|         android:maxLines="1" | ||||
|         app:layout_constraintBottom_toTopOf="@+id/chapter_date" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/chapter_menu" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/chapter_title" | ||||
|         tools:text="Scanlator" /> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/chapter_date" | ||||
|         android:id="@+id/chapter_description" | ||||
|         style="@style/TextAppearance.Regular.Caption" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginBottom="8dp" | ||||
|         android:layout_marginStart="16dp" | ||||
|         android:ellipsize="marquee" | ||||
|         android:singleLine="true" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         tools:text="22/02/2016" /> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/chapter_pages" | ||||
|         style="@style/TextAppearance.Regular.Caption.Hint" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:ellipsize="marquee" | ||||
|         android:singleLine="true" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         tools:text="Pages: 45" /> | ||||
|         tools:text="22/02/2016 • Scanlator • Page: 45" /> | ||||
|  | ||||
|     <ImageButton | ||||
|         android:id="@+id/chapter_menu" | ||||
| @@ -76,6 +52,7 @@ | ||||
|         style="@style/TextAppearance.Regular.Caption.Hint" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginBottom="8dp" | ||||
|         android:layout_marginEnd="16dp" | ||||
|         android:textAllCaps="true" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user