|
|
|
@ -10,7 +10,10 @@ import android.view.LayoutInflater
|
|
|
|
import android.view.View
|
|
|
|
import android.view.View
|
|
|
|
import android.view.ViewGroup
|
|
|
|
import android.view.ViewGroup
|
|
|
|
import android.widget.CheckedTextView
|
|
|
|
import android.widget.CheckedTextView
|
|
|
|
|
|
|
|
import android.widget.TextView
|
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
|
|
|
|
|
import androidx.core.view.forEach
|
|
|
|
|
|
|
|
import androidx.core.view.forEachIndexed
|
|
|
|
import androidx.core.view.get
|
|
|
|
import androidx.core.view.get
|
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import androidx.navigation.fragment.navArgs
|
|
|
|
import androidx.navigation.fragment.navArgs
|
|
|
|
@ -20,6 +23,7 @@ import com.cyb3rko.techniklogger.databinding.FragmentProjectBinding
|
|
|
|
import com.cyb3rko.techniklogger.recycler.ProjectTechniker
|
|
|
|
import com.cyb3rko.techniklogger.recycler.ProjectTechniker
|
|
|
|
import com.cyb3rko.techniklogger.recycler.ProjectTechnikerAdapter
|
|
|
|
import com.cyb3rko.techniklogger.recycler.ProjectTechnikerAdapter
|
|
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|
|
|
|
|
|
|
import com.google.android.material.dialog.MaterialDialogs
|
|
|
|
import com.google.android.material.timepicker.MaterialTimePicker
|
|
|
|
import com.google.android.material.timepicker.MaterialTimePicker
|
|
|
|
import com.google.android.material.timepicker.TimeFormat
|
|
|
|
import com.google.android.material.timepicker.TimeFormat
|
|
|
|
import com.parse.ParseObject
|
|
|
|
import com.parse.ParseObject
|
|
|
|
@ -375,18 +379,25 @@ class ProjectFragment : Fragment() {
|
|
|
|
|
|
|
|
|
|
|
|
val checkedNames = mutableListOf<String>()
|
|
|
|
val checkedNames = mutableListOf<String>()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val previousSelection = currentSelection.toList()
|
|
|
|
|
|
|
|
|
|
|
|
MaterialAlertDialogBuilder(myContext)
|
|
|
|
MaterialAlertDialogBuilder(myContext)
|
|
|
|
.setMultiChoiceItems(names.toTypedArray(), currentSelection) { dialogInterface, index, isChecked ->
|
|
|
|
.setMultiChoiceItems(names.toTypedArray(), currentSelection) { dialogInterface, index, isChecked ->
|
|
|
|
val dialogList = (dialogInterface as AlertDialog).listView
|
|
|
|
val name = names[index]
|
|
|
|
val item = dialogList[index] as CheckedTextView
|
|
|
|
if (previousSelection[index]) {
|
|
|
|
|
|
|
|
var disabledIndex = -1
|
|
|
|
if (!item.isEnabled) {
|
|
|
|
val listView = (dialogInterface as AlertDialog).listView
|
|
|
|
item.isChecked = true
|
|
|
|
while (disabledIndex + 1 < names.size && (listView[disabledIndex + 1] as TextView).text != name) {
|
|
|
|
|
|
|
|
disabledIndex++
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (disabledIndex != -1) (listView[disabledIndex + 1] as CheckedTextView).isChecked = true
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (isChecked) {
|
|
|
|
if (isChecked) {
|
|
|
|
checkedNames.add(names[index])
|
|
|
|
if (!checkedNames.contains(name)) {
|
|
|
|
|
|
|
|
checkedNames.add(name)
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
checkedNames.remove(names[index])
|
|
|
|
checkedNames.remove(name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|