Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ package com.barryrowe.android.coveralls.coveragetest
import androidx.lifecycle.ViewModel

class MainViewModel(
private val names: List<String> = listOf("John", "Sally", "Erica", "Brad", "Veda")
_names: List<String> = mutableListOf("John", "Sally", "Erica", "Brad", "Veda")
) : ViewModel() {

private val names = mutableListOf<String>()

init {
names.addAll(_names)
}


private var currentIndex = 0
var name = names[currentIndex]

Expand All @@ -14,4 +21,8 @@ class MainViewModel(
currentIndex = currentIndex.inc() % names.size
name = names[currentIndex]
}

fun addName(newName: String) {
names.add(newName)
}
}