Bookmarks feature

This commit is contained in:
Koitharu
2022-05-10 15:09:27 +03:00
parent 161bc5f69d
commit 1cbb825892
34 changed files with 905 additions and 300 deletions

View File

@@ -7,6 +7,7 @@ import androidx.fragment.app.strictmode.FragmentStrictMode
import org.koin.android.ext.android.get
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
import org.koitharu.kotatsu.bookmarks.bookmarksModule
import org.koitharu.kotatsu.core.db.databaseModule
import org.koitharu.kotatsu.core.github.githubModule
import org.koitharu.kotatsu.core.network.networkModule
@@ -67,6 +68,7 @@ class KotatsuApp : Application() {
readerModule,
appWidgetModule,
suggestionsModule,
bookmarksModule,
)
}
}

View File

@@ -0,0 +1,20 @@
package org.koitharu.kotatsu.base.ui.list
import android.view.View
import android.view.View.OnClickListener
import android.view.View.OnLongClickListener
import com.hannesdorfmann.adapterdelegates4.dsl.AdapterDelegateViewBindingViewHolder
class AdapterDelegateClickListenerAdapter<I>(
private val adapterDelegate: AdapterDelegateViewBindingViewHolder<I, *>,
private val clickListener: OnListItemClickListener<I>,
) : OnClickListener, OnLongClickListener {
override fun onClick(v: View) {
clickListener.onItemClick(adapterDelegate.item, v)
}
override fun onLongClick(v: View): Boolean {
return clickListener.onItemLongClick(adapterDelegate.item, v)
}
}

View File

@@ -0,0 +1,10 @@
package org.koitharu.kotatsu.bookmarks
import org.koin.dsl.module
import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository
val bookmarksModule
get() = module {
factory { BookmarksRepository(get()) }
}

View File

@@ -0,0 +1,28 @@
package org.koitharu.kotatsu.bookmarks.data
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import org.koitharu.kotatsu.core.db.entity.MangaEntity
@Entity(
tableName = "bookmarks",
primaryKeys = ["manga_id", "page_id"],
foreignKeys = [
ForeignKey(
entity = MangaEntity::class,
parentColumns = ["manga_id"],
childColumns = ["manga_id"],
onDelete = ForeignKey.CASCADE
),
]
)
class BookmarkEntity(
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
@ColumnInfo(name = "page_id", index = true) val pageId: Long,
@ColumnInfo(name = "chapter_id") val chapterId: Long,
@ColumnInfo(name = "page") val page: Int,
@ColumnInfo(name = "scroll") val scroll: Int,
@ColumnInfo(name = "image") val imageUrl: String,
@ColumnInfo(name = "created_at") val createdAt: Long,
)

View File

@@ -0,0 +1,23 @@
package org.koitharu.kotatsu.bookmarks.data
import androidx.room.Embedded
import androidx.room.Junction
import androidx.room.Relation
import org.koitharu.kotatsu.core.db.entity.MangaEntity
import org.koitharu.kotatsu.core.db.entity.MangaTagsEntity
import org.koitharu.kotatsu.core.db.entity.TagEntity
class BookmarkWithManga(
@Embedded val bookmark: BookmarkEntity,
@Relation(
parentColumn = "manga_id",
entityColumn = "manga_id"
)
val manga: MangaEntity,
@Relation(
parentColumn = "manga_id",
entityColumn = "tag_id",
associateBy = Junction(MangaTagsEntity::class)
)
val tags: List<TagEntity>,
)

View File

@@ -0,0 +1,26 @@
package org.koitharu.kotatsu.bookmarks.data
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import kotlinx.coroutines.flow.Flow
@Dao
abstract class BookmarksDao {
@Query("SELECT * FROM bookmarks WHERE manga_id = :mangaId AND chapter_id = :chapterId AND page = :page")
abstract fun observe(mangaId: Long, chapterId: Long, page: Int): Flow<BookmarkEntity?>
@Query("SELECT * FROM bookmarks WHERE manga_id = :mangaId ORDER BY created_at DESC")
abstract fun observe(mangaId: Long): Flow<List<BookmarkEntity>>
@Insert
abstract suspend fun insert(entity: BookmarkEntity)
@Delete
abstract suspend fun delete(entity: BookmarkEntity)
@Query("DELETE FROM bookmarks WHERE manga_id = :mangaId AND page_id = :pageId")
abstract suspend fun delete(mangaId: Long, pageId: Long)
}

View File

@@ -0,0 +1,31 @@
package org.koitharu.kotatsu.bookmarks.data
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
import org.koitharu.kotatsu.core.db.entity.toManga
import org.koitharu.kotatsu.core.db.entity.toMangaTags
import org.koitharu.kotatsu.parsers.model.Manga
import java.util.*
fun BookmarkWithManga.toBookmark() = bookmark.toBookmark(
manga.toManga(tags.toMangaTags())
)
fun BookmarkEntity.toBookmark(manga: Manga) = Bookmark(
manga = manga,
pageId = pageId,
chapterId = chapterId,
page = page,
scroll = scroll,
imageUrl = imageUrl,
createdAt = Date(createdAt),
)
fun Bookmark.toEntity() = BookmarkEntity(
mangaId = manga.id,
pageId = pageId,
chapterId = chapterId,
page = page,
scroll = scroll,
imageUrl = imageUrl,
createdAt = createdAt.time,
)

View File

@@ -0,0 +1,43 @@
package org.koitharu.kotatsu.bookmarks.domain
import org.koitharu.kotatsu.parsers.model.Manga
import java.util.*
class Bookmark(
val manga: Manga,
val pageId: Long,
val chapterId: Long,
val page: Int,
val scroll: Int,
val imageUrl: String,
val createdAt: Date,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Bookmark
if (manga != other.manga) return false
if (pageId != other.pageId) return false
if (chapterId != other.chapterId) return false
if (page != other.page) return false
if (scroll != other.scroll) return false
if (imageUrl != other.imageUrl) return false
if (createdAt != other.createdAt) return false
return true
}
override fun hashCode(): Int {
var result = manga.hashCode()
result = 31 * result + pageId.hashCode()
result = 31 * result + chapterId.hashCode()
result = 31 * result + page
result = 31 * result + scroll
result = 31 * result + imageUrl.hashCode()
result = 31 * result + createdAt.hashCode()
return result
}
}

View File

@@ -0,0 +1,38 @@
package org.koitharu.kotatsu.bookmarks.domain
import androidx.room.withTransaction
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import org.koitharu.kotatsu.bookmarks.data.toBookmark
import org.koitharu.kotatsu.bookmarks.data.toEntity
import org.koitharu.kotatsu.core.db.MangaDatabase
import org.koitharu.kotatsu.core.db.entity.toEntities
import org.koitharu.kotatsu.core.db.entity.toEntity
import org.koitharu.kotatsu.parsers.model.Manga
import org.koitharu.kotatsu.utils.ext.mapItems
class BookmarksRepository(
private val db: MangaDatabase,
) {
fun observeBookmark(manga: Manga, chapterId: Long, page: Int): Flow<Bookmark?> {
return db.bookmarksDao.observe(manga.id, chapterId, page).map { it?.toBookmark(manga) }
}
fun observeBookmarks(manga: Manga): Flow<List<Bookmark>> {
return db.bookmarksDao.observe(manga.id).mapItems { it.toBookmark(manga) }
}
suspend fun addBookmark(bookmark: Bookmark) {
db.withTransaction {
val tags = bookmark.manga.tags.toEntities()
db.tagsDao.upsert(tags)
db.mangaDao.upsert(bookmark.manga.toEntity(), tags)
db.bookmarksDao.insert(bookmark.toEntity())
}
}
suspend fun removeBookmark(mangaId: Long, pageId: Long) {
db.bookmarksDao.delete(mangaId, pageId)
}
}

View File

@@ -0,0 +1,51 @@
package org.koitharu.kotatsu.bookmarks.ui
import androidx.lifecycle.LifecycleOwner
import coil.ImageLoader
import coil.request.Disposable
import coil.size.Scale
import coil.util.CoilUtils
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.ui.list.AdapterDelegateClickListenerAdapter
import org.koitharu.kotatsu.base.ui.list.OnListItemClickListener
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
import org.koitharu.kotatsu.databinding.ItemBookmarkBinding
import org.koitharu.kotatsu.utils.ext.enqueueWith
import org.koitharu.kotatsu.utils.ext.newImageRequest
import org.koitharu.kotatsu.utils.ext.referer
fun bookmarkListAD(
coil: ImageLoader,
lifecycleOwner: LifecycleOwner,
clickListener: OnListItemClickListener<Bookmark>,
) = adapterDelegateViewBinding<Bookmark, Bookmark, ItemBookmarkBinding>(
{ inflater, parent -> ItemBookmarkBinding.inflate(inflater, parent, false) }
) {
var imageRequest: Disposable? = null
val listener = AdapterDelegateClickListenerAdapter(this, clickListener)
binding.root.setOnClickListener(listener)
binding.root.setOnLongClickListener(listener)
bind {
imageRequest?.dispose()
imageRequest = binding.imageViewThumb.newImageRequest(item.imageUrl)
.referer(item.manga.publicUrl)
.placeholder(R.drawable.ic_placeholder)
.fallback(R.drawable.ic_placeholder)
.error(R.drawable.ic_placeholder)
.allowRgb565(true)
.scale(Scale.FILL)
.lifecycle(lifecycleOwner)
.enqueueWith(coil)
}
onViewRecycled {
imageRequest?.dispose()
imageRequest = null
CoilUtils.dispose(binding.imageViewThumb)
binding.imageViewThumb.setImageDrawable(null)
}
}

View File

@@ -0,0 +1,30 @@
package org.koitharu.kotatsu.bookmarks.ui
import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.DiffUtil
import coil.ImageLoader
import com.hannesdorfmann.adapterdelegates4.AsyncListDifferDelegationAdapter
import org.koitharu.kotatsu.base.ui.list.OnListItemClickListener
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
class BookmarksAdapter(
coil: ImageLoader,
lifecycleOwner: LifecycleOwner,
clickListener: OnListItemClickListener<Bookmark>,
) : AsyncListDifferDelegationAdapter<Bookmark>(
DiffCallback(),
bookmarkListAD(coil, lifecycleOwner, clickListener)
) {
private class DiffCallback : DiffUtil.ItemCallback<Bookmark>() {
override fun areItemsTheSame(oldItem: Bookmark, newItem: Bookmark): Boolean {
return oldItem.manga.id == newItem.manga.id && oldItem.chapterId == newItem.chapterId
}
override fun areContentsTheSame(oldItem: Bookmark, newItem: Bookmark): Boolean {
return oldItem.imageUrl == newItem.imageUrl
}
}
}

View File

@@ -4,6 +4,8 @@ import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import org.koitharu.kotatsu.bookmarks.data.BookmarkEntity
import org.koitharu.kotatsu.bookmarks.data.BookmarksDao
import org.koitharu.kotatsu.core.db.dao.*
import org.koitharu.kotatsu.core.db.entity.*
import org.koitharu.kotatsu.core.db.migrations.*
@@ -20,9 +22,9 @@ import org.koitharu.kotatsu.suggestions.data.SuggestionEntity
entities = [
MangaEntity::class, TagEntity::class, HistoryEntity::class, MangaTagsEntity::class,
FavouriteCategoryEntity::class, FavouriteEntity::class, MangaPrefsEntity::class,
TrackEntity::class, TrackLogEntity::class, SuggestionEntity::class
TrackEntity::class, TrackLogEntity::class, SuggestionEntity::class, BookmarkEntity::class,
],
version = 10
version = 11,
)
abstract class MangaDatabase : RoomDatabase() {
@@ -43,6 +45,8 @@ abstract class MangaDatabase : RoomDatabase() {
abstract val trackLogsDao: TrackLogsDao
abstract val suggestionDao: SuggestionDao
abstract val bookmarksDao: BookmarksDao
}
fun MangaDatabase(context: Context): MangaDatabase = Room.databaseBuilder(
@@ -59,6 +63,7 @@ fun MangaDatabase(context: Context): MangaDatabase = Room.databaseBuilder(
Migration7To8(),
Migration8To9(),
Migration9To10(),
Migration10To11(),
).addCallback(
DatabasePrePopulateCallback(context.resources)
).build()

View File

@@ -0,0 +1,26 @@
package org.koitharu.kotatsu.core.db.migrations
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
class Migration10To11 : Migration(10, 11) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL(
"""
CREATE TABLE IF NOT EXISTS `bookmarks` (
`manga_id` INTEGER NOT NULL,
`page_id` INTEGER NOT NULL,
`chapter_id` INTEGER NOT NULL,
`page` INTEGER NOT NULL,
`scroll` INTEGER NOT NULL,
`image` TEXT NOT NULL,
`created_at` INTEGER NOT NULL,
PRIMARY KEY(`manga_id`, `page_id`),
FOREIGN KEY(`manga_id`) REFERENCES `manga`(`manga_id`) ON UPDATE NO ACTION ON DELETE CASCADE )
""".trimIndent()
)
database.execSQL("CREATE INDEX IF NOT EXISTS `index_bookmarks_manga_id` ON `bookmarks` (`manga_id`)")
database.execSQL("CREATE INDEX IF NOT EXISTS `index_bookmarks_page_id` ON `bookmarks` (`page_id`)")
}
}

View File

@@ -8,6 +8,6 @@ val detailsModule
get() = module {
viewModel { intent ->
DetailsViewModel(intent.get(), get(), get(), get(), get(), get(), get())
DetailsViewModel(intent.get(), get(), get(), get(), get(), get(), get(), get())
}
}

View File

@@ -83,6 +83,9 @@ class DetailsActivity :
viewModel.newChaptersCount.observe(this, ::onNewChaptersChanged)
viewModel.onMangaRemoved.observe(this, ::onMangaRemoved)
viewModel.onError.observe(this, ::onError)
viewModel.onShowToast.observe(this) {
binding.snackbar.show(messageText = getString(it), longDuration = false)
}
registerReceiver(downloadReceiver, IntentFilter(DownloadService.ACTION_DOWNLOAD_COMPLETE))
}

View File

@@ -10,6 +10,7 @@ import androidx.core.content.ContextCompat
import androidx.core.graphics.Insets
import androidx.core.net.toUri
import androidx.core.text.parseAsHtml
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import coil.ImageLoader
@@ -21,7 +22,11 @@ import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.ui.BaseFragment
import org.koitharu.kotatsu.base.ui.list.OnListItemClickListener
import org.koitharu.kotatsu.base.ui.list.decor.SpacingItemDecoration
import org.koitharu.kotatsu.base.ui.widgets.ChipsView
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
import org.koitharu.kotatsu.bookmarks.ui.BookmarksAdapter
import org.koitharu.kotatsu.core.model.MangaHistory
import org.koitharu.kotatsu.databinding.FragmentDetailsBinding
import org.koitharu.kotatsu.favourites.ui.categories.select.FavouriteCategoriesBottomSheet
@@ -41,7 +46,8 @@ class DetailsFragment :
BaseFragment<FragmentDetailsBinding>(),
View.OnClickListener,
View.OnLongClickListener,
ChipsView.OnChipClickListener {
ChipsView.OnChipClickListener,
OnListItemClickListener<Bookmark> {
private val viewModel by sharedViewModel<DetailsViewModel>()
private val coil by inject<ImageLoader>(mode = LazyThreadSafetyMode.NONE)
@@ -69,6 +75,7 @@ class DetailsFragment :
viewModel.isLoading.observe(viewLifecycleOwner, ::onLoadingStateChanged)
viewModel.favouriteCategories.observe(viewLifecycleOwner, ::onFavouriteChanged)
viewModel.readingHistory.observe(viewLifecycleOwner, ::onHistoryChanged)
viewModel.bookmarks.observe(viewLifecycleOwner, ::onBookmarksChanged)
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
@@ -76,6 +83,24 @@ class DetailsFragment :
inflater.inflate(R.menu.opt_details_info, menu)
}
override fun onItemClick(item: Bookmark, view: View) {
val options = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.measuredWidth, view.measuredHeight)
startActivity(ReaderActivity.newIntent(view.context, item), options.toBundle())
}
override fun onItemLongClick(item: Bookmark, view: View): Boolean {
val menu = PopupMenu(view.context, view)
menu.inflate(R.menu.popup_bookmark)
menu.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.action_remove -> viewModel.removeBookmark(item)
}
true
}
menu.show()
return true
}
private fun onMangaUpdated(manga: Manga) {
with(binding) {
// Main
@@ -176,6 +201,20 @@ class DetailsFragment :
}
}
private fun onBookmarksChanged(bookmarks: List<Bookmark>) {
var adapter = binding.recyclerViewBookmarks.adapter as? BookmarksAdapter
binding.groupBookmarks.isGone = bookmarks.isEmpty()
if (adapter != null) {
adapter.items = bookmarks
} else {
adapter = BookmarksAdapter(coil, viewLifecycleOwner, this)
adapter.items = bookmarks
binding.recyclerViewBookmarks.adapter = adapter
val spacing = resources.getDimensionPixelOffset(R.dimen.bookmark_list_spacing)
binding.recyclerViewBookmarks.addItemDecoration(SpacingItemDecoration(spacing))
}
}
override fun onClick(v: View) {
val manga = viewModel.manga.value ?: return
when (v.id) {

View File

@@ -10,9 +10,12 @@ import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.plus
import org.koitharu.kotatsu.BuildConfig
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.domain.MangaDataRepository
import org.koitharu.kotatsu.base.domain.MangaIntent
import org.koitharu.kotatsu.base.ui.BaseViewModel
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository
import org.koitharu.kotatsu.core.exceptions.MangaNotFoundException
import org.koitharu.kotatsu.core.parser.MangaRepository
import org.koitharu.kotatsu.core.prefs.AppSettings
@@ -39,6 +42,7 @@ class DetailsViewModel(
private val localMangaRepository: LocalMangaRepository,
private val trackingRepository: TrackingRepository,
private val mangaDataRepository: MangaDataRepository,
private val bookmarksRepository: BookmarksRepository,
private val settings: AppSettings,
) : BaseViewModel() {
@@ -46,6 +50,8 @@ class DetailsViewModel(
private val mangaData = MutableStateFlow(intent.manga)
private val selectedBranch = MutableStateFlow<String?>(null)
val onShowToast = SingleLiveEvent<Int>()
private val history = mangaData.mapNotNull { it?.id }
.distinctUntilChanged()
.flatMapLatest { mangaId ->
@@ -85,6 +91,10 @@ class DetailsViewModel(
val isChaptersReversed = chaptersReversed
.asLiveData(viewModelScope.coroutineContext)
val bookmarks = mangaData.flatMapLatest {
if (it != null) bookmarksRepository.observeBookmarks(it) else flowOf(emptyList())
}.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default)
val onMangaRemoved = SingleLiveEvent<Manga>()
val branches = mangaData.map {
@@ -149,6 +159,13 @@ class DetailsViewModel(
}
}
fun removeBookmark(bookmark: Bookmark) {
launchJob {
bookmarksRepository.removeBookmark(bookmark.manga.id, bookmark.pageId)
onShowToast.call(R.string.bookmark_removed)
}
}
fun setChaptersReversed(newValue: Boolean) {
settings.chaptersReverse = newValue
}

View File

@@ -1,9 +1,9 @@
package org.koitharu.kotatsu.details.ui.adapter
import android.view.View
import androidx.core.view.isVisible
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.ui.list.AdapterDelegateClickListenerAdapter
import org.koitharu.kotatsu.base.ui.list.OnListItemClickListener
import org.koitharu.kotatsu.databinding.ItemChapterBinding
import org.koitharu.kotatsu.details.ui.model.ChapterListItem
@@ -21,11 +21,7 @@ fun chapterListItemAD(
{ inflater, parent -> ItemChapterBinding.inflate(inflater, parent, false) }
) {
val eventListener = object : View.OnClickListener, View.OnLongClickListener {
override fun onClick(v: View) = clickListener.onItemClick(item, v)
override fun onLongClick(v: View) = clickListener.onItemLongClick(item, v)
}
val eventListener = AdapterDelegateClickListenerAdapter(this, clickListener)
itemView.setOnClickListener(eventListener)
itemView.setOnLongClickListener(eventListener)

View File

@@ -6,7 +6,6 @@ import android.os.Bundle
import android.view.*
import androidx.appcompat.widget.SearchView
import androidx.fragment.app.FragmentManager
import org.koin.androidx.viewmodel.ViewModelOwner.Companion.from
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.ui.BaseBottomSheet
@@ -14,11 +13,14 @@ import org.koitharu.kotatsu.databinding.SheetFilterBinding
import org.koitharu.kotatsu.remotelist.ui.RemoteListViewModel
import org.koitharu.kotatsu.utils.BottomSheetToolbarController
class FilterBottomSheet : BaseBottomSheet<SheetFilterBinding>(), MenuItem.OnActionExpandListener,
SearchView.OnQueryTextListener, DialogInterface.OnKeyListener {
class FilterBottomSheet :
BaseBottomSheet<SheetFilterBinding>(),
MenuItem.OnActionExpandListener,
SearchView.OnQueryTextListener,
DialogInterface.OnKeyListener {
private val viewModel by sharedViewModel<RemoteListViewModel>(
owner = { from(requireParentFragment(), requireParentFragment()) }
owner = { requireParentFragment() }
)
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {

View File

@@ -26,6 +26,7 @@ val readerModule
shortcutsRepository = get(),
settings = get(),
pageSaveHelper = get(),
bookmarksRepository = get(),
)
}
}

View File

@@ -29,6 +29,7 @@ import org.koitharu.kotatsu.BuildConfig
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.domain.MangaIntent
import org.koitharu.kotatsu.base.ui.BaseFullscreenActivity
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
import org.koitharu.kotatsu.core.exceptions.resolve.ExceptionResolver
import org.koitharu.kotatsu.core.model.parcelable.ParcelableManga
import org.koitharu.kotatsu.core.prefs.ReaderMode
@@ -103,6 +104,12 @@ class ReaderActivity :
onLoadingStateChanged(viewModel.isLoading.value == true)
}
viewModel.isScreenshotsBlockEnabled.observe(this, this::setWindowSecure)
viewModel.isBookmarkAdded.observe(this, this::onBookmarkStateChanged)
viewModel.onShowToast.observe(this) { msgId ->
Snackbar.make(binding.container, msgId, Snackbar.LENGTH_SHORT)
.setAnchorView(binding.appbarBottom)
.show()
}
}
private fun onInitReader(mode: ReaderMode) {
@@ -189,6 +196,13 @@ class ReaderActivity :
viewModel.saveCurrentPage(page, savePageRequest)
} ?: showWaitWhileLoading()
}
R.id.action_bookmark -> {
if (viewModel.isBookmarkAdded.value == true) {
viewModel.removeBookmark()
} else {
viewModel.addBookmark()
}
}
else -> return super.onOptionsItemSelected(item)
}
return true
@@ -309,8 +323,8 @@ class ReaderActivity :
val transition = TransitionSet()
.setOrdering(TransitionSet.ORDERING_TOGETHER)
.addTransition(Slide(Gravity.TOP).addTarget(binding.appbarTop))
binding.appbarBottom?.let { botomBar ->
transition.addTransition(Slide(Gravity.BOTTOM).addTarget(botomBar))
binding.appbarBottom?.let { bottomBar ->
transition.addTransition(Slide(Gravity.BOTTOM).addTarget(bottomBar))
}
TransitionManager.beginDelayedTransition(binding.root, transition)
binding.appbarTop.isVisible = isUiVisible
@@ -351,6 +365,12 @@ class ReaderActivity :
setUiIsVisible(!binding.appbarTop.isVisible)
}
private fun onBookmarkStateChanged(isAdded: Boolean) {
val menuItem = binding.toolbarBottom.menu.findItem(R.id.action_bookmark) ?: return
menuItem.setTitle(if (isAdded) R.string.bookmark_remove else R.string.bookmark_add)
menuItem.setIcon(if (isAdded) R.drawable.ic_bookmark_added else R.drawable.ic_bookmark)
}
private fun onUiStateChanged(uiState: ReaderUiState, previous: ReaderUiState?) {
title = uiState.chapterName ?: uiState.mangaName ?: getString(R.string.loading_)
supportActionBar?.subtitle = if (uiState.chapterNumber in 1..uiState.chaptersTotal) {
@@ -419,6 +439,11 @@ class ReaderActivity :
.putExtra(EXTRA_STATE, state)
}
fun newIntent(context: Context, bookmark: Bookmark): Intent {
val state = ReaderState(bookmark.chapterId, bookmark.page, bookmark.scroll)
return newIntent(context, bookmark.manga, state)
}
fun newIntent(context: Context, mangaId: Long): Intent {
return Intent(context, ReaderActivity::class.java)
.putExtra(MangaIntent.KEY_ID, mangaId)

View File

@@ -9,23 +9,20 @@ import org.koitharu.kotatsu.parsers.model.Manga
data class ReaderState(
val chapterId: Long,
val page: Int,
val scroll: Int
val scroll: Int,
) : Parcelable {
companion object {
constructor(history: MangaHistory) : this(
chapterId = history.chapterId,
page = history.page,
scroll = history.scroll,
)
fun from(history: MangaHistory) = ReaderState(
chapterId = history.chapterId,
page = history.page,
scroll = history.scroll
)
fun initial(manga: Manga, branch: String?) = ReaderState(
chapterId = manga.chapters?.firstOrNull {
it.branch == branch
}?.id ?: error("Cannot find first chapter"),
page = 0,
scroll = 0
)
}
constructor(manga: Manga, branch: String?) : this(
chapterId = manga.chapters?.firstOrNull {
it.branch == branch
}?.id ?: error("Cannot find first chapter"),
page = 0,
scroll = 0,
)
}

View File

@@ -3,6 +3,7 @@ package org.koitharu.kotatsu.reader.ui
import android.net.Uri
import android.util.LongSparseArray
import androidx.activity.result.ActivityResultLauncher
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.*
@@ -10,10 +11,13 @@ import kotlinx.coroutines.flow.*
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
import org.koitharu.kotatsu.BuildConfig
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.domain.MangaDataRepository
import org.koitharu.kotatsu.base.domain.MangaIntent
import org.koitharu.kotatsu.base.domain.MangaUtils
import org.koitharu.kotatsu.base.ui.BaseViewModel
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository
import org.koitharu.kotatsu.core.exceptions.MangaNotFoundException
import org.koitharu.kotatsu.core.os.ShortcutsRepository
import org.koitharu.kotatsu.core.parser.MangaRepository
@@ -31,6 +35,7 @@ import org.koitharu.kotatsu.utils.SingleLiveEvent
import org.koitharu.kotatsu.utils.ext.IgnoreErrors
import org.koitharu.kotatsu.utils.ext.asLiveDataDistinct
import org.koitharu.kotatsu.utils.ext.processLifecycleScope
import java.util.*
class ReaderViewModel(
private val intent: MangaIntent,
@@ -39,12 +44,14 @@ class ReaderViewModel(
private val dataRepository: MangaDataRepository,
private val historyRepository: HistoryRepository,
private val shortcutsRepository: ShortcutsRepository,
private val bookmarksRepository: BookmarksRepository,
private val settings: AppSettings,
private val pageSaveHelper: PageSaveHelper,
) : BaseViewModel() {
private var loadingJob: Job? = null
private var pageSaveJob: Job? = null
private var bookmarkJob: Job? = null
private val currentState = MutableStateFlow(initialState)
private val mangaData = MutableStateFlow(intent.manga)
private val chapters = LongSparseArray<MangaChapter>()
@@ -53,6 +60,7 @@ class ReaderViewModel(
val readerMode = MutableLiveData<ReaderMode>()
val onPageSaved = SingleLiveEvent<Uri?>()
val onShowToast = SingleLiveEvent<Int>()
val uiState = combine(
mangaData,
currentState,
@@ -89,6 +97,16 @@ class ReaderViewModel(
val onZoomChanged = SingleLiveEvent<Unit>()
val isBookmarkAdded: LiveData<Boolean> = currentState.flatMapLatest { state ->
val manga = mangaData.value
if (state == null || manga == null) {
flowOf(false)
} else {
bookmarksRepository.observeBookmark(manga, state.chapterId, state.page)
.map { it != null }
}
}.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default)
init {
loadImpl()
subscribeToSettings()
@@ -187,10 +205,9 @@ class ReaderViewModel(
fun onCurrentPageChanged(position: Int) {
val pages = content.value?.pages ?: return
pages.getOrNull(position)?.let {
val currentValue = currentState.value
if (currentValue != null && currentValue.chapterId != it.chapterId) {
currentState.value = currentValue.copy(chapterId = it.chapterId)
pages.getOrNull(position)?.let { page ->
currentState.update { cs ->
cs?.copy(chapterId = page.chapterId, page = page.index)
}
}
if (pages.isEmpty() || loadingJob?.isActive == true) {
@@ -207,6 +224,41 @@ class ReaderViewModel(
}
}
fun addBookmark() {
if (bookmarkJob?.isActive == true) {
return
}
bookmarkJob = launchJob {
loadingJob?.join()
val state = checkNotNull(currentState.value)
val page = checkNotNull(getCurrentPage()) { "Page not found" }
val bookmark = Bookmark(
manga = checkNotNull(mangaData.value),
pageId = page.id,
chapterId = state.chapterId,
page = state.page,
scroll = state.scroll,
imageUrl = page.preview ?: pageLoader.getPageUrl(page),
createdAt = Date(),
)
bookmarksRepository.addBookmark(bookmark)
onShowToast.call(R.string.bookmark_added)
}
}
fun removeBookmark() {
if (bookmarkJob?.isActive == true) {
return
}
bookmarkJob = launchJob {
loadingJob?.join()
val manga = checkNotNull(mangaData.value)
val page = checkNotNull(getCurrentPage()) { "Page not found" }
bookmarksRepository.removeBookmark(manga.id, page.id)
onShowToast.call(R.string.bookmark_removed)
}
}
private fun loadImpl() {
loadingJob = launchLoadingJob(Dispatchers.Default) {
var manga = dataRepository.resolveIntent(intent) ?: throw MangaNotFoundException("Cannot find manga")
@@ -229,8 +281,8 @@ class ReaderViewModel(
// obtain state
if (currentState.value == null) {
currentState.value = historyRepository.getOne(manga)?.let {
ReaderState.from(it)
} ?: ReaderState.initial(manga, preselectedBranch)
ReaderState(it)
} ?: ReaderState(manga, preselectedBranch)
}
val branch = chapters[currentState.value?.chapterId ?: 0L].branch
@@ -259,7 +311,7 @@ class ReaderViewModel(
val chapter = checkNotNull(chapters[chapterId]) { "Requested chapter not found" }
val repo = MangaRepository(manga.source)
return repo.getPages(chapter).mapIndexed { index, page ->
ReaderPage.from(page, index, chapterId)
ReaderPage(page, index, chapterId)
}
}

View File

@@ -13,27 +13,24 @@ data class ReaderPage(
val preview: String?,
val chapterId: Long,
val index: Int,
val source: MangaSource
val source: MangaSource,
) : Parcelable {
constructor(page: MangaPage, index: Int, chapterId: Long) : this(
id = page.id,
url = page.url,
referer = page.referer,
preview = page.preview,
chapterId = chapterId,
index = index,
source = page.source,
)
fun toMangaPage() = MangaPage(
id = id,
url = url,
referer = referer,
preview = preview,
source = source
source = source,
)
companion object {
fun from(page: MangaPage, index: Int, chapterId: Long) = ReaderPage(
id = page.id,
url = page.url,
referer = page.referer,
preview = page.preview,
chapterId = chapterId,
index = index,
source = page.source
)
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000"
android:pathData="M17,18L12,15.82L7,18V5H17M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" />
</vector>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000"
android:pathData="M9.47 9.65L8.06 11.07L11 14L16.19 8.82L14.78 7.4L11 11.18M17 3H7C5.9 3 5 3.9 5 5L5 21L12 18L19 21V5C19 3.9 18.1 3 17 3M17 18L12 15.82L7 18V5H17Z" />
</vector>

View File

@@ -157,6 +157,37 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_titles" />
<TextView
android:id="@+id/textView_bookmarks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center_vertical|start"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:singleLine="true"
android:text="@string/bookmarks"
android:textAppearance="@style/TextAppearance.Kotatsu.SectionHeader"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chips_tags" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_bookmarks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="6dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingEnd="12dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textView_bookmarks"
tools:listitem="@layout/item_bookmark" />
<TextView
android:id="@+id/textView_description"
android:layout_width="0dp"
@@ -171,7 +202,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chips_tags"
app:layout_constraintTop_toBottomOf="@id/recyclerView_bookmarks"
tools:ignore="UnusedAttribute"
tools:text="@tools:sample/lorem/random[250]" />
@@ -189,6 +220,14 @@
app:showAnimationBehavior="inward"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_bookmarks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="recyclerView_bookmarks,textView_bookmarks"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -161,6 +161,37 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_read" />
<TextView
android:id="@+id/textView_bookmarks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center_vertical|start"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:singleLine="true"
android:text="@string/bookmarks"
android:textAppearance="@style/TextAppearance.Kotatsu.SectionHeader"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chips_tags" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_bookmarks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="6dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingEnd="12dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textView_bookmarks"
tools:listitem="@layout/item_bookmark" />
<TextView
android:id="@+id/textView_description"
android:layout_width="0dp"
@@ -175,7 +206,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chips_tags"
app:layout_constraintTop_toBottomOf="@id/recyclerView_bookmarks"
tools:ignore="UnusedAttribute"
tools:text="@tools:sample/lorem/random[250]" />
@@ -193,6 +224,14 @@
app:showAnimationBehavior="inward"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_bookmarks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="recyclerView_bookmarks,textView_bookmarks"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="wrap_content"
android:layout_height="@dimen/bookmark_item_height"
app:cardCornerRadius="12dp">
<org.koitharu.kotatsu.base.ui.widgets.CoverImageView
android:id="@+id/imageView_thumb"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:scaleType="centerCrop"
tools:src="@drawable/ic_placeholder" />
</com.google.android.material.card.MaterialCardView>

View File

@@ -6,10 +6,9 @@
tools:ignore="AlwaysShowAction">
<item
android:id="@+id/action_screen_rotate"
android:icon="@drawable/ic_screen_rotation"
android:title="@string/rotate_screen"
android:visible="false"
android:id="@+id/action_bookmark"
android:icon="@drawable/ic_bookmark"
android:title="@string/bookmark_add"
app:showAsAction="always" />
<item
@@ -18,6 +17,13 @@
android:title="@string/pages"
app:showAsAction="always" />
<item
android:id="@+id/action_screen_rotate"
android:icon="@drawable/ic_screen_rotation"
android:title="@string/rotate_screen"
android:visible="false"
app:showAsAction="always" />
<item
android:id="@+id/action_reader_mode"
android:icon="@drawable/ic_loading"

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_remove"
android:title="@string/remove" />
</menu>

View File

@@ -13,6 +13,8 @@
<dimen name="grid_spacing_outer">2dp</dimen>
<dimen name="manga_list_item_height">86dp</dimen>
<dimen name="manga_list_details_item_height">120dp</dimen>
<dimen name="bookmark_item_height">120dp</dimen>
<dimen name="bookmark_list_spacing">4dp</dimen>
<dimen name="chapter_list_item_height">62dp</dimen>
<dimen name="preferred_grid_width">120dp</dimen>
<dimen name="header_height">48dp</dimen>

View File

@@ -1,241 +1,241 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name" translatable="false">Kotatsu</string>
<string name="close_menu">Close menu</string>
<string name="open_menu">Open menu</string>
<string name="local_storage">Local storage</string>
<string name="favourites">Favourites</string>
<string name="history">History</string>
<string name="error_occurred">An error occurred</string>
<string name="network_error">Could not connect to the Internet</string>
<string name="details">Details</string>
<string name="chapters">Chapters</string>
<string name="list">List</string>
<string name="detailed_list">Detailed list</string>
<string name="grid">Grid</string>
<string name="list_mode">List mode</string>
<string name="settings">Settings</string>
<string name="remote_sources">Remote sources</string>
<string name="loading_">Loading…</string>
<string name="computing_">Computing…</string>
<string name="chapter_d_of_d">Chapter %1$d of %2$d</string>
<string name="close">Close</string>
<string name="try_again">Try again</string>
<string name="clear_history">Clear history</string>
<string name="nothing_found">Nothing found</string>
<string name="history_is_empty">No history yet</string>
<string name="read">Read</string>
<string name="you_have_not_favourites_yet">No favourites yet</string>
<string name="add_to_favourites">Favourite this</string>
<string name="add_new_category">New category</string>
<string name="add">Add</string>
<string name="enter_category_name">Enter category name</string>
<string name="save">Save</string>
<string name="share">Share</string>
<string name="create_shortcut">Create shortcut…</string>
<string name="share_s">Share %s</string>
<string name="search">Search</string>
<string name="search_manga">Search manga</string>
<string name="manga_downloading_">Downloading…</string>
<string name="processing_">Processing…</string>
<string name="download_complete">Downloaded</string>
<string name="downloads">Downloads</string>
<string name="by_name">Name</string>
<string name="popular">Popular</string>
<string name="updated">Updated</string>
<string name="newest">Newest</string>
<string name="by_rating">Rating</string>
<string name="sort_order">Sorting order</string>
<string name="filter">Filter</string>
<string name="theme">Theme</string>
<string name="light">Light</string>
<string name="dark">Dark</string>
<string name="automatic">Follow system</string>
<string name="pages">Pages</string>
<string name="clear">Clear</string>
<string name="text_clear_history_prompt">Clear all reading history permanently?</string>
<string name="remove">Remove</string>
<string name="_s_removed_from_history">\"%s\" removed from history</string>
<string name="_s_deleted_from_local_storage">\"%s\" deleted from local storage</string>
<string name="wait_for_loading_finish">Wait for loading to finish…</string>
<string name="save_page">Save page</string>
<string name="page_saved">Saved</string>
<string name="share_image">Share image</string>
<string name="_import">Import</string>
<string name="delete">Delete</string>
<string name="operation_not_supported">This operation is not supported</string>
<string name="text_file_not_supported">Either pick a ZIP or CBZ file.</string>
<string name="no_description">No description</string>
<string name="history_and_cache">History and cache</string>
<string name="clear_pages_cache">Clear page cache</string>
<string name="cache">Cache</string>
<string name="text_file_sizes">B|kB|MB|GB|TB</string>
<string name="standard">Standard</string>
<string name="webtoon">Webtoon</string>
<string name="read_mode">Read mode</string>
<string name="grid_size">Grid size</string>
<string name="search_on_s">Search on %s</string>
<string name="delete_manga">Delete manga</string>
<string name="text_delete_local_manga">Delete \"%s\" from device permanently?</string>
<string name="reader_settings">Reader settings</string>
<string name="switch_pages">Switch pages</string>
<string name="taps_on_edges">Edge taps</string>
<string name="volume_buttons">Volume buttons</string>
<string name="_continue">Continue</string>
<string name="warning">Warning</string>
<string name="network_consumption_warning">This may transfer a lot of data</string>
<string name="dont_ask_again">Don\'t ask again</string>
<string name="cancelling_">Cancelling…</string>
<string name="error">Error</string>
<string name="clear_thumbs_cache">Clear thumbnails cache</string>
<string name="clear_search_history">Clear search history</string>
<string name="search_history_cleared">Cleared</string>
<string name="gestures_only">Gestures only</string>
<string name="internal_storage">Internal storage</string>
<string name="external_storage">External storage</string>
<string name="domain">Domain</string>
<string name="application_update">Check for new versions of the app</string>
<string name="app_update_available">A new version of the app is available</string>
<string name="show_notification_app_update">Show notification if a new version is available</string>
<string name="open_in_browser">Open in web browser</string>
<string name="large_manga_save_confirm">This manga has %s. Save all of it?</string>
<string name="save_manga">Save</string>
<string name="notifications">Notifications</string>
<string name="enabled_d_of_d" tools:ignore="PluralsCandidate">%1$d of %2$d on</string>
<string name="new_chapters">New chapters</string>
<string name="download">Download</string>
<string name="read_from_start">Read from start</string>
<string name="restart">Restart</string>
<string name="notifications_settings">Notifications settings</string>
<string name="notification_sound">Notification sound</string>
<string name="light_indicator">LED indicator</string>
<string name="vibration">Vibration</string>
<string name="favourites_categories">Favourite categories</string>
<string name="categories_">Categories…</string>
<string name="rename">Rename</string>
<string name="category_delete_confirm">Remove the \"%s\" category from your favourites? \nAll manga in it will be lost.</string>
<string name="remove_category">Remove</string>
<string name="text_empty_holder_primary">It\'s kind of empty here…</string>
<string name="text_categories_holder">You can use categories to organize your favourites. Press «+» to create a category</string>
<string name="text_search_holder_secondary">Try to reformulate the query.</string>
<string name="text_history_holder_primary">What you read will be displayed here</string>
<string name="text_history_holder_secondary">Find what to read in side menu.</string>
<string name="text_local_holder_primary">Save something first</string>
<string name="text_local_holder_secondary">Save it from online sources or import files.</string>
<string name="manga_shelf">Shelf</string>
<string name="recent_manga">Recent</string>
<string name="pages_animation">Page animation</string>
<string name="manga_save_location">Folder for downloads</string>
<string name="not_available">Not available</string>
<string name="cannot_find_available_storage">No available storage</string>
<string name="other_storage">Other storage</string>
<string name="close_menu">Close menu</string>
<string name="open_menu">Open menu</string>
<string name="local_storage">Local storage</string>
<string name="favourites">Favourites</string>
<string name="history">History</string>
<string name="error_occurred">An error occurred</string>
<string name="network_error">Could not connect to the Internet</string>
<string name="details">Details</string>
<string name="chapters">Chapters</string>
<string name="list">List</string>
<string name="detailed_list">Detailed list</string>
<string name="grid">Grid</string>
<string name="list_mode">List mode</string>
<string name="settings">Settings</string>
<string name="remote_sources">Remote sources</string>
<string name="loading_">Loading…</string>
<string name="computing_">Computing…</string>
<string name="chapter_d_of_d">Chapter %1$d of %2$d</string>
<string name="close">Close</string>
<string name="try_again">Try again</string>
<string name="clear_history">Clear history</string>
<string name="nothing_found">Nothing found</string>
<string name="history_is_empty">No history yet</string>
<string name="read">Read</string>
<string name="you_have_not_favourites_yet">No favourites yet</string>
<string name="add_to_favourites">Favourite this</string>
<string name="add_new_category">New category</string>
<string name="add">Add</string>
<string name="enter_category_name">Enter category name</string>
<string name="save">Save</string>
<string name="share">Share</string>
<string name="create_shortcut">Create shortcut…</string>
<string name="share_s">Share %s</string>
<string name="search">Search</string>
<string name="search_manga">Search manga</string>
<string name="manga_downloading_">Downloading…</string>
<string name="processing_">Processing…</string>
<string name="download_complete">Downloaded</string>
<string name="downloads">Downloads</string>
<string name="by_name">Name</string>
<string name="popular">Popular</string>
<string name="updated">Updated</string>
<string name="newest">Newest</string>
<string name="by_rating">Rating</string>
<string name="sort_order">Sorting order</string>
<string name="filter">Filter</string>
<string name="theme">Theme</string>
<string name="light">Light</string>
<string name="dark">Dark</string>
<string name="automatic">Follow system</string>
<string name="pages">Pages</string>
<string name="clear">Clear</string>
<string name="text_clear_history_prompt">Clear all reading history permanently?</string>
<string name="remove">Remove</string>
<string name="_s_removed_from_history">\"%s\" removed from history</string>
<string name="_s_deleted_from_local_storage">\"%s\" deleted from local storage</string>
<string name="wait_for_loading_finish">Wait for loading to finish…</string>
<string name="save_page">Save page</string>
<string name="page_saved">Saved</string>
<string name="share_image">Share image</string>
<string name="_import">Import</string>
<string name="delete">Delete</string>
<string name="operation_not_supported">This operation is not supported</string>
<string name="text_file_not_supported">Either pick a ZIP or CBZ file.</string>
<string name="no_description">No description</string>
<string name="history_and_cache">History and cache</string>
<string name="clear_pages_cache">Clear page cache</string>
<string name="cache">Cache</string>
<string name="text_file_sizes">B|kB|MB|GB|TB</string>
<string name="standard">Standard</string>
<string name="webtoon">Webtoon</string>
<string name="read_mode">Read mode</string>
<string name="grid_size">Grid size</string>
<string name="search_on_s">Search on %s</string>
<string name="delete_manga">Delete manga</string>
<string name="text_delete_local_manga">Delete \"%s\" from device permanently?</string>
<string name="reader_settings">Reader settings</string>
<string name="switch_pages">Switch pages</string>
<string name="taps_on_edges">Edge taps</string>
<string name="volume_buttons">Volume buttons</string>
<string name="_continue">Continue</string>
<string name="warning">Warning</string>
<string name="network_consumption_warning">This may transfer a lot of data</string>
<string name="dont_ask_again">Don\'t ask again</string>
<string name="cancelling_">Cancelling…</string>
<string name="error">Error</string>
<string name="clear_thumbs_cache">Clear thumbnails cache</string>
<string name="clear_search_history">Clear search history</string>
<string name="search_history_cleared">Cleared</string>
<string name="gestures_only">Gestures only</string>
<string name="internal_storage">Internal storage</string>
<string name="external_storage">External storage</string>
<string name="domain">Domain</string>
<string name="application_update">Check for new versions of the app</string>
<string name="app_update_available">A new version of the app is available</string>
<string name="show_notification_app_update">Show notification if a new version is available</string>
<string name="open_in_browser">Open in web browser</string>
<string name="large_manga_save_confirm">This manga has %s. Save all of it?</string>
<string name="save_manga">Save</string>
<string name="notifications">Notifications</string>
<string name="enabled_d_of_d" tools:ignore="PluralsCandidate">%1$d of %2$d on</string>
<string name="new_chapters">New chapters</string>
<string name="download">Download</string>
<string name="read_from_start">Read from start</string>
<string name="restart">Restart</string>
<string name="notifications_settings">Notifications settings</string>
<string name="notification_sound">Notification sound</string>
<string name="light_indicator">LED indicator</string>
<string name="vibration">Vibration</string>
<string name="favourites_categories">Favourite categories</string>
<string name="categories_">Categories…</string>
<string name="rename">Rename</string>
<string name="category_delete_confirm">Remove the \"%s\" category from your favourites? \nAll manga in it will be lost.</string>
<string name="remove_category">Remove</string>
<string name="text_empty_holder_primary">It\'s kind of empty here…</string>
<string name="text_categories_holder">You can use categories to organize your favourites. Press «+» to create a category</string>
<string name="text_search_holder_secondary">Try to reformulate the query.</string>
<string name="text_history_holder_primary">What you read will be displayed here</string>
<string name="text_history_holder_secondary">Find what to read in side menu.</string>
<string name="text_local_holder_primary">Save something first</string>
<string name="text_local_holder_secondary">Save it from online sources or import files.</string>
<string name="manga_shelf">Shelf</string>
<string name="recent_manga">Recent</string>
<string name="pages_animation">Page animation</string>
<string name="manga_save_location">Folder for downloads</string>
<string name="not_available">Not available</string>
<string name="cannot_find_available_storage">No available storage</string>
<string name="other_storage">Other storage</string>
<string name="done">Done</string>
<string name="all_favourites">All favourites</string>
<string name="favourites_category_empty">Empty category</string>
<string name="read_later">Read later</string>
<string name="updates">Updates</string>
<string name="text_feed_holder">New chapters of what you are reading is shown here</string>
<string name="search_results">Search results</string>
<string name="related">Related</string>
<string name="new_version_s">New version: %s</string>
<string name="size_s">Size: %s</string>
<string name="waiting_for_network">Waiting for network…</string>
<string name="clear_updates_feed">Clear updates feed</string>
<string name="updates_feed_cleared">Cleared</string>
<string name="rotate_screen">Rotate screen</string>
<string name="update">Update</string>
<string name="feed_will_update_soon">Feed update will start soon</string>
<string name="track_sources">Look for updates</string>
<string name="dont_check">Don\'t check</string>
<string name="enter_password">Enter password</string>
<string name="wrong_password">Wrong password</string>
<string name="protect_application">Protect the app</string>
<string name="protect_application_summary">Ask for password when starting Kotatsu</string>
<string name="repeat_password">Repeat the password</string>
<string name="passwords_mismatch">Mismatching passwords</string>
<string name="about">About</string>
<string name="app_version">Version %s</string>
<string name="check_for_updates">Check for updates</string>
<string name="checking_for_updates">Checking for updates…</string>
<string name="update_check_failed">Could not look for updates</string>
<string name="no_update_available">No updates available</string>
<string name="right_to_left">Right-to-left (←)</string>
<string name="prefer_rtl_reader">Prefer right-to-left (←) reader</string>
<string name="prefer_rtl_reader_summary">Reading mode can be set up separately for each series</string>
<string name="create_category">New category</string>
<string name="scale_mode">Scale mode</string>
<string name="zoom_mode_fit_center">Fit center</string>
<string name="zoom_mode_fit_height">Fit to height</string>
<string name="zoom_mode_fit_width">Fit to width</string>
<string name="zoom_mode_keep_start">Keep at start</string>
<string name="black_dark_theme">Black</string>
<string name="black_dark_theme_summary">Uses less power on AMOLED screens</string>
<string name="restart_required">Restart required</string>
<string name="backup_restore">Backup and restore</string>
<string name="create_backup">Create data backup</string>
<string name="restore_backup">Restore from backup</string>
<string name="data_restored">Restored</string>
<string name="preparing_">Preparing…</string>
<string name="report_github">Create issue on GitHub</string>
<string name="file_not_found">File not found</string>
<string name="data_restored_success">All data was restored</string>
<string name="data_restored_with_errors">The data was restored, but there are errors</string>
<string name="backup_information">You can create backup of your history and favourites and restore it</string>
<string name="just_now">Just now</string>
<string name="yesterday">Yesterday</string>
<string name="long_ago">Long ago</string>
<string name="group">Group</string>
<string name="today">Today</string>
<string name="tap_to_try_again">Tap to try again</string>
<string name="reader_mode_hint">The chosen configuration will be remembered for this manga</string>
<string name="silent">Silent</string>
<string name="captcha_required">CAPTCHA required</string>
<string name="captcha_solve">Solve</string>
<string name="clear_cookies">Clear cookies</string>
<string name="cookies_cleared">All cookies were removed</string>
<string name="chapters_checking_progress">Checking for new chapters: %1$d of %2$d</string>
<string name="clear_feed">Clear feed</string>
<string name="text_clear_updates_feed_prompt">Clear all update history permanently?</string>
<string name="check_for_new_chapters">Check for new chapters</string>
<string name="reverse">Reverse</string>
<string name="sign_in">Sign in</string>
<string name="auth_required">Sign in to view this content</string>
<string name="default_s">Default: %s</string>
<string name="_and_x_more">…and %1$d more</string>
<string name="next">Next</string>
<string name="protect_application_subtitle">Enter a password to start the app with</string>
<string name="confirm">Confirm</string>
<string name="password_length_hint">The password must be 4 characters or more</string>
<string name="all_favourites">All favourites</string>
<string name="favourites_category_empty">Empty category</string>
<string name="read_later">Read later</string>
<string name="updates">Updates</string>
<string name="text_feed_holder">New chapters of what you are reading is shown here</string>
<string name="search_results">Search results</string>
<string name="related">Related</string>
<string name="new_version_s">New version: %s</string>
<string name="size_s">Size: %s</string>
<string name="waiting_for_network">Waiting for network…</string>
<string name="clear_updates_feed">Clear updates feed</string>
<string name="updates_feed_cleared">Cleared</string>
<string name="rotate_screen">Rotate screen</string>
<string name="update">Update</string>
<string name="feed_will_update_soon">Feed update will start soon</string>
<string name="track_sources">Look for updates</string>
<string name="dont_check">Don\'t check</string>
<string name="enter_password">Enter password</string>
<string name="wrong_password">Wrong password</string>
<string name="protect_application">Protect the app</string>
<string name="protect_application_summary">Ask for password when starting Kotatsu</string>
<string name="repeat_password">Repeat the password</string>
<string name="passwords_mismatch">Mismatching passwords</string>
<string name="about">About</string>
<string name="app_version">Version %s</string>
<string name="check_for_updates">Check for updates</string>
<string name="checking_for_updates">Checking for updates…</string>
<string name="update_check_failed">Could not look for updates</string>
<string name="no_update_available">No updates available</string>
<string name="right_to_left">Right-to-left (←)</string>
<string name="prefer_rtl_reader">Prefer right-to-left (←) reader</string>
<string name="prefer_rtl_reader_summary">Reading mode can be set up separately for each series</string>
<string name="create_category">New category</string>
<string name="scale_mode">Scale mode</string>
<string name="zoom_mode_fit_center">Fit center</string>
<string name="zoom_mode_fit_height">Fit to height</string>
<string name="zoom_mode_fit_width">Fit to width</string>
<string name="zoom_mode_keep_start">Keep at start</string>
<string name="black_dark_theme">Black</string>
<string name="black_dark_theme_summary">Uses less power on AMOLED screens</string>
<string name="restart_required">Restart required</string>
<string name="backup_restore">Backup and restore</string>
<string name="create_backup">Create data backup</string>
<string name="restore_backup">Restore from backup</string>
<string name="data_restored">Restored</string>
<string name="preparing_">Preparing…</string>
<string name="report_github">Create issue on GitHub</string>
<string name="file_not_found">File not found</string>
<string name="data_restored_success">All data was restored</string>
<string name="data_restored_with_errors">The data was restored, but there are errors</string>
<string name="backup_information">You can create backup of your history and favourites and restore it</string>
<string name="just_now">Just now</string>
<string name="yesterday">Yesterday</string>
<string name="long_ago">Long ago</string>
<string name="group">Group</string>
<string name="today">Today</string>
<string name="tap_to_try_again">Tap to try again</string>
<string name="reader_mode_hint">The chosen configuration will be remembered for this manga</string>
<string name="silent">Silent</string>
<string name="captcha_required">CAPTCHA required</string>
<string name="captcha_solve">Solve</string>
<string name="clear_cookies">Clear cookies</string>
<string name="cookies_cleared">All cookies were removed</string>
<string name="chapters_checking_progress">Checking for new chapters: %1$d of %2$d</string>
<string name="clear_feed">Clear feed</string>
<string name="text_clear_updates_feed_prompt">Clear all update history permanently?</string>
<string name="check_for_new_chapters">Check for new chapters</string>
<string name="reverse">Reverse</string>
<string name="sign_in">Sign in</string>
<string name="auth_required">Sign in to view this content</string>
<string name="default_s">Default: %s</string>
<string name="_and_x_more">…and %1$d more</string>
<string name="next">Next</string>
<string name="protect_application_subtitle">Enter a password to start the app with</string>
<string name="confirm">Confirm</string>
<string name="password_length_hint">The password must be 4 characters or more</string>
<string name="search_only_on_s">Search only on %s</string>
<string name="text_clear_search_history_prompt">Remove all recent search queries permanently?</string>
<string name="other">Other</string>
<string name="welcome">Welcome</string>
<string name="backup_saved">Backup saved</string>
<string name="tracker_warning">Some devices have different system behavior, which may break background tasks.</string>
<string name="read_more">Read more</string>
<string name="queued">Queued</string>
<string name="text_downloads_holder">No active downloads</string>
<string name="chapter_is_missing_text">Download or read this missing chapter online.</string>
<string name="chapter_is_missing">The chapter is missing</string>
<string name="about_app_translation_summary">Translate this app</string>
<string name="about_app_translation">Translation</string>
<string name="about_feedback">Feedback</string>
<string name="about_feedback_4pda">Topic on 4PDA</string>
<string name="text_clear_search_history_prompt">Remove all recent search queries permanently?</string>
<string name="other">Other</string>
<string name="welcome">Welcome</string>
<string name="backup_saved">Backup saved</string>
<string name="tracker_warning">Some devices have different system behavior, which may break background tasks.</string>
<string name="read_more">Read more</string>
<string name="queued">Queued</string>
<string name="text_downloads_holder">No active downloads</string>
<string name="chapter_is_missing_text">Download or read this missing chapter online.</string>
<string name="chapter_is_missing">The chapter is missing</string>
<string name="about_app_translation_summary">Translate this app</string>
<string name="about_app_translation">Translation</string>
<string name="about_feedback">Feedback</string>
<string name="about_feedback_4pda">Topic on 4PDA</string>
<string name="auth_complete">Authorized</string>
<string name="auth_not_supported_by">Logging in on %s is not supported</string>
<string name="text_clear_cookies_prompt">You will be logged out from all sources</string>
<string name="genres">Genres</string>
<string name="state_finished">Finished</string>
<string name="state_ongoing">Ongoing</string>
<string name="date_format">Date format</string>
<string name="system_default">Default</string>
<string name="exclude_nsfw_from_history">Exclude NSFW manga from history</string>
<string name="error_empty_name">You must enter a name</string>
<string name="show_pages_numbers">Numbered pages</string>
<string name="enabled_sources">Used sources</string>
<string name="available_sources">Available sources</string>
<string name="dynamic_theme">Dynamic theme</string>
<string name="dynamic_theme_summary">Applies a theme created on the color scheme of your wallpaper</string>
<string name="auth_not_supported_by">Logging in on %s is not supported</string>
<string name="text_clear_cookies_prompt">You will be logged out from all sources</string>
<string name="genres">Genres</string>
<string name="state_finished">Finished</string>
<string name="state_ongoing">Ongoing</string>
<string name="date_format">Date format</string>
<string name="system_default">Default</string>
<string name="exclude_nsfw_from_history">Exclude NSFW manga from history</string>
<string name="error_empty_name">You must enter a name</string>
<string name="show_pages_numbers">Numbered pages</string>
<string name="enabled_sources">Used sources</string>
<string name="available_sources">Available sources</string>
<string name="dynamic_theme">Dynamic theme</string>
<string name="dynamic_theme_summary">Applies a theme created on the color scheme of your wallpaper</string>
<string name="importing_progress">Importing manga: %1$d of %2$d</string>
<string name="screenshots_policy">Screenshot policy</string>
<string name="screenshots_allow">Allow</string>
@@ -288,4 +288,9 @@
<string name="edit">Edit</string>
<string name="edit_category">Edit category</string>
<string name="empty_favourite_categories">No favourite categories</string>
<string name="bookmark_add">Add bookmark</string>
<string name="bookmark_remove">Remove bookmark</string>
<string name="bookmarks">Bookmarks</string>
<string name="bookmark_removed">Bookmark removed</string>
<string name="bookmark_added">Bookmark added</string>
</resources>