Fixing tracepot crashes p1

This commit is contained in:
Jay 2020-05-07 21:10:33 -04:00
parent 7b9ee0d75b
commit 283ff636f4
5 changed files with 18 additions and 15 deletions

View File

@ -77,7 +77,7 @@ class DownloadCache(
checkRenew()
val files = mangaFiles[manga.id] ?: return false
val files = mangaFiles[manga.id]?.toSet() ?: return false
return files.any { file -> provider.getValidChapterDirNames(chapter).any {
it.toLowerCase() == file.toLowerCase()
} }

View File

@ -275,7 +275,8 @@ class MangaDetailsController : BaseController,
}
private fun setInsets(insets: WindowInsets, appbarHeight: Int, offset: Int) {
recycler?.updatePaddingRelative(bottom = insets.systemWindowInsetBottom)
val recycler = recycler ?: return
recycler.updatePaddingRelative(bottom = insets.systemWindowInsetBottom)
headerHeight = appbarHeight + insets.systemWindowInsetTop
swipe_refresh.setProgressViewOffset(false, (-40).dpToPx, headerHeight + offset)
// 1dp extra to line up chapter header and manga header

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.ui.recent_updates
import android.app.Activity
import android.view.View
import androidx.core.content.ContextCompat
import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -69,13 +70,12 @@ class RecentChapterHolder(private val view: View, private val adapter: RecentCha
}
// Set cover
if ((view.context as? Activity)?.isDestroyed != true) {
GlideApp.with(itemView.context).clear(manga_cover)
if (!item.manga.thumbnail_url.isNullOrEmpty()) {
GlideApp.with(itemView.context)
.load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.circleCrop()
.into(manga_cover)
GlideApp.with(itemView.context).load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE).circleCrop().into(manga_cover)
}
}
val chapterColor = ChapterUtil.chapterColor(itemView.context, item)

View File

@ -151,17 +151,19 @@ class SourceController : NucleusController<SourcePresenter>(),
}
override fun onStateChanged(p0: View, state: Int) {
val ext_bottom_sheet = ext_bottom_sheet ?: return
if (state == BottomSheetBehavior.STATE_EXPANDED) activity?.appbar?.y = 0f
val extBottomSheet = ext_bottom_sheet ?: return
if (state == BottomSheetBehavior.STATE_EXPANDED) {
activity?.appbar?.y = 0f
}
if (state == BottomSheetBehavior.STATE_EXPANDED ||
state == BottomSheetBehavior.STATE_COLLAPSED) {
sheet_layout.alpha =
sheet_layout?.alpha =
if (state == BottomSheetBehavior.STATE_COLLAPSED) 1f else 0f
showingExtensions = state == BottomSheetBehavior.STATE_EXPANDED
setTitle()
if (state == BottomSheetBehavior.STATE_EXPANDED)
ext_bottom_sheet.fetchOnlineExtensionsIfNeeded()
else ext_bottom_sheet.shouldCallApi = true
extBottomSheet.fetchOnlineExtensionsIfNeeded()
else extBottomSheet.shouldCallApi = true
activity?.invalidateOptionsMenu()
}

View File

@ -190,7 +190,7 @@ open class BrowseSourceController(bundle: Bundle) :
recycler.adapter = adapter
scrollViewWith(recycler, true, afterInsets = { insets ->
fab.updateLayoutParams<ViewGroup.MarginLayoutParams> {
fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = insets.systemWindowInsetBottom + 16.dpToPx
}
})