diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BackupConfigView.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BackupConfigView.java index 8d4cec4bf..14c5a54a3 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BackupConfigView.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BackupConfigView.java @@ -148,9 +148,9 @@ public class BackupConfigView extends LinearLayout ? R.string.archive_button_store : R.string.archive_button_load; } - public List getSaveWhat() + public ArrayList getSaveWhat() { - List result = new ArrayList<>(); + ArrayList result = new ArrayList<>(); for ( SaveWhat what : mCheckBoxes.keySet() ) { CheckBox box = mCheckBoxes.get( what ); if ( box.isChecked() ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java index 90eb520b0..0be018806 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java @@ -58,6 +58,7 @@ public class DlgDelegate { SEND_LOGS, OPEN_BYOD_DICT, CLEAR_INT_STATS, // debug only + BACKUP_OVERWRITE, // BoardDelegate UNDO_LAST_ACTION, diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 2d8bc72b8..c1a14f51c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -1474,6 +1474,14 @@ public class GamesListDelegate extends ListDelegateBase openWithChecks( rowid, summary ); break; + case BACKUP_OVERWRITE: + ArrayList whats = (ArrayList)params[0]; + Uri uri = Uri.parse((String)params[1]); + if ( ZipUtils.load( m_activity, uri, whats ) ) { + ProcessPhoenix.triggerRebirth( m_activity ); + } + break; + case QUARANTINE_DELETE: deleteIfConfirmed( new long[] {(long)params[0]}, true ); break; @@ -1567,10 +1575,11 @@ public class GamesListDelegate extends ListDelegateBase if ( null == uri ) { // store case startFileChooser( view.getSaveWhat() ); } else { - List what = view.getSaveWhat(); - if ( ZipUtils.load( m_activity, uri, what ) ) { - ProcessPhoenix.triggerRebirth( m_activity ); - } + ArrayList what = view.getSaveWhat(); + makeConfirmThenBuilder( R.string.backup_overwrite_confirm, + Action.BACKUP_OVERWRITE ) + .setParams(what, uri.toString()) + .show(); } } } ) @@ -1581,7 +1590,7 @@ public class GamesListDelegate extends ListDelegateBase // This is in liu of passing through the startActivityForResult call, // which apparently isn't supported. - private List mSaveWhat; + private List mSaveWhat; private void startFileChooser( List what ) { diff --git a/xwords4/android/app/src/main/res/values/tmpstrings.xml b/xwords4/android/app/src/main/res/values/tmpstrings.xml index d5464dc53..d19cdefca 100644 --- a/xwords4/android/app/src/main/res/values/tmpstrings.xml +++ b/xwords4/android/app/src/main/res/values/tmpstrings.xml @@ -24,5 +24,11 @@ identify your device. Use this to migrate CrossWords to a new device. + Are you sure you want to + overwrite CrossWords\'s current games or settings with those from + the file you selected?\n\nPlease note that if you are bringing + networked games over from another device (migrating, that is), you + should not continue to use CrossWords on the old device. + CrossWords-backup-%1$s.zip