Updated commons and refactored PermissionRequiredDialog

This commit is contained in:
merkost 2023-07-19 16:12:13 +10:00
parent 1d9ea4a69b
commit 627938e535
6 changed files with 52 additions and 9 deletions

View File

@ -72,7 +72,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:7176c52fd8'
implementation 'com.github.SimpleMobileTools:Simple-Commons:8814cd2d4b'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@ -31,7 +31,6 @@ import com.simplemobiletools.calendar.pro.adapters.AutoCompleteTextViewAdapter
import com.simplemobiletools.calendar.pro.dialogs.*
import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.models.*
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
@ -42,11 +41,13 @@ import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.commons.views.MyAutoCompleteTextView
import kotlinx.android.synthetic.main.activity_event.*
import kotlinx.android.synthetic.main.activity_event.view.*
import kotlinx.android.synthetic.main.activity_event.view.event_reminder_2
import kotlinx.android.synthetic.main.activity_event.view.event_reminder_3
import kotlinx.android.synthetic.main.item_attendee.view.*
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import java.util.*
import java.util.Calendar
import java.util.TimeZone
import java.util.regex.Pattern
class EventActivity : SimpleActivity() {
@ -1320,7 +1321,15 @@ class EventActivity : SimpleActivity() {
storeEvent(wasRepeatable)
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders)
PermissionRequiredDialog(
this,
R.string.allow_notifications_reminders,
positiveActionCallback = {
handleNotificationPermission {
openNotificationSettings()
}
}
)
}
}
} else {
@ -1374,6 +1383,7 @@ class EventActivity : SimpleActivity() {
}
}
}
EDIT_FUTURE_OCCURRENCES -> {
ensureBackgroundThread {
val eventId = mEvent.id!!
@ -1392,6 +1402,7 @@ class EventActivity : SimpleActivity() {
}
}
}
EDIT_ALL_OCCURRENCES -> {
ensureBackgroundThread {
applyOriginalStartEndTimes()

View File

@ -1067,7 +1067,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders)
PermissionRequiredDialog(
this,
R.string.allow_notifications_reminders,
positiveActionCallback = {
handleNotificationPermission {
openNotificationSettings()
}
}
)
}
}
} else {

View File

@ -85,7 +85,15 @@ open class SimpleActivity : BaseSimpleActivity() {
}
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders)
PermissionRequiredDialog(
this,
R.string.allow_notifications_reminders,
positiveActionCallback = {
handleNotificationPermission {
openNotificationSettings()
}
}
)
}
}
}

View File

@ -433,7 +433,15 @@ class TaskActivity : SimpleActivity() {
storeTask(wasRepeatable)
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders)
PermissionRequiredDialog(
this,
R.string.allow_notifications_reminders,
positiveActionCallback = {
handleNotificationPermission {
openNotificationSettings()
}
}
)
}
}
} else {

View File

@ -36,7 +36,15 @@ class SetRemindersDialog(val activity: SimpleActivity, val eventType: Int, val c
}
}
} else {
PermissionRequiredDialog(activity, R.string.allow_notifications_reminders)
PermissionRequiredDialog(
activity,
R.string.allow_notifications_reminders,
positiveActionCallback = {
activity.handleNotificationPermission {
activity.openNotificationSettings()
}
}
)
}
}
}