mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 18:28:59 +03:00
Use OCFile inside UploadDbObject,
made OCFile serializable (requires casts to make invocation of Intent.putExtra() unambiguous)
This commit is contained in:
parent
39abd71e82
commit
d1386ea140
18 changed files with 83 additions and 84 deletions
|
@ -19,15 +19,23 @@
|
||||||
package com.owncloud.android.datamodel;
|
package com.owncloud.android.datamodel;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||||
import third_parties.daveKoeller.AlphanumComparator;
|
|
||||||
|
|
||||||
|
import third_parties.daveKoeller.AlphanumComparator;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
public class OCFile implements Parcelable, Comparable<OCFile> {
|
// OCFile needs to be Serializable because it is stored persistently inside UploadDbObject.
|
||||||
|
// (Parcelable is not suitable for persistent storage.)
|
||||||
|
public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be changed whenever any property of OCFile changes.
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 5604080482686390078L;
|
||||||
|
|
||||||
public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
|
public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,14 +50,13 @@ public class UploadDbHandler extends Observable {
|
||||||
|
|
||||||
// for testing only
|
// for testing only
|
||||||
public void recreateDb() {
|
public void recreateDb() {
|
||||||
// mDB.beginTransaction();
|
// getDB().beginTransaction();
|
||||||
// try {
|
// try {
|
||||||
// mHelper.onUpgrade(mDB, 0, mDatabaseVersion);
|
// mHelper.onUpgrade(getDB(), 0, mDatabaseVersion);
|
||||||
// mDB.setTransactionSuccessful();
|
// getDB().setTransactionSuccessful();
|
||||||
// } finally {
|
// } finally {
|
||||||
// mDB.endTransaction();
|
// getDB().endTransaction();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum UploadStatus {
|
public enum UploadStatus {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.content.Context;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
import com.owncloud.android.authentication.AccountUtils;
|
import com.owncloud.android.authentication.AccountUtils;
|
||||||
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.db.UploadDbHandler.UploadStatus;
|
import com.owncloud.android.db.UploadDbHandler.UploadStatus;
|
||||||
import com.owncloud.android.files.services.FileUploadService.LocalBehaviour;
|
import com.owncloud.android.files.services.FileUploadService.LocalBehaviour;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
|
@ -32,19 +33,30 @@ public class UploadDbObject implements Serializable {
|
||||||
private static final long serialVersionUID = -2306246191385279928L;
|
private static final long serialVersionUID = -2306246191385279928L;
|
||||||
|
|
||||||
private static final String TAG = "UploadDbObject";
|
private static final String TAG = "UploadDbObject";
|
||||||
/**
|
|
||||||
* Local path to file which is to be uploaded.
|
|
||||||
*/
|
|
||||||
String localPath;
|
|
||||||
/**
|
|
||||||
* Remote path where file is to be uploaded to.
|
|
||||||
*/
|
|
||||||
String remotePath;
|
|
||||||
|
|
||||||
/**
|
public UploadDbObject(OCFile ocFile) {
|
||||||
* Mime type of upload file.
|
this.ocFile = ocFile;
|
||||||
*/
|
}
|
||||||
String mimeType;
|
// /**
|
||||||
|
// * Local path to file which is to be uploaded.
|
||||||
|
// */
|
||||||
|
// String localPath;
|
||||||
|
// /**
|
||||||
|
// * Remote path where file is to be uploaded to.
|
||||||
|
// */
|
||||||
|
// String remotePath;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Mime type of upload file.
|
||||||
|
// */
|
||||||
|
// String mimeType;
|
||||||
|
OCFile ocFile;
|
||||||
|
|
||||||
|
public OCFile getOCFile() {
|
||||||
|
return ocFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local action for upload.
|
* Local action for upload.
|
||||||
*/
|
*/
|
||||||
|
@ -120,43 +132,23 @@ public class UploadDbObject implements Serializable {
|
||||||
* @return the localPath
|
* @return the localPath
|
||||||
*/
|
*/
|
||||||
public String getLocalPath() {
|
public String getLocalPath() {
|
||||||
return localPath;
|
return ocFile.getStoragePath();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param localPath the localPath to set
|
|
||||||
*/
|
|
||||||
public void setLocalPath(String localPath) {
|
|
||||||
this.localPath = localPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the remotePath
|
* @return the remotePath
|
||||||
*/
|
*/
|
||||||
public String getRemotePath() {
|
public String getRemotePath() {
|
||||||
return remotePath;
|
return ocFile.getRemotePath();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param remotePath the remotePath to set
|
|
||||||
*/
|
|
||||||
public void setRemotePath(String remotePath) {
|
|
||||||
this.remotePath = remotePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the mimeType
|
* @return the mimeType
|
||||||
*/
|
*/
|
||||||
public String getMimeType() {
|
public String getMimeType() {
|
||||||
return mimeType;
|
return ocFile.getMimetype();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mimeType the mimeType to set
|
|
||||||
*/
|
|
||||||
public void setMimeType(String mimeType) {
|
|
||||||
this.mimeType = mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the localAction
|
* @return the localAction
|
||||||
|
|
|
@ -32,7 +32,6 @@ import com.owncloud.android.R;
|
||||||
import com.owncloud.android.authentication.AuthenticatorActivity;
|
import com.owncloud.android.authentication.AuthenticatorActivity;
|
||||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
|
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
|
||||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||||
|
@ -62,6 +61,7 @@ import android.os.HandlerThread;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
|
||||||
} else {
|
} else {
|
||||||
showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
||||||
}
|
}
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, download.getFile());
|
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)download.getFile());
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, download.getAccount());
|
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, download.getAccount());
|
||||||
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ import android.os.Binder;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
@ -377,10 +378,7 @@ public class FileUploadService extends IntentService {
|
||||||
// save always persistently path of upload, so it can be retried if
|
// save always persistently path of upload, so it can be retried if
|
||||||
// failed.
|
// failed.
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
UploadDbObject uploadObject = new UploadDbObject();
|
UploadDbObject uploadObject = new UploadDbObject(files[i]);
|
||||||
uploadObject.setRemotePath(files[i].getRemotePath());
|
|
||||||
uploadObject.setLocalPath(files[i].getStoragePath());
|
|
||||||
uploadObject.setMimeType(files[i].getMimetype());
|
|
||||||
uploadObject.setAccountName(account.name);
|
uploadObject.setAccountName(account.name);
|
||||||
uploadObject.setForceOverwrite(forceOverwrite);
|
uploadObject.setForceOverwrite(forceOverwrite);
|
||||||
uploadObject.setCreateRemoteFolder(isCreateRemoteFolder);
|
uploadObject.setCreateRemoteFolder(isCreateRemoteFolder);
|
||||||
|
@ -608,8 +606,7 @@ public class FileUploadService extends IntentService {
|
||||||
String uploadKey = null;
|
String uploadKey = null;
|
||||||
|
|
||||||
uploadKey = buildRemoteName(account, uploadDbObject.getRemotePath());
|
uploadKey = buildRemoteName(account, uploadDbObject.getRemotePath());
|
||||||
OCFile file = obtainNewOCFileToUpload(uploadDbObject.getRemotePath(), uploadDbObject.getLocalPath(),
|
OCFile file = uploadDbObject.getOCFile();
|
||||||
uploadDbObject.getMimeType());
|
|
||||||
mCurrentUpload = new UploadFileOperation(account, file, chunked, uploadDbObject.isForceOverwrite(),
|
mCurrentUpload = new UploadFileOperation(account, file, chunked, uploadDbObject.isForceOverwrite(),
|
||||||
uploadDbObject.getLocalAction(), getApplicationContext());
|
uploadDbObject.getLocalAction(), getApplicationContext());
|
||||||
if (uploadDbObject.isCreateRemoteFolder()) {
|
if (uploadDbObject.isCreateRemoteFolder()) {
|
||||||
|
@ -840,7 +837,7 @@ public class FileUploadService extends IntentService {
|
||||||
// / includes a pending intent in the notification showing the details
|
// / includes a pending intent in the notification showing the details
|
||||||
// view of the file
|
// view of the file
|
||||||
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, upload.getFile());
|
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)upload.getFile());
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount());
|
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount());
|
||||||
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
mNotificationBuilder.setContentIntent(PendingIntent.getActivity(this, (int) System.currentTimeMillis(),
|
mNotificationBuilder.setContentIntent(PendingIntent.getActivity(this, (int) System.currentTimeMillis(),
|
||||||
|
|
|
@ -32,6 +32,7 @@ import android.media.MediaPlayer.OnPreparedListener;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.net.wifi.WifiManager.WifiLock;
|
import android.net.wifi.WifiManager.WifiLock;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -535,7 +536,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
|
||||||
private void updateNotification(String content) {
|
private void updateNotification(String content) {
|
||||||
// TODO check if updating the Intent is really necessary
|
// TODO check if updating the Intent is really necessary
|
||||||
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, mFile);
|
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)mFile);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
|
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
|
||||||
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
|
mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
|
||||||
|
@ -572,7 +573,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
|
||||||
|
|
||||||
/// includes a pending intent in the notification showing the details view of the file
|
/// includes a pending intent in the notification showing the details view of the file
|
||||||
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, mFile);
|
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)mFile);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
|
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
|
||||||
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
|
mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
|
||||||
|
|
|
@ -26,6 +26,7 @@ import android.accounts.Account;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.widget.MediaController;
|
import android.widget.MediaController;
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
|
||||||
Log_OC.d(TAG, "Loading and starting through binder...");
|
Log_OC.d(TAG, "Loading and starting through binder...");
|
||||||
Intent i = new Intent(mService, MediaService.class);
|
Intent i = new Intent(mService, MediaService.class);
|
||||||
i.putExtra(MediaService.EXTRA_ACCOUNT, account);
|
i.putExtra(MediaService.EXTRA_ACCOUNT, account);
|
||||||
i.putExtra(MediaService.EXTRA_FILE, file);
|
i.putExtra(MediaService.EXTRA_FILE, (Parcelable)file);
|
||||||
i.putExtra(MediaService.EXTRA_PLAY_ON_LOAD, playImmediately);
|
i.putExtra(MediaService.EXTRA_PLAY_ON_LOAD, playImmediately);
|
||||||
i.putExtra(MediaService.EXTRA_START_POSITION, position);
|
i.putExtra(MediaService.EXTRA_START_POSITION, position);
|
||||||
i.setAction(MediaService.ACTION_PLAY_FILE);
|
i.setAction(MediaService.ACTION_PLAY_FILE);
|
||||||
|
|
|
@ -33,6 +33,7 @@ import com.owncloud.android.utils.FileStorageUtils;
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remote operation performing the read of remote file in the ownCloud server.
|
* Remote operation performing the read of remote file in the ownCloud server.
|
||||||
|
@ -209,7 +210,7 @@ public class SynchronizeFileOperation extends SyncOperation {
|
||||||
private void requestForUpload(OCFile file) {
|
private void requestForUpload(OCFile file) {
|
||||||
Intent i = new Intent(mContext, FileUploadService.class);
|
Intent i = new Intent(mContext, FileUploadService.class);
|
||||||
i.putExtra(FileUploadService.KEY_ACCOUNT, mAccount);
|
i.putExtra(FileUploadService.KEY_ACCOUNT, mAccount);
|
||||||
i.putExtra(FileUploadService.KEY_FILE, file);
|
i.putExtra(FileUploadService.KEY_FILE, (Parcelable)file);
|
||||||
/*i.putExtra(FileUploader.KEY_REMOTE_FILE, mRemotePath); // doing this we would lose the value of keepInSync in the road, and maybe it's not updated in the database when the FileUploader service gets it!
|
/*i.putExtra(FileUploader.KEY_REMOTE_FILE, mRemotePath); // doing this we would lose the value of keepInSync in the road, and maybe it's not updated in the database when the FileUploader service gets it!
|
||||||
i.putExtra(FileUploader.KEY_LOCAL_FILE, localFile.getStoragePath());*/
|
i.putExtra(FileUploader.KEY_LOCAL_FILE, localFile.getStoragePath());*/
|
||||||
i.putExtra(FileUploadService.KEY_UPLOAD_TYPE, FileUploadService.UploadSingleMulti.UPLOAD_SINGLE_FILE);
|
i.putExtra(FileUploadService.KEY_UPLOAD_TYPE, FileUploadService.UploadSingleMulti.UPLOAD_SINGLE_FILE);
|
||||||
|
@ -227,7 +228,7 @@ public class SynchronizeFileOperation extends SyncOperation {
|
||||||
private void requestForDownload(OCFile file) {
|
private void requestForDownload(OCFile file) {
|
||||||
Intent i = new Intent(mContext, FileDownloader.class);
|
Intent i = new Intent(mContext, FileDownloader.class);
|
||||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
|
i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
|
||||||
i.putExtra(FileDownloader.EXTRA_FILE, file);
|
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)file);
|
||||||
mContext.startService(i);
|
mContext.startService(i);
|
||||||
mTransferWasRequested = true;
|
mTransferWasRequested = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.owncloud.android.MainApp;
|
import com.owncloud.android.MainApp;
|
||||||
import com.owncloud.android.authentication.AccountUtils;
|
import com.owncloud.android.authentication.AccountUtils;
|
||||||
|
@ -101,7 +102,7 @@ public class FileObserverService extends Service {
|
||||||
Intent intent = new Intent(context, FileObserverService.class);
|
Intent intent = new Intent(context, FileObserverService.class);
|
||||||
intent.setAction(watchIt ? FileObserverService.ACTION_ADD_OBSERVED_FILE
|
intent.setAction(watchIt ? FileObserverService.ACTION_ADD_OBSERVED_FILE
|
||||||
: FileObserverService.ACTION_DEL_OBSERVED_FILE);
|
: FileObserverService.ACTION_DEL_OBSERVED_FILE);
|
||||||
intent.putExtra(FileObserverService.ARG_FILE, file);
|
intent.putExtra(FileObserverService.ARG_FILE, (Parcelable)file);
|
||||||
intent.putExtra(FileObserverService.ARG_ACCOUNT, account);
|
intent.putExtra(FileObserverService.ARG_ACCOUNT, account);
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.accounts.Account;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.FileObserver;
|
import android.os.FileObserver;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
|
@ -203,7 +204,7 @@ public class FolderObserver extends FileObserver {
|
||||||
// this can be very intrusive; a notification should be preferred
|
// this can be very intrusive; a notification should be preferred
|
||||||
Intent i = new Intent(mContext, ConflictsResolveActivity.class);
|
Intent i = new Intent(mContext, ConflictsResolveActivity.class);
|
||||||
i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, file);
|
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, (Parcelable)file);
|
||||||
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, mAccount);
|
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, mAccount);
|
||||||
mContext.startActivity(i);
|
mContext.startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.owncloud.android.utils.DisplayUtils;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper activity which will be launched if keep-in-sync file will be modified by external
|
* Wrapper activity which will be launched if keep-in-sync file will be modified by external
|
||||||
|
@ -68,7 +69,7 @@ public class ConflictsResolveActivity extends FileActivity implements OnConflict
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i.putExtra(FileUploadService.KEY_ACCOUNT, getAccount());
|
i.putExtra(FileUploadService.KEY_ACCOUNT, getAccount());
|
||||||
i.putExtra(FileUploadService.KEY_FILE, getFile());
|
i.putExtra(FileUploadService.KEY_FILE, (Parcelable)getFile());
|
||||||
i.putExtra(FileUploadService.KEY_UPLOAD_TYPE, FileUploadService.UploadSingleMulti.UPLOAD_SINGLE_FILE);
|
i.putExtra(FileUploadService.KEY_UPLOAD_TYPE, FileUploadService.UploadSingleMulti.UPLOAD_SINGLE_FILE);
|
||||||
|
|
||||||
startService(i);
|
startService(i);
|
||||||
|
|
|
@ -46,6 +46,7 @@ import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.DocumentsContract;
|
import android.provider.DocumentsContract;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
@ -1661,7 +1662,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
if (result.getCode() == ResultCode.SYNC_CONFLICT) {
|
if (result.getCode() == ResultCode.SYNC_CONFLICT) {
|
||||||
Intent i = new Intent(this, ConflictsResolveActivity.class);
|
Intent i = new Intent(this, ConflictsResolveActivity.class);
|
||||||
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile);
|
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, (Parcelable)syncedFile);
|
||||||
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount());
|
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount());
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
|
|
||||||
|
@ -1731,7 +1732,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
||||||
if (!mDownloaderBinder.isDownloading(account, mWaitingToPreview)) {
|
if (!mDownloaderBinder.isDownloading(account, mWaitingToPreview)) {
|
||||||
Intent i = new Intent(this, FileDownloader.class);
|
Intent i = new Intent(this, FileDownloader.class);
|
||||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
|
i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
|
||||||
i.putExtra(FileDownloader.EXTRA_FILE, mWaitingToPreview);
|
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)mWaitingToPreview);
|
||||||
startService(i);
|
startService(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1788,7 +1789,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
||||||
if (!mDownloaderBinder.isDownloading(account, file)) {
|
if (!mDownloaderBinder.isDownloading(account, file)) {
|
||||||
Intent i = new Intent(this, FileDownloader.class);
|
Intent i = new Intent(this, FileDownloader.class);
|
||||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
|
i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
|
||||||
i.putExtra(FileDownloader.EXTRA_FILE, file);
|
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)file);
|
||||||
startService(i);
|
startService(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1820,7 +1821,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
||||||
*/
|
*/
|
||||||
public void startImagePreview(OCFile file) {
|
public void startImagePreview(OCFile file) {
|
||||||
Intent showDetailsIntent = new Intent(this, PreviewImageActivity.class);
|
Intent showDetailsIntent = new Intent(this, PreviewImageActivity.class);
|
||||||
showDetailsIntent.putExtra(EXTRA_FILE, file);
|
showDetailsIntent.putExtra(EXTRA_FILE, (Parcelable)file);
|
||||||
showDetailsIntent.putExtra(EXTRA_ACCOUNT, getAccount());
|
showDetailsIntent.putExtra(EXTRA_ACCOUNT, getAccount());
|
||||||
startActivity(showDetailsIntent);
|
startActivity(showDetailsIntent);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Resources.NotFoundException;
|
import android.content.res.Resources.NotFoundException;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -373,8 +374,8 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
|
||||||
OCFile targetFile = (OCFile) i.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);
|
OCFile targetFile = (OCFile) i.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);
|
||||||
|
|
||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder());
|
data.putExtra(EXTRA_CURRENT_FOLDER, (Parcelable)getCurrentFolder());
|
||||||
data.putExtra(EXTRA_TARGET_FILE, targetFile);
|
data.putExtra(EXTRA_TARGET_FILE, (Parcelable)targetFile);
|
||||||
setResult(RESULT_OK_AND_MOVE, data);
|
setResult(RESULT_OK_AND_MOVE, data);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
|
@ -47,7 +48,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onUploadItemClick(UploadDbObject file) {
|
public void onUploadItemClick(UploadDbObject file) {
|
||||||
OCFile ocFile = FileStorageUtils.fillOCFile(file);
|
OCFile ocFile = file.getOCFile();
|
||||||
switch (file.getUploadStatus()) {
|
switch (file.getUploadStatus()) {
|
||||||
case UPLOAD_IN_PROGRESS:
|
case UPLOAD_IN_PROGRESS:
|
||||||
if (ocFile != null) {
|
if (ocFile != null) {
|
||||||
|
@ -58,7 +59,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
|
||||||
break;
|
break;
|
||||||
case UPLOAD_SUCCEEDED:
|
case UPLOAD_SUCCEEDED:
|
||||||
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, ocFile);
|
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)ocFile);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, file.getAccount(this));
|
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, file.getAccount(this));
|
||||||
startActivity(showDetailsIntent);
|
startActivity(showDetailsIntent);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.File;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -325,7 +326,7 @@ public class OCFileListFragment extends ExtendedListFragment {
|
||||||
Intent action = new Intent(getActivity(), MoveActivity.class);
|
Intent action = new Intent(getActivity(), MoveActivity.class);
|
||||||
|
|
||||||
// Pass mTargetFile that contains info of selected file/folder
|
// Pass mTargetFile that contains info of selected file/folder
|
||||||
action.putExtra(MoveActivity.EXTRA_TARGET_FILE, mTargetFile);
|
action.putExtra(MoveActivity.EXTRA_TARGET_FILE, (Parcelable)mTargetFile);
|
||||||
getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES);
|
getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -350,7 +351,7 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
|
||||||
public void showDetails(OCFile file) {
|
public void showDetails(OCFile file) {
|
||||||
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
||||||
showDetailsIntent.setAction(FileDisplayActivity.ACTION_DETAILS);
|
showDetailsIntent.setAction(FileDisplayActivity.ACTION_DETAILS);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, file);
|
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)file);
|
||||||
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this));
|
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this));
|
||||||
startActivity(showDetailsIntent);
|
startActivity(showDetailsIntent);
|
||||||
int pos = mPreviewImagePagerAdapter.getFilePosition(file);
|
int pos = mPreviewImagePagerAdapter.getFilePosition(file);
|
||||||
|
@ -366,7 +367,7 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
|
||||||
} else if (!mDownloaderBinder.isDownloading(getAccount(), file)) {
|
} else if (!mDownloaderBinder.isDownloading(getAccount(), file)) {
|
||||||
Intent i = new Intent(this, FileDownloader.class);
|
Intent i = new Intent(this, FileDownloader.class);
|
||||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount());
|
i.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount());
|
||||||
i.putExtra(FileDownloader.EXTRA_FILE, file);
|
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)file);
|
||||||
startService(i);
|
startService(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -516,7 +517,7 @@ public class PreviewMediaFragment extends FileFragment implements
|
||||||
private void startFullScreenVideo() {
|
private void startFullScreenVideo() {
|
||||||
Intent i = new Intent(getSherlockActivity(), PreviewVideoActivity.class);
|
Intent i = new Intent(getSherlockActivity(), PreviewVideoActivity.class);
|
||||||
i.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
|
i.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
|
||||||
i.putExtra(FileActivity.EXTRA_FILE, getFile());
|
i.putExtra(FileActivity.EXTRA_FILE, (Parcelable)getFile());
|
||||||
i.putExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, mVideoPreview.isPlaying());
|
i.putExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, mVideoPreview.isPlaying());
|
||||||
mVideoPreview.pause();
|
mVideoPreview.pause();
|
||||||
i.putExtra(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPreview.getCurrentPosition());
|
i.putExtra(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPreview.getCurrentPosition());
|
||||||
|
|
|
@ -136,15 +136,6 @@ public class FileStorageUtils {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OCFile fillOCFile(UploadDbObject o) {
|
|
||||||
OCFile file = new OCFile(o.getRemotePath());
|
|
||||||
File localFile = new File(o.getLocalPath());
|
|
||||||
file.setFileLength(localFile.length());
|
|
||||||
file.setMimetype(o.getMimeType());
|
|
||||||
file.setStoragePath(o.getLocalPath());
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and populates a new {@link RemoteFile} object with the data read from an {@link OCFile}.
|
* Creates and populates a new {@link RemoteFile} object with the data read from an {@link OCFile}.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue