Add Batoto Scanlator to Chapter view (#789)
* Added scanlator for Batoto on chapter list * adjusted item_chapter layout for scanlator adjusted so db chapters get updated if scanlator does not match source scanlator * adjusted item_chapter layout for scanlator adjusted chapter holder to dynamically set title max lines depending on if scanlator exists * fixed excess blank line * changed scanlator to be instantiated instead lateint to prevent toast message erro when viewing chapters by catalog * changed item_chapter.xml to constraint layout * removed accidental changes to catalog * cleaned up code. * fixed issue where long title was running into 3 dot menu fixed issue where no scanlator for manga was causing date to not be bottom lined fixed general chapter layout to be more similar to existing * allow scanlator to be null * fixed merge issue * fixed merge issue * attempt to fix whitespace carriage return issue * attempt to fix whitespace carriage return issue * attempt to fix whitespace carriage return issue
Cette révision appartient à :
Parent
b79855c01d
révision
a12a34e3bb
9 fichiers modifiés avec 124 ajouts et 92 suppressions
|
@ -17,7 +17,7 @@ class DbOpenHelper(context: Context)
|
|||
/**
|
||||
* Version of the database.
|
||||
*/
|
||||
const val DATABASE_VERSION = 4
|
||||
const val DATABASE_VERSION = 5
|
||||
}
|
||||
|
||||
override fun onCreate(db: SQLiteDatabase) = with(db) {
|
||||
|
@ -51,6 +51,9 @@ class DbOpenHelper(context: Context)
|
|||
if (oldVersion < 4) {
|
||||
db.execSQL(ChapterTable.bookmarkUpdateQuery)
|
||||
}
|
||||
if (oldVersion < 5){
|
||||
db.execSQL(ChapterTable.addScanlator)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onConfigure(db: SQLiteDatabase) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_LAST_PAGE_READ
|
|||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_MANGA_ID
|
||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_NAME
|
||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_READ
|
||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_SCANLATOR
|
||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_SOURCE_ORDER
|
||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_URL
|
||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.TABLE
|
||||
|
@ -48,6 +49,7 @@ class ChapterPutResolver : DefaultPutResolver<Chapter>() {
|
|||
put(COL_URL, obj.url)
|
||||
put(COL_NAME, obj.name)
|
||||
put(COL_READ, obj.read)
|
||||
put(COL_SCANLATOR, obj.scanlator)
|
||||
put(COL_BOOKMARK, obj.bookmark)
|
||||
put(COL_DATE_FETCH, obj.date_fetch)
|
||||
put(COL_DATE_UPLOAD, obj.date_upload)
|
||||
|
@ -64,6 +66,7 @@ class ChapterGetResolver : DefaultGetResolver<Chapter>() {
|
|||
manga_id = cursor.getLong(cursor.getColumnIndex(COL_MANGA_ID))
|
||||
url = cursor.getString(cursor.getColumnIndex(COL_URL))
|
||||
name = cursor.getString(cursor.getColumnIndex(COL_NAME))
|
||||
scanlator = cursor.getString(cursor.getColumnIndex(COL_SCANLATOR))
|
||||
read = cursor.getInt(cursor.getColumnIndex(COL_READ)) == 1
|
||||
bookmark = cursor.getInt(cursor.getColumnIndex(COL_BOOKMARK)) == 1
|
||||
date_fetch = cursor.getLong(cursor.getColumnIndex(COL_DATE_FETCH))
|
||||
|
|
|
@ -10,6 +10,8 @@ class ChapterImpl : Chapter {
|
|||
|
||||
override lateinit var name: String
|
||||
|
||||
override var scanlator: String? = null
|
||||
|
||||
override var read: Boolean = false
|
||||
|
||||
override var bookmark: Boolean = false
|
||||
|
@ -29,8 +31,8 @@ class ChapterImpl : Chapter {
|
|||
if (other == null || javaClass != other.javaClass) return false
|
||||
|
||||
val chapter = other as Chapter
|
||||
|
||||
return url == chapter.url
|
||||
//forces updates on manga if scanlator changes. This will allow existing manga in library with scanlator to update
|
||||
return url == chapter.url && scanlator == chapter.scanlator
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ object ChapterTable {
|
|||
|
||||
const val COL_READ = "read"
|
||||
|
||||
const val COL_SCANLATOR ="scanlator"
|
||||
|
||||
const val COL_BOOKMARK = "bookmark"
|
||||
|
||||
const val COL_DATE_FETCH = "date_fetch"
|
||||
|
@ -32,6 +34,7 @@ object ChapterTable {
|
|||
$COL_MANGA_ID INTEGER NOT NULL,
|
||||
$COL_URL TEXT NOT NULL,
|
||||
$COL_NAME TEXT NOT NULL,
|
||||
$COL_SCANLATOR TEXT,
|
||||
$COL_READ BOOLEAN NOT NULL,
|
||||
$COL_BOOKMARK BOOLEAN NOT NULL,
|
||||
$COL_LAST_PAGE_READ INT NOT NULL,
|
||||
|
@ -52,4 +55,7 @@ object ChapterTable {
|
|||
val bookmarkUpdateQuery: String
|
||||
get() = "ALTER TABLE $TABLE ADD COLUMN $COL_BOOKMARK BOOLEAN DEFAULT FALSE"
|
||||
|
||||
val addScanlator:String
|
||||
get ()= "ALTER TABLE $TABLE ADD COLUMN $COL_SCANLATOR TEXT DEFAULT"
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,14 @@ interface SChapter : Serializable {
|
|||
|
||||
var chapter_number: Float
|
||||
|
||||
var scanlator: String?
|
||||
|
||||
fun copyFrom(other: SChapter) {
|
||||
name = other.name
|
||||
url = other.url
|
||||
date_upload = other.date_upload
|
||||
chapter_number = other.chapter_number
|
||||
scanlator = other.scanlator
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -10,4 +10,6 @@ class SChapterImpl : SChapter {
|
|||
|
||||
override var chapter_number: Float = -1f
|
||||
|
||||
override var scanlator: String? = null
|
||||
|
||||
}
|
|
@ -197,6 +197,7 @@ class Batoto : ParsedHttpSource(), LoginSource {
|
|||
chapter.date_upload = element.select("td").getOrNull(4)?.let {
|
||||
parseDateFromElement(it)
|
||||
} ?: 0
|
||||
chapter.scanlator = element.select("td").getOrNull(2)?.text()
|
||||
return chapter
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.davidea.viewholders.FlexibleViewHolder
|
|||
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.util.gone
|
||||
import kotlinx.android.synthetic.main.chapters_item.view.*
|
||||
import java.util.*
|
||||
|
||||
|
@ -43,6 +44,16 @@ class ChapterHolder(
|
|||
chapter_date.text = ""
|
||||
}
|
||||
|
||||
//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.setMaxLines(2)
|
||||
chapter_scanlator.gone()
|
||||
} else {
|
||||
chapter_title.setMaxLines(1)
|
||||
}
|
||||
|
||||
chapter_pages.text = if (!chapter.read && chapter.last_page_read > 0) {
|
||||
context.getString(R.string.chapter_progress, chapter.last_page_read + 1)
|
||||
} else {
|
||||
|
|
|
@ -1,100 +1,101 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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="fill_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:background="?attr/selectable_list_drawable">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
|
||||
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart">
|
||||
<android.support.constraint.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="fill_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:background="?attr/selectable_list_drawable">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="18dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true">
|
||||
<TextView
|
||||
android:id="@+id/chapter_title"
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
tools:text="Title"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="12dp"
|
||||
app:layout_constraintRight_toLeftOf="@+id/chapter_menu"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chapter_pages"
|
||||
style="@style/TextAppearance.Regular.Caption.Hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
tools:text="Pages: 45"/>
|
||||
<TextView
|
||||
android:id="@+id/chapter_scanlator"
|
||||
style="@style/TextAppearance.Regular.Caption.Hint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Scanlator"
|
||||
android:maxLines="1"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chapter_title"
|
||||
app:layout_constraintBottom_toTopOf="@+id/chapter_date"
|
||||
app:layout_constraintRight_toLeftOf="@+id/chapter_menu"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chapter_date"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
tools:text="22/02/2016"/>
|
||||
<TextView
|
||||
android:id="@+id/chapter_date"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="22/02/2016"
|
||||
android:ellipsize="marquee"
|
||||
android:maxLines="1"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/guideline3"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textAllCaps="true"/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/chapter_pages"
|
||||
style="@style/TextAppearance.Regular.Caption.Hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Pages: 45"
|
||||
android:ellipsize="marquee"
|
||||
android:maxLines="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chapter_title"
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/relativeLayout"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_marginRight="30dp"
|
||||
android:ellipsize="middle"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="2"
|
||||
tools:text="Title"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
<ImageView
|
||||
android:id="@+id/chapter_menu"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center|end"
|
||||
android:paddingBottom="18dp"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingRight="?android:attr/listPreferredItemPaddingRight">
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/ic_more_horiz_black_24dp"
|
||||
app:layout_constraintRight_toLeftOf="@+id/guideline4"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingTop="12dp"
|
||||
android:contentDescription="@string/description_cover"
|
||||
/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
app:srcCompat="@drawable/ic_more_horiz_black_24dp"/>
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="DOWNLOADED"
|
||||
android:textAllCaps="true"
|
||||
app:layout_constraintRight_toLeftOf="@+id/guideline4"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
<android.support.constraint.Guideline
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/guideline3"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="16dp"
|
||||
/>
|
||||
|
||||
<android.support.constraint.Guideline
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/guideline4"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_end="16dp"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
Référencer dans un nouveau ticket