mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
use the new date/time theme picker way
This commit is contained in:
@@ -70,7 +70,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:266b95747d'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:b0bdd457be'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
|
@@ -62,7 +62,6 @@ class EventActivity : SimpleActivity() {
|
||||
private var mRepeatLimit = 0L
|
||||
private var mRepeatRule = 0
|
||||
private var mEventTypeId = REGULAR_EVENT_TYPE_ID
|
||||
private var mDialogTheme = 0
|
||||
private var mEventOccurrenceTS = 0L
|
||||
private var mLastSavePromptTS = 0L
|
||||
private var mEventCalendarId = STORED_LOCALLY_ONLY
|
||||
@@ -92,7 +91,6 @@ class EventActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
val intent = intent ?: return
|
||||
mDialogTheme = getDialogTheme()
|
||||
mWasContactsPermissionChecked = hasPermission(PERMISSION_READ_CONTACTS)
|
||||
|
||||
val eventId = intent.getLongExtra(EVENT_ID, 0L)
|
||||
@@ -1306,7 +1304,7 @@ class EventActivity : SimpleActivity() {
|
||||
private fun setupStartDate() {
|
||||
hideKeyboard()
|
||||
val datepicker = DatePickerDialog(
|
||||
this, mDialogTheme, startDateSetListener, mEventStartDateTime.year, mEventStartDateTime.monthOfYear - 1,
|
||||
this, getDatePickerDialogTheme(), startDateSetListener, mEventStartDateTime.year, mEventStartDateTime.monthOfYear - 1,
|
||||
mEventStartDateTime.dayOfMonth
|
||||
)
|
||||
|
||||
@@ -1318,7 +1316,7 @@ class EventActivity : SimpleActivity() {
|
||||
hideKeyboard()
|
||||
TimePickerDialog(
|
||||
this,
|
||||
mDialogTheme,
|
||||
getTimePickerDialogTheme(),
|
||||
startTimeSetListener,
|
||||
mEventStartDateTime.hourOfDay,
|
||||
mEventStartDateTime.minuteOfHour,
|
||||
@@ -1329,7 +1327,7 @@ class EventActivity : SimpleActivity() {
|
||||
private fun setupEndDate() {
|
||||
hideKeyboard()
|
||||
val datepicker = DatePickerDialog(
|
||||
this, mDialogTheme, endDateSetListener, mEventEndDateTime.year, mEventEndDateTime.monthOfYear - 1,
|
||||
this, getDatePickerDialogTheme(), endDateSetListener, mEventEndDateTime.year, mEventEndDateTime.monthOfYear - 1,
|
||||
mEventEndDateTime.dayOfMonth
|
||||
)
|
||||
|
||||
@@ -1339,7 +1337,14 @@ class EventActivity : SimpleActivity() {
|
||||
|
||||
private fun setupEndTime() {
|
||||
hideKeyboard()
|
||||
TimePickerDialog(this, mDialogTheme, endTimeSetListener, mEventEndDateTime.hourOfDay, mEventEndDateTime.minuteOfHour, config.use24HourFormat).show()
|
||||
TimePickerDialog(
|
||||
this,
|
||||
getTimePickerDialogTheme(),
|
||||
endTimeSetListener,
|
||||
mEventEndDateTime.hourOfDay,
|
||||
mEventEndDateTime.minuteOfHour,
|
||||
config.use24HourFormat
|
||||
).show()
|
||||
}
|
||||
|
||||
private val startDateSetListener = DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
|
||||
|
@@ -763,7 +763,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
val currentDateTime = DateTime.now()
|
||||
TimePickerDialog(
|
||||
this,
|
||||
getDialogTheme(),
|
||||
getTimePickerDialogTheme(),
|
||||
timeListener,
|
||||
currentDateTime.hourOfDay,
|
||||
currentDateTime.minuteOfHour,
|
||||
|
@@ -23,7 +23,6 @@ import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
class TaskActivity : SimpleActivity() {
|
||||
private var mDialogTheme = 0
|
||||
private var mEventTypeId = REGULAR_EVENT_TYPE_ID
|
||||
private lateinit var mTaskDateTime: DateTime
|
||||
private lateinit var mTask: Event
|
||||
@@ -37,7 +36,6 @@ class TaskActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
val intent = intent ?: return
|
||||
mDialogTheme = getDialogTheme()
|
||||
updateColors()
|
||||
val taskId = intent.getLongExtra(EVENT_ID, 0L)
|
||||
ensureBackgroundThread {
|
||||
@@ -226,7 +224,7 @@ class TaskActivity : SimpleActivity() {
|
||||
private fun setupDate() {
|
||||
hideKeyboard()
|
||||
val datepicker = DatePickerDialog(
|
||||
this, mDialogTheme, dateSetListener, mTaskDateTime.year, mTaskDateTime.monthOfYear - 1, mTaskDateTime.dayOfMonth
|
||||
this, getDatePickerDialogTheme(), dateSetListener, mTaskDateTime.year, mTaskDateTime.monthOfYear - 1, mTaskDateTime.dayOfMonth
|
||||
)
|
||||
|
||||
datepicker.datePicker.firstDayOfWeek = if (config.isSundayFirst) Calendar.SUNDAY else Calendar.MONDAY
|
||||
@@ -236,7 +234,7 @@ class TaskActivity : SimpleActivity() {
|
||||
private fun setupTime() {
|
||||
hideKeyboard()
|
||||
TimePickerDialog(
|
||||
this, mDialogTheme, timeSetListener, mTaskDateTime.hourOfDay, mTaskDateTime.minuteOfHour, config.use24HourFormat
|
||||
this, getTimePickerDialogTheme(), timeSetListener, mTaskDateTime.hourOfDay, mTaskDateTime.minuteOfHour, config.use24HourFormat
|
||||
).show()
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@ import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.seconds
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.getNowSeconds
|
||||
import com.simplemobiletools.commons.extensions.getDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.getDatePickerDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.value
|
||||
import kotlinx.android.synthetic.main.dialog_repeat_limit_type_picker.view.*
|
||||
@@ -39,13 +39,13 @@ class RepeatLimitTypePickerDialog(val activity: Activity, var repeatLimit: Long,
|
||||
updateRepeatLimitText()
|
||||
|
||||
dialog = AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { dialogInterface, i -> confirmRepetition() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this) {
|
||||
activity.currentFocus?.clearFocus()
|
||||
}
|
||||
.setPositiveButton(R.string.ok) { dialogInterface, i -> confirmRepetition() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this) {
|
||||
activity.currentFocus?.clearFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCheckedItem() = when {
|
||||
@@ -84,8 +84,10 @@ class RepeatLimitTypePickerDialog(val activity: Activity, var repeatLimit: Long,
|
||||
|
||||
private fun showRepetitionLimitDialog() {
|
||||
val repeatLimitDateTime = Formatter.getDateTimeFromTS(if (repeatLimit != 0L) repeatLimit else getNowSeconds())
|
||||
val datepicker = DatePickerDialog(activity, activity.getDialogTheme(), repetitionLimitDateSetListener, repeatLimitDateTime.year,
|
||||
repeatLimitDateTime.monthOfYear - 1, repeatLimitDateTime.dayOfMonth)
|
||||
val datepicker = DatePickerDialog(
|
||||
activity, activity.getDatePickerDialogTheme(), repetitionLimitDateSetListener, repeatLimitDateTime.year,
|
||||
repeatLimitDateTime.monthOfYear - 1, repeatLimitDateTime.dayOfMonth
|
||||
)
|
||||
|
||||
datepicker.datePicker.firstDayOfWeek = if (activity.config.isSundayFirst) Calendar.SUNDAY else Calendar.MONDAY
|
||||
datepicker.show()
|
||||
|
@@ -11,19 +11,17 @@ import androidx.viewpager.widget.ViewPager
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||
import com.simplemobiletools.calendar.pro.adapters.MyDayPagerAdapter
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.helpers.DAILY_VIEW
|
||||
import com.simplemobiletools.calendar.pro.helpers.DAY_CODE
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.interfaces.NavigationListener
|
||||
import com.simplemobiletools.commons.extensions.getDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.getDatePickerDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.fragment_days_holder.view.*
|
||||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
class DayFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||
private val PREFILLED_DAYS = 251
|
||||
@@ -108,7 +106,7 @@ class DayFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||
}
|
||||
|
||||
override fun showGoToDateDialog() {
|
||||
requireActivity().setTheme(requireContext().getDialogTheme())
|
||||
requireActivity().setTheme(requireContext().getDatePickerDialogTheme())
|
||||
val view = layoutInflater.inflate(R.layout.date_picker, null)
|
||||
val datePicker = view.findViewById<DatePicker>(R.id.date_picker)
|
||||
|
||||
|
@@ -105,7 +105,7 @@ class MonthDayFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||
}
|
||||
|
||||
override fun showGoToDateDialog() {
|
||||
requireActivity().setTheme(requireContext().getDialogTheme())
|
||||
requireActivity().setTheme(requireContext().getDatePickerDialogTheme())
|
||||
val view = layoutInflater.inflate(R.layout.date_picker, null)
|
||||
val datePicker = view.findViewById<DatePicker>(R.id.date_picker)
|
||||
datePicker.findViewById<View>(Resources.getSystem().getIdentifier("day", "id", "android")).beGone()
|
||||
|
@@ -106,7 +106,7 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||
}
|
||||
|
||||
override fun showGoToDateDialog() {
|
||||
requireActivity().setTheme(requireContext().getDialogTheme())
|
||||
requireActivity().setTheme(requireContext().getDatePickerDialogTheme())
|
||||
val view = layoutInflater.inflate(R.layout.date_picker, null)
|
||||
val datePicker = view.findViewById<DatePicker>(R.id.date_picker)
|
||||
datePicker.findViewById<View>(Resources.getSystem().getIdentifier("day", "id", "android")).beGone()
|
||||
|
@@ -178,7 +178,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
||||
}
|
||||
|
||||
override fun showGoToDateDialog() {
|
||||
requireActivity().setTheme(requireContext().getDialogTheme())
|
||||
requireActivity().setTheme(requireContext().getDatePickerDialogTheme())
|
||||
val view = layoutInflater.inflate(R.layout.date_picker, null)
|
||||
val datePicker = view.findViewById<DatePicker>(R.id.date_picker)
|
||||
|
||||
|
@@ -92,7 +92,7 @@ class YearFragmentsHolder : MyFragmentHolder() {
|
||||
}
|
||||
|
||||
override fun showGoToDateDialog() {
|
||||
requireActivity().setTheme(requireContext().getDialogTheme())
|
||||
requireActivity().setTheme(requireContext().getDatePickerDialogTheme())
|
||||
val view = layoutInflater.inflate(R.layout.date_picker, null)
|
||||
val datePicker = view.findViewById<DatePicker>(R.id.date_picker)
|
||||
datePicker.findViewById<View>(Resources.getSystem().getIdentifier("day", "id", "android")).beGone()
|
||||
|
Reference in New Issue
Block a user