Files
svxhomyak/app/src/main/java/ru/ua1zbe/svxremote/SplashActivity.kt
ua1zbe 9790f9d69c Show centered node join/leave overlay for 5s (v1.0.4)
- Replaces bottom toast: dark rounded card centered on screen,
  auto-hides after 5 seconds
- Optional test trigger via node_toast_test intent extra
2026-08-14 13:28:55 +03:00

72 lines
2.0 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package ru.ua1zbe.svxremote
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
/** Красивая заставка с плавным появлением логотипа. */
class SplashActivity : Activity() {
companion object {
@Volatile
var mainAlive = false
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (mainAlive) {
openMain()
return
}
setContentView(R.layout.activity_splash)
val title = findViewById<View>(R.id.splash_title)
val subtitle = findViewById<View>(R.id.splash_subtitle)
val line = findViewById<View>(R.id.splash_line)
title.alpha = 0f
subtitle.alpha = 0f
line.alpha = 0f
title.animate()
.alpha(1f)
.scaleX(1.0f)
.scaleY(1.0f)
.setStartDelay(150)
.setDuration(700)
.setInterpolator(AccelerateDecelerateInterpolator())
.start()
subtitle.animate()
.alpha(1f)
.setStartDelay(600)
.setDuration(600)
.start()
line.animate()
.alpha(1f)
.setStartDelay(900)
.setDuration(500)
.start()
window.decorView.postDelayed({
openMain()
}, 4000)
}
private fun openMain() {
val intent = Intent(this, MainActivity::class.java)
.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TOP or
Intent.FLAG_ACTIVITY_SINGLE_TOP
)
val testText = this.intent?.getStringExtra("node_toast_test")
if (testText != null) intent.putExtra("node_toast_test", testText)
startActivity(intent)
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
finish()
}
}