remove deprecated call to isUserVisibleHint() and test if the view has been destroyed instead.
prevent potential memory leak by clearing the toolbarVisibilityDisposable reference.
This commit is contained in:
parent
0cc229fd67
commit
09ddffbf64
|
@ -45,9 +45,9 @@ import com.keylesspalace.tusky.util.viewBinding
|
|||
import com.keylesspalace.tusky.util.visible
|
||||
import com.ortiz.touchview.OnTouchCoordinatesListener
|
||||
import com.ortiz.touchview.TouchImageView
|
||||
import kotlin.math.abs
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.abs
|
||||
|
||||
class ViewImageFragment : ViewMediaFragment() {
|
||||
interface PhotoActionsListener {
|
||||
|
@ -232,7 +232,7 @@ class ViewImageFragment : ViewMediaFragment() {
|
|||
}
|
||||
|
||||
override fun onToolbarVisibilityChange(visible: Boolean) {
|
||||
if (!userVisibleHint) return
|
||||
if (view == null) return
|
||||
|
||||
isDescriptionVisible = showingDescription && visible
|
||||
val alpha = if (isDescriptionVisible) 1.0f else 0.0f
|
||||
|
|
|
@ -100,6 +100,7 @@ abstract class ViewMediaFragment : Fragment() {
|
|||
|
||||
override fun onDestroyView() {
|
||||
toolbarVisibilityDisposable?.invoke()
|
||||
toolbarVisibilityDisposable = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ class ViewVideoFragment : ViewMediaFragment(), Injectable {
|
|||
}
|
||||
|
||||
override fun onToolbarVisibilityChange(visible: Boolean) {
|
||||
if (!userVisibleHint) {
|
||||
if (view == null) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue