From 5b2195ff64b08a573e401f0650cc93d984decc1f Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 14 Jul 2020 20:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/data/entities/rule/BookInfoRule.kt | 46 ++---------------- .../app/data/entities/rule/ContentRule.kt | 33 ++----------- .../app/data/entities/rule/ExploreRule.kt | 47 ++----------------- .../app/data/entities/rule/SearchRule.kt | 47 ++----------------- .../legado/app/data/entities/rule/TocRule.kt | 37 ++------------- 5 files changed, 15 insertions(+), 195 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt index 57fa3c495..882ffbad7 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt @@ -1,8 +1,9 @@ package io.legado.app.data.entities.rule -import android.os.Parcel import android.os.Parcelable +import kotlinx.android.parcel.Parcelize +@Parcelize data class BookInfoRule( var init: String? = null, var name: String? = null, @@ -14,45 +15,4 @@ data class BookInfoRule( var coverUrl: String? = null, var tocUrl: String? = null, var wordCount: String? = null -) : Parcelable { - - constructor(parcel: Parcel) : this( - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) { - dest.writeString(init) - dest.writeString(name) - dest.writeString(author) - dest.writeString(intro) - dest.writeString(kind) - dest.writeString(lastChapter) - dest.writeString(updateTime) - dest.writeString(coverUrl) - dest.writeString(tocUrl) - dest.writeString(wordCount) - } - - override fun describeContents(): Int { - return 0 - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): BookInfoRule { - return BookInfoRule(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} \ No newline at end of file +) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt index 306e7e659..84cc2db3f 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt @@ -1,39 +1,12 @@ package io.legado.app.data.entities.rule -import android.os.Parcel import android.os.Parcelable +import kotlinx.android.parcel.Parcelize +@Parcelize data class ContentRule( var content: String? = null, var nextContentUrl: String? = null, var webJs: String? = null, var sourceRegex: String? = null -) : Parcelable { - constructor(parcel: Parcel) : this( - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) { - dest.writeString(content) - dest.writeString(nextContentUrl) - dest.writeString(webJs) - dest.writeString(sourceRegex) - } - - override fun describeContents(): Int { - return 0 - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): ContentRule { - return ContentRule(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} \ No newline at end of file +) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt index 8ccbe8aba..41031e61e 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt @@ -1,8 +1,9 @@ package io.legado.app.data.entities.rule -import android.os.Parcel import android.os.Parcelable +import kotlinx.android.parcel.Parcelize +@Parcelize data class ExploreRule( override var bookList: String? = null, override var name: String? = null, @@ -14,46 +15,4 @@ data class ExploreRule( override var bookUrl: String? = null, override var coverUrl: String? = null, override var wordCount: String? = null -) : BookListRule, Parcelable { - - constructor(parcel: Parcel) : this( - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) { - dest.writeString(bookList) - dest.writeString(name) - dest.writeString(author) - dest.writeString(intro) - dest.writeString(kind) - dest.writeString(lastChapter) - dest.writeString(updateTime) - dest.writeString(bookUrl) - dest.writeString(coverUrl) - dest.writeString(wordCount) - } - - override fun describeContents(): Int { - return 0 - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): ExploreRule { - return ExploreRule(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} - +) : BookListRule, Parcelable \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt index 3968226e2..731d5f730 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt @@ -1,8 +1,9 @@ package io.legado.app.data.entities.rule -import android.os.Parcel import android.os.Parcelable +import kotlinx.android.parcel.Parcelize +@Parcelize data class SearchRule( override var bookList: String? = null, override var name: String? = null, @@ -14,46 +15,4 @@ data class SearchRule( override var bookUrl: String? = null, override var coverUrl: String? = null, override var wordCount: String? = null -) : BookListRule, Parcelable { - - constructor(parcel: Parcel) : this( - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) { - dest.writeString(bookList) - dest.writeString(name) - dest.writeString(author) - dest.writeString(intro) - dest.writeString(kind) - dest.writeString(lastChapter) - dest.writeString(updateTime) - dest.writeString(bookUrl) - dest.writeString(coverUrl) - dest.writeString(wordCount) - } - - override fun describeContents(): Int { - return 0 - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): SearchRule { - return SearchRule(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} - +) : BookListRule, Parcelable \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt index d49a08e33..d040f3905 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt @@ -1,8 +1,9 @@ package io.legado.app.data.entities.rule -import android.os.Parcel import android.os.Parcelable +import kotlinx.android.parcel.Parcelize +@Parcelize data class TocRule( var chapterList: String? = null, var chapterName: String? = null, @@ -10,36 +11,4 @@ data class TocRule( var isVip: String? = null, var updateTime: String? = null, var nextTocUrl: String? = null -) : Parcelable { - constructor(parcel: Parcel) : this( - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString(), - parcel.readString() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) { - dest.writeString(chapterList) - dest.writeString(chapterName) - dest.writeString(chapterUrl) - dest.writeString(isVip) - dest.writeString(updateTime) - dest.writeString(nextTocUrl) - } - - override fun describeContents(): Int { - return 0 - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): TocRule { - return TocRule(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} \ No newline at end of file +) : Parcelable \ No newline at end of file