diff --git a/app/build.gradle b/app/build.gradle index 74df0362e..0eb291004 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/java/org/koitharu/kotatsu/tracker/ui/model/ListModelConversionExt.kt b/app/src/main/java/org/koitharu/kotatsu/tracker/ui/model/ListModelConversionExt.kt index d1d6694de..87c7efd2f 100644 --- a/app/src/main/java/org/koitharu/kotatsu/tracker/ui/model/ListModelConversionExt.kt +++ b/app/src/main/java/org/koitharu/kotatsu/tracker/ui/model/ListModelConversionExt.kt @@ -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 -) \ No newline at end of file + } 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 \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index df1439358..5b8286062 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -200,4 +200,5 @@ Войти Для просмотра этого контента требуется авторизация По умолчанию: %s + …и ещё %1$d \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f11bb380c..9ecd2811c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -202,4 +202,5 @@ Sign in You should authorize to view this content Default: %s + …and %1$d more \ No newline at end of file