mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Won't Fix:
Revert "OC-3121: (fix bug) An empty message is sent, when renaming a file in the web of a big file"
This reverts commit df4d0355f2
.
This commit is contained in:
parent
df4d0355f2
commit
56853acff0
5 changed files with 9 additions and 116 deletions
|
@ -254,7 +254,6 @@
|
|||
<string name="unshare_link_file_error">An error occurred while trying to unshare this file or folder</string>
|
||||
|
||||
<string name="activity_chooser_send_file_title">Send</string>
|
||||
<string name="send_file_missing_file">Sorry, trying to send a missing file.</string>
|
||||
|
||||
<string name="copy_link">Copy link</string>
|
||||
<string name="clipboard_text_copied">Copied to clipboard</string>
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package com.owncloud.android.files;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
|
||||
import android.accounts.AccountManager;
|
||||
|
@ -37,7 +35,6 @@ import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
|||
import com.owncloud.android.services.OperationsService;
|
||||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
import com.owncloud.android.ui.dialog.ShareLinkToDialog;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.Log_OC;
|
||||
|
||||
/**
|
||||
|
@ -51,8 +48,6 @@ public class FileOperationsHelper {
|
|||
|
||||
private static final String FTAG_CHOOSER_DIALOG = "CHOOSER_DIALOG";
|
||||
|
||||
public final static int REQUEST_CODE_FILE_OPEN_HELPER = 100;
|
||||
|
||||
|
||||
public void openFile(OCFile file, FileActivity callerActivity) {
|
||||
if (file != null) {
|
||||
|
@ -190,40 +185,4 @@ public class FileOperationsHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendFileToApp(Intent sendIntent, FileActivity callerActivity) {
|
||||
Uri filePath = sendIntent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
File file = new File(filePath.getPath());
|
||||
Log_OC.d(TAG, "FILE " + filePath.getPath());
|
||||
if (file.exists()) {
|
||||
File folder = new File(FileStorageUtils.getTemporalPath(callerActivity.getAccount().name) + "/send");
|
||||
boolean success = true;
|
||||
if (!folder.exists()) {
|
||||
success = folder.mkdir();
|
||||
}
|
||||
if (success) {
|
||||
File tmpFile = new File(folder.getAbsolutePath()+ "/" + file.getName());
|
||||
try {
|
||||
tmpFile.createNewFile();
|
||||
FileStorageUtils.copyFile(file, tmpFile);
|
||||
} catch (IOException e) {
|
||||
Log_OC.e(TAG, "An error occurred while it was trying to copy in a temporal folder " + e.getMessage());
|
||||
}
|
||||
// Update Uri
|
||||
Uri uri = Uri.fromFile(tmpFile);
|
||||
sendIntent.removeExtra(Intent.EXTRA_STREAM);
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
callerActivity.startActivityForResult(sendIntent, REQUEST_CODE_FILE_OPEN_HELPER);
|
||||
}
|
||||
} else {
|
||||
// Show a Message
|
||||
Toast t = Toast.makeText(callerActivity, callerActivity.getString(R.string.send_file_missing_file), Toast.LENGTH_LONG);
|
||||
t.show();
|
||||
Log_OC.d(TAG, "Missing file");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AccountManagerCallback;
|
||||
|
@ -54,7 +52,6 @@ import com.owncloud.android.operations.UnshareLinkOperation;
|
|||
import com.owncloud.android.services.OperationsService;
|
||||
import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
|
||||
import com.owncloud.android.ui.dialog.LoadingDialog;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.Log_OC;
|
||||
|
||||
|
||||
|
@ -160,7 +157,6 @@ public class FileActivity extends SherlockFragmentActivity implements OnRemoteOp
|
|||
if (mOperationsServiceBinder != null) {
|
||||
mOperationsServiceBinder.addOperationListener(FileActivity.this, mHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -496,23 +492,6 @@ public class FileActivity extends SherlockFragmentActivity implements OnRemoteOp
|
|||
// TODO whatever could be waiting for the service is unbound
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
Log_OC.d(TAG, "requestCode " + String.valueOf(requestCode) );
|
||||
if (requestCode == FileOperationsHelper.REQUEST_CODE_FILE_OPEN_HELPER) {
|
||||
// Remove "send" folder
|
||||
File folder = new File(FileStorageUtils.getTemporalPath(getAccount().name) + "/send");
|
||||
if (folder.exists()) {
|
||||
FileStorageUtils.deleteFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -111,7 +111,10 @@ public class ShareLinkToDialog extends SherlockDialogFragment {
|
|||
Collections.sort(activities, new ResolveInfo.DisplayNameComparator(pm));
|
||||
mAdapter = new ActivityAdapter(getSherlockActivity(), pm, activities);
|
||||
|
||||
|
||||
|
||||
if (sendAction) {
|
||||
|
||||
return new AlertDialog.Builder(getSherlockActivity())
|
||||
.setTitle(R.string.activity_chooser_send_file_title)
|
||||
.setAdapter(mAdapter, new DialogInterface.OnClickListener() {
|
||||
|
@ -124,13 +127,11 @@ public class ShareLinkToDialog extends SherlockDialogFragment {
|
|||
mIntent.setComponent(name);
|
||||
|
||||
// Send the file
|
||||
FileOperationsHelper foh = new FileOperationsHelper();
|
||||
foh.sendFileToApp(mIntent, (FileActivity)getSherlockActivity());
|
||||
((FileActivity)getSherlockActivity()).startActivity(mIntent);
|
||||
|
||||
}
|
||||
})
|
||||
.create();
|
||||
|
||||
} else {
|
||||
return new AlertDialog.Builder(getSherlockActivity())
|
||||
.setTitle(R.string.activity_chooser_title)
|
||||
|
|
|
@ -18,10 +18,6 @@
|
|||
package com.owncloud.android.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
|
@ -121,45 +117,4 @@ public class FileStorageUtils {
|
|||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy file src in dst
|
||||
* @param src
|
||||
* @param dst
|
||||
* @throws IOException
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public static void copyFile(File src, File dst) throws IOException {
|
||||
FileChannel inChannel = new FileInputStream(src).getChannel();
|
||||
FileChannel outChannel = new FileOutputStream(dst).getChannel();
|
||||
try {
|
||||
inChannel.transferTo(0, inChannel.size(), outChannel);
|
||||
} finally {
|
||||
if (inChannel != null)
|
||||
inChannel.close();
|
||||
if (outChannel != null)
|
||||
outChannel.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete folder
|
||||
* @param folder
|
||||
* @return true if folder is deleted
|
||||
*/
|
||||
public static boolean deleteFolder(File folder){
|
||||
if (folder.isDirectory()) {
|
||||
String[] children = folder.list();
|
||||
for (int i=0; i<children.length; i++) {
|
||||
boolean success = deleteFolder(new File(folder, children[i]));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The folder is now empty so delete it
|
||||
return folder.delete();
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue