remove the raw export feature
This commit is contained in:
parent
44e773ffdd
commit
7fb13441a1
16 changed files with 0 additions and 75 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
android:id="@+id/export_events"
|
||||
android:title="@string/export_events_to_ics"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/export_raw"
|
||||
android:title="@string/export_raw_database"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings"
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Einige Termine wurden nicht erfolgreich importiert</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Ungültiges Dateiformat</string>
|
||||
<string name="export_raw_database">Exportiere raw Datenbank</string>
|
||||
<string name="default_event_type">Standard-Termin-Typ</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">L\'import de certains evénements a échoué</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Format de fichier invalide</string>
|
||||
<string name="export_raw_database">Exporter la base de données brute</string>
|
||||
<string name="default_event_type">Type d\'evénement par défaut</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Alguns eventos não foram importados</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Formato de arquivo inválido</string>
|
||||
<string name="export_raw_database">Exportar base de dados raw</string>
|
||||
<string name="default_event_type">Tipo de evento padrão</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Alguns eventos não foram importados</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Formato de ficheiro inválido</string>
|
||||
<string name="export_raw_database">Exportar base de dados raw</string>
|
||||
<string name="default_event_type">Tipo de evento padrão</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Ошибка импорта</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Неправильный формат файла</string>
|
||||
<string name="export_raw_database">Экспортировать необработанную базу</string>
|
||||
<string name="default_event_type">Тип события по умолчанию</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -113,7 +113,6 @@
|
|||
<string name="importing_some_events_failed">Importovanie niektorých udalostí zlyhalo</string>
|
||||
<string name="exporting_some_events_failed">Exportovanie niektorých udalostí zlyhalo</string>
|
||||
<string name="invalid_file_format">Nesprávny formát súboru</string>
|
||||
<string name="export_raw_database">Exportovať surovú databázu</string>
|
||||
<string name="default_event_type">Predvolený typ udalosti</string>
|
||||
<string name="no_events_for_exporting">Nenašli sa žiadne udalosti na exportovanie</string>
|
||||
<string name="export_past_events_too">Exportovať aj minulé udalosti</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
<string name="importing_some_events_failed">Importing some events failed</string>
|
||||
<string name="exporting_some_events_failed">Exporting some events failed</string>
|
||||
<string name="invalid_file_format">Invalid file format</string>
|
||||
<string name="export_raw_database">Export raw database</string>
|
||||
<string name="default_event_type">Default event type</string>
|
||||
<string name="no_events_for_exporting">No events for exporting have been found</string>
|
||||
<string name="export_past_events_too">Export past events too</string>
|
||||
|
|
Loading…
Reference in a new issue