farben geändert, default werte fade on und 20 minuten

This commit is contained in:
pi
2025-12-06 22:44:14 +01:00
parent 82276868c4
commit 10c6a8eb95
2 changed files with 9 additions and 8 deletions
@@ -19,7 +19,7 @@ class MainActivity : Activity() {
private var streamId = 0
private val handler = Handler()
private var isPlaying = false
private var fadeEnabled = false
private var fadeEnabled = true
private var totalMillis: Long = 0
private var startTime: Long = 0
private var fadeRunnable: Runnable? = null
@@ -46,7 +46,7 @@ class MainActivity : Activity() {
soundId = soundPool.load(this, R.raw.sound, 1)
updateUI(status, volumeBar, "Bereit", Color.LTGRAY, 1f)
updateUI(status, volumeBar, "Bereit", Color.GREEN, 1f)
fadeToggle.setOnClickListener {
fadeEnabled = !fadeEnabled
fadeToggle.text = "Fade-Out: " + if (fadeEnabled) "ON" else "OFF"
@@ -107,7 +107,7 @@ class MainActivity : Activity() {
}
} else {
// unendlich
updateUI(status, volumeBar, "Läuft: ∞", Color.GREEN, 1f)
updateUI(status, volumeBar, "Stopp: ∞", Color.RED, 1f)
volumeBar.progress = 100
}
}
@@ -115,8 +115,8 @@ class MainActivity : Activity() {
private fun updateCountdown(remainingSec: Int, status: TextView) {
val minutes = remainingSec / 60
val seconds = remainingSec % 60
status.text = String.format("Läuft: %02d:%02d", minutes, seconds)
status.setBackgroundColor(Color.GREEN)
status.text = String.format("Stopp: %02d:%02d", minutes, seconds)
status.setBackgroundColor(Color.RED)
status.setTextColor(Color.BLACK)
}
@@ -127,7 +127,7 @@ class MainActivity : Activity() {
}
handler.removeCallbacks(countdownRunnable ?: Runnable {})
handler.removeCallbacks(fadeRunnable ?: Runnable {})
updateUI(status, volumeBar, "Gestoppt", Color.RED, 0f)
updateUI(status, volumeBar, "Start", Color.GREEN, 0f)
volumeBar.progress = 0
}