|
|
|
|
@ -29,6 +29,8 @@ import com.google.android.material.timepicker.TimeFormat
|
|
|
|
|
import com.parse.ParseObject
|
|
|
|
|
import es.dmoral.toasty.Toasty
|
|
|
|
|
import java.sql.Time
|
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
@SuppressLint("SetTextI18n")
|
|
|
|
|
class MissionFragment : Fragment() {
|
|
|
|
|
@ -36,12 +38,12 @@ class MissionFragment : Fragment() {
|
|
|
|
|
private lateinit var myContext: Context
|
|
|
|
|
private val args: MissionFragmentArgs by navArgs()
|
|
|
|
|
|
|
|
|
|
private var objectId = ""
|
|
|
|
|
private var time = ""
|
|
|
|
|
private var duration = 0f
|
|
|
|
|
private lateinit var participationAdapter: ParticipationAdapter
|
|
|
|
|
private var adminMode = false
|
|
|
|
|
private var objectId = ""
|
|
|
|
|
private var duration = 0f
|
|
|
|
|
private lateinit var sharedPref: SharedPreferences
|
|
|
|
|
private var time = ""
|
|
|
|
|
|
|
|
|
|
private val binding get() = _binding!!
|
|
|
|
|
|
|
|
|
|
@ -208,11 +210,6 @@ class MissionFragment : Fragment() {
|
|
|
|
|
setProgressBackgroundColorSchemeResource(R.color.refreshLayoutBackground)
|
|
|
|
|
setColorSchemeResources(R.color.refreshLayoutArrow)
|
|
|
|
|
setOnRefreshListener {
|
|
|
|
|
binding.titleView.text = ""
|
|
|
|
|
binding.dateView.text = ""
|
|
|
|
|
binding.locationView.text = ""
|
|
|
|
|
showDivider(false)
|
|
|
|
|
updateTechnikerCount(0)
|
|
|
|
|
loadData()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -223,15 +220,24 @@ class MissionFragment : Fragment() {
|
|
|
|
|
private fun loadData() {
|
|
|
|
|
ParseController.fetchMission(objectId) { mission, e ->
|
|
|
|
|
if (e == null) {
|
|
|
|
|
binding.titleView.text = mission!!.name
|
|
|
|
|
binding.locationView.text = mission.location
|
|
|
|
|
val dates = mission.getString(COLUMN_EINSATZ_DATUM)!!.split(",")
|
|
|
|
|
val dateParts = dates[0].split(".")
|
|
|
|
|
val date = "${dateParts[2]}.${dateParts[1]}.${dateParts[0]}"
|
|
|
|
|
val date = SimpleDateFormat("dd.MM.yyyy", Locale.GERMANY).format(mission!!.date())
|
|
|
|
|
time = mission.time()
|
|
|
|
|
duration = mission.duration
|
|
|
|
|
if (dates.size > 1) time = dates[1]
|
|
|
|
|
val time = if (dates.size > 1) ", ${dates[1]}" else ", $duration h"
|
|
|
|
|
binding.dateView.text = date + time
|
|
|
|
|
|
|
|
|
|
time = if (time != "") ", $time ($duration h)" else ", $duration h"
|
|
|
|
|
val dateTime = date + time
|
|
|
|
|
|
|
|
|
|
binding.apply {
|
|
|
|
|
if (titleView.text != mission.name) {
|
|
|
|
|
titleView.text = mission.name
|
|
|
|
|
}
|
|
|
|
|
if (dateView.text != dateTime) {
|
|
|
|
|
dateView.text = dateTime
|
|
|
|
|
}
|
|
|
|
|
if (locationView.text != mission.location) {
|
|
|
|
|
locationView.text = mission.location
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadParticipations()
|
|
|
|
|
} else {
|
|
|
|
|
|