forked from upstream-mirrors/OpenTracks
Improve the wording where there is no backup.
This commit is contained in:
@@ -1527,8 +1527,10 @@ limitations under the License.
|
||||
<string name="settings_backup_restore_no_backup"
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now'
|
||||
option, the message in the alert dialog informing the user that there is no backup to restore
|
||||
from.">
|
||||
No backup found.
|
||||
from.
|
||||
|
||||
%1$s the directory. E.g., '/MyTracks/backups'.">
|
||||
No backups found in %1$s.
|
||||
</string>
|
||||
<string name="settings_backup_restore_progress_message"
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now'
|
||||
|
||||
@@ -59,7 +59,6 @@ class ExternalFileBackup {
|
||||
BACKUP_FILENAME_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
private static final String BACKUPS_SUBDIR = "backups";
|
||||
private static final int BACKUP_FORMAT_VERSION = 1;
|
||||
private static final String ZIP_ENTRY_NAME =
|
||||
"backup.mytracks.v" + BACKUP_FORMAT_VERSION;
|
||||
@@ -86,7 +85,7 @@ class ExternalFileBackup {
|
||||
* @param create whether to try creating the directory if it doesn't exist
|
||||
*/
|
||||
private File getBackupsDirectory(boolean create) {
|
||||
String directoryPath = FileUtils.getDirectoryPath(BACKUPS_SUBDIR);
|
||||
String directoryPath = FileUtils.getDirectoryPath(FileUtils.BACKUPS_DIR);
|
||||
final File dir = new File(directoryPath);
|
||||
Log.d(Constants.TAG, "Dir: " + dir.getAbsolutePath());
|
||||
if (create) {
|
||||
|
||||
+11
-2
@@ -64,14 +64,14 @@ public class RestoreChooserActivity extends Activity {
|
||||
}
|
||||
|
||||
if (!externalFileBackup.isBackupsDirectoryAvailable(false)) {
|
||||
Toast.makeText(this, R.string.settings_backup_restore_no_backup, Toast.LENGTH_LONG).show();
|
||||
showNoBackupMessage();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
backupDates = externalFileBackup.getAvailableBackups();
|
||||
if (backupDates == null || backupDates.length == 0) {
|
||||
Toast.makeText(this, R.string.settings_backup_restore_no_backup, Toast.LENGTH_LONG).show();
|
||||
showNoBackupMessage();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
@@ -118,4 +118,13 @@ public class RestoreChooserActivity extends Activity {
|
||||
.setTitle(R.string.settings_backup_restore_select_title)
|
||||
.create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a no backup message.
|
||||
*/
|
||||
private void showNoBackupMessage() {
|
||||
String message = getString(R.string.settings_backup_restore_no_backup,
|
||||
FileUtils.getDirectoryDisplayName(FileUtils.BACKUPS_DIR));
|
||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class FileUtils {
|
||||
private FileUtils() {}
|
||||
|
||||
public static final String TEMP_DIR = "tmp";
|
||||
public static final String BACKUPS_DIR = "backups";
|
||||
|
||||
/**
|
||||
* Name of the top-level directory inside the SD card where our files will be
|
||||
|
||||
Reference in New Issue
Block a user