You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
838 B
26 lines
838 B
package net.pokeranalytics.android.util
|
|
|
|
import android.app.DatePickerDialog
|
|
import android.app.Dialog
|
|
import android.os.Bundle
|
|
import android.widget.DatePicker
|
|
import androidx.fragment.app.DialogFragment
|
|
import java.util.*
|
|
|
|
class DatePickerFragment : DialogFragment(), DatePickerDialog.OnDateSetListener {
|
|
|
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
|
// Use the current date as the default date in the picker
|
|
val c = Calendar.getInstance()
|
|
val year = c.get(Calendar.YEAR)
|
|
val month = c.get(Calendar.MONTH)
|
|
val day = c.get(Calendar.DAY_OF_MONTH)
|
|
|
|
// Create a new instance of DatePickerDialog and return it
|
|
return DatePickerDialog(activity, this, year, month, day)
|
|
}
|
|
|
|
override fun onDateSet(view: DatePicker, year: Int, month: Int, day: Int) {
|
|
// Do something with the date chosen by the user
|
|
}
|
|
} |