Ellipsize chapters in feed
This commit is contained in:
@@ -67,13 +67,13 @@ dependencies {
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.5.0-beta01'
|
||||
implementation 'androidx.activity:activity-ktx:1.2.0-rc01'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.3.0-rc02'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-rc01'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-rc01'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-rc01'
|
||||
implementation 'androidx.lifecycle:lifecycle-service:2.3.0-rc01'
|
||||
implementation 'androidx.lifecycle:lifecycle-process:2.3.0-rc01'
|
||||
implementation 'androidx.activity:activity-ktx:1.2.0'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.3.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-service:2.3.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-process:2.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.0-beta01'
|
||||
@@ -82,7 +82,7 @@ dependencies {
|
||||
implementation 'androidx.work:work-runtime-ktx:2.5.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
//noinspection LifecycleAnnotationProcessorWithJava8
|
||||
kapt 'androidx.lifecycle:lifecycle-compiler:2.3.0-rc01'
|
||||
kapt 'androidx.lifecycle:lifecycle-compiler:2.3.0'
|
||||
|
||||
implementation 'androidx.room:room-runtime:2.2.6'
|
||||
implementation 'androidx.room:room-ktx:2.2.6'
|
||||
|
||||
@@ -6,21 +6,37 @@ import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.TrackingLogItem
|
||||
import org.koitharu.kotatsu.utils.ext.formatRelative
|
||||
|
||||
fun TrackingLogItem.toFeedItem(resources: Resources) = FeedItem(
|
||||
id = id,
|
||||
imageUrl = manga.coverUrl,
|
||||
title = manga.title,
|
||||
subtitle = buildString {
|
||||
append(createdAt.formatRelative(DateUtils.DAY_IN_MILLIS))
|
||||
append(" ")
|
||||
append(
|
||||
resources.getQuantityString(
|
||||
R.plurals.new_chapters,
|
||||
chapters.size,
|
||||
chapters.size
|
||||
fun TrackingLogItem.toFeedItem(resources: Resources): FeedItem {
|
||||
val chaptersString = if (chapters.size > MAX_CHAPTERS) {
|
||||
chapters.joinToString(
|
||||
separator = "\n",
|
||||
limit = MAX_CHAPTERS - 1,
|
||||
truncated = resources.getString(
|
||||
R.string._and_x_more,
|
||||
chapters.size - MAX_CHAPTERS + 1
|
||||
)
|
||||
)
|
||||
},
|
||||
chapters = chapters.joinToString("\n"),
|
||||
manga = manga
|
||||
)
|
||||
} else {
|
||||
chapters.joinToString("\n")
|
||||
}
|
||||
return FeedItem(
|
||||
id = id,
|
||||
imageUrl = manga.coverUrl,
|
||||
title = manga.title,
|
||||
subtitle = buildString {
|
||||
append(createdAt.formatRelative(DateUtils.DAY_IN_MILLIS))
|
||||
append(" ")
|
||||
append(
|
||||
resources.getQuantityString(
|
||||
R.plurals.new_chapters,
|
||||
chapters.size,
|
||||
chapters.size
|
||||
)
|
||||
)
|
||||
},
|
||||
chapters = chaptersString,
|
||||
manga = manga
|
||||
)
|
||||
}
|
||||
|
||||
private const val MAX_CHAPTERS = 6
|
||||
@@ -200,4 +200,5 @@
|
||||
<string name="sign_in">Войти</string>
|
||||
<string name="auth_required">Для просмотра этого контента требуется авторизация</string>
|
||||
<string name="default_s">По умолчанию: %s</string>
|
||||
<string name="_and_x_more">…и ещё %1$d</string>
|
||||
</resources>
|
||||
@@ -202,4 +202,5 @@
|
||||
<string name="sign_in">Sign in</string>
|
||||
<string name="auth_required">You should authorize to view this content</string>
|
||||
<string name="default_s">Default: %s</string>
|
||||
<string name="_and_x_more">…and %1$d more</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user