Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f669a1ca0f | ||
|
|
5a921ea862 | ||
|
|
810efde0b0 | ||
|
|
03510a1f19 | ||
|
|
049f32d2f0 | ||
|
|
11a9db3cc2 | ||
|
|
57dd5743f0 | ||
|
|
5f37e76c85 | ||
|
|
fc51d49505 | ||
|
|
3dde254452 | ||
|
|
aa21dd9721 | ||
|
|
71f5ee8cb1 |
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/misc.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
|
||||
22
.idea/misc.xml
generated
@@ -4,12 +4,32 @@
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="../../../../../../layout/custom_preview.xml" value="0.1" />
|
||||
<entry key="../../../../../../opt/usr/android-sdk/platforms/android-30/data/res/drawable/list_divider_material.xml" value="0.28512820512820514" />
|
||||
<entry key="../../../../../../opt/usr/android-sdk/platforms/android-30/data/res/layout/simple_dropdown_item_1line.xml" value="0.24739583333333334" />
|
||||
<entry key="app/src/main/res/drawable/tab_indicator.xml" value="0.28512820512820514" />
|
||||
<entry key="app/src/main/res/drawable/tabs_background.xml" value="0.28512820512820514" />
|
||||
<entry key="app/src/main/res/layout-w600dp/fragment_details.xml" value="0.14583333333333334" />
|
||||
<entry key="app/src/main/res/layout-w600dp/fragment_list.xml" value="0.14635416666666667" />
|
||||
<entry key="app/src/main/res/layout/dialog_favorite_categories.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/dialog_list_mode.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/fragment_chapters.xml" value="0.24739583333333334" />
|
||||
<entry key="app/src/main/res/layout/fragment_details.xml" value="0.26145833333333335" />
|
||||
<entry key="app/src/main/res/layout/fragment_favourites.xml" value="0.26296296296296295" />
|
||||
<entry key="app/src/main/res/layout/fragment_feed.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/fragment_list.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/item_branch.xml" value="0.24739583333333334" />
|
||||
<entry key="app/src/main/res/layout/item_branch_dropdown.xml" value="0.25743589743589745" />
|
||||
<entry key="app/src/main/res/layout/item_category_checkable.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/item_manga_grid.xml" value="0.26042632066728455" />
|
||||
<entry key="app/src/main/res/layout/item_manga_list_details.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/item_page_thumb.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/item_recent.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/layout/sheet_pages.xml" value="0.2601851851851852" />
|
||||
<entry key="app/src/main/res/menu/popup_category.xml" value="0.2601851851851852" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
18
README.md
@@ -15,20 +15,20 @@ Legacy build (Android 4.1+): [available here](https://github.com/nv95/Kotatsu/re
|
||||
* Online manga catalogues
|
||||
* Search manga by name and genre
|
||||
* Reading history
|
||||
* Favourites with custom categories
|
||||
* Saving manga and reading it offline
|
||||
* Tablet-optimized modern UI
|
||||
* Reading third-party comics from CBZ
|
||||
* Favourites organized by user-defined categories
|
||||
* Downloading manga and reading it offline. Third-party CBZ archives also supported
|
||||
* Tablet-optimized material design UI
|
||||
* Standard and Webtoon-optimized reader
|
||||
* Notifications about new chapters
|
||||
* Updates feed
|
||||
* Global search
|
||||
* Notifications about new chapters with updates feed
|
||||
|
||||
### Screenshots
|
||||
|
||||
|  |  |  |
|
||||
|  |  |  |
|
||||
|---|---|---|
|
||||
|  |  |  |
|
||||
|  |  |  |
|
||||
|
||||
|  |  |
|
||||
|---|---|
|
||||
|
||||
### License
|
||||
[](http://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
|
||||
@@ -16,7 +16,7 @@ android {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode gitCommits
|
||||
versionName '1.0-rc2'
|
||||
versionName '1.0'
|
||||
|
||||
kapt {
|
||||
arguments {
|
||||
@@ -62,27 +62,26 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
}
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.5.0-beta02'
|
||||
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.core:core-ktx:1.5.0-rc01'
|
||||
implementation 'androidx.activity:activity-ktx:1.2.2'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.3.2'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-service:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-process:2.3.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.0-beta02'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.0-rc01'
|
||||
implementation 'androidx.viewpager2:viewpager2:1.1.0-alpha01'
|
||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||
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'
|
||||
kapt 'androidx.lifecycle:lifecycle-compiler:2.3.1'
|
||||
|
||||
implementation 'androidx.room:room-runtime:2.2.6'
|
||||
implementation 'androidx.room:room-ktx:2.2.6'
|
||||
@@ -103,7 +102,7 @@ dependencies {
|
||||
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
|
||||
|
||||
testImplementation 'junit:junit:4.13.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.json:json:20201115'
|
||||
testImplementation 'org.koin:koin-test:2.2.2'
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import androidx.annotation.CallSuper
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
||||
abstract class AlertDialogFragment<B : ViewBinding> : DialogFragment() {
|
||||
|
||||
@@ -20,7 +21,7 @@ abstract class AlertDialogFragment<B : ViewBinding> : DialogFragment() {
|
||||
val inflater = activity?.layoutInflater ?: LayoutInflater.from(requireContext())
|
||||
val binding = onInflateView(inflater, null)
|
||||
viewBinding = binding
|
||||
return AlertDialog.Builder(requireContext(), theme)
|
||||
return MaterialAlertDialogBuilder(requireContext(), theme)
|
||||
.setView(binding.root)
|
||||
.also(::onBuildDialog)
|
||||
.create()
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.koitharu.kotatsu.databinding.DialogCheckboxBinding
|
||||
|
||||
class CheckBoxAlertDialog private constructor(private val delegate: AlertDialog) :
|
||||
@@ -17,7 +18,7 @@ class CheckBoxAlertDialog private constructor(private val delegate: AlertDialog)
|
||||
|
||||
private val binding = DialogCheckboxBinding.inflate(LayoutInflater.from(context))
|
||||
|
||||
private val delegate = AlertDialog.Builder(context)
|
||||
private val delegate = MaterialAlertDialogBuilder(context)
|
||||
.setView(binding.root)
|
||||
|
||||
fun setTitle(@StringRes titleResId: Int): Builder {
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.view.ViewGroup
|
||||
import android.widget.BaseAdapter
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.databinding.ItemStorageBinding
|
||||
import org.koitharu.kotatsu.local.domain.LocalMangaRepository
|
||||
@@ -23,7 +24,7 @@ class StorageSelectDialog private constructor(private val delegate: AlertDialog)
|
||||
class Builder(context: Context, defaultValue: File?, listener: OnStorageSelectListener) {
|
||||
|
||||
private val adapter = VolumesAdapter(context)
|
||||
private val delegate = AlertDialog.Builder(context)
|
||||
private val delegate = MaterialAlertDialogBuilder(context)
|
||||
|
||||
init {
|
||||
if (adapter.isEmpty) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.text.InputFilter
|
||||
import android.view.LayoutInflater
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.koitharu.kotatsu.databinding.DialogInputBinding
|
||||
|
||||
class TextInputDialog private constructor(
|
||||
@@ -18,7 +19,7 @@ class TextInputDialog private constructor(
|
||||
|
||||
private val binding = DialogInputBinding.inflate(LayoutInflater.from(context))
|
||||
|
||||
private val delegate = AlertDialog.Builder(context)
|
||||
private val delegate = MaterialAlertDialogBuilder(context)
|
||||
.setView(binding.root)
|
||||
|
||||
fun setTitle(@StringRes titleResId: Int): Builder {
|
||||
|
||||
@@ -9,5 +9,6 @@ data class MangaChapter(
|
||||
val name: String,
|
||||
val number: Int,
|
||||
val url: String,
|
||||
val branch: String? = null,
|
||||
val source: MangaSource
|
||||
) : Parcelable
|
||||
@@ -90,6 +90,8 @@ open class MangaLibRepository(loaderContext: MangaLoaderContext) :
|
||||
chapters = ArrayList(total)
|
||||
for (i in 0 until total) {
|
||||
val item = list.getJSONObject(i)
|
||||
val chapterId = item.getLong("chapter_id")
|
||||
val branchName = item.getStringOrNull("username")
|
||||
val url = buildString {
|
||||
append(manga.url)
|
||||
append("/v")
|
||||
@@ -106,9 +108,10 @@ open class MangaLibRepository(loaderContext: MangaLoaderContext) :
|
||||
}
|
||||
chapters.add(
|
||||
MangaChapter(
|
||||
id = generateUid(url),
|
||||
id = generateUid(chapterId),
|
||||
url = url,
|
||||
source = source,
|
||||
branch = branchName,
|
||||
number = total - i,
|
||||
name = name
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.koitharu.kotatsu.details.ui
|
||||
import android.app.ActivityOptions
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import android.widget.AdapterView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ActionMode
|
||||
import androidx.core.graphics.Insets
|
||||
@@ -17,6 +18,7 @@ import org.koitharu.kotatsu.base.ui.list.OnListItemClickListener
|
||||
import org.koitharu.kotatsu.core.model.MangaChapter
|
||||
import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.databinding.FragmentChaptersBinding
|
||||
import org.koitharu.kotatsu.details.ui.adapter.BranchesAdapter
|
||||
import org.koitharu.kotatsu.details.ui.adapter.ChaptersAdapter
|
||||
import org.koitharu.kotatsu.details.ui.adapter.ChaptersSelectionDecoration
|
||||
import org.koitharu.kotatsu.details.ui.model.ChapterListItem
|
||||
@@ -25,7 +27,7 @@ import org.koitharu.kotatsu.reader.ui.ReaderActivity
|
||||
import org.koitharu.kotatsu.reader.ui.ReaderState
|
||||
|
||||
class ChaptersFragment : BaseFragment<FragmentChaptersBinding>(),
|
||||
OnListItemClickListener<MangaChapter>, ActionMode.Callback {
|
||||
OnListItemClickListener<MangaChapter>, ActionMode.Callback, AdapterView.OnItemSelectedListener {
|
||||
|
||||
private val viewModel by sharedViewModel<DetailsViewModel>()
|
||||
|
||||
@@ -48,14 +50,31 @@ class ChaptersFragment : BaseFragment<FragmentChaptersBinding>(),
|
||||
chaptersAdapter = ChaptersAdapter(this)
|
||||
selectionDecoration = ChaptersSelectionDecoration(view.context)
|
||||
with(binding.recyclerViewChapters) {
|
||||
addItemDecoration(DividerItemDecoration(view.context, RecyclerView.VERTICAL))
|
||||
addItemDecoration(
|
||||
DividerItemDecoration(
|
||||
view.context,
|
||||
RecyclerView.VERTICAL
|
||||
)
|
||||
)
|
||||
addItemDecoration(selectionDecoration!!)
|
||||
setHasFixedSize(true)
|
||||
adapter = chaptersAdapter
|
||||
}
|
||||
val branchesAdapter = BranchesAdapter()
|
||||
binding.spinnerBranches.adapter = branchesAdapter
|
||||
binding.spinnerBranches.onItemSelectedListener = this
|
||||
|
||||
viewModel.isLoading.observe(viewLifecycleOwner, this::onLoadingStateChanged)
|
||||
viewModel.chapters.observe(viewLifecycleOwner, this::onChaptersChanged)
|
||||
viewModel.branches.observe(viewLifecycleOwner) {
|
||||
branchesAdapter.setItems(it)
|
||||
binding.spinnerBranches.isVisible = it.size > 1
|
||||
}
|
||||
viewModel.selectedBranchIndex.observe(viewLifecycleOwner) {
|
||||
if (it != -1 && it != binding.spinnerBranches.selectedItemPosition) {
|
||||
binding.spinnerBranches.setSelection(it)
|
||||
}
|
||||
}
|
||||
viewModel.isChaptersReversed.observe(viewLifecycleOwner) {
|
||||
activity?.invalidateOptionsMenu()
|
||||
}
|
||||
@@ -64,6 +83,7 @@ class ChaptersFragment : BaseFragment<FragmentChaptersBinding>(),
|
||||
override fun onDestroyView() {
|
||||
chaptersAdapter = null
|
||||
selectionDecoration = null
|
||||
binding.spinnerBranches.adapter = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
@@ -145,6 +165,12 @@ class ChaptersFragment : BaseFragment<FragmentChaptersBinding>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
viewModel.setSelectedBranch(binding.spinnerBranches.selectedItem as String?)
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) = Unit
|
||||
|
||||
override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
|
||||
val manga = viewModel.manga.value
|
||||
mode.menuInflater.inflate(R.menu.mode_chapters, menu)
|
||||
@@ -174,7 +200,7 @@ class ChaptersFragment : BaseFragment<FragmentChaptersBinding>(),
|
||||
binding.recyclerViewChapters.updatePadding(
|
||||
left = insets.left,
|
||||
right = insets.right,
|
||||
bottom = insets.bottom
|
||||
bottom = insets.bottom + binding.spinnerBranches.height
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.view.ActionMode
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
@@ -15,6 +14,7 @@ import androidx.core.graphics.Insets
|
||||
import androidx.core.net.toFile
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
@@ -144,7 +144,7 @@ class DetailsActivity : BaseActivity<ActivityDetailsBinding>(),
|
||||
}
|
||||
R.id.action_delete -> {
|
||||
viewModel.manga.value?.let { m ->
|
||||
AlertDialog.Builder(this)
|
||||
MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.delete_manga)
|
||||
.setMessage(getString(R.string.text_delete_local_manga, m.title))
|
||||
.setPositiveButton(R.string.delete) { _, _ ->
|
||||
@@ -159,7 +159,7 @@ class DetailsActivity : BaseActivity<ActivityDetailsBinding>(),
|
||||
viewModel.manga.value?.let {
|
||||
val chaptersCount = it.chapters?.size ?: 0
|
||||
if (chaptersCount > 5) {
|
||||
AlertDialog.Builder(this)
|
||||
MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.save_manga)
|
||||
.setMessage(
|
||||
getString(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.koitharu.kotatsu.details.ui
|
||||
|
||||
import androidx.lifecycle.asFlow
|
||||
import androidx.lifecycle.asLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -18,6 +19,7 @@ import org.koitharu.kotatsu.history.domain.HistoryRepository
|
||||
import org.koitharu.kotatsu.local.domain.LocalMangaRepository
|
||||
import org.koitharu.kotatsu.tracker.domain.TrackingRepository
|
||||
import org.koitharu.kotatsu.utils.SingleLiveEvent
|
||||
import org.koitharu.kotatsu.utils.ext.mapToSet
|
||||
import java.io.IOException
|
||||
|
||||
class DetailsViewModel(
|
||||
@@ -31,6 +33,7 @@ class DetailsViewModel(
|
||||
) : BaseViewModel() {
|
||||
|
||||
private val mangaData = MutableStateFlow<Manga?>(intent.manga)
|
||||
private val selectedBranch = MutableStateFlow<String?>(null)
|
||||
|
||||
private val history = mangaData.mapNotNull { it?.id }
|
||||
.distinctUntilChanged()
|
||||
@@ -69,12 +72,24 @@ class DetailsViewModel(
|
||||
|
||||
val onMangaRemoved = SingleLiveEvent<Manga>()
|
||||
|
||||
val branches = mangaData.map {
|
||||
it?.chapters?.mapToSet { x -> x.branch }?.sortedBy { x -> x }.orEmpty()
|
||||
}.asLiveData(viewModelScope.coroutineContext + Dispatchers.Default)
|
||||
|
||||
val selectedBranchIndex = combine(
|
||||
branches.asFlow(),
|
||||
selectedBranch
|
||||
) { branches, selected ->
|
||||
branches.indexOf(selected)
|
||||
}.asLiveData(viewModelScope.coroutineContext + Dispatchers.Default)
|
||||
|
||||
val chapters = combine(
|
||||
mangaData.map { it?.chapters.orEmpty() },
|
||||
history.map { it?.chapterId },
|
||||
newChapters,
|
||||
chaptersReversed
|
||||
) { chapters, currentId, newCount, reversed ->
|
||||
chaptersReversed,
|
||||
selectedBranch
|
||||
) { chapters, currentId, newCount, reversed, branch ->
|
||||
val currentIndex = chapters.indexOfFirst { it.id == currentId }
|
||||
val firstNewIndex = chapters.size - newCount
|
||||
val res = chapters.mapIndexed { index, chapter ->
|
||||
@@ -86,7 +101,7 @@ class DetailsViewModel(
|
||||
else -> ChapterExtra.UNREAD
|
||||
}
|
||||
)
|
||||
}
|
||||
}.filter { it.chapter.branch == branch }
|
||||
if (reversed) res.asReversed() else res
|
||||
}.asLiveData(viewModelScope.coroutineContext + Dispatchers.Default)
|
||||
|
||||
@@ -96,6 +111,15 @@ class DetailsViewModel(
|
||||
?: throw MangaNotFoundException("Cannot find manga")
|
||||
mangaData.value = manga
|
||||
manga = manga.source.repository.getDetails(manga)
|
||||
// find default branch
|
||||
val hist = historyRepository.getOne(manga)
|
||||
selectedBranch.value = if (hist != null) {
|
||||
manga.chapters?.find { it.id == hist.chapterId }?.branch
|
||||
} else {
|
||||
manga.chapters
|
||||
?.groupBy { it.branch }
|
||||
?.maxByOrNull { it.value.size }?.key
|
||||
}
|
||||
mangaData.value = manga
|
||||
}
|
||||
}
|
||||
@@ -114,4 +138,8 @@ class DetailsViewModel(
|
||||
fun setChaptersReversed(newValue: Boolean) {
|
||||
settings.chaptersReverse = newValue
|
||||
}
|
||||
|
||||
fun setSelectedBranch(branch: String?) {
|
||||
selectedBranch.value = branch
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.koitharu.kotatsu.details.ui.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.BaseAdapter
|
||||
import android.widget.TextView
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.utils.ext.replaceWith
|
||||
|
||||
class BranchesAdapter : BaseAdapter() {
|
||||
|
||||
private val dataSet = ArrayList<String?>()
|
||||
|
||||
override fun getCount(): Int {
|
||||
return dataSet.size
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Any? {
|
||||
return dataSet[position]
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return dataSet[position].hashCode().toLong()
|
||||
}
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||
val view = convertView ?: LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_branch, parent, false)
|
||||
(view as TextView).text = dataSet[position]
|
||||
return view
|
||||
}
|
||||
|
||||
override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||
val view = convertView ?: LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_branch_dropdown, parent, false)
|
||||
(view as TextView).text = dataSet[position]
|
||||
return view
|
||||
}
|
||||
|
||||
fun setItems(items: Collection<String?>) {
|
||||
dataSet.replaceWith(items)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,14 @@ class FavouritesPagerAdapter(
|
||||
return FavouritesListFragment.newInstance(item.id)
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return differ.currentList[position].id
|
||||
}
|
||||
|
||||
override fun containsItem(itemId: Long): Boolean {
|
||||
return differ.currentList.any { it.id == itemId }
|
||||
}
|
||||
|
||||
override fun onConfigureTab(tab: TabLayout.Tab, position: Int) {
|
||||
val item = differ.currentList[position]
|
||||
tab.text = item.title
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.koitharu.kotatsu.favourites.ui.categories
|
||||
|
||||
import android.content.Context
|
||||
import android.text.InputType
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.base.ui.dialog.TextInputDialog
|
||||
import org.koitharu.kotatsu.core.model.FavouriteCategory
|
||||
@@ -13,7 +13,7 @@ class CategoriesEditDelegate(
|
||||
) {
|
||||
|
||||
fun deleteCategory(category: FavouriteCategory) {
|
||||
AlertDialog.Builder(context)
|
||||
MaterialAlertDialogBuilder(context)
|
||||
.setMessage(context.getString(R.string.category_delete_confirm, category.title))
|
||||
.setTitle(R.string.remove_category)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import org.koitharu.kotatsu.R
|
||||
@@ -42,7 +42,7 @@ class HistoryListFragment : MangaListFragment() {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.action_clear_history -> {
|
||||
AlertDialog.Builder(context ?: return false)
|
||||
MaterialAlertDialogBuilder(context ?: return false)
|
||||
.setTitle(R.string.clear_history)
|
||||
.setMessage(R.string.text_clear_history_prompt)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
|
||||
@@ -55,6 +55,7 @@ abstract class MangaListFragment : BaseFragment<FragmentListBinding>(),
|
||||
spanSizeLookup.invalidateCache()
|
||||
}
|
||||
open val isSwipeRefreshEnabled = true
|
||||
private var drawer: DrawerLayout? = null
|
||||
|
||||
protected abstract val viewModel: MangaListViewModel
|
||||
|
||||
@@ -70,7 +71,8 @@ abstract class MangaListFragment : BaseFragment<FragmentListBinding>(),
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.drawer?.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||
drawer = binding.root as? DrawerLayout
|
||||
drawer?.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||
listAdapter = MangaListAdapter(get(), viewLifecycleOwner, this, ::resolveException)
|
||||
paginationListener = PaginationScrollListener(4, this)
|
||||
with(binding.recyclerView) {
|
||||
@@ -101,6 +103,7 @@ abstract class MangaListFragment : BaseFragment<FragmentListBinding>(),
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
drawer = null
|
||||
listAdapter = null
|
||||
paginationListener = null
|
||||
spanSizeLookup.invalidateCache()
|
||||
@@ -118,15 +121,15 @@ abstract class MangaListFragment : BaseFragment<FragmentListBinding>(),
|
||||
true
|
||||
}
|
||||
R.id.action_filter -> {
|
||||
binding.drawer?.toggleDrawer(GravityCompat.END)
|
||||
drawer?.toggleDrawer(GravityCompat.END)
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
menu.findItem(R.id.action_filter).isVisible = binding.drawer != null &&
|
||||
binding.drawer?.getDrawerLockMode(GravityCompat.END) != DrawerLayout.LOCK_MODE_LOCKED_CLOSED
|
||||
menu.findItem(R.id.action_filter).isVisible = drawer != null &&
|
||||
drawer?.getDrawerLockMode(GravityCompat.END) != DrawerLayout.LOCK_MODE_LOCKED_CLOSED
|
||||
super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
@@ -199,7 +202,7 @@ abstract class MangaListFragment : BaseFragment<FragmentListBinding>(),
|
||||
state = config.currentFilter,
|
||||
listener = this
|
||||
)
|
||||
binding.drawer?.setDrawerLockMode(
|
||||
drawer?.setDrawerLockMode(
|
||||
if (config.sortOrders.isEmpty() && config.tags.isEmpty()) {
|
||||
DrawerLayout.LOCK_MODE_LOCKED_CLOSED
|
||||
} else {
|
||||
@@ -214,7 +217,7 @@ abstract class MangaListFragment : BaseFragment<FragmentListBinding>(),
|
||||
|
||||
@CallSuper
|
||||
override fun onFilterChanged(filter: MangaFilter) {
|
||||
binding.drawer?.closeDrawers()
|
||||
drawer?.closeDrawers()
|
||||
}
|
||||
|
||||
override fun onWindowInsetsChanged(insets: Insets) {
|
||||
|
||||
@@ -72,6 +72,7 @@ class MangaIndex(source: String?) {
|
||||
jo.put("number", chapter.number)
|
||||
jo.put("url", chapter.url)
|
||||
jo.put("name", chapter.name)
|
||||
jo.put("branch", chapter.branch)
|
||||
jo.put("entries", "%03d\\d{3}".format(chapter.number))
|
||||
chapters.put(chapter.id.toString(), jo)
|
||||
}
|
||||
@@ -97,6 +98,7 @@ class MangaIndex(source: String?) {
|
||||
name = v.getString("name"),
|
||||
url = v.getString("url"),
|
||||
number = v.getInt("number"),
|
||||
branch = v.getStringOrNull("branch"),
|
||||
source = source
|
||||
)
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.activity.result.ActivityResultCallback
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import org.koitharu.kotatsu.BuildConfig
|
||||
@@ -77,7 +77,7 @@ class LocalListFragment : MangaListFragment(), ActivityResultCallback<Uri> {
|
||||
override fun onPopupMenuItemSelected(item: MenuItem, data: Manga): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.action_delete -> {
|
||||
AlertDialog.Builder(context ?: return false)
|
||||
MaterialAlertDialogBuilder(context ?: return false)
|
||||
.setTitle(R.string.delete_manga)
|
||||
.setMessage(getString(R.string.text_delete_local_manga, data.title))
|
||||
.setPositiveButton(R.string.delete) { _, _ ->
|
||||
|
||||
@@ -88,12 +88,12 @@ class PageLoader(
|
||||
}
|
||||
|
||||
suspend fun convertInPlace(file: File) {
|
||||
convertLock.withLock(file) {
|
||||
convertLock.withLock(Lock) {
|
||||
withContext(Dispatchers.Default) {
|
||||
val image = BitmapFactory.decodeFile(file.absolutePath)
|
||||
try {
|
||||
file.outputStream().use { out ->
|
||||
image.compress(Bitmap.CompressFormat.WEBP, 100, out)
|
||||
image.compress(Bitmap.CompressFormat.PNG, 100, out)
|
||||
}
|
||||
} finally {
|
||||
image.recycle()
|
||||
@@ -101,4 +101,6 @@ class PageLoader(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private companion object Lock
|
||||
}
|
||||
@@ -10,12 +10,12 @@ import android.view.*
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.ActivityResultCallback
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.*
|
||||
import androidx.fragment.app.commit
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
@@ -207,7 +207,7 @@ class ReaderActivity : BaseFullscreenActivity<ActivityReaderBinding>(),
|
||||
}
|
||||
|
||||
private fun onError(e: Throwable) {
|
||||
val dialog = AlertDialog.Builder(this)
|
||||
val dialog = MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.error_occurred)
|
||||
.setMessage(e.getDisplayMessage(resources))
|
||||
.setPositiveButton(R.string.close, null)
|
||||
|
||||
@@ -40,7 +40,7 @@ class ReaderViewModel(
|
||||
|
||||
private var loadingJob: Job? = null
|
||||
private val currentState = MutableStateFlow<ReaderState?>(null)
|
||||
private val mangaData = MutableStateFlow<Manga?>(intent.manga)
|
||||
private val mangaData = MutableStateFlow(intent.manga)
|
||||
private val chapters = LongSparseArray<MangaChapter>()
|
||||
|
||||
val readerMode = MutableLiveData<ReaderMode>()
|
||||
@@ -58,7 +58,7 @@ class ReaderViewModel(
|
||||
)
|
||||
}.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default)
|
||||
|
||||
val content = MutableLiveData<ReaderContent>(ReaderContent(emptyList(), null))
|
||||
val content = MutableLiveData(ReaderContent(emptyList(), null))
|
||||
val manga: Manga?
|
||||
get() = mangaData.value
|
||||
|
||||
@@ -80,7 +80,6 @@ class ReaderViewModel(
|
||||
manga.chapters?.forEach {
|
||||
chapters.put(it.id, it)
|
||||
}
|
||||
mangaData.value = manga
|
||||
// determine mode
|
||||
val mode =
|
||||
dataRepository.getReaderMode(manga.id) ?: manga.chapters?.randomOrNull()?.let {
|
||||
@@ -96,6 +95,9 @@ class ReaderViewModel(
|
||||
currentState.value = state ?: historyRepository.getOne(manga)?.let {
|
||||
ReaderState.from(it)
|
||||
} ?: ReaderState.initial(manga)
|
||||
|
||||
val branch = chapters[currentState.value?.chapterId ?: 0L].branch
|
||||
mangaData.value = manga.copy(chapters = manga.chapters?.filter { it.branch == branch })
|
||||
readerMode.postValue(mode)
|
||||
|
||||
val pages = loadChapter(requireNotNull(currentState.value).chapterId)
|
||||
|
||||
@@ -21,6 +21,7 @@ abstract class BaseReaderAdapter<H : BasePageHolder<*>>(
|
||||
|
||||
init {
|
||||
setHasStableIds(true)
|
||||
stateRestorationPolicy = StateRestorationPolicy.PREVENT
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: H, position: Int) {
|
||||
|
||||
@@ -12,7 +12,9 @@ import org.koitharu.kotatsu.reader.ui.ReaderState
|
||||
import org.koitharu.kotatsu.reader.ui.pager.BaseReader
|
||||
import org.koitharu.kotatsu.reader.ui.pager.BaseReaderAdapter
|
||||
import org.koitharu.kotatsu.reader.ui.pager.ReaderPage
|
||||
import org.koitharu.kotatsu.reader.ui.pager.standard.PagerReaderFragment
|
||||
import org.koitharu.kotatsu.utils.ext.*
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
class ReversedReaderFragment : BaseReader<FragmentReaderStandardBinding>() {
|
||||
|
||||
@@ -58,7 +60,10 @@ class ReversedReaderFragment : BaseReader<FragmentReaderStandardBinding>() {
|
||||
}
|
||||
|
||||
override fun switchPageTo(position: Int, smooth: Boolean) {
|
||||
binding.pager.setCurrentItem(reversed(position), smooth)
|
||||
binding.pager.setCurrentItem(
|
||||
reversed(position),
|
||||
smooth && (binding.pager.currentItem - position).absoluteValue < PagerReaderFragment.SMOOTH_SCROLL_LIMIT
|
||||
)
|
||||
}
|
||||
|
||||
override fun onPagesChanged(pages: List<ReaderPage>, pendingState: ReaderState?) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.koitharu.kotatsu.reader.ui.pager.BaseReader
|
||||
import org.koitharu.kotatsu.reader.ui.pager.BaseReaderAdapter
|
||||
import org.koitharu.kotatsu.reader.ui.pager.ReaderPage
|
||||
import org.koitharu.kotatsu.utils.ext.*
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
class PagerReaderFragment : BaseReader<FragmentReaderStandardBinding>() {
|
||||
|
||||
@@ -78,7 +79,10 @@ class PagerReaderFragment : BaseReader<FragmentReaderStandardBinding>() {
|
||||
}
|
||||
|
||||
override fun switchPageTo(position: Int, smooth: Boolean) {
|
||||
binding.pager.setCurrentItem(position, smooth)
|
||||
binding.pager.setCurrentItem(
|
||||
position,
|
||||
smooth && (binding.pager.currentItem - position).absoluteValue < SMOOTH_SCROLL_LIMIT
|
||||
)
|
||||
}
|
||||
|
||||
override fun getCurrentState(): ReaderState? = bindingOrNull()?.run {
|
||||
@@ -94,4 +98,9 @@ class PagerReaderFragment : BaseReader<FragmentReaderStandardBinding>() {
|
||||
private fun notifyPageChanged(page: Int) {
|
||||
viewModel.onCurrentPageChanged(page)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val SMOOTH_SCROLL_LIMIT = 3
|
||||
}
|
||||
}
|
||||
@@ -88,10 +88,6 @@ class WebtoonReaderFragment : BaseReader<FragmentReaderWebtoonBinding>() {
|
||||
}
|
||||
|
||||
override fun switchPageTo(position: Int, smooth: Boolean) {
|
||||
if (smooth) {
|
||||
binding.recyclerView.smoothScrollToPosition(position)
|
||||
} else {
|
||||
binding.recyclerView.firstItem = position
|
||||
}
|
||||
binding.recyclerView.firstItem = position
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -77,7 +77,7 @@ class AppUpdateChecker(private val activity: ComponentActivity) {
|
||||
|
||||
@MainThread
|
||||
private fun showUpdateDialog(version: AppVersion) {
|
||||
AlertDialog.Builder(activity)
|
||||
MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.app_update_available)
|
||||
.setMessage(buildString {
|
||||
append(activity.getString(R.string.new_version_s, version.name))
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.isVisible
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.base.ui.AlertDialogFragment
|
||||
@@ -40,7 +41,7 @@ class BackupDialogFragment : AlertDialogFragment<DialogProgressBinding>() {
|
||||
}
|
||||
|
||||
private fun onError(e: Throwable) {
|
||||
AlertDialog.Builder(context ?: return)
|
||||
MaterialAlertDialogBuilder(context ?: return)
|
||||
.setNegativeButton(R.string.close, null)
|
||||
.setTitle(R.string.error)
|
||||
.setMessage(e.getDisplayMessage(resources))
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.isVisible
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import org.koin.core.parameter.parametersOf
|
||||
import org.koitharu.kotatsu.R
|
||||
@@ -44,7 +45,7 @@ class RestoreDialogFragment : AlertDialogFragment<DialogProgressBinding>() {
|
||||
}
|
||||
|
||||
private fun onError(e: Throwable) {
|
||||
AlertDialog.Builder(context ?: return)
|
||||
MaterialAlertDialogBuilder(context ?: return)
|
||||
.setNegativeButton(R.string.close, null)
|
||||
.setTitle(R.string.error)
|
||||
.setMessage(e.getDisplayMessage(resources))
|
||||
@@ -64,7 +65,7 @@ class RestoreDialogFragment : AlertDialogFragment<DialogProgressBinding>() {
|
||||
}
|
||||
|
||||
private fun onRestoreDone(result: CompositeResult) {
|
||||
val builder = AlertDialog.Builder(context ?: return)
|
||||
val builder = MaterialAlertDialogBuilder(context ?: return)
|
||||
when {
|
||||
result.isAllSuccess -> builder.setTitle(R.string.data_restored)
|
||||
.setMessage(R.string.data_restored_success)
|
||||
|
||||
@@ -2,9 +2,9 @@ package org.koitharu.kotatsu.tracker.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.updatePadding
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import org.koin.android.ext.android.get
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
@@ -80,7 +80,7 @@ class FeedFragment : BaseFragment<FragmentFeedBinding>(), PaginationScrollListen
|
||||
true
|
||||
}
|
||||
R.id.action_clear_feed -> {
|
||||
AlertDialog.Builder(context ?: return false)
|
||||
MaterialAlertDialogBuilder(context ?: return false)
|
||||
.setTitle(R.string.clear_updates_feed)
|
||||
.setMessage(R.string.text_clear_updates_feed_prompt)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
|
||||
5
app/src/main/res/color/tab_text.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?colorPrimary" android:state_selected="true" />
|
||||
<item android:alpha="0.6" android:color="?colorOnSurface" />
|
||||
</selector>
|
||||
9
app/src/main/res/drawable/tab_indicator.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="3dp"
|
||||
android:topRightRadius="3dp" />
|
||||
<size android:height="3dp" />
|
||||
</shape>
|
||||
20
app/src/main/res/drawable/tabs_background.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="?colorSurface" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:left="-2dp"
|
||||
android:right="-2dp"
|
||||
android:top="-2dp">
|
||||
<shape>
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/tabs_line" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -23,13 +23,14 @@
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
style="@style/Widget.MaterialComponents.TabLayout.Colored"
|
||||
style="@style/Widget.MaterialComponents.TabLayout.PrimarySurface"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:background="@android:color/transparent"
|
||||
app:tabGravity="start"
|
||||
app:tabMode="scrollable" />
|
||||
app:tabMode="scrollable"
|
||||
app:tabSelectedTextColor="?colorOnPrimarySurface" />
|
||||
|
||||
</com.google.android.material.appbar.MaterialToolbar>
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/grid_spacing_outer"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
app:fastScrollEnabled="true"
|
||||
app:fastScrollHorizontalThumbDrawable="@drawable/list_thumb"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<TextView
|
||||
style="@style/MaterialAlertDialog.MaterialComponents.Title.Text"
|
||||
android:padding="16dp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add_to_favourites" />
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_grid_title"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
style="@style/MaterialAlertDialog.MaterialComponents.Title.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="?attr/dialogPreferredPadding"
|
||||
|
||||
@@ -1,18 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
<RelativeLayout
|
||||
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_branches"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:visibility="gone"
|
||||
tools:listitem="@layout/item_branch" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_chapters"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_below="@id/spinner_branches"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical"
|
||||
android:scrollbars="vertical"
|
||||
app:fastScrollEnabled="true"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
app:fastScrollHorizontalThumbDrawable="@drawable/list_thumb"
|
||||
app:fastScrollHorizontalTrackDrawable="@drawable/list_track"
|
||||
app:fastScrollVerticalThumbDrawable="@drawable/list_thumb"
|
||||
@@ -25,8 +41,9 @@
|
||||
style="@style/Widget.AppCompat.ProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
@@ -10,7 +10,6 @@
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="4dp"
|
||||
app:tabGravity="center"
|
||||
app:tabMode="scrollable" />
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/grid_spacing_outer"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
app:fastScrollEnabled="true"
|
||||
app:fastScrollHorizontalThumbDrawable="@drawable/list_thumb"
|
||||
|
||||
@@ -1,50 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
android:id="@+id/drawer"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:scrollbars="vertical"
|
||||
app:fastScrollEnabled="true"
|
||||
app:fastScrollHorizontalThumbDrawable="@drawable/list_thumb"
|
||||
app:fastScrollHorizontalTrackDrawable="@drawable/list_track"
|
||||
app:fastScrollVerticalThumbDrawable="@drawable/list_thumb"
|
||||
app:fastScrollVerticalTrackDrawable="@drawable/list_track"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/item_manga_list" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_filter"
|
||||
android:layout_width="240dp"
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="?android:windowBackground"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/grid_spacing_outer"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
app:fastScrollEnabled="true"
|
||||
app:fastScrollHorizontalThumbDrawable="@drawable/list_thumb"
|
||||
app:fastScrollHorizontalTrackDrawable="@drawable/list_track"
|
||||
app:fastScrollVerticalThumbDrawable="@drawable/list_thumb"
|
||||
app:fastScrollVerticalTrackDrawable="@drawable/list_track"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/item_category_checkable" />
|
||||
tools:listitem="@layout/item_manga_list" />
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
</LinearLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_filter"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="?android:windowBackground"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/item_category_checkable" />
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
9
app/src/main/res/layout/item_branch.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CheckedTextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="?android:attr/spinnerItemStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeightSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLargePopupMenu" />
|
||||
9
app/src/main/res/layout/item_branch_dropdown.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CheckedTextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="?android:attr/spinnerDropDownItemStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeightSmall"
|
||||
android:drawableEnd="?android:listChoiceIndicatorSingle"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLargePopupMenu" />
|
||||
@@ -23,6 +23,7 @@
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical|start"
|
||||
android:lines="2"
|
||||
android:elegantTextHeight="true"
|
||||
android:padding="6dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="vertical"
|
||||
android:padding="@dimen/grid_spacing"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="3"
|
||||
tools:listitem="@layout/item_page_thumb" />
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
<color name="red_accent">#FF8A65</color>
|
||||
<color name="dim">#99000000</color>
|
||||
<color name="error">#E57373</color>
|
||||
<color name="tabs_line">#5E636A</color>
|
||||
</resources>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="BaseAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="actionModeCloseDrawable">@drawable/ic_cross</item>
|
||||
@@ -9,5 +10,6 @@
|
||||
<item name="android:statusBarColor">@color/status_bar</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="colorOnPrimary">@android:color/white</item>
|
||||
<item name="tabStyle">@style/Widget.MaterialComponents.TabLayout.New</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="grid_spacing">4dp</dimen>
|
||||
<dimen name="grid_spacing_outer">2dp</dimen>
|
||||
<dimen name="preferred_grid_width">140dp</dimen>
|
||||
</resources>
|
||||
@@ -9,4 +9,5 @@
|
||||
<color name="dim">#99000000</color>
|
||||
<color name="error">#D32F2F</color>
|
||||
<color name="status_bar">#33000000</color>
|
||||
<color name="tabs_line">#C3CFDD</color>
|
||||
</resources>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="grid_spacing">2.5dp</dimen>
|
||||
<dimen name="grid_spacing_outer">2dp</dimen>
|
||||
<dimen name="manga_list_item_height">84dp</dimen>
|
||||
<dimen name="manga_list_details_item_height">120dp</dimen>
|
||||
<dimen name="chapter_list_item_height">46dp</dimen>
|
||||
|
||||
@@ -25,4 +25,19 @@
|
||||
<item name="background">@color/grey</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.MaterialComponents.TabLayout.New">
|
||||
<item name="tabIndicatorFullWidth">false</item>
|
||||
<item name="android:background">@drawable/tabs_background</item>
|
||||
<item name="tabIndicator">@drawable/tab_indicator</item>
|
||||
<item name="tabIconTint">@color/tab_text</item>
|
||||
<item name="tabSelectedTextColor">?colorPrimary</item>
|
||||
<item name="tabTextColor">@color/tab_text</item>
|
||||
<item name="tabTextAppearance">@style/TextAppearance.Design.Tab.New</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Design.Tab.New">
|
||||
<item name="textAllCaps">false</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="BaseAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
@@ -9,6 +10,7 @@
|
||||
<item name="badgeStyle">@style/Widget.MaterialComponents.Badge</item>
|
||||
<item name="android:statusBarColor">@color/status_bar</item>
|
||||
<item name="colorOnPrimary">@android:color/white</item>
|
||||
<item name="tabStyle">@style/Widget.MaterialComponents.TabLayout.New</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme" parent="BaseAppTheme">
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.4.30'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
12
metadata/en-US/full_description.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Kotatsu is a free and open source manga reader for Android.<br>
|
||||
Main Features:
|
||||
<ul>
|
||||
<li>Online manga catalogues</li>
|
||||
<li>Search manga by name and genre</li>
|
||||
<li>Reading history</li>
|
||||
<li>Favourites organized by user-defined categories</li>
|
||||
<li>Downloading manga and reading it offline. Third-party CBZ archives also supported</li>
|
||||
<li>Tablet-optimized material design UI</li>
|
||||
<li>Standard and Webtoon-optimized reader</li>
|
||||
<li>Notifications about new chapters with updates feed</li>
|
||||
</ul>
|
||||
BIN
metadata/en-US/images/phoneScreenshots/1.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
metadata/en-US/images/phoneScreenshots/2.png
Normal file
|
After Width: | Height: | Size: 173 KiB |
BIN
metadata/en-US/images/phoneScreenshots/3.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
metadata/en-US/images/phoneScreenshots/4.png
Normal file
|
After Width: | Height: | Size: 281 KiB |
BIN
metadata/en-US/images/phoneScreenshots/5.png
Normal file
|
After Width: | Height: | Size: 220 KiB |
BIN
metadata/en-US/images/phoneScreenshots/6.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
metadata/en-US/images/tenInchScreenshots/1.png
Normal file
|
After Width: | Height: | Size: 295 KiB |
BIN
metadata/en-US/images/tenInchScreenshots/2.png
Normal file
|
After Width: | Height: | Size: 193 KiB |
1
metadata/en-US/short_description.txt
Normal file
@@ -0,0 +1 @@
|
||||
Manga reader with online catalogues
|
||||
12
metadata/ru/full_description.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Kotatsu - приложения для чтения манги с открытым исходным кодом.<br>
|
||||
Основные возможности:
|
||||
<ul>
|
||||
<li>Онлайн каталоги с мангой</li>
|
||||
<li>Поиск манги по имени и жанрам</li>
|
||||
<li>История чтения</li>
|
||||
<li>Избранное с пользовательскими категориями</li>
|
||||
<li>Возможность сохранять мангу и читать её оффлайн. Поддержка сторонних комиксов в формате CBZ</li>
|
||||
<li>Интерфейс также оптимизирован для планшетов</li>
|
||||
<li>Поддержка манхвы (Webtoon)</li>
|
||||
<li>Уведомления о новых главах и лента обновлений</li>
|
||||
</ul>
|
||||
BIN
metadata/ru/images/phoneScreenshots/1.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
BIN
metadata/ru/images/phoneScreenshots/2.png
Normal file
|
After Width: | Height: | Size: 161 KiB |
BIN
metadata/ru/images/phoneScreenshots/3.png
Normal file
|
After Width: | Height: | Size: 113 KiB |
BIN
metadata/ru/images/phoneScreenshots/4.png
Normal file
|
After Width: | Height: | Size: 173 KiB |
BIN
metadata/ru/images/phoneScreenshots/5.png
Normal file
|
After Width: | Height: | Size: 190 KiB |
BIN
metadata/ru/images/phoneScreenshots/6.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
metadata/ru/images/tenInchScreenshots/1.png
Normal file
|
After Width: | Height: | Size: 272 KiB |
BIN
metadata/ru/images/tenInchScreenshots/2.png
Normal file
|
After Width: | Height: | Size: 177 KiB |
1
metadata/ru/short_description.txt
Normal file
@@ -0,0 +1 @@
|
||||
Приложение для чтения манги с онлайн каталогами
|
||||