mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
add a warning before overwriting games
This commit is contained in:
parent
c311eac65e
commit
ca1b12d194
4 changed files with 23 additions and 7 deletions
|
@ -148,9 +148,9 @@ public class BackupConfigView extends LinearLayout
|
|||
? R.string.archive_button_store : R.string.archive_button_load;
|
||||
}
|
||||
|
||||
public List<SaveWhat> getSaveWhat()
|
||||
public ArrayList<SaveWhat> getSaveWhat()
|
||||
{
|
||||
List<SaveWhat> result = new ArrayList<>();
|
||||
ArrayList<SaveWhat> result = new ArrayList<>();
|
||||
for ( SaveWhat what : mCheckBoxes.keySet() ) {
|
||||
CheckBox box = mCheckBoxes.get( what );
|
||||
if ( box.isChecked() ) {
|
||||
|
|
|
@ -58,6 +58,7 @@ public class DlgDelegate {
|
|||
SEND_LOGS,
|
||||
OPEN_BYOD_DICT,
|
||||
CLEAR_INT_STATS, // debug only
|
||||
BACKUP_OVERWRITE,
|
||||
|
||||
// BoardDelegate
|
||||
UNDO_LAST_ACTION,
|
||||
|
|
|
@ -1474,6 +1474,14 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
openWithChecks( rowid, summary );
|
||||
break;
|
||||
|
||||
case BACKUP_OVERWRITE:
|
||||
ArrayList<SaveWhat> whats = (ArrayList<SaveWhat>)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<ZipUtils.SaveWhat> what = view.getSaveWhat();
|
||||
if ( ZipUtils.load( m_activity, uri, what ) ) {
|
||||
ProcessPhoenix.triggerRebirth( m_activity );
|
||||
}
|
||||
ArrayList<SaveWhat> 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<ZipUtils.SaveWhat> mSaveWhat;
|
||||
private List<SaveWhat> mSaveWhat;
|
||||
|
||||
private void startFileChooser( List<SaveWhat> what )
|
||||
{
|
||||
|
|
|
@ -24,5 +24,11 @@
|
|||
identify your device. Use this to migrate CrossWords to a new
|
||||
device.</string>
|
||||
|
||||
<string name="backup_overwrite_confirm">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.</string>
|
||||
|
||||
<string name="archive_filename_fmt">CrossWords-backup-%1$s.zip</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue