mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Improve death dialog display
This commit is contained in:
parent
a9326eaa17
commit
0b4ea3cb0c
4 changed files with 11 additions and 6 deletions
|
|
@ -57,8 +57,6 @@
|
|||
android:scaleType="centerCrop"
|
||||
android:paddingBottom="400dp"
|
||||
/>
|
||||
|
||||
|
||||
</com.habitrpg.android.habitica.ui.views.login.LoginBackgroundView>
|
||||
|
||||
</com.habitrpg.android.habitica.ui.views.login.LockableScrollView>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ object MainNavigationController {
|
|||
private val navController: NavController?
|
||||
get() { return controllerReference?.get() }
|
||||
|
||||
val isReady: Boolean
|
||||
get() = controllerReference?.get() != null
|
||||
|
||||
fun setup(navController: NavController) {
|
||||
this.controllerReference = WeakReference(navController)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,11 +89,15 @@ class DeathActivity: BaseActivity() {
|
|||
|
||||
private fun startAnimating() {
|
||||
binding.ghostView.startAnimation(Animations.bobbingAnimation())
|
||||
makeCoins(305)
|
||||
makeCoins(160)
|
||||
binding.heartView.post {
|
||||
makeCoins(305)
|
||||
makeCoins(160)
|
||||
}
|
||||
}
|
||||
|
||||
private fun makeCoins(startAngle: Int) {
|
||||
val positionArray = intArrayOf(0, 0)
|
||||
binding.heartView.getLocationOnScreen(positionArray)
|
||||
ParticleSystem(
|
||||
binding.confettiContainer,
|
||||
14,
|
||||
|
|
@ -105,7 +109,7 @@ class DeathActivity: BaseActivity() {
|
|||
.setSpeedRange(0.01f, 0.03f)
|
||||
.setFadeOut(4000, AccelerateInterpolator())
|
||||
.setSpeedModuleAndAngleRange(0.01f, 0.03f, startAngle, startAngle+80)
|
||||
.emit(550, 670, 3, 6000)
|
||||
.emit(binding.root.width / 2, positionArray[1] + (binding.heartView.height/2), 3, 6000)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ open class MainActivity : BaseActivity(), SnackbarActivity {
|
|||
}
|
||||
|
||||
val now = Date().time
|
||||
if (!this.isFinishing && now - lastDeathDialogDisplay > 60000) {
|
||||
if (!this.isFinishing && MainNavigationController.isReady && now - lastDeathDialogDisplay > 60000) {
|
||||
lastDeathDialogDisplay = now
|
||||
MainNavigationController.navigate(R.id.deathActivity)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue