Merge branch 'devel' into feature/downloads_worker

This commit is contained in:
Koitharu
2023-05-06 18:30:45 +03:00
33 changed files with 73 additions and 64 deletions

View File

@@ -15,8 +15,8 @@ android {
applicationId 'org.koitharu.kotatsu'
minSdkVersion 21
targetSdkVersion 33
versionCode 539
versionName '5.0.1'
versionCode 540
versionName '5.0.2'
generatedDensities = []
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -78,7 +78,7 @@ afterEvaluate {
}
dependencies {
//noinspection GradleDependency
implementation('com.github.KotatsuApp:kotatsu-parsers:3e349d3db3') {
implementation('com.github.KotatsuApp:kotatsu-parsers:96b9ac36f3') {
exclude group: 'org.json', module: 'json'
}
@@ -99,7 +99,7 @@ dependencies {
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.biometric:biometric-ktx:1.2.0-alpha05'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.google.android.material:material:1.9.0'
//noinspection LifecycleAnnotationProcessorWithJava8
kapt 'androidx.lifecycle:lifecycle-compiler:2.6.1'
implementation 'androidx.work:work-runtime-ktx:2.8.1'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 KiB

View File

@@ -1,10 +0,0 @@
Slice of Life, Mystery
Slice of Life, Mystery
Psychological, Romance, Comedy, Slice of Life, Supernatural
Sci-Fi, Comedy
Reincarnation, Sci-Fi, Historical, Psychological, Drama, Slice of Life, Supernatural, Mystery
Reincarnation, Sci-Fi, Historical, Psychological, Drama, Slice of Life, Supernatural, Mystery
Reincarnation, Sci-Fi, Historical, Psychological, Drama, Slice of Life, Supernatural, Mystery
Reincarnation, Sci-Fi, Historical, Psychological, Drama, Slice of Life, Supernatural, Mystery
Adventure, Slice of Life, Mystery
Adventure, Slice of Life, Mystery

View File

@@ -1,10 +0,0 @@
Forget-me-not Vol. 1
Forget-me-not Vol. 2
La Pomme Prisoinniere
Momo Kanchou no Himitsu Kichi
Omoide Emanon
Sasurai Emanon Vol. 1
Sasurai Emanon Vol. 2
Sasurai Emanon Vol. 3
Wandering Island Vol. 1
Wandering Island Vol. 2

View File

@@ -4,6 +4,7 @@ package org.koitharu.kotatsu.list.ui.adapter
import android.view.View
import androidx.annotation.CheckResult
import androidx.cardview.widget.CardView
import androidx.core.view.doOnNextLayout
import com.google.android.material.badge.BadgeDrawable
import com.google.android.material.badge.BadgeUtils
@@ -16,7 +17,7 @@ fun View.bindBadge(badge: BadgeDrawable?, counter: Int): BadgeDrawable? {
val badgeDrawable = badge ?: initBadge(this)
badgeDrawable.number = counter
badgeDrawable.isVisible = true
badgeDrawable.align()
badgeDrawable.align(this)
badgeDrawable
} else {
badge?.isVisible = false
@@ -34,12 +35,17 @@ private fun initBadge(anchor: View): BadgeDrawable {
badge.maxCharacterCount = resources.getInteger(R.integer.manga_badge_max_character_count)
anchor.doOnNextLayout {
BadgeUtils.attachBadgeDrawable(badge, it)
badge.align()
badge.align(it)
}
return badge
}
private fun BadgeDrawable.align() {
horizontalOffset = intrinsicWidth
verticalOffset = intrinsicHeight
private fun BadgeDrawable.align(anchor: View) {
val extraOffset = if (anchor is CardView) {
(anchor.radius / 2f).toInt()
} else {
0
}
horizontalOffset = intrinsicWidth + extraOffset
verticalOffset = intrinsicHeight + extraOffset
}

View File

@@ -6,12 +6,14 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.channelFlow
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.launch
import kotlinx.coroutines.runInterruptible
import org.koitharu.kotatsu.core.parser.MangaRepository
import org.koitharu.kotatsu.local.data.LocalManga
import org.koitharu.kotatsu.local.data.LocalStorageChanges
import org.koitharu.kotatsu.local.data.LocalStorageManager
import org.koitharu.kotatsu.local.data.TempFileFilter
import org.koitharu.kotatsu.local.data.input.LocalMangaInput
@@ -35,7 +37,10 @@ import javax.inject.Singleton
private const val MAX_PARALLELISM = 4
@Singleton
class LocalMangaRepository @Inject constructor(private val storageManager: LocalStorageManager) : MangaRepository {
class LocalMangaRepository @Inject constructor(
private val storageManager: LocalStorageManager,
@LocalStorageChanges private val localStorageChanges: MutableSharedFlow<LocalManga?>,
) : MangaRepository {
override val source = MangaSource.LOCAL
private val locks = CompositeMutex<Long>()
@@ -85,13 +90,18 @@ class LocalMangaRepository @Inject constructor(private val storageManager: Local
suspend fun delete(manga: Manga): Boolean {
val file = Uri.parse(manga.url).toFile()
return file.deleteAwait()
val result = file.deleteAwait()
if (result) {
localStorageChanges.emit(null)
}
return result
}
suspend fun deleteChapters(manga: Manga, ids: Set<Long>) {
lockManga(manga.id)
try {
LocalMangaUtil(manga).deleteChapters(ids)
localStorageChanges.emit(LocalManga(manga))
} finally {
unlockManga(manga.id)
}

View File

@@ -51,7 +51,7 @@
app:shapeAppearance="?shapeAppearanceCornerLarge"
app:strokeColor="?colorOutline"
app:strokeWidth="1dp"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progress_before"
@@ -88,7 +88,7 @@
app:shapeAppearance="?shapeAppearanceCornerLarge"
app:strokeColor="?colorOutline"
app:strokeWidth="1dp"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progress_after"

View File

@@ -29,7 +29,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.3"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover"
tools:background="@sample/covers[5]"
tools:background="@tools:sample/backgrounds/scenic[5]"
tools:ignore="ContentDescription,UnusedAttribute" />
<org.koitharu.kotatsu.history.ui.util.ReadingProgressView
@@ -53,7 +53,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/imageView_cover"
app:layout_constraintTop_toTopOf="parent"
tools:text="@sample/titles[5]" />
tools:text="@tools:sample/lorem" />
<TextView
android:id="@+id/textView_subtitle"

View File

@@ -20,7 +20,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"
@@ -33,7 +33,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView_cover"
app:layout_constraintTop_toTopOf="@+id/imageView_cover"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@@ -26,7 +26,7 @@
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
app:tintMode="src_atop"
tools:backgroundTint="#99FFFFFF"
tools:src="@sample/covers"
tools:src="@tools:sample/backgrounds/scenic"
tools:tint="#99FFFFFF" />
<com.google.android.material.imageview.ShapeableImageView
@@ -44,7 +44,7 @@
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
app:tintMode="src_atop"
tools:backgroundTint="#4DFFFFFF"
tools:src="@sample/covers"
tools:src="@tools:sample/backgrounds/scenic"
tools:tint="#4DFFFFFF" />
<com.google.android.material.imageview.ShapeableImageView
@@ -60,7 +60,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"

View File

@@ -22,7 +22,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Medium"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"
@@ -37,7 +37,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/imageView_cover"
app:layout_constraintTop_toTopOf="parent"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_top"

View File

@@ -18,7 +18,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"
@@ -32,7 +32,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView_cover"
app:layout_constraintTop_toTopOf="@+id/imageView_cover"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
<TextView
android:id="@+id/textView_summary"

View File

@@ -27,7 +27,7 @@
android:scaleType="centerCrop"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover"
tools:ignore="ContentDescription"
tools:src="@sample/covers[5]" />
tools:src="@tools:sample/backgrounds/scenic[5]" />
<org.koitharu.kotatsu.history.ui.util.ReadingProgressView
android:id="@+id/progressView"
@@ -50,7 +50,7 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/thumbnail"
tools:text="@sample/titles[5]" />
tools:text="@tools:sample/lorem" />
</LinearLayout>

View File

@@ -18,7 +18,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"
@@ -32,7 +32,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView_cover"
app:layout_constraintTop_toTopOf="@+id/imageView_cover"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
<TextView
android:id="@+id/textView_subtitle"
@@ -46,6 +46,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView_cover"
app:layout_constraintTop_toBottomOf="@+id/textView_title"
tools:text="@sample/genres" />
tools:text="@tools:sample/lorem/random" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -20,7 +20,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<org.koitharu.kotatsu.history.ui.util.ReadingProgressView
android:id="@+id/progressView"
@@ -44,7 +44,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView_cover"
app:layout_constraintTop_toTopOf="parent"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
<TextView
android:id="@+id/textView_subtitle"

View File

@@ -21,7 +21,7 @@
android:layout_alignParentTop="true"
android:contentDescription="@null"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
tools:src="@sample/covers[7]" />
tools:src="@tools:sample/backgrounds/scenic[7]" />
<TextView
android:id="@+id/textView_title"
@@ -36,7 +36,7 @@
android:textAppearance="@style/TextAppearance.Material3.TitleSmall"
app:drawableTint="?colorControlNormal"
tools:drawableEndCompat="@drawable/ic_shikimori"
tools:text="@sample/titles[5]" />
tools:text="@tools:sample/lorem" />
<RatingBar
android:id="@+id/ratingBar"

View File

@@ -18,7 +18,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"
@@ -32,7 +32,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView_cover"
app:layout_constraintTop_toTopOf="@+id/imageView_cover"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
<RatingBar
android:id="@+id/ratingBar"

View File

@@ -23,7 +23,7 @@
android:orientation="vertical"
android:scaleType="centerCrop"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"
@@ -33,7 +33,7 @@
android:ellipsize="end"
android:lines="1"
android:textAppearance="?attr/textAppearanceLabelSmall"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
</LinearLayout>

View File

@@ -24,7 +24,7 @@
android:layout_height="@dimen/widget_cover_height"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
tools:src="@sample/covers" />
tools:src="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/textView_title"
@@ -35,7 +35,7 @@
android:lines="2"
android:padding="2dp"
android:textColor="?android:attr/textColorPrimary"
tools:text="@sample/titles" />
tools:text="@tools:sample/lorem" />
</LinearLayout>

View File

@@ -33,7 +33,7 @@
app:layout_constraintTop_toBottomOf="@id/dragHandle"
app:layout_constraintWidth_percent="0.3"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover"
tools:background="@sample/covers[9]"
tools:background="@tools:sample/backgrounds/scenic"
tools:ignore="ContentDescription,UnusedAttribute" />
<ImageView
@@ -61,7 +61,7 @@
app:layout_constraintEnd_toStartOf="@id/button_menu"
app:layout_constraintStart_toEndOf="@id/imageView_cover"
app:layout_constraintTop_toBottomOf="@id/dragHandle"
tools:text="@sample/titles[9]" />
tools:text="@tools:sample/lorem[9]" />
<ImageButton
android:id="@+id/button_menu"

View File

@@ -428,4 +428,6 @@
<string name="speed">Хуткасць</string>
<string name="restore_backup_description">Імпарт раней створанай рэзервовай копіі дадзеных карыстальніка</string>
<string name="show_on_shelf">Паказаць на паліцы</string>
<string name="find_similar">Знайсці падобныя</string>
<string name="sync_auth_hint">Вы можаце ўвайсці ў існуючы ўліковы запіс або стварыць новы</string>
</resources>

View File

@@ -421,4 +421,13 @@
<string name="domain">Domain</string>
<string name="light_indicator">LED indicator</string>
<string name="settings_apply_restart_required">Mangyaring i-restart ang application upang ilapat ang mga pagbabagong ito</string>
<string name="got_it">Nakuha ko</string>
<string name="sources_reorder_tip">I-tap at hawakan ang isang aytem upang muling ayusin ang mga ito</string>
<string name="restore_backup_description">Mag-import ng dating ginawa na backup ng data ng user</string>
<string name="show_on_shelf">Ipakita sa Istante</string>
<string name="speed">Bilis</string>
<string name="comics_archive_import_description">Maaari kang pumili ng isa o higit pang .cbz o .zip file, ang bawat file ay makikilala bilang isang hiwalay na manga.</string>
<string name="folder_with_images_import_description">Maaari kang pumili ng isang directory na may mga archive o mga larawan. Ang bawat archive (o subdirectory) ay makikilala bilang isang kabanata.</string>
<string name="find_similar">Maghanap ng katulad</string>
<string name="sync_auth_hint">Maaari kang mag-sign in sa isang umiiral na account o lumikha ng bago</string>
</resources>

View File

@@ -11,7 +11,7 @@
<string name="favourites">お気に入り</string>
<string name="error_occurred">エラーが発生しました</string>
<string name="details">詳細</string>
<string name="chapters">チャプター</string>
<string name="chapters"></string>
<string name="list">リスト</string>
<string name="detailed_list">詳細リスト</string>
<string name="grid">グリッド</string>
@@ -55,8 +55,8 @@
<string name="history_and_cache">履歴とキャッシュ</string>
<string name="clear_pages_cache">ページのキャッシュをクリアする</string>
<string name="text_file_sizes">B|kB|MB|GB|TB</string>
<string name="close_menu">閉じる</string>
<string name="open_menu">開く</string>
<string name="close_menu">メニューを閉じる</string>
<string name="open_menu">メニューを開く</string>
<string name="settings">設定</string>
<string name="light">ライトテーマ</string>
<string name="filter">フィルター</string>

View File

@@ -428,4 +428,6 @@
<string name="restore_backup_description">Імпортуйте раніше створену резервну копію даних користувача</string>
<string name="show_on_shelf">Показати на полиці</string>
<string name="sources_reorder_tip">Натисніть і утримуйте елемент, щоб змінити його порядок</string>
<string name="sync_auth_hint">Ви можете увійти в існуючий обліковий запис або створити новий</string>
<string name="find_similar">Знайти схожі</string>
</resources>