1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-18 06:21:25 +02:00

Minor simplification

This commit is contained in:
Erik Johansson
2018-10-06 20:59:35 +02:00
parent 1929a75462
commit eabe351b37

View File

@@ -89,12 +89,14 @@ public class AlarmBackupHandler
String databaseName = "openScale.db";
File exportDir = new File(Environment.getExternalStorageDirectory(), PreferenceManager.getDefaultSharedPreferences(context).getString("exportDir", "openScale Backup"));
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
File exportDir = new File(Environment.getExternalStorageDirectory(),
prefs.getString("exportDir", "openScale Backup"));
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return;
}
if (!prefs.getBoolean("overwriteBackup", false)) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
databaseName = dateFormat.format(new Date()) + "_" + databaseName;