allow storing events locally only, even if caldav sync is on
This commit is contained in:
parent
53e08da673
commit
a66931c17d
|
@ -396,6 +396,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
updateCurrentCalendarInfo(getCalendarWithId(calendars))
|
||||
|
||||
event_caldav_calendar_holder.setOnClickListener {
|
||||
hideKeyboard()
|
||||
SelectEventCalendarDialog(this, calendars, config.lastUsedCaldavCalendar) {
|
||||
config.lastUsedCaldavCalendar = it
|
||||
updateCurrentCalendarInfo(getCalendarWithId(calendars))
|
||||
|
@ -408,8 +409,24 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
calendars.firstOrNull { it.id == config.lastUsedCaldavCalendar }
|
||||
|
||||
private fun updateCurrentCalendarInfo(currentCalendar: CalDAVCalendar?) {
|
||||
event_caldav_calendar_name.text = currentCalendar?.displayName
|
||||
event_caldav_calendar_email.text = currentCalendar?.accountName
|
||||
if (currentCalendar == null) {
|
||||
event_caldav_calendar_email.beGone()
|
||||
event_caldav_calendar_name.apply {
|
||||
text = getString(R.string.store_locally_only)
|
||||
apply {
|
||||
setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.medium_margin).toInt())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
event_caldav_calendar_email.text = currentCalendar.accountName
|
||||
event_caldav_calendar_email.beVisible()
|
||||
event_caldav_calendar_name.apply {
|
||||
text = currentCalendar.displayName
|
||||
apply {
|
||||
setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.tiny_margin).toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleAllDay(isChecked: Boolean) {
|
||||
|
|
|
@ -17,9 +17,11 @@ import kotlinx.android.synthetic.main.dialog_select_radio_group.view.*
|
|||
import kotlinx.android.synthetic.main.radio_button_with_color.view.*
|
||||
|
||||
class SelectEventCalendarDialog(val activity: Activity, val calendars: List<CalDAVCalendar>, val currCalendarId: Int, val callback: (id: Int) -> Unit) {
|
||||
val dialog: AlertDialog?
|
||||
val radioGroup: RadioGroup
|
||||
var wasInit = false
|
||||
private val STORE_LOCALLY_ONLY = 0
|
||||
|
||||
private val dialog: AlertDialog?
|
||||
private val radioGroup: RadioGroup
|
||||
private var wasInit = false
|
||||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_select_radio_group, null) as ViewGroup
|
||||
|
@ -28,8 +30,9 @@ class SelectEventCalendarDialog(val activity: Activity, val calendars: List<CalD
|
|||
activity.dbHelper.getEventTypes {
|
||||
activity.runOnUiThread {
|
||||
calendars.forEach {
|
||||
addRadioButton(it.displayName, it.id.toInt(), it.color)
|
||||
addRadioButton(it.displayName, it.id, it.color)
|
||||
}
|
||||
addRadioButton(activity.getString(R.string.store_locally_only), STORE_LOCALLY_ONLY, Color.TRANSPARENT)
|
||||
wasInit = true
|
||||
activity.updateTextColors(view.dialog_radio_holder)
|
||||
}
|
||||
|
@ -56,7 +59,7 @@ class SelectEventCalendarDialog(val activity: Activity, val calendars: List<CalD
|
|||
radioGroup.addView(view, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
||||
}
|
||||
|
||||
fun viewClicked(typeId: Int) {
|
||||
private fun viewClicked(typeId: Int) {
|
||||
if (!wasInit)
|
||||
return
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ import kotlinx.android.synthetic.main.radio_button_with_color.view.*
|
|||
import java.util.*
|
||||
|
||||
class SelectEventTypeDialog(val activity: Activity, val currEventType: Int, val callback: (checkedId: Int) -> Unit) {
|
||||
val NEW_TYPE_ID = -2
|
||||
private val NEW_TYPE_ID = -2
|
||||
|
||||
val dialog: AlertDialog?
|
||||
val radioGroup: RadioGroup
|
||||
var wasInit = false
|
||||
var eventTypes = ArrayList<EventType>()
|
||||
private val dialog: AlertDialog?
|
||||
private val radioGroup: RadioGroup
|
||||
private var wasInit = false
|
||||
private var eventTypes = ArrayList<EventType>()
|
||||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_select_radio_group, null) as ViewGroup
|
||||
|
@ -63,7 +63,7 @@ class SelectEventTypeDialog(val activity: Activity, val currEventType: Int, val
|
|||
radioGroup.addView(view, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
||||
}
|
||||
|
||||
fun viewClicked(typeId: Int) {
|
||||
private fun viewClicked(typeId: Int) {
|
||||
if (!wasInit)
|
||||
return
|
||||
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -200,6 +200,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minutę</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Selecione os calendários a sincronizar</string>
|
||||
<string name="manage_synced_calendars">Gerir calendários sincronizados</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minuto</item>
|
||||
|
|
|
@ -209,6 +209,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d минута</item>
|
||||
|
|
|
@ -202,6 +202,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Zvoľte kalendáre pre synchronizáciu</string>
|
||||
<string name="manage_synced_calendars">Spravovať synchronizované kalendáre</string>
|
||||
<string name="store_locally_only">Uložiť iba lokálne</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minútu</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minut</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<string name="caldav">CalDAV</string>
|
||||
<string name="select_caldav_calendars">Select calendars to sync</string>
|
||||
<string name="manage_synced_calendars">Manage synced calendars</string>
|
||||
<string name="store_locally_only">Store locally only</string>
|
||||
|
||||
<plurals name="by_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
Loading…
Reference in New Issue