-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] Support displaying media previews on the reading page; supp…
…ort partial media RSS fields (#49); support displaying category tags on the reading page
- Loading branch information
Showing
39 changed files
with
523 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
app/src/main/java/com/skyd/anivu/model/bean/LinkEnclosureBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package com.skyd.anivu.model.bean | ||
|
||
import com.skyd.anivu.base.BaseBean | ||
import com.skyd.anivu.model.bean.article.EnclosureBean | ||
|
||
data class LinkEnclosureBean( | ||
val link: String, | ||
) : BaseBean { | ||
val isMedia: Boolean | ||
get() = EnclosureBean.mediaExtensions.any { link.endsWith(it) } | ||
get() = EnclosureBean.videoExtensions.any { link.endsWith(it) } || | ||
EnclosureBean.audioExtensions.any { link.endsWith(it) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
.../skyd/anivu/model/bean/ArticleWithFeed.kt → ...ivu/model/bean/article/ArticleWithFeed.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/skyd/anivu/model/bean/article/RssMediaBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.skyd.anivu.model.bean.article | ||
|
||
import android.os.Parcelable | ||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.ForeignKey | ||
import androidx.room.PrimaryKey | ||
import com.skyd.anivu.base.BaseBean | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.serialization.Serializable | ||
|
||
const val RSS_MEDIA_TABLE_NAME = "RssMedia" | ||
|
||
@Parcelize | ||
@Serializable | ||
@Entity( | ||
tableName = RSS_MEDIA_TABLE_NAME, | ||
foreignKeys = [ | ||
ForeignKey( | ||
entity = ArticleBean::class, | ||
parentColumns = [ArticleBean.ARTICLE_ID_COLUMN], | ||
childColumns = [RssMediaBean.ARTICLE_ID_COLUMN], | ||
onDelete = ForeignKey.CASCADE | ||
) | ||
], | ||
) | ||
data class RssMediaBean( | ||
@PrimaryKey | ||
@ColumnInfo(name = ARTICLE_ID_COLUMN) | ||
val articleId: String, | ||
@ColumnInfo(name = DURATION_COLUMN) | ||
val duration: Long? = null, | ||
@ColumnInfo(name = ADULT_COLUMN) | ||
var adult: Boolean = false, | ||
@ColumnInfo(name = IMAGE_COLUMN) | ||
val image: String? = null, | ||
@ColumnInfo(name = EPISODE_COLUMN) | ||
var episode: String? = null, | ||
) : BaseBean, Parcelable { | ||
companion object { | ||
const val ARTICLE_ID_COLUMN = "articleId" | ||
const val DURATION_COLUMN = "duration" | ||
const val ADULT_COLUMN = "adult" | ||
const val IMAGE_COLUMN = "image" | ||
const val EPISODE_COLUMN = "episode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/skyd/anivu/model/db/converter/CategoriesConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.skyd.anivu.model.db.converter | ||
|
||
import androidx.room.TypeConverter | ||
import com.skyd.anivu.model.bean.article.ArticleBean | ||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
|
||
class CategoriesConverter { | ||
@TypeConverter | ||
fun fromString(string: String?): ArticleBean.Categories? { | ||
string ?: return null | ||
return ArticleBean.Categories(categories = Json.decodeFromString(string)) | ||
} | ||
|
||
@TypeConverter | ||
fun categoriesToString(categories: ArticleBean.Categories?): String? { | ||
val list = categories?.categories ?: return null | ||
return Json.encodeToString(list) | ||
} | ||
} |
Oops, something went wrong.