mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Disabled gestures during the animation of something disappearing. Prevents a minor blank screen bug.
This commit is contained in:
parent
f64512f865
commit
83325300ae
2 changed files with 20 additions and 2 deletions
|
|
@ -1015,6 +1015,9 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
velocityX: Float,
|
velocityX: Float,
|
||||||
velocityY: Float
|
velocityY: Float
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
if (animations.isInAnim) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (e1 != null) {
|
if (e1 != null) {
|
||||||
val deltaY = e2.y - e1.y
|
val deltaY = e2.y - e1.y
|
||||||
val deltaX = e2.x - e1.x
|
val deltaX = e2.x - e1.x
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import eu.ottop.yamlauncher.settings.SharedPreferenceManager
|
||||||
class Animations (context: Context) {
|
class Animations (context: Context) {
|
||||||
|
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager(context)
|
private val sharedPreferenceManager = SharedPreferenceManager(context)
|
||||||
|
var isInAnim = false
|
||||||
|
|
||||||
// fadeViewIn and fadeViewOut are for smaller item transitions, such as the action menu
|
// fadeViewIn and fadeViewOut are for smaller item transitions, such as the action menu
|
||||||
|
|
||||||
|
|
@ -93,7 +94,7 @@ class Animations (context: Context) {
|
||||||
|
|
||||||
private fun View.slideOutToBottom(duration: Long) {
|
private fun View.slideOutToBottom(duration: Long) {
|
||||||
if (visibility == View.VISIBLE) {
|
if (visibility == View.VISIBLE) {
|
||||||
|
isInAnim = true
|
||||||
animate()
|
animate()
|
||||||
.translationY(height.toFloat() / 5)
|
.translationY(height.toFloat() / 5)
|
||||||
.scaleY(1.2f)
|
.scaleY(1.2f)
|
||||||
|
|
@ -101,7 +102,14 @@ class Animations (context: Context) {
|
||||||
.setDuration(duration/2)
|
.setDuration(duration/2)
|
||||||
.setListener(object : AnimatorListenerAdapter() {
|
.setListener(object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
|
super.onAnimationEnd(animation)
|
||||||
visibility = View.INVISIBLE
|
visibility = View.INVISIBLE
|
||||||
|
isInAnim = false
|
||||||
|
}
|
||||||
|
override fun onAnimationCancel(animation: Animator) {
|
||||||
|
super.onAnimationCancel(animation)
|
||||||
|
visibility = View.INVISIBLE
|
||||||
|
isInAnim = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -118,12 +126,12 @@ class Animations (context: Context) {
|
||||||
.translationY(0f)
|
.translationY(0f)
|
||||||
.setDuration(duration)
|
.setDuration(duration)
|
||||||
.setListener(null)
|
.setListener(null)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun View.fadeOut() {
|
private fun View.fadeOut() {
|
||||||
if (visibility == View.VISIBLE) {
|
if (visibility == View.VISIBLE) {
|
||||||
|
isInAnim = true
|
||||||
val duration = sharedPreferenceManager.getAnimationSpeed()
|
val duration = sharedPreferenceManager.getAnimationSpeed()
|
||||||
|
|
||||||
animate()
|
animate()
|
||||||
|
|
@ -132,7 +140,14 @@ class Animations (context: Context) {
|
||||||
.setDuration(duration/2)
|
.setDuration(duration/2)
|
||||||
.setListener(object : AnimatorListenerAdapter() {
|
.setListener(object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
|
super.onAnimationEnd(animation)
|
||||||
visibility = View.INVISIBLE
|
visibility = View.INVISIBLE
|
||||||
|
isInAnim = false
|
||||||
|
}
|
||||||
|
override fun onAnimationCancel(animation: Animator) {
|
||||||
|
super.onAnimationCancel(animation)
|
||||||
|
visibility = View.INVISIBLE
|
||||||
|
isInAnim = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue