Remove exportAsJSON function from DatabaseHelper
This commit is contained in:
parent
08ad01b3db
commit
cb155823f7
2 changed files with 2 additions and 11 deletions
|
@ -399,9 +399,9 @@ public class BackupActivity extends BaseActivity {
|
||||||
|
|
||||||
private void doBackupPlain(Uri uri) {
|
private void doBackupPlain(Uri uri) {
|
||||||
if (Tools.isExternalStorageWritable()) {
|
if (Tools.isExternalStorageWritable()) {
|
||||||
boolean success = DatabaseHelper.exportAsJSON(this, uri);
|
ArrayList<Entry> entries = DatabaseHelper.loadDatabase(this);
|
||||||
|
|
||||||
if (success)
|
if (FileHelper.writeStringToFile(this, uri, DatabaseHelper.entriesToString(entries)))
|
||||||
Toast.makeText(this, R.string.backup_toast_export_success, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.backup_toast_export_success, Toast.LENGTH_LONG).show();
|
||||||
else
|
else
|
||||||
Toast.makeText(this, R.string.backup_toast_export_failed, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.backup_toast_export_failed, Toast.LENGTH_LONG).show();
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
package org.shadowice.flocke.andotp.Utilities;
|
package org.shadowice.flocke.andotp.Utilities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.shadowice.flocke.andotp.Database.Entry;
|
import org.shadowice.flocke.andotp.Database.Entry;
|
||||||
|
@ -108,12 +107,4 @@ public class DatabaseHelper {
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Export functions */
|
|
||||||
|
|
||||||
public static boolean exportAsJSON(Context context, Uri file) {
|
|
||||||
ArrayList<Entry> entries = loadDatabase(context);
|
|
||||||
|
|
||||||
return FileHelper.writeStringToFile(context, file, entriesToString(entries));
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue