allow start of objective when all previous are finished
This commit is contained in:
parent
3d68b28179
commit
8cc51abae9
|
@ -161,7 +161,7 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
holder.accomplished.visibility = View.GONE
|
||||
holder.unFinish.visibility = View.GONE
|
||||
holder.unStart.visibility = View.GONE
|
||||
if (position == 0 || objectivesPlugin.objectives[position - 1].isAccomplished)
|
||||
if (position == 0 || objectivesPlugin.allPriorAccomplished(position))
|
||||
holder.start.visibility = View.VISIBLE
|
||||
else
|
||||
holder.start.visibility = View.GONE
|
||||
|
|
|
@ -144,6 +144,14 @@ class ObjectivesPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun allPriorAccomplished(position: Int) : Boolean {
|
||||
var accomplished = true
|
||||
for (i in 0 until position) {
|
||||
accomplished = accomplished && objectives[i].isAccomplished
|
||||
}
|
||||
return accomplished
|
||||
}
|
||||
|
||||
/**
|
||||
* Constraints interface
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue