mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 05:45:10 +01:00
Various fixes for crashes from Tracepot
This commit is contained in:
parent
65071dc01e
commit
3e541a0500
@ -64,7 +64,8 @@ open class MangaImpl : Manga {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return url.hashCode()
|
if (::url.isInitialized) return url.hashCode()
|
||||||
|
else return (id ?: 0L).hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -163,7 +163,7 @@ class LibraryController(
|
|||||||
activeCategory = order
|
activeCategory = order
|
||||||
if (presenter.categories.size > 1 && dy != 0) {
|
if (presenter.categories.size > 1 && dy != 0) {
|
||||||
val headerItem = getHeader() ?: return
|
val headerItem = getHeader() ?: return
|
||||||
val view = fast_scroller.getChildAt(0) ?: return
|
val view = fast_scroller?.getChildAt(0) ?: return
|
||||||
val index = adapter.headerItems.indexOf(headerItem)
|
val index = adapter.headerItems.indexOf(headerItem)
|
||||||
textAnim?.cancel()
|
textAnim?.cancel()
|
||||||
textAnim = text_view_m.animate().alpha(0f).setDuration(250L).setStartDelay(2000)
|
textAnim = text_view_m.animate().alpha(0f).setDuration(250L).setStartDelay(2000)
|
||||||
@ -186,12 +186,12 @@ class LibraryController(
|
|||||||
when (newState) {
|
when (newState) {
|
||||||
RecyclerView.SCROLL_STATE_DRAGGING -> {
|
RecyclerView.SCROLL_STATE_DRAGGING -> {
|
||||||
scrollAnim?.cancel()
|
scrollAnim?.cancel()
|
||||||
if (fast_scroller.translationX != 0f) {
|
if (fast_scroller?.translationX != 0f) {
|
||||||
fast_scroller.show()
|
fast_scroller?.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RecyclerView.SCROLL_STATE_IDLE -> {
|
RecyclerView.SCROLL_STATE_IDLE -> {
|
||||||
scrollAnim = fast_scroller.hide()
|
scrollAnim = fast_scroller?.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ class LibraryController(
|
|||||||
activity!!.theme.resolveAttribute(R.attr.actionBarTintColor, tv, true)
|
activity!!.theme.resolveAttribute(R.attr.actionBarTintColor, tv, true)
|
||||||
swipe_refresh.setStyle()
|
swipe_refresh.setStyle()
|
||||||
scrollViewWith(recycler, swipeRefreshLayout = swipe_refresh, afterInsets = { insets ->
|
scrollViewWith(recycler, swipeRefreshLayout = swipe_refresh, afterInsets = { insets ->
|
||||||
fast_scroller.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
fast_scroller?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
topMargin = insets.systemWindowInsetTop
|
topMargin = insets.systemWindowInsetTop
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -405,11 +405,11 @@ class LibraryController(
|
|||||||
|
|
||||||
fun updateShowScrollbar(show: Boolean) {
|
fun updateShowScrollbar(show: Boolean) {
|
||||||
alwaysShowScroller = show
|
alwaysShowScroller = show
|
||||||
fast_scroller.setBackground(!show)
|
fast_scroller?.setBackground(!show)
|
||||||
if (libraryLayout == 0) reattachAdapter()
|
if (libraryLayout == 0) reattachAdapter()
|
||||||
scrollAnim?.cancel()
|
scrollAnim?.cancel()
|
||||||
if (show) fast_scroller.translationX = 0f
|
if (show) fast_scroller?.translationX = 0f
|
||||||
else scrollAnim = fast_scroller.hide()
|
else scrollAnim = fast_scroller?.hide()
|
||||||
setRecyclerLayout()
|
setRecyclerLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,9 +503,9 @@ class LibraryController(
|
|||||||
if (justStarted && freshStart) {
|
if (justStarted && freshStart) {
|
||||||
scrollToHeader(activeCategory)
|
scrollToHeader(activeCategory)
|
||||||
if (!alwaysShowScroller) {
|
if (!alwaysShowScroller) {
|
||||||
fast_scroller.show(false)
|
fast_scroller?.show(false)
|
||||||
view?.post {
|
view?.post {
|
||||||
scrollAnim = fast_scroller.hide(2000)
|
scrollAnim = fast_scroller?.hide(2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import android.os.Bundle
|
|||||||
import com.bluelinelabs.conductor.Controller
|
import com.bluelinelabs.conductor.Controller
|
||||||
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
import eu.kanade.tachiyomi.ui.source.global_search.SourceSearchController
|
|
||||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||||
|
import eu.kanade.tachiyomi.ui.source.global_search.SourceSearchController
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||||
import kotlinx.android.synthetic.main.main_activity.*
|
import kotlinx.android.synthetic.main.main_activity.*
|
||||||
@ -16,8 +16,8 @@ class SearchActivity : MainActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
toolbar.navigationIcon = drawerArrow
|
toolbar?.navigationIcon = drawerArrow
|
||||||
toolbar.setNavigationOnClickListener {
|
toolbar?.setNavigationOnClickListener {
|
||||||
popToRoot()
|
popToRoot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,10 +477,12 @@ class MangaDetailsPresenter(
|
|||||||
updateChapters()
|
updateChapters()
|
||||||
withContext(Dispatchers.Main) { controller.updateChapters(this@MangaDetailsPresenter.chapters) }
|
withContext(Dispatchers.Main) { controller.updateChapters(this@MangaDetailsPresenter.chapters) }
|
||||||
} catch (e: java.lang.Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
controller.showError(trimException(e))
|
controller.showError(trimException(e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun trimException(e: java.lang.Exception): String {
|
private fun trimException(e: java.lang.Exception): String {
|
||||||
return (if (e.message?.contains(": ") == true) e.message?.split(": ")?.drop(1)
|
return (if (e.message?.contains(": ") == true) e.message?.split(": ")?.drop(1)
|
||||||
|
@ -140,10 +140,10 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
* activity of the change and requests the preload of the next chapter if this is the last page.
|
* activity of the change and requests the preload of the next chapter if this is the last page.
|
||||||
*/
|
*/
|
||||||
private fun onReaderPageSelected(page: ReaderPage) {
|
private fun onReaderPageSelected(page: ReaderPage) {
|
||||||
val pages = page.chapter.pages!! // Won't be null because it's the loaded chapter
|
|
||||||
Timber.d("onReaderPageSelected: ${page.number}/${pages.size}")
|
|
||||||
activity.onPageSelected(page)
|
activity.onPageSelected(page)
|
||||||
|
|
||||||
|
val pages = page.chapter.pages ?: return
|
||||||
|
Timber.d("onReaderPageSelected: ${page.number}/${pages.size}")
|
||||||
// Preload next chapter once we're within the last 3 pages of the current chapter
|
// Preload next chapter once we're within the last 3 pages of the current chapter
|
||||||
val inPreloadRange = pages.size - page.number < 3
|
val inPreloadRange = pages.size - page.number < 3
|
||||||
if (inPreloadRange) {
|
if (inPreloadRange) {
|
||||||
|
@ -253,6 +253,7 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
fun refresh() = presenter.getRecents()
|
fun refresh() = presenter.getRecents()
|
||||||
|
|
||||||
fun showLists(recents: List<RecentMangaItem>) {
|
fun showLists(recents: List<RecentMangaItem>) {
|
||||||
|
if (view == null) return
|
||||||
swipe_refresh.isRefreshing = LibraryUpdateService.isRunning()
|
swipe_refresh.isRefreshing = LibraryUpdateService.isRunning()
|
||||||
adapter.updateItems(recents)
|
adapter.updateItems(recents)
|
||||||
adapter.removeAllScrollableHeaders()
|
adapter.removeAllScrollableHeaders()
|
||||||
|
Loading…
Reference in New Issue
Block a user