From 7fb13441a13493fefc30186c61ac42e43944861d Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 6 Apr 2017 23:00:02 +0200 Subject: [PATCH] remove the raw export feature --- .../calendar/activities/MainActivity.kt | 57 ------------------- app/src/main/res/menu/menu_main.xml | 4 -- app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-es/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 1 - app/src/main/res/values-hi-rIN/strings.xml | 1 - app/src/main/res/values-hu/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 1 - app/src/main/res/values-iw/strings.xml | 1 - app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values-sk/strings.xml | 1 - app/src/main/res/values-sv/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - 16 files changed, 75 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index 788cfdc69..b0e7d9f38 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -36,7 +36,6 @@ import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.Release import kotlinx.android.synthetic.main.activity_main.* import org.joda.time.DateTime -import java.io.* import java.util.* class MainActivity : SimpleActivity(), NavigationListener { @@ -45,7 +44,6 @@ class MainActivity : SimpleActivity(), NavigationListener { private val PREFILLED_WEEKS = 41 private val STORAGE_PERMISSION_IMPORT = 1 private val STORAGE_PERMISSION_EXPORT = 2 - private val STORAGE_PERMISSION_EXPORT_RAW = 3 private var mIsMonthSelected = false private var mStoredTextColor = 0 @@ -131,7 +129,6 @@ class MainActivity : SimpleActivity(), NavigationListener { R.id.filter -> showFilterDialog() R.id.import_events -> tryImportEvents() R.id.export_events -> tryExportEvents() - R.id.export_raw -> tryExportRaw() R.id.settings -> launchSettings() R.id.about -> launchAbout() else -> return super.onOptionsItemSelected(item) @@ -285,58 +282,6 @@ class MainActivity : SimpleActivity(), NavigationListener { } } - private fun tryExportRaw() { - if (hasWriteStoragePermission()) { - exportRaw() - } else { - ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION_EXPORT_RAW) - } - } - - private fun exportRaw() { - FilePickerDialog(this, pickFile = false) { - val source = getDatabasePath(DBHelper.DB_NAME) - val destination = File(it, "calendar_${System.currentTimeMillis()}.db") - handleSAFDialog(destination) { - Thread({ - if (source.exists()) { - val inputStream = FileInputStream(source) - val outputStream: OutputStream? - - if (needsStupidWritePermissions(destination.absolutePath)) { - var document = getFileDocument(destination.absolutePath, config.treeUri) ?: return@Thread - if (!destination.exists()) { - document = document.createFile("", destination.name) - } - outputStream = contentResolver.openOutputStream(document.uri) - } else { - outputStream = FileOutputStream(destination) - } - - copyStream(inputStream, outputStream) - inputStream.close() - outputStream?.close() - - runOnUiThread { - toast(R.string.events_exported_successfully) - } - } - }).start() - } - } - } - - private fun copyStream(inputStream: InputStream, out: OutputStream?) { - val buf = ByteArray(1024) - var len: Int - while (true) { - len = inputStream.read(buf) - if (len <= 0) - break - out?.write(buf, 0, len) - } - } - private fun launchSettings() { startActivity(Intent(applicationContext, SettingsActivity::class.java)) } @@ -534,8 +479,6 @@ class MainActivity : SimpleActivity(), NavigationListener { importEvents() } else if (requestCode == STORAGE_PERMISSION_EXPORT) { exportEvents() - } else if (requestCode == STORAGE_PERMISSION_EXPORT_RAW) { - exportRaw() } } } diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index e3506a414..ebc3a9737 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -24,10 +24,6 @@ android:id="@+id/export_events" android:title="@string/export_events_to_ics" app:showAsAction="never"/> - Einige Termine wurden nicht erfolgreich importiert Exporting some events failed Ungültiges Dateiformat - Exportiere raw Datenbank Standard-Termin-Typ No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index fc963f237..d5269d82d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 407e1b51a..f727c6f48 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -106,7 +106,6 @@ L\'import de certains evénements a échoué Exporting some events failed Format de fichier invalide - Exporter la base de données brute Type d\'evénement par défaut No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index 18c11e676..f1583b755 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 01b0fd57c..4e4358e9c 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 29eb1b40a..f5b7ec34e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index b64454907..34e43f7f5 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index f7c19feac..adb7b5ba7 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 76ee3b880..edf78f046 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -106,7 +106,6 @@ Alguns eventos não foram importados Exporting some events failed Formato de arquivo inválido - Exportar base de dados raw Tipo de evento padrão No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0f68cbca1..b9dc44ca1 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -106,7 +106,6 @@ Alguns eventos não foram importados Exporting some events failed Formato de ficheiro inválido - Exportar base de dados raw Tipo de evento padrão No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 28cd090c5..8307c3ab6 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -106,7 +106,6 @@ Ошибка импорта Exporting some events failed Неправильный формат файла - Экспортировать необработанную базу Тип события по умолчанию No events for exporting have been found Export past events too diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 3f1915b9d..1554661ae 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -113,7 +113,6 @@ Importovanie niektorých udalostí zlyhalo Exportovanie niektorých udalostí zlyhalo Nesprávny formát súboru - Exportovať surovú databázu Predvolený typ udalosti Nenašli sa žiadne udalosti na exportovanie Exportovať aj minulé udalosti diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 639784fa8..fbaf2d733 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a510cfe1e..ed2b54134 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -106,7 +106,6 @@ Importing some events failed Exporting some events failed Invalid file format - Export raw database Default event type No events for exporting have been found Export past events too