Merge pull request #1068 from owncloud/conflictDialog_newWording

Conflict dialog: new wording
This commit is contained in:
masensio 2015-08-05 12:53:03 +02:00
commit 9a0361945c
6 changed files with 26 additions and 29 deletions

View file

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--TODO re-enable when server-side folder size calculation is available
<!--TODO re-enable when server-side folder size calculation is available
<item>Biggest - Smallest</item>-->
<!--TODO re-enable when "Accounts" is available in Navigation Drawer-->
<!--<string name="drawer_item_accounts">Accounts</string>-->

View file

@ -265,11 +265,11 @@
<string name="instant_upload_on_wifi">Upload pictures via WiFi only</string>
<string name="instant_video_upload_on_wifi">Upload videos via WiFi only</string>
<string name="instant_upload_path">/InstantUpload</string>
<string name="conflict_title">Update conflict</string>
<string name="conflict_message">Remote file %s is not synchronized with local file. Continuing will replace content of file on server.</string>
<string name="conflict_title">File conflict</string>
<string name="conflict_message">Which files do you want to keep? If you select both versions, the local file will have a number added to its name.</string>
<string name="conflict_keep_both">Keep both</string>
<string name="conflict_overwrite">Overwrite</string>
<string name="conflict_dont_upload">Don\'t upload</string>
<string name="conflict_use_local_version">Use local version</string>
<string name="conflict_use_server_version">Use server version</string>
<string name="preview_image_description">Image preview</string>
<string name="preview_image_error_unknown_format">This image cannot be shown</string>

View file

@ -23,6 +23,7 @@
package com.owncloud.android.ui.activity;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog;
@ -58,11 +59,20 @@ public class ConflictsResolveActivity extends FileActivity implements OnConflict
finish();
return;
case OVERWRITE:
// use local version -> overwrite on server
i.putExtra(FileUploader.KEY_FORCE_OVERWRITE, true);
break;
case KEEP_BOTH:
i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE);
break;
case SERVER:
// use server version -> delete local, request download
Intent intent = new Intent(this, FileDownloader.class);
intent.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount());
intent.putExtra(FileDownloader.EXTRA_FILE, getFile());
startService(intent);
finish();
return;
default:
Log_OC.wtf(TAG, "Unhandled conflict decision " + decision);
return;

View file

@ -779,14 +779,15 @@ public class FileActivity extends ActionBarActivity
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile);
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount());
startActivity(i);
}
} else {
if (!operation.transferWasRequested()) {
Toast msg = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result,
operation, getResources()), Toast.LENGTH_LONG);
msg.show();
}
invalidateOptionsMenu();
}
}

View file

@ -1259,7 +1259,7 @@ public class FileDisplayActivity extends HookActivity
super.onRemoteOperationFinish(operation, result);
if (operation instanceof RemoveFileOperation) {
onRemoveFileOperationFinish((RemoveFileOperation)operation, result);
onRemoveFileOperationFinish((RemoveFileOperation) operation, result);
} else if (operation instanceof RenameFileOperation) {
onRenameFileOperationFinish((RenameFileOperation)operation, result);
@ -1437,27 +1437,12 @@ public class FileDisplayActivity extends HookActivity
private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation,
RemoteOperationResult result) {
dismissLoadingDialog();
OCFile syncedFile = operation.getLocalFile();
if (!result.isSuccess()) {
if (result.getCode() == ResultCode.SYNC_CONFLICT) {
Intent i = new Intent(this, ConflictsResolveActivity.class);
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile);
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount());
startActivity(i);
}
} else {
if (result.isSuccess()) {
if (operation.transferWasRequested()) {
OCFile syncedFile = operation.getLocalFile();
onTransferStateChanged(syncedFile, true, true);
} else {
Toast msg = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result,
operation, getResources()), Toast.LENGTH_LONG);
msg.show();
invalidateOptionsMenu();
}
invalidateOptionsMenu();
}
}

View file

@ -42,7 +42,8 @@ public class ConflictsResolveDialog extends DialogFragment {
public static enum Decision {
CANCEL,
KEEP_BOTH,
OVERWRITE
OVERWRITE,
SERVER
}
OnConflictDecisionMadeListener mListener;
@ -63,7 +64,7 @@ public class ConflictsResolveDialog extends DialogFragment {
.setIcon(DisplayUtils.getSeasonalIconId())
.setTitle(R.string.conflict_title)
.setMessage(String.format(getString(R.string.conflict_message), remotepath))
.setPositiveButton(R.string.conflict_overwrite,
.setPositiveButton(R.string.conflict_use_local_version,
new DialogInterface.OnClickListener() {
@Override
@ -80,12 +81,12 @@ public class ConflictsResolveDialog extends DialogFragment {
mListener.conflictDecisionMade(Decision.KEEP_BOTH);
}
})
.setNegativeButton(R.string.conflict_dont_upload,
.setNegativeButton(R.string.conflict_use_server_version,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mListener != null)
mListener.conflictDecisionMade(Decision.CANCEL);
mListener.conflictDecisionMade(Decision.SERVER);
}
})
.create();