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() checkRenew()
val files = mangaFiles[manga.id] ?: return false val files = mangaFiles[manga.id]?.toSet() ?: return false
return files.any { file -> provider.getValidChapterDirNames(chapter).any { return files.any { file -> provider.getValidChapterDirNames(chapter).any {
it.toLowerCase() == file.toLowerCase() it.toLowerCase() == file.toLowerCase()
} } } }

View File

@ -275,7 +275,8 @@ class MangaDetailsController : BaseController,
} }
private fun setInsets(insets: WindowInsets, appbarHeight: Int, offset: Int) { 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 headerHeight = appbarHeight + insets.systemWindowInsetTop
swipe_refresh.setProgressViewOffset(false, (-40).dpToPx, headerHeight + offset) swipe_refresh.setProgressViewOffset(false, (-40).dpToPx, headerHeight + offset)
// 1dp extra to line up chapter header and manga header // 1dp extra to line up chapter header and manga header

View File

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

View File

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

View File

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