mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 02:39:16 +01:00
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
This commit is contained in:
parent
b79855c01d
commit
a12a34e3bb
@ -17,7 +17,7 @@ class DbOpenHelper(context: Context)
|
|||||||
/**
|
/**
|
||||||
* Version of the database.
|
* Version of the database.
|
||||||
*/
|
*/
|
||||||
const val DATABASE_VERSION = 4
|
const val DATABASE_VERSION = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(db: SQLiteDatabase) = with(db) {
|
override fun onCreate(db: SQLiteDatabase) = with(db) {
|
||||||
@ -51,6 +51,9 @@ class DbOpenHelper(context: Context)
|
|||||||
if (oldVersion < 4) {
|
if (oldVersion < 4) {
|
||||||
db.execSQL(ChapterTable.bookmarkUpdateQuery)
|
db.execSQL(ChapterTable.bookmarkUpdateQuery)
|
||||||
}
|
}
|
||||||
|
if (oldVersion < 5){
|
||||||
|
db.execSQL(ChapterTable.addScanlator)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigure(db: SQLiteDatabase) {
|
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_MANGA_ID
|
||||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_NAME
|
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_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_SOURCE_ORDER
|
||||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_URL
|
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.COL_URL
|
||||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.TABLE
|
import eu.kanade.tachiyomi.data.database.tables.ChapterTable.TABLE
|
||||||
@ -48,6 +49,7 @@ class ChapterPutResolver : DefaultPutResolver<Chapter>() {
|
|||||||
put(COL_URL, obj.url)
|
put(COL_URL, obj.url)
|
||||||
put(COL_NAME, obj.name)
|
put(COL_NAME, obj.name)
|
||||||
put(COL_READ, obj.read)
|
put(COL_READ, obj.read)
|
||||||
|
put(COL_SCANLATOR, obj.scanlator)
|
||||||
put(COL_BOOKMARK, obj.bookmark)
|
put(COL_BOOKMARK, obj.bookmark)
|
||||||
put(COL_DATE_FETCH, obj.date_fetch)
|
put(COL_DATE_FETCH, obj.date_fetch)
|
||||||
put(COL_DATE_UPLOAD, obj.date_upload)
|
put(COL_DATE_UPLOAD, obj.date_upload)
|
||||||
@ -64,6 +66,7 @@ class ChapterGetResolver : DefaultGetResolver<Chapter>() {
|
|||||||
manga_id = cursor.getLong(cursor.getColumnIndex(COL_MANGA_ID))
|
manga_id = cursor.getLong(cursor.getColumnIndex(COL_MANGA_ID))
|
||||||
url = cursor.getString(cursor.getColumnIndex(COL_URL))
|
url = cursor.getString(cursor.getColumnIndex(COL_URL))
|
||||||
name = cursor.getString(cursor.getColumnIndex(COL_NAME))
|
name = cursor.getString(cursor.getColumnIndex(COL_NAME))
|
||||||
|
scanlator = cursor.getString(cursor.getColumnIndex(COL_SCANLATOR))
|
||||||
read = cursor.getInt(cursor.getColumnIndex(COL_READ)) == 1
|
read = cursor.getInt(cursor.getColumnIndex(COL_READ)) == 1
|
||||||
bookmark = cursor.getInt(cursor.getColumnIndex(COL_BOOKMARK)) == 1
|
bookmark = cursor.getInt(cursor.getColumnIndex(COL_BOOKMARK)) == 1
|
||||||
date_fetch = cursor.getLong(cursor.getColumnIndex(COL_DATE_FETCH))
|
date_fetch = cursor.getLong(cursor.getColumnIndex(COL_DATE_FETCH))
|
||||||
|
@ -10,6 +10,8 @@ class ChapterImpl : Chapter {
|
|||||||
|
|
||||||
override lateinit var name: String
|
override lateinit var name: String
|
||||||
|
|
||||||
|
override var scanlator: String? = null
|
||||||
|
|
||||||
override var read: Boolean = false
|
override var read: Boolean = false
|
||||||
|
|
||||||
override var bookmark: Boolean = false
|
override var bookmark: Boolean = false
|
||||||
@ -29,8 +31,8 @@ class ChapterImpl : Chapter {
|
|||||||
if (other == null || javaClass != other.javaClass) return false
|
if (other == null || javaClass != other.javaClass) return false
|
||||||
|
|
||||||
val chapter = other as Chapter
|
val chapter = other as Chapter
|
||||||
|
//forces updates on manga if scanlator changes. This will allow existing manga in library with scanlator to update
|
||||||
return url == chapter.url
|
return url == chapter.url && scanlator == chapter.scanlator
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ object ChapterTable {
|
|||||||
|
|
||||||
const val COL_READ = "read"
|
const val COL_READ = "read"
|
||||||
|
|
||||||
|
const val COL_SCANLATOR ="scanlator"
|
||||||
|
|
||||||
const val COL_BOOKMARK = "bookmark"
|
const val COL_BOOKMARK = "bookmark"
|
||||||
|
|
||||||
const val COL_DATE_FETCH = "date_fetch"
|
const val COL_DATE_FETCH = "date_fetch"
|
||||||
@ -32,6 +34,7 @@ object ChapterTable {
|
|||||||
$COL_MANGA_ID INTEGER NOT NULL,
|
$COL_MANGA_ID INTEGER NOT NULL,
|
||||||
$COL_URL TEXT NOT NULL,
|
$COL_URL TEXT NOT NULL,
|
||||||
$COL_NAME TEXT NOT NULL,
|
$COL_NAME TEXT NOT NULL,
|
||||||
|
$COL_SCANLATOR TEXT,
|
||||||
$COL_READ BOOLEAN NOT NULL,
|
$COL_READ BOOLEAN NOT NULL,
|
||||||
$COL_BOOKMARK BOOLEAN NOT NULL,
|
$COL_BOOKMARK BOOLEAN NOT NULL,
|
||||||
$COL_LAST_PAGE_READ INT NOT NULL,
|
$COL_LAST_PAGE_READ INT NOT NULL,
|
||||||
@ -52,4 +55,7 @@ object ChapterTable {
|
|||||||
val bookmarkUpdateQuery: String
|
val bookmarkUpdateQuery: String
|
||||||
get() = "ALTER TABLE $TABLE ADD COLUMN $COL_BOOKMARK BOOLEAN DEFAULT FALSE"
|
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 chapter_number: Float
|
||||||
|
|
||||||
|
var scanlator: String?
|
||||||
|
|
||||||
fun copyFrom(other: SChapter) {
|
fun copyFrom(other: SChapter) {
|
||||||
name = other.name
|
name = other.name
|
||||||
url = other.url
|
url = other.url
|
||||||
date_upload = other.date_upload
|
date_upload = other.date_upload
|
||||||
chapter_number = other.chapter_number
|
chapter_number = other.chapter_number
|
||||||
|
scanlator = other.scanlator
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -10,4 +10,6 @@ class SChapterImpl : SChapter {
|
|||||||
|
|
||||||
override var chapter_number: Float = -1f
|
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 {
|
chapter.date_upload = element.select("td").getOrNull(4)?.let {
|
||||||
parseDateFromElement(it)
|
parseDateFromElement(it)
|
||||||
} ?: 0
|
} ?: 0
|
||||||
|
chapter.scanlator = element.select("td").getOrNull(2)?.text()
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import eu.davidea.viewholders.FlexibleViewHolder
|
|||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.download.model.Download
|
import eu.kanade.tachiyomi.data.download.model.Download
|
||||||
|
import eu.kanade.tachiyomi.util.gone
|
||||||
import kotlinx.android.synthetic.main.chapters_item.view.*
|
import kotlinx.android.synthetic.main.chapters_item.view.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@ -43,6 +44,16 @@ class ChapterHolder(
|
|||||||
chapter_date.text = ""
|
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) {
|
chapter_pages.text = if (!chapter.read && chapter.last_page_read > 0) {
|
||||||
context.getString(R.string.chapter_progress, chapter.last_page_read + 1)
|
context.getString(R.string.chapter_progress, chapter.last_page_read + 1)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,100 +1,101 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||||
android:background="?attr/selectable_list_drawable">
|
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">
|
|
||||||
|
|
||||||
<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
|
<TextView
|
||||||
android:id="@+id/chapter_pages"
|
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_scanlator"
|
||||||
style="@style/TextAppearance.Regular.Caption.Hint"
|
style="@style/TextAppearance.Regular.Caption.Hint"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
tools:text="Scanlator"
|
||||||
android:layout_centerHorizontal="true"
|
android:maxLines="1"
|
||||||
android:ellipsize="marquee"
|
app:layout_constraintLeft_toLeftOf="@+id/guideline3"
|
||||||
android:singleLine="true"
|
app:layout_constraintTop_toBottomOf="@+id/chapter_title"
|
||||||
tools:text="Pages: 45"/>
|
app:layout_constraintBottom_toTopOf="@+id/chapter_date"
|
||||||
|
app:layout_constraintRight_toLeftOf="@+id/chapter_menu"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/chapter_date"
|
android:id="@+id/chapter_date"
|
||||||
style="@style/TextAppearance.Regular.Caption"
|
style="@style/TextAppearance.Regular.Caption"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="22/02/2016"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:singleLine="true"
|
android:maxLines="1"
|
||||||
tools:text="22/02/2016"/>
|
app:layout_constraintLeft_toLeftOf="@+id/guideline3"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/chapter_menu"
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/download_text"
|
android:id="@+id/download_text"
|
||||||
style="@style/TextAppearance.Regular.Caption.Hint"
|
style="@style/TextAppearance.Regular.Caption.Hint"
|
||||||
android:layout_width="wrap_content"
|
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_title"
|
|
||||||
style="@style/TextAppearance.Regular.Body1"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@+id/relativeLayout"
|
tools:text="DOWNLOADED"
|
||||||
android:layout_alignParentEnd="true"
|
android:textAllCaps="true"
|
||||||
android:layout_alignParentLeft="true"
|
app:layout_constraintRight_toLeftOf="@+id/guideline4"
|
||||||
android:layout_alignParentRight="true"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
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"/>
|
|
||||||
|
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
<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>
|
||||||
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.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"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user