mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 12:20:51 +01:00
show a toast when importing events completes successfully
This commit is contained in:
parent
485b126d51
commit
0d7653787c
@ -25,6 +25,7 @@ import com.simplemobiletools.calendar.dialogs.CustomEventReminderDialog
|
||||
import com.simplemobiletools.calendar.dialogs.SnoozePickerDialog
|
||||
import com.simplemobiletools.calendar.extensions.*
|
||||
import com.simplemobiletools.calendar.helpers.*
|
||||
import com.simplemobiletools.calendar.interfaces.GoogleSyncListener
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
@ -359,7 +360,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
runOnUiThread {
|
||||
settings_google_sync.isChecked = true
|
||||
}
|
||||
FetchGoogleEventsTask(applicationContext).execute()
|
||||
FetchGoogleEventsTask(applicationContext, googleSyncListener).execute()
|
||||
} catch (e: Exception) {
|
||||
if (e is UserRecoverableAuthIOException) {
|
||||
startActivityForResult(e.intent, REQUEST_AUTHORIZATION)
|
||||
@ -395,6 +396,12 @@ class SettingsActivity : SimpleActivity() {
|
||||
config.googleDefaultReminders = reminderMinutes.joinToString(",")
|
||||
}
|
||||
|
||||
val googleSyncListener = object : GoogleSyncListener {
|
||||
override fun syncCompleted() {
|
||||
toast(R.string.events_imported_successfully)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
|
||||
|
@ -61,10 +61,10 @@ class FetchGoogleEventsTask(val context: Context, val googleSyncListener: Google
|
||||
try {
|
||||
getColors()
|
||||
getDataFromApi()
|
||||
googleSyncListener?.syncCompleted()
|
||||
} catch (e: Exception) {
|
||||
parseError = e
|
||||
}
|
||||
googleSyncListener?.syncCompleted()
|
||||
return ""
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user