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