1 Commits
v0.8.1 ... v0.9

Author SHA1 Message Date
pi
10c6a8eb95 farben geändert, default werte fade on und 20 minuten 2025-12-06 22:44:14 +01:00
2 changed files with 9 additions and 8 deletions

View File

@@ -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
}

View File

@@ -21,7 +21,7 @@
android:layout_height="50dp" />
<TextView
android:id="@+id/statusText"
android:text="Bereit"
android:text="Start"
android:textSize="26sp"
android:gravity="center"
android:textColor="#000000"
@@ -33,6 +33,7 @@
<EditText
android:id="@+id/timerInput"
android:hint="Sleep Timer (Minuten)"
android:text="20"
android:inputType="number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -40,7 +41,7 @@
<TextView
android:id="@+id/fadeToggle"
android:text="Fade-Out: OFF"
android:text="Fade-Out: ON"
android:gravity="center"
android:padding="12dp"
android:layout_marginTop="20dp"