|
|
|
@ -52,11 +52,11 @@ class MissionPusherFragment : Fragment() {
|
|
|
|
val timePickerBuilder = TimePickerBuilder()
|
|
|
|
val timePickerBuilder = TimePickerBuilder()
|
|
|
|
|
|
|
|
|
|
|
|
binding.dateButton.setOnClickListener {
|
|
|
|
binding.dateButton.setOnClickListener {
|
|
|
|
if (date != "") {
|
|
|
|
if (date.isNotEmpty()) {
|
|
|
|
datePickerBuilder.setInitialDate(date)
|
|
|
|
datePickerBuilder.setInitialDate(date)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (time != "") {
|
|
|
|
if (time.isNotEmpty()) {
|
|
|
|
val times = time.split(" Uhr")[0].split(" - ")
|
|
|
|
val times = time.split(" Uhr")[0].split(" - ")
|
|
|
|
timePickerBuilder.apply {
|
|
|
|
timePickerBuilder.apply {
|
|
|
|
initialStart = HourMinute.fromString(times[0])
|
|
|
|
initialStart = HourMinute.fromString(times[0])
|
|
|
|
@ -78,7 +78,7 @@ class MissionPusherFragment : Fragment() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (childKey != "") {
|
|
|
|
if (childKey.isNotEmpty()) {
|
|
|
|
binding.deleteButton.show()
|
|
|
|
binding.deleteButton.show()
|
|
|
|
binding.deleteButton.setOnClickListener {
|
|
|
|
binding.deleteButton.setOnClickListener {
|
|
|
|
MaterialAlertDialogBuilder(myContext)
|
|
|
|
MaterialAlertDialogBuilder(myContext)
|
|
|
|
@ -114,12 +114,12 @@ class MissionPusherFragment : Fragment() {
|
|
|
|
val name = binding.nameEditText.text.toString().trim()
|
|
|
|
val name = binding.nameEditText.text.toString().trim()
|
|
|
|
val location = binding.locationEditText.text.toString().trim()
|
|
|
|
val location = binding.locationEditText.text.toString().trim()
|
|
|
|
|
|
|
|
|
|
|
|
if (name != "" && location != "" && time != "") {
|
|
|
|
if (name.isNotEmpty() && location.isNotEmpty() && time.isNotEmpty()) {
|
|
|
|
mission.setName(name)
|
|
|
|
mission.setName(name)
|
|
|
|
mission.setLocation(location)
|
|
|
|
mission.setLocation(location)
|
|
|
|
val dateTimes = date.split(".")
|
|
|
|
val dateTimes = date.split(".")
|
|
|
|
var dateTime = "${dateTimes[2]}.${dateTimes[1]}.${dateTimes[0]}"
|
|
|
|
var dateTime = "${dateTimes[2]}.${dateTimes[1]}.${dateTimes[0]}"
|
|
|
|
if (time != "") dateTime += ",$time"
|
|
|
|
if (time.isNotEmpty()) dateTime += ",$time"
|
|
|
|
mission.setDate(dateTime)
|
|
|
|
mission.setDate(dateTime)
|
|
|
|
mission.setDuration(duration)
|
|
|
|
mission.setDuration(duration)
|
|
|
|
mission.setYear(Safe.getKey(myContext, CURRENT_YEAR))
|
|
|
|
mission.setYear(Safe.getKey(myContext, CURRENT_YEAR))
|
|
|
|
@ -150,25 +150,25 @@ class MissionPusherFragment : Fragment() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun restoreInformation() {
|
|
|
|
private fun restoreInformation() {
|
|
|
|
if (name != "") {
|
|
|
|
if (name.isNotEmpty()) {
|
|
|
|
binding.nameEditText.text = SpannableStringBuilder(name)
|
|
|
|
binding.nameEditText.text = SpannableStringBuilder(name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (location != "") {
|
|
|
|
if (location.isNotEmpty()) {
|
|
|
|
binding.locationEditText.text = SpannableStringBuilder(location)
|
|
|
|
binding.locationEditText.text = SpannableStringBuilder(location)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (date != "") {
|
|
|
|
if (date.isNotEmpty()) {
|
|
|
|
binding.dateView.text = Html.fromHtml("<b>Datum:</b><br/>${date}")
|
|
|
|
binding.dateView.text = Html.fromHtml("<b>Datum:</b><br/>${date}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (time != "") {
|
|
|
|
if (time.isNotEmpty()) {
|
|
|
|
binding.durationView.text = Html.fromHtml("<b>Dauer:</b> $time Uhr, $duration Stunden")
|
|
|
|
binding.durationView.text = Html.fromHtml("<b>Dauer:</b> $time Uhr, $duration Stunden")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
binding.durationView.text = Html.fromHtml("<b>Dauer:</b> $duration Stunden")
|
|
|
|
binding.durationView.text = Html.fromHtml("<b>Dauer:</b> $duration Stunden")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (childKey == "") {
|
|
|
|
mission = if (childKey.isEmpty()) {
|
|
|
|
mission = Mission()
|
|
|
|
Mission()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
mission = Mission.emptyObject(childKey)
|
|
|
|
Mission.emptyObject(childKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|