add a setting for deleting all events

This commit is contained in:
tibbi
2018-01-31 23:49:38 +01:00
parent 005c65cc76
commit 58102447af
27 changed files with 82 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ import com.simplemobiletools.calendar.helpers.FONT_SIZE_LARGE
import com.simplemobiletools.calendar.helpers.FONT_SIZE_MEDIUM import com.simplemobiletools.calendar.helpers.FONT_SIZE_MEDIUM
import com.simplemobiletools.calendar.helpers.FONT_SIZE_SMALL import com.simplemobiletools.calendar.helpers.FONT_SIZE_SMALL
import com.simplemobiletools.calendar.models.EventType import com.simplemobiletools.calendar.models.EventType
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR
@@ -49,6 +50,7 @@ class SettingsActivity : SimpleActivity() {
setupManageEventTypes() setupManageEventTypes()
setupHourFormat() setupHourFormat()
setupSundayFirst() setupSundayFirst()
setupDeleteAllEvents()
setupReplaceDescription() setupReplaceDescription()
setupWeekNumbers() setupWeekNumbers()
setupWeeklyStart() setupWeeklyStart()
@@ -204,6 +206,14 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupDeleteAllEvents() {
settings_delete_all_events_holder.setOnClickListener {
ConfirmationDialog(this, messageId = R.string.delete_all_events_confirmation) {
dbHelper.deleteAllEvents()
}
}
}
private fun setupReplaceDescription() { private fun setupReplaceDescription() {
settings_replace_description.isChecked = config.replaceDescription settings_replace_description.isChecked = config.replaceDescription
settings_replace_description_holder.setOnClickListener { settings_replace_description_holder.setOnClickListener {

View File

@@ -412,7 +412,6 @@ class CalDAVHandler(val context: Context) {
try { try {
context.contentResolver.delete(contentUri, null, null) context.contentResolver.delete(contentUri, null, null)
} catch (ignored: Exception) { } catch (ignored: Exception) {
} }
} }

View File

@@ -426,6 +426,10 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
return fillEvents(cursor) return fillEvents(cursor)
} }
fun deleteAllEvents() {
}
fun deleteEvents(ids: Array<String>, deleteFromCalDAV: Boolean) { fun deleteEvents(ids: Array<String>, deleteFromCalDAV: Boolean) {
val args = TextUtils.join(", ", ids) val args = TextUtils.join(", ", ids)
val selection = "$MAIN_TABLE_NAME.$COL_ID IN ($args)" val selection = "$MAIN_TABLE_NAME.$COL_ID IN ($args)"

View File

@@ -109,6 +109,28 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_delete_all_events_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/bigger_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_delete_all_events"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:text="@string/delete_all_events"/>
</RelativeLayout>
<View <View
android:id="@+id/reminders_divider" android:id="@+id/reminders_divider"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Daleañ an adc\'halv eus</string> <string name="snooze_delay">Daleañ an adc\'halv eus</string>
<string name="widgets">Widjetoù</string> <string name="widgets">Widjetoù</string>
<string name="replace_description_with_location">Amsaviñ an deskrivadur gant al lec\'hiadur er gwell roll enankadoù </string> <string name="replace_description_with_location">Amsaviñ an deskrivadur gant al lec\'hiadur er gwell roll enankadoù </string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -202,6 +202,8 @@
<string name="snooze_delay">Odložit připomenutí pomocí funkce Snooze by</string> <string name="snooze_delay">Odložit připomenutí pomocí funkce Snooze by</string>
<string name="widgets">Widgety</string> <string name="widgets">Widgety</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Udsæt påmindelsen med en snooze på</string> <string name="snooze_delay">Udsæt påmindelsen med en snooze på</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Erstat beskrivelse med sted på visningen af begivenhedslisten</string> <string name="replace_description_with_location">Erstat beskrivelse med sted på visningen af begivenhedslisten</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Erinnerung mit Snooze verschieben um</string> <string name="snooze_delay">Erinnerung mit Snooze verschieben um</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Ersetze Beschreibung mit Ort bei Listeneinträgen</string> <string name="replace_description_with_location">Ersetze Beschreibung mit Ort bei Listeneinträgen</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Retrasar recordatorio durante</string> <string name="snooze_delay">Retrasar recordatorio durante</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Remplazar la descripción con la ubicación al mostrar entradas</string> <string name="replace_description_with_location">Remplazar la descripción con la ubicación al mostrar entradas</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Reporter le rappel avec Snooze de</string> <string name="snooze_delay">Reporter le rappel avec Snooze de</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Remplacer la description par la position dans la vue sous forme de liste</string> <string name="replace_description_with_location">Remplacer la description par la position dans la vue sous forme de liste</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -196,6 +196,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -196,6 +196,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">스누즈 알림 시간</string> <string name="snooze_delay">스누즈 알림 시간</string>
<string name="widgets">위젯</string> <string name="widgets">위젯</string>
<string name="replace_description_with_location">목록보기의 설명정보를 위치정보로 대체</string> <string name="replace_description_with_location">목록보기의 설명정보를 위치정보로 대체</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Utsett påminnelser med Snooze</string> <string name="snooze_delay">Utsett påminnelser med Snooze</string>
<string name="widgets">Moduler</string> <string name="widgets">Moduler</string>
<string name="replace_description_with_location">Erstatt Beskrivelse med Sted i listevisningen</string> <string name="replace_description_with_location">Erstatt Beskrivelse med Sted i listevisningen</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Herinnering uitstellen met</string> <string name="snooze_delay">Herinnering uitstellen met</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Beschrijving vervangen door Locatie in lijstweergave</string> <string name="replace_description_with_location">Beschrijving vervangen door Locatie in lijstweergave</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Utsett påminnelser med Snooze med</string> <string name="snooze_delay">Utsett påminnelser med Snooze med</string>
<string name="widgets">Moduler</string> <string name="widgets">Moduler</string>
<string name="replace_description_with_location">Erstatt Beskrivelse med Sted i listevisningen</string> <string name="replace_description_with_location">Erstatt Beskrivelse med Sted i listevisningen</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -200,6 +200,8 @@
<string name="snooze_delay">Opóźnij przypomnienie o</string> <string name="snooze_delay">Opóźnij przypomnienie o</string>
<string name="widgets">Widżety</string> <string name="widgets">Widżety</string>
<string name="replace_description_with_location">Zastąp Opis z Lokalizacją w widoku wejść</string> <string name="replace_description_with_location">Zastąp Opis z Lokalizacją w widoku wejść</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Adiar lembrete com a opção Snooze</string> <string name="snooze_delay">Adiar lembrete com a opção Snooze</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Substituir descrição e localização nas entradas da vista de lista</string> <string name="replace_description_with_location">Substituir descrição e localização nas entradas da vista de lista</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -209,6 +209,8 @@
<string name="snooze_delay">Отложить напоминание на</string> <string name="snooze_delay">Отложить напоминание на</string>
<string name="widgets">Виджеты</string> <string name="widgets">Виджеты</string>
<string name="replace_description_with_location">Показывать место вместо описания в списке событий</string> <string name="replace_description_with_location">Показывать место вместо описания в списке событий</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -202,6 +202,8 @@
<string name="snooze_delay">Posunúť pripomienku s Odložiť o</string> <string name="snooze_delay">Posunúť pripomienku s Odložiť o</string>
<string name="widgets">Widgety</string> <string name="widgets">Widgety</string>
<string name="replace_description_with_location">Nahradiť Popis udalosti Miestom v listových zobrazeniach</string> <string name="replace_description_with_location">Nahradiť Popis udalosti Miestom v listových zobrazeniach</string>
<string name="delete_all_events">Odstrániť všetky udalosti</string>
<string name="delete_all_events_confirmation">Ste si istý, že chcete odstrániť všetky udalosti? Všetky typy udalostí a nastavenia ostanú nedotknuté.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Skjut upp påminnelse med Snooza</string> <string name="snooze_delay">Skjut upp påminnelse med Snooza</string>
<string name="widgets">Widgetar</string> <string name="widgets">Widgetar</string>
<string name="replace_description_with_location">Ersätt Beskrivning med Plats i listvyn</string> <string name="replace_description_with_location">Ersätt Beskrivning med Plats i listvyn</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>

View File

@@ -195,6 +195,8 @@
<string name="snooze_delay">Postpone reminder with Snooze by</string> <string name="snooze_delay">Postpone reminder with Snooze by</string>
<string name="widgets">Widgets</string> <string name="widgets">Widgets</string>
<string name="replace_description_with_location">Replace Description with Location at list view entries</string> <string name="replace_description_with_location">Replace Description with Location at list view entries</string>
<string name="delete_all_events">Delete all events</string>
<string name="delete_all_events_confirmation">Are you sure you want to delete all events? This will leave your event types and other settings intact.</string>
<!-- CalDAV sync --> <!-- CalDAV sync -->
<string name="caldav">CalDAV</string> <string name="caldav">CalDAV</string>