diff --git a/app/src/main/java/com/lukas/music/song/Song.kt b/app/src/main/java/com/lukas/music/song/Song.kt index 4b23eac..ee87349 100644 --- a/app/src/main/java/com/lukas/music/song/Song.kt +++ b/app/src/main/java/com/lukas/music/song/Song.kt @@ -14,12 +14,15 @@ val chordProgression: ChordProgression, val beats: Int ) { - private var beat = 0 - private var chord: Chord = chordProgression.step() + private var beat = beats - 1 + private lateinit var chord: Chord val stepButtons = mutableListOf() lateinit var chordDisplay: TextView fun step() { + if (chordProgression.phrases.isEmpty()) { + return + } Handler(Looper.getMainLooper()).post { stepButtons[beat].isChecked = false beat++ diff --git a/app/src/main/java/com/lukas/music/song/Song.kt b/app/src/main/java/com/lukas/music/song/Song.kt index 4b23eac..ee87349 100644 --- a/app/src/main/java/com/lukas/music/song/Song.kt +++ b/app/src/main/java/com/lukas/music/song/Song.kt @@ -14,12 +14,15 @@ val chordProgression: ChordProgression, val beats: Int ) { - private var beat = 0 - private var chord: Chord = chordProgression.step() + private var beat = beats - 1 + private lateinit var chord: Chord val stepButtons = mutableListOf() lateinit var chordDisplay: TextView fun step() { + if (chordProgression.phrases.isEmpty()) { + return + } Handler(Looper.getMainLooper()).post { stepButtons[beat].isChecked = false beat++ diff --git a/app/src/main/java/com/lukas/music/song/chords/ChordProgression.kt b/app/src/main/java/com/lukas/music/song/chords/ChordProgression.kt index 2e189b4..ba9419e 100644 --- a/app/src/main/java/com/lukas/music/song/chords/ChordProgression.kt +++ b/app/src/main/java/com/lukas/music/song/chords/ChordProgression.kt @@ -3,7 +3,7 @@ class ChordProgression { // TODO: special handler for increasing or decreasing measuresPerPhrase val measuresPerPhrase: Int = 4 - val phrases = mutableListOf(Phrase(), Phrase()) + val phrases = mutableListOf() private var position = 0 fun step(): Chord {