Disabled Tabbed Library

Likely to be removed forever
Also global update no longer shows download paused notification when queing up
Also bumped up to vCode 62 since 0.9.82 is out
Also fixed issue when the manga details header is taller than the screen
This commit is contained in:
Jay 2020-03-29 00:08:09 -04:00
parent b48cff63e4
commit 44446b8f8a
13 changed files with 30 additions and 43 deletions

View File

@ -34,8 +34,8 @@ android {
minSdkVersion(23) minSdkVersion(23)
targetSdkVersion(29) targetSdkVersion(29)
applicationId = "eu.kanade.tachiyomi" applicationId = "eu.kanade.tachiyomi"
versionCode = 61 versionCode = 62
versionName = "0.9.81" versionName = "0.9.82"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = true multiDexEnabled = true
@ -51,7 +51,7 @@ android {
} }
buildTypes { buildTypes {
getByName("debug") { getByName("debug") {
applicationIdSuffix = ".debug" applicationIdSuffix = ".debugJ2K"
} }
getByName("release") { getByName("release") {
applicationIdSuffix = ".j2k" applicationIdSuffix = ".j2k"

View File

@ -64,7 +64,7 @@ object Migrations {
} }
if (oldVersion < 54) if (oldVersion < 54)
DownloadProvider(context).renameChaapters() DownloadProvider(context).renameChaapters()
if (oldVersion < 61) if (oldVersion < 62)
LibraryPresenter.resetCustomManga() LibraryPresenter.resetCustomManga()
return true return true
} }

View File

@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.data.download.model.DownloadQueue import eu.kanade.tachiyomi.data.download.model.DownloadQueue
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
@ -263,7 +264,7 @@ class Downloader(
// Start downloader if needed // Start downloader if needed
if (autoStart && wasEmpty) { if (autoStart && wasEmpty) {
DownloadService.start(this@Downloader.context) DownloadService.start(this@Downloader.context)
} else if (!isRunning) { } else if (!isRunning && !LibraryUpdateService.isRunning()) {
notifier.onDownloadPaused() notifier.onDownloadPaused()
} }
} }

View File

@ -8,8 +8,6 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.util.lang.chop import eu.kanade.tachiyomi.util.lang.chop
import eu.kanade.tachiyomi.util.lang.removeArticles import eu.kanade.tachiyomi.util.lang.removeArticles
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Calendar import java.util.Calendar
@ -25,8 +23,7 @@ class LibraryCategoryAdapter(val libraryListener: LibraryListener) :
FlexibleAdapter<IFlexible<*>>(null, libraryListener, true) { FlexibleAdapter<IFlexible<*>>(null, libraryListener, true) {
init { init {
setDisplayHeadersAtStartUp(Injekt.get<PreferencesHelper>().libraryAsSingleList() setDisplayHeadersAtStartUp(true)
.getOrDefault())
} }
/** /**
* The list of manga in this category. * The list of manga in this category.

View File

@ -150,8 +150,6 @@ open class LibraryController(
var libraryLayout: Int = preferences.libraryLayout().getOrDefault() var libraryLayout: Int = preferences.libraryLayout().getOrDefault()
private var usePager: Boolean = !preferences.libraryAsSingleList().getOrDefault()
open fun contentView(): View = pager_layout open fun contentView(): View = pager_layout
init { init {
@ -522,7 +520,7 @@ open class LibraryController(
override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean { override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
mode.menuInflater.inflate(R.menu.library_selection, menu) mode.menuInflater.inflate(R.menu.library_selection, menu)
val selectItem = menu.findItem(R.id.action_select_all) val selectItem = menu.findItem(R.id.action_select_all)
selectItem.isVisible = !preferences.libraryAsSingleList().getOrDefault() selectItem.isVisible = false
return true return true
} }

View File

@ -126,7 +126,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
resetRecyclerY() resetRecyclerY()
return return
} }
if (flinging) return if (flinging || presenter.categories.size <= 1) return
if (isDragging) { if (isDragging) {
resetScrollingValues() resetScrollingValues()
resetRecyclerY(false) resetRecyclerY(false)

View File

@ -99,8 +99,6 @@ class LibraryPresenter(
fun getLibrary() { fun getLibrary() {
launchUI { launchUI {
totalChapters = null totalChapters = null
val freshStart = !preferences.libraryAsSingleList().getOrDefault() &&
(currentMangaMap?.values?.firstOrNull()?.firstOrNull()?.header != null)
val mangaMap = withContext(Dispatchers.IO) { val mangaMap = withContext(Dispatchers.IO) {
val library = getLibraryFromDB() val library = getLibraryFromDB()
library.apply { setDownloadCount(library.mangaMap) } library.apply { setDownloadCount(library.mangaMap) }
@ -111,7 +109,7 @@ class LibraryPresenter(
mangaMap mangaMap
} }
currentMangaMap = mangaMap currentMangaMap = mangaMap
updateView(categories, mangaMap, freshStart) updateView(categories, mangaMap)
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
setTotalChapters() setTotalChapters()
} }
@ -315,8 +313,7 @@ class LibraryPresenter(
} }
val ascending = preferences.librarySortingAscending().getOrDefault() val ascending = preferences.librarySortingAscending().getOrDefault()
val useDnD = preferences.libraryAsSingleList().getOrDefault() && !preferences val useDnD = !preferences.hideCategories().getOrDefault()
.hideCategories().getOrDefault()
val sortFn: (LibraryItem, LibraryItem) -> Int = { i1, i2 -> val sortFn: (LibraryItem, LibraryItem) -> Int = { i1, i2 ->
i1.chapterCount = -1 i1.chapterCount = -1
@ -394,7 +391,8 @@ class LibraryPresenter(
val category = initCat ?: allCategories.find { it.id == i1.manga.category } ?: return 0 val category = initCat ?: allCategories.find { it.id == i1.manga.category } ?: return 0
if (category.mangaOrder.isNullOrEmpty() && category.mangaSort == null) { if (category.mangaOrder.isNullOrEmpty() && category.mangaSort == null) {
category.changeSortTo(preferences.librarySortingMode().getOrDefault()) category.changeSortTo(preferences.librarySortingMode().getOrDefault())
db.insertCategory(category).asRxObservable().subscribe() if (category.id == 0) preferences.defaultMangaOrder().set(category.mangaSort.toString())
else db.insertCategory(category).asRxObservable().subscribe()
} }
val compare = when { val compare = when {
category.mangaSort != null -> { category.mangaSort != null -> {
@ -466,7 +464,7 @@ class LibraryPresenter(
val showCategories = !preferences.hideCategories().getOrDefault() val showCategories = !preferences.hideCategories().getOrDefault()
val unreadBadgeType = preferences.unreadBadgeType().getOrDefault() val unreadBadgeType = preferences.unreadBadgeType().getOrDefault()
var libraryManga = db.getLibraryMangas().executeAsBlocking() var libraryManga = db.getLibraryMangas().executeAsBlocking()
val singleList = preferences.libraryAsSingleList().getOrDefault() val singleList = true
if (!showCategories) if (!showCategories)
libraryManga = libraryManga.distinctBy { it.id } libraryManga = libraryManga.distinctBy { it.id }
/*val libraryMap = libraryManga.map { manga -> /*val libraryMap = libraryManga.map { manga ->
@ -505,12 +503,10 @@ class LibraryPresenter(
// LibraryItem(manga, libraryLayout).apply { unreadType = unreadBadgeType } // LibraryItem(manga, libraryLayout).apply { unreadType = unreadBadgeType }
}.toMap() }.toMap()
}.toMutableMap() }.toMutableMap()
if (libraryMap.containsKey(0))
categories.add(0, createDefaultCategory())
if (showCategories) { if (showCategories) {
categories.forEach { category -> categories.forEach { category ->
if (!libraryMap.containsKey(category.id)) { if (category.id ?: 0 <= 0 && !libraryMap.containsKey(category.id)) {
val headerItem = val headerItem =
LibraryHeaderItem({ getCategory(category.id!!) }, category.id!!) LibraryHeaderItem({ getCategory(category.id!!) }, category.id!!)
libraryMap[category.id!!] = listOf( libraryMap[category.id!!] = listOf(
@ -525,6 +521,9 @@ class LibraryPresenter(
} }
} }
if (libraryMap.containsKey(0))
categories.add(0, createDefaultCategory())
if (categories.size == 1 && showCategories) if (categories.size == 1 && showCategories)
categories.first().name = context.getString(R.string.label_library) categories.first().name = context.getString(R.string.label_library)

View File

@ -145,12 +145,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
val currentRoot = router.backstack.firstOrNull() val currentRoot = router.backstack.firstOrNull()
if (currentRoot?.tag()?.toIntOrNull() != id) { if (currentRoot?.tag()?.toIntOrNull() != id) {
when (id) { when (id) {
R.id.nav_library -> setRoot( R.id.nav_library -> setRoot(LibraryListController(), id)
if (preferences.libraryAsSingleList()
.getOrDefault()
) LibraryListController()
else LibraryController(), id
)
R.id.nav_recents -> { R.id.nav_recents -> {
setRoot(RecentsController(), id) setRoot(RecentsController(), id)
// if (preferences.showRecentUpdates().getOrDefault()) setRoot( // if (preferences.showRecentUpdates().getOrDefault()) setRoot(
@ -273,8 +268,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (Migrations.upgrade(preferences)) { if (Migrations.upgrade(preferences)) {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
MaterialDialog(this).title(text = "Welcome to the J2K MD2 Beta").message( MaterialDialog(this).title(text = "Welcome to the J2K MD2 Beta").message(
text = "This beta is for testing the upcoming " + "release. Requests for new additions this beta will ignored (however" + " suggestions on how to better implement a feature in this beta are " + "welcome).\n\nFor any bugs you come across, there is a bug report " + "button in settings.\n\nAs a reminder this is a *BETA* build and bugs" + " may happen and features may be missing/not implemented yet." + "\n\nEnjoy and thanks for testing!" text = "This beta is for testing the upcoming release. Requests for new additions for this beta will ignored (however suggestions on how to better implement a feature in this beta are welcome).\n\nFor any bugs you come across, there is a bug report button in settings.\n\nAs a reminder this is a *BETA* build; bugs may happen, features may be missing/not implemented yet, and screens can change.\n\nEnjoy and thanks for testing!"
).positiveButton(android.R.string.ok).cancelOnTouchOutside(false).show() ).positiveButton(android.R.string.ok).cancelOnTouchOutside(false).show()
} else ChangelogDialogController().showDialog(router) } else ChangelogDialogController().showDialog(router)
} }
} }

View File

@ -1170,8 +1170,10 @@ class MangaDetailsController : BaseController,
* Called to set the last used catalogue at the top of the view. * Called to set the last used catalogue at the top of the view.
*/ */
private fun addMangaHeader() { private fun addMangaHeader() {
adapter?.removeAllScrollableHeaders() if (adapter?.scrollableHeaders?.isEmpty() == true) {
adapter?.addScrollableHeader(presenter.headerItem) adapter?.removeAllScrollableHeaders()
adapter?.addScrollableHeader(presenter.headerItem)
}
} }
private fun setStatusBarAndToolbar() { private fun setStatusBarAndToolbar() {

View File

@ -13,11 +13,9 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.data.library.LibraryUpdateService import eu.kanade.tachiyomi.data.library.LibraryUpdateService
import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Target import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Target
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.ui.library.LibraryController
import eu.kanade.tachiyomi.ui.library.LibraryListController import eu.kanade.tachiyomi.ui.library.LibraryListController
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
@ -156,10 +154,7 @@ class SettingsAdvancedController : SettingsController() {
private fun clearDatabase() { private fun clearDatabase() {
// Avoid weird behavior by going back to the library. // Avoid weird behavior by going back to the library.
val newBackstack = listOf(RouterTransaction.with( val newBackstack = listOf(RouterTransaction.with(
if (preferences.libraryAsSingleList().getOrDefault()) LibraryListController())) +
LibraryListController()
else
LibraryController())) +
router.backstack.drop(1) router.backstack.drop(1)
router.setBackstack(newBackstack, FadeChangeHandler()) router.setBackstack(newBackstack, FadeChangeHandler())

View File

@ -29,13 +29,13 @@ class SettingsLibraryController : SettingsController() {
titleRes = R.string.pref_category_library titleRes = R.string.pref_category_library
preferenceCategory { preferenceCategory {
titleRes = R.string.pref_category_library_display titleRes = R.string.pref_category_library_display
/*
switchPreference { switchPreference {
key = Keys.libraryAsSingleList key = Keys.libraryAsSingleList
titleRes = R.string.pref_library_single_list titleRes = R.string.pref_library_single_list
summaryRes = R.string.pref_library_single_list_summary summaryRes = R.string.pref_library_single_list_summary
defaultValue = false defaultValue = false
} }*/
switchPreference { switchPreference {
key = Keys.removeArticles key = Keys.removeArticles

View File

@ -254,11 +254,11 @@
<string name="pref_category_library_migration">Migration</string> <string name="pref_category_library_migration">Migration</string>
<string name="pref_keep_category_sorting">Change category sorting when moving</string> <string name="pref_keep_category_sorting">Change category sorting when moving</string>
<string name="pref_keep_category_sorting_summary">In single list mode, should dragging and <string name="pref_keep_category_sorting_summary">Should dragging and
dropping an entry into a new category change the category\'s sorting to drag &amp; dropping an entry into a new category change the category\'s sorting to drag &amp;
drop?</string> drop?</string>
<string name="always_ask">Always ask</string> <string name="always_ask">Always ask</string>
<string name="option_keep_category_sort">Keep current sorting method</string> <string name="option_keep_category_sort">Keep category\'s current sorting</string>
<string name="option_switch_to_dnd">Switch to Drag &amp; Drop</string> <string name="option_switch_to_dnd">Switch to Drag &amp; Drop</string>

Binary file not shown.