mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 10:18: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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
|
||||
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.Parcelable;
|
||||
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>() {
|
||||
@Override
|
||||
|
|
|
@ -50,14 +50,13 @@ public class UploadDbHandler extends Observable {
|
|||
|
||||
// for testing only
|
||||
public void recreateDb() {
|
||||
// mDB.beginTransaction();
|
||||
// getDB().beginTransaction();
|
||||
// try {
|
||||
// mHelper.onUpgrade(mDB, 0, mDatabaseVersion);
|
||||
// mDB.setTransactionSuccessful();
|
||||
// mHelper.onUpgrade(getDB(), 0, mDatabaseVersion);
|
||||
// getDB().setTransactionSuccessful();
|
||||
// } finally {
|
||||
// mDB.endTransaction();
|
||||
// getDB().endTransaction();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public enum UploadStatus {
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.content.Context;
|
|||
import android.util.Base64;
|
||||
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.db.UploadDbHandler.UploadStatus;
|
||||
import com.owncloud.android.files.services.FileUploadService.LocalBehaviour;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* Mime type of upload file.
|
||||
*/
|
||||
String mimeType;
|
||||
public UploadDbObject(OCFile ocFile) {
|
||||
this.ocFile = ocFile;
|
||||
}
|
||||
// /**
|
||||
// * 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.
|
||||
*/
|
||||
|
@ -120,43 +132,23 @@ public class UploadDbObject implements Serializable {
|
|||
* @return the localPath
|
||||
*/
|
||||
public String getLocalPath() {
|
||||
return localPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param localPath the localPath to set
|
||||
*/
|
||||
public void setLocalPath(String localPath) {
|
||||
this.localPath = localPath;
|
||||
return ocFile.getStoragePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the remotePath
|
||||
*/
|
||||
public String getRemotePath() {
|
||||
return remotePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param remotePath the remotePath to set
|
||||
*/
|
||||
public void setRemotePath(String remotePath) {
|
||||
this.remotePath = remotePath;
|
||||
return ocFile.getRemotePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mimeType
|
||||
*/
|
||||
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
|
||||
|
|
|
@ -32,7 +32,6 @@ import com.owncloud.android.R;
|
|||
import com.owncloud.android.authentication.AuthenticatorActivity;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
|
||||
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
|
@ -62,6 +61,7 @@ import android.os.HandlerThread;
|
|||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Process;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
||||
|
@ -431,7 +431,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
|
|||
} else {
|
||||
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.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import android.os.Binder;
|
|||
import android.os.HandlerThread;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Process;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
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
|
||||
// failed.
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
UploadDbObject uploadObject = new UploadDbObject();
|
||||
uploadObject.setRemotePath(files[i].getRemotePath());
|
||||
uploadObject.setLocalPath(files[i].getStoragePath());
|
||||
uploadObject.setMimeType(files[i].getMimetype());
|
||||
UploadDbObject uploadObject = new UploadDbObject(files[i]);
|
||||
uploadObject.setAccountName(account.name);
|
||||
uploadObject.setForceOverwrite(forceOverwrite);
|
||||
uploadObject.setCreateRemoteFolder(isCreateRemoteFolder);
|
||||
|
@ -608,8 +606,7 @@ public class FileUploadService extends IntentService {
|
|||
String uploadKey = null;
|
||||
|
||||
uploadKey = buildRemoteName(account, uploadDbObject.getRemotePath());
|
||||
OCFile file = obtainNewOCFileToUpload(uploadDbObject.getRemotePath(), uploadDbObject.getLocalPath(),
|
||||
uploadDbObject.getMimeType());
|
||||
OCFile file = uploadDbObject.getOCFile();
|
||||
mCurrentUpload = new UploadFileOperation(account, file, chunked, uploadDbObject.isForceOverwrite(),
|
||||
uploadDbObject.getLocalAction(), getApplicationContext());
|
||||
if (uploadDbObject.isCreateRemoteFolder()) {
|
||||
|
@ -840,7 +837,7 @@ public class FileUploadService extends IntentService {
|
|||
// / includes a pending intent in the notification showing the details
|
||||
// view of the file
|
||||
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.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
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.WifiLock;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcelable;
|
||||
import android.os.PowerManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -535,7 +536,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
|
|||
private void updateNotification(String content) {
|
||||
// TODO check if updating the Intent is really necessary
|
||||
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.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
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
|
||||
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.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.accounts.Account;
|
|||
import android.content.Intent;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Binder;
|
||||
import android.os.Parcelable;
|
||||
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...");
|
||||
Intent i = new Intent(mService, MediaService.class);
|
||||
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_START_POSITION, position);
|
||||
i.setAction(MediaService.ACTION_PLAY_FILE);
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.owncloud.android.utils.FileStorageUtils;
|
|||
import android.accounts.Account;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
Intent i = new Intent(mContext, FileUploadService.class);
|
||||
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_LOCAL_FILE, localFile.getStoragePath());*/
|
||||
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) {
|
||||
Intent i = new Intent(mContext, FileDownloader.class);
|
||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, file);
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)file);
|
||||
mContext.startService(i);
|
||||
mTransferWasRequested = true;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
import android.database.Cursor;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
|
@ -101,7 +102,7 @@ public class FileObserverService extends Service {
|
|||
Intent intent = new Intent(context, FileObserverService.class);
|
||||
intent.setAction(watchIt ? FileObserverService.ACTION_ADD_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);
|
||||
return intent;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.accounts.Account;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.FileObserver;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
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
|
||||
Intent i = new Intent(mContext, ConflictsResolveActivity.class);
|
||||
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);
|
||||
mContext.startActivity(i);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.owncloud.android.utils.DisplayUtils;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
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);
|
||||
|
||||
startService(i);
|
||||
|
|
|
@ -46,6 +46,7 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcelable;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
|
@ -1661,7 +1662,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
|||
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_FILE, (Parcelable)syncedFile);
|
||||
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount());
|
||||
startActivity(i);
|
||||
|
||||
|
@ -1731,7 +1732,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
|||
if (!mDownloaderBinder.isDownloading(account, mWaitingToPreview)) {
|
||||
Intent i = new Intent(this, FileDownloader.class);
|
||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, mWaitingToPreview);
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)mWaitingToPreview);
|
||||
startService(i);
|
||||
}
|
||||
}
|
||||
|
@ -1788,7 +1789,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
|||
if (!mDownloaderBinder.isDownloading(account, file)) {
|
||||
Intent i = new Intent(this, FileDownloader.class);
|
||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, file);
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)file);
|
||||
startService(i);
|
||||
}
|
||||
}
|
||||
|
@ -1820,7 +1821,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
|||
*/
|
||||
public void startImagePreview(OCFile file) {
|
||||
Intent showDetailsIntent = new Intent(this, PreviewImageActivity.class);
|
||||
showDetailsIntent.putExtra(EXTRA_FILE, file);
|
||||
showDetailsIntent.putExtra(EXTRA_FILE, (Parcelable)file);
|
||||
showDetailsIntent.putExtra(EXTRA_ACCOUNT, getAccount());
|
||||
startActivity(showDetailsIntent);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
import android.content.res.Resources.NotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
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);
|
||||
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder());
|
||||
data.putExtra(EXTRA_TARGET_FILE, targetFile);
|
||||
data.putExtra(EXTRA_CURRENT_FOLDER, (Parcelable)getCurrentFolder());
|
||||
data.putExtra(EXTRA_TARGET_FILE, (Parcelable)targetFile);
|
||||
setResult(RESULT_OK_AND_MOVE, data);
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.File;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
|
@ -47,7 +48,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
|
|||
*/
|
||||
@Override
|
||||
public void onUploadItemClick(UploadDbObject file) {
|
||||
OCFile ocFile = FileStorageUtils.fillOCFile(file);
|
||||
OCFile ocFile = file.getOCFile();
|
||||
switch (file.getUploadStatus()) {
|
||||
case UPLOAD_IN_PROGRESS:
|
||||
if (ocFile != null) {
|
||||
|
@ -58,7 +59,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
|
|||
break;
|
||||
case UPLOAD_SUCCEEDED:
|
||||
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));
|
||||
startActivity(showDetailsIntent);
|
||||
break;
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.File;
|
|||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -325,7 +326,7 @@ public class OCFileListFragment extends ExtendedListFragment {
|
|||
Intent action = new Intent(getActivity(), MoveActivity.class);
|
||||
|
||||
// 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);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.Parcelable;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
|
@ -350,7 +351,7 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
|
|||
public void showDetails(OCFile file) {
|
||||
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
|
||||
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));
|
||||
startActivity(showDetailsIntent);
|
||||
int pos = mPreviewImagePagerAdapter.getFilePosition(file);
|
||||
|
@ -366,7 +367,7 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
|
|||
} else if (!mDownloaderBinder.isDownloading(getAccount(), file)) {
|
||||
Intent i = new Intent(this, FileDownloader.class);
|
||||
i.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount());
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, file);
|
||||
i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)file);
|
||||
startService(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcelable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -516,7 +517,7 @@ public class PreviewMediaFragment extends FileFragment implements
|
|||
private void startFullScreenVideo() {
|
||||
Intent i = new Intent(getSherlockActivity(), PreviewVideoActivity.class);
|
||||
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());
|
||||
mVideoPreview.pause();
|
||||
i.putExtra(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPreview.getCurrentPosition());
|
||||
|
|
|
@ -136,15 +136,6 @@ public class FileStorageUtils {
|
|||
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}.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue