Fix lifecycle crashes

realmasync
Laurent 3 years ago
parent 7d7ae3bf82
commit 004bf5031a
  1. 16
      app/src/main/java/net/pokeranalytics/android/ui/modules/feed/FeedFragment.kt
  2. 18
      app/src/main/java/net/pokeranalytics/android/ui/modules/feed/NewDataMenuActivity.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/session/SessionFragment.kt

@ -603,13 +603,17 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate, PurchaseLis
} }
private fun displayBlogPostButton(newCount: Int = 0) { private fun displayBlogPostButton(newCount: Int = 0) {
var show = false
if (Preferences.shouldShowBlogTips(requireContext()) && newCount > 0) { context?.let { context ->
show = true var show = false
this.badgeDrawable?.number = newCount if (Preferences.shouldShowBlogTips(context) && newCount > 0) {
show = true
this.badgeDrawable?.number = newCount
}
this.binding.postButton.isVisible = show
this.badgeDrawable?.isVisible = show
} }
this.binding.postButton.isVisible = show
this.badgeDrawable?.isVisible = show
} }
} }

@ -117,14 +117,18 @@ class NewDataMenuActivity : BaseActivity() {
private fun showMenu() { private fun showMenu() {
val menuContainer = binding.menuContainer val menuContainer = binding.menuContainer
val cx = menuContainer.measuredWidth - fabSize / 2
val cy = menuContainer.measuredHeight - fabSize / 2
val finalRadius = max(menuContainer.width, menuContainer.height)
val anim = ViewAnimationUtils.createCircularReveal(menuContainer, cx, cy, 0f, finalRadius.toFloat())
anim.duration = 150
menuContainer.visibility = View.VISIBLE if (menuContainer.isAttachedToWindow) {
anim.start() val cx = menuContainer.measuredWidth - fabSize / 2
val cy = menuContainer.measuredHeight - fabSize / 2
val finalRadius = max(menuContainer.width, menuContainer.height)
val anim = ViewAnimationUtils.createCircularReveal(menuContainer, cx, cy, 0f, finalRadius.toFloat())
anim.duration = 150
menuContainer.visibility = View.VISIBLE
anim.start()
}
} }
/** /**

@ -76,7 +76,7 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
CrashLogging.log("session (id=${this.currentSession.id}): valid=${currentSession.isValid}, managed=${currentSession.isManaged}, loaded=${currentSession.isLoaded} ") // CrashLogging.log("session (id=${this.currentSession.id}): valid=${currentSession.isValid}, managed=${currentSession.isManaged}, loaded=${currentSession.isLoaded} ")
this.refreshTimer() this.refreshTimer()
} }

Loading…
Cancel
Save