Made further documentation and safety changes. Scraper classes (StudIPParser.kt, StwParser.kt) still need to be checked for safety.

This commit is contained in:
denizk0461
2023-04-27 20:27:42 +02:00
parent 9d6489f83b
commit ccd77a5daf
57 changed files with 349 additions and 213 deletions
@@ -6,6 +6,13 @@ import android.app.TimePickerDialog
import android.os.Bundle
import android.widget.TimePicker
/**
* Dialogue used for letting the user pick a timestamp.
*
* @param timestamp timestamp that is to be edited
* @param listener listener for when the user finishes setting a time
* @param isEventStart whether the timestamp to be edited is the start of the event
*/
class TimePickerFragment(
private val timestamp: String,
private val listener: OnTimeSetListener,
@@ -14,14 +21,36 @@ class TimePickerFragment(
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val timestampSplit = timestamp.split(":")
return TimePickerDialog(activity, this, timestampSplit[0].toInt(), timestampSplit[1].toInt(), true)
return TimePickerDialog(
activity,
this,
timestampSplit[0].toInt(),
timestampSplit[1].toInt(),
true,
)
}
/**
* Custom implementation of TimePickerDialog#OnTimeSetListener that includes a boolean to find
* out whether the start or the end timestamp has been edited.
*/
interface OnTimeSetListener {
/**
* Timestamp has been edited by the user.
*
* @param hours hour of the timestamp
* @param minutes minute of the timestamp
* @param isEventStart whether the timestamp to be edited is the start of the event
*/
fun onTimeSet(hours: Int, minutes: Int, isEventStart: Boolean)
}
/**
* Override the implementation of TimePickerDialog#OnTimeSetListener.
*/
override fun onTimeSet(picker: TimePicker?, hours: Int, minutes: Int) {
// Use custom implementation of OnTimeSetListener
listener.onTimeSet(hours, minutes, isEventStart)
}
}