add a dialog for exporting events

This commit is contained in:
tibbi 2017-04-02 19:51:20 +02:00
parent 5265f216cf
commit abf7bb07bf
17 changed files with 81 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.adapters.MyMonthPagerAdapter
import com.simplemobiletools.calendar.adapters.MyWeekPagerAdapter
import com.simplemobiletools.calendar.adapters.MyYearPagerAdapter
import com.simplemobiletools.calendar.dialogs.ExportEventsDialog
import com.simplemobiletools.calendar.dialogs.FilterEventTypesDialog
import com.simplemobiletools.calendar.dialogs.ImportEventsDialog
import com.simplemobiletools.calendar.extensions.*
@ -259,7 +260,9 @@ class MainActivity : SimpleActivity(), NavigationListener {
private fun exportEvents() {
FilePickerDialog(this, pickFile = false) {
ExportEventsDialog(this, it) {
}
}
}

View File

@ -0,0 +1,27 @@
package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.ViewGroup
import com.simplemobiletools.calendar.R
import com.simplemobiletools.commons.extensions.humanizePath
import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.dialog_export_events.view.*
class ExportEventsDialog(val activity: Activity, val path: String, val callback: (refreshView: Boolean) -> Unit) : AlertDialog.Builder(activity) {
init {
val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply {
export_events_folder.text = activity.humanizePath(path)
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this, R.string.export_events)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
})
}
}
}

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/export_events_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/export_events_folder_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/folder"
android:textSize="@dimen/smaller_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/export_events_folder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:layout_marginLeft="@dimen/activity_margin"
android:paddingBottom="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:paddingTop="@dimen/small_margin"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/export_events_checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/small_margin"
android:paddingTop="@dimen/small_margin"
android:text="@string/export_past_events_too"/>
</LinearLayout>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Importiere Termine</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Importiere Termine aus .ics Datei</string>
<string name="events_imported_successfully">Termine erfolgreich importiert</string>
<string name="importing_events_failed">Termine importieren fehlgeschlagen</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Import events</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">Events imported successfully</string>
<string name="importing_events_failed">Importing events failed</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Importer des evénements</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Importer des evénements depuis un fichier .ics</string>
<string name="events_imported_successfully">Evénements importés avec succès</string>
<string name="importing_events_failed">Import des evénements échoué</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Import events</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">Events imported successfully</string>
<string name="importing_events_failed">Importing events failed</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Import events</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">Events imported successfully</string>
<string name="importing_events_failed">Importing events failed</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Import events</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">Events imported successfully</string>
<string name="importing_events_failed">Importing events failed</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">ייבוא אירועים</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">האירועים יובאו בהצלחה</string>
<string name="importing_events_failed">Importing events failed</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Import events</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">Events imported successfully</string>
<string name="importing_events_failed">Importing events failed</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Importar eventos</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Importar eventos de um arquivo .ics</string>
<string name="events_imported_successfully">Eventos importados com sucesso</string>
<string name="importing_events_failed">Falha de importação</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Importar eventos</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Importar eventos de um ficheiro .ics</string>
<string name="events_imported_successfully">Eventos importados com sucesso</string>
<string name="importing_events_failed">Falha de importação</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Импорт событий</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Импорт событий из .ics файла</string>
<string name="events_imported_successfully">События успешно импортированы</string>
<string name="importing_events_failed">Импорт событий не удался</string>

View File

@ -103,6 +103,7 @@
<!-- Export / Import -->
<string name="import_events">Importovať udalosti</string>
<string name="export_events">Exportovať udalosti</string>
<string name="import_events_from_ics">Importovať udalosti z .ics súboru</string>
<string name="events_imported_successfully">Udalosti boli úspešne importované</string>
<string name="importing_events_failed">Importovanie udalostí zlyhalo</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Import events</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">Events imported successfully</string>
<string name="importing_events_failed">Importing events failed</string>

View File

@ -96,6 +96,7 @@
<!-- Export / Import -->
<string name="import_events">Import events</string>
<string name="export_events">Export events</string>
<string name="import_events_from_ics">Import events from an .ics file</string>
<string name="events_imported_successfully">Events imported successfully</string>
<string name="importing_events_failed">Importing events failed</string>