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

View File

@ -64,7 +64,7 @@ object Migrations {
}
if (oldVersion < 54)
DownloadProvider(context).renameChaapters()
if (oldVersion < 61)
if (oldVersion < 62)
LibraryPresenter.resetCustomManga()
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.download.model.Download
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.model.Page
import eu.kanade.tachiyomi.source.online.HttpSource
@ -263,7 +264,7 @@ class Downloader(
// Start downloader if needed
if (autoStart && wasEmpty) {
DownloadService.start(this@Downloader.context)
} else if (!isRunning) {
} else if (!isRunning && !LibraryUpdateService.isRunning()) {
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.util.lang.chop
import eu.kanade.tachiyomi.util.lang.removeArticles
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat
import java.util.Calendar
@ -25,8 +23,7 @@ class LibraryCategoryAdapter(val libraryListener: LibraryListener) :
FlexibleAdapter<IFlexible<*>>(null, libraryListener, true) {
init {
setDisplayHeadersAtStartUp(Injekt.get<PreferencesHelper>().libraryAsSingleList()
.getOrDefault())
setDisplayHeadersAtStartUp(true)
}
/**
* The list of manga in this category.

View File

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

View File

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

View File

@ -99,8 +99,6 @@ class LibraryPresenter(
fun getLibrary() {
launchUI {
totalChapters = null
val freshStart = !preferences.libraryAsSingleList().getOrDefault() &&
(currentMangaMap?.values?.firstOrNull()?.firstOrNull()?.header != null)
val mangaMap = withContext(Dispatchers.IO) {
val library = getLibraryFromDB()
library.apply { setDownloadCount(library.mangaMap) }
@ -111,7 +109,7 @@ class LibraryPresenter(
mangaMap
}
currentMangaMap = mangaMap
updateView(categories, mangaMap, freshStart)
updateView(categories, mangaMap)
withContext(Dispatchers.IO) {
setTotalChapters()
}
@ -315,8 +313,7 @@ class LibraryPresenter(
}
val ascending = preferences.librarySortingAscending().getOrDefault()
val useDnD = preferences.libraryAsSingleList().getOrDefault() && !preferences
.hideCategories().getOrDefault()
val useDnD = !preferences.hideCategories().getOrDefault()
val sortFn: (LibraryItem, LibraryItem) -> Int = { i1, i2 ->
i1.chapterCount = -1
@ -394,7 +391,8 @@ class LibraryPresenter(
val category = initCat ?: allCategories.find { it.id == i1.manga.category } ?: return 0
if (category.mangaOrder.isNullOrEmpty() && category.mangaSort == null) {
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 {
category.mangaSort != null -> {
@ -466,7 +464,7 @@ class LibraryPresenter(
val showCategories = !preferences.hideCategories().getOrDefault()
val unreadBadgeType = preferences.unreadBadgeType().getOrDefault()
var libraryManga = db.getLibraryMangas().executeAsBlocking()
val singleList = preferences.libraryAsSingleList().getOrDefault()
val singleList = true
if (!showCategories)
libraryManga = libraryManga.distinctBy { it.id }
/*val libraryMap = libraryManga.map { manga ->
@ -505,12 +503,10 @@ class LibraryPresenter(
// LibraryItem(manga, libraryLayout).apply { unreadType = unreadBadgeType }
}.toMap()
}.toMutableMap()
if (libraryMap.containsKey(0))
categories.add(0, createDefaultCategory())
if (showCategories) {
categories.forEach { category ->
if (!libraryMap.containsKey(category.id)) {
if (category.id ?: 0 <= 0 && !libraryMap.containsKey(category.id)) {
val headerItem =
LibraryHeaderItem({ getCategory(category.id!!) }, category.id!!)
libraryMap[category.id!!] = listOf(
@ -525,6 +521,9 @@ class LibraryPresenter(
}
}
if (libraryMap.containsKey(0))
categories.add(0, createDefaultCategory())
if (categories.size == 1 && showCategories)
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()
if (currentRoot?.tag()?.toIntOrNull() != id) {
when (id) {
R.id.nav_library -> setRoot(
if (preferences.libraryAsSingleList()
.getOrDefault()
) LibraryListController()
else LibraryController(), id
)
R.id.nav_library -> setRoot(LibraryListController(), id)
R.id.nav_recents -> {
setRoot(RecentsController(), id)
// if (preferences.showRecentUpdates().getOrDefault()) setRoot(
@ -273,8 +268,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (Migrations.upgrade(preferences)) {
if (BuildConfig.DEBUG) {
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!"
).positiveButton(android.R.string.ok).cancelOnTouchOutside(false).show()
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()
} 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.
*/
private fun addMangaHeader() {
adapter?.removeAllScrollableHeaders()
adapter?.addScrollableHeader(presenter.headerItem)
if (adapter?.scrollableHeaders?.isEmpty() == true) {
adapter?.removeAllScrollableHeaders()
adapter?.addScrollableHeader(presenter.headerItem)
}
}
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.library.LibraryUpdateService
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.source.SourceManager
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.util.system.launchUI
import eu.kanade.tachiyomi.util.system.toast
@ -156,10 +154,7 @@ class SettingsAdvancedController : SettingsController() {
private fun clearDatabase() {
// Avoid weird behavior by going back to the library.
val newBackstack = listOf(RouterTransaction.with(
if (preferences.libraryAsSingleList().getOrDefault())
LibraryListController()
else
LibraryController())) +
LibraryListController())) +
router.backstack.drop(1)
router.setBackstack(newBackstack, FadeChangeHandler())

View File

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

View File

@ -254,11 +254,11 @@
<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_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;
drop?</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>

Binary file not shown.