along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<manifest package="com.owncloud.android"
- android:versionCode="104005"
- android:versionName="1.4.5" xmlns:android="http://schemas.android.com/apk/res/android">
+ android:versionCode="104006"
+ android:versionName="1.4.6" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.owncloud.android.workaround.accounts"
- android:versionCode="0100007"
- android:versionName="1.0.7" >
+ android:versionCode="0100008"
+ android:versionName="1.0.8" >
<uses-sdk
android:minSdkVersion="16"
- android:targetSdkVersion="16"
- android:maxSdkVersion="17"
- />
+ android:targetSdkVersion="16" />
<application
android:allowBackup="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:paddingTop="4dip"
+ android:paddingTop="4dp"
android:orientation="horizontal"
>
android:id="@+id/currentTimeText"
android:textSize="14sp"
android:textStyle="bold"
- android:paddingTop="4dip"
- android:paddingStart="4dip"
+ android:paddingTop="4dp"
+ android:paddingStart="4dp"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingEnd="4dip"
+ android:paddingEnd="4dp"
android:text="@string/placeholder_media_time"
/>
<SeekBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="0dip"
+ android:layout_width="0dp"
android:layout_weight="1"
- android:layout_height="32dip"
+ android:layout_height="32dp"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<TextView android:id="@+id/totalTimeText"
android:textSize="14sp"
android:textStyle="bold"
- android:paddingTop="4dip"
- android:paddingEnd="4dip"
+ android:paddingTop="4dp"
+ android:paddingEnd="4dp"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="4dip"
+ android:paddingStart="4dp"
android:text="@string/placeholder_media_time"
/>
mPendingUploads.remove(uploadKey);
Log_OC.i(TAG, "Remove CurrentUploadItem from pending upload Item Map.");
}
+ if (uploadResult.isException()) {
+ // enforce the creation of a new client object for next uploads; this grant that a new socket will
+ // be created in the future if the current exception is due to an abrupt lose of network connection
+ mUploadClient = null;
+ }
}
/// notify result
mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon);
/// includes a pending intent in the notification showing the details view of the file
- Intent showDetailsIntent = null;
- if (PreviewImageFragment.canBePreviewed(upload.getFile())) {
- showDetailsIntent = new Intent(this, PreviewImageActivity.class);
- } else {
- showDetailsIntent = new Intent(this, FileDisplayActivity.class);
- }
+ Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, upload.getFile());
showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount());
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
/** Generated - should be refreshed every time the class changes!! */
private static final long serialVersionUID = -4415103901492836870L;
+
private static final String TAG = "RemoteOperationResult";
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.ui.fragment.OCFileListFragment;
import com.owncloud.android.ui.preview.PreviewImageActivity;
+import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.ui.preview.PreviewMediaFragment;
import com.owncloud.android.ui.preview.PreviewVideoActivity;
/// Check whether the 'main' OCFile handled by the Activity is contained in the current Account
OCFile file = getFile();
+ // get parent from path
+ String parentPath = "";
if (file != null) {
if (file.isDown() && file.getLastSyncDateForProperties() == 0) {
// upload in progress - right now, files are not inserted in the local cache until the upload is successful
- if (mStorageManager.getFileById(file.getParentId()) == null) {
- file = null; // not able to know the directory where the file is uploading
- }
+ // get parent from path
+ parentPath = file.getRemotePath().substring(0, file.getRemotePath().lastIndexOf(file.getFileName()));
+ if (mStorageManager.getFileByPath(parentPath) == null)
+ file = null; // not able to know the directory where the file is uploading
} else {
file = mStorageManager.getFileByPath(file.getRemotePath()); // currentDir = null if not in the current Account
}
private void setNavigationListWithFolder(OCFile file) {
mDirectories.clear();
OCFile fileIt = file;
+ String parentPath;
while(fileIt != null && fileIt.getFileName() != OCFile.ROOT_PATH) {
if (fileIt.isFolder()) {
mDirectories.add(fileIt.getFileName());
}
- fileIt = mStorageManager.getFileById(fileIt.getParentId());
+ //fileIt = mStorageManager.getFileById(fileIt.getParentId());
+ // get parent from path
+ parentPath = fileIt.getRemotePath().substring(0, fileIt.getRemotePath().lastIndexOf(fileIt.getFileName()));
+ fileIt = mStorageManager.getFileByPath(parentPath);
}
mDirectories.add(OCFile.PATH_SEPARATOR);
}
String accountName = intent.getStringExtra(FileSyncService.ACCOUNT_NAME);
RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncService.SYNC_RESULT);
- if (getAccount() != null && accountName.equals(getAccount().name)) {
+ if (getAccount() != null && accountName.equals(getAccount().name)
+ && mStorageManager != null
+ ) {
String synchFolderRemotePath = intent.getStringExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH);
if (file.isFolder()) {
return file;
} else if (mStorageManager != null) {
- return mStorageManager.getFileById(file.getParentId());
+ String parentPath = file.getRemotePath().substring(0, file.getRemotePath().lastIndexOf(file.getFileName()));
+ return mStorageManager.getFileByPath(parentPath);
}
}
return null;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.dialog.EditNameDialog;
import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener;
+import com.owncloud.android.ui.preview.PreviewImageFragment;
import eu.alefzero.webdav.OnDatatransferProgressListener;
msg.show();
}
getSherlockActivity().removeStickyBroadcast(intent); // not the best place to do this; a small refactorization of BroadcastReceivers should be done
+
updateFileDetails(false, false); // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server
+
+ // Force the preview if the file is an image
+ if (uploadWasFine && PreviewImageFragment.canBePreviewed(getFile())) {
+ ((FileDisplayActivity) mContainerActivity).startImagePreview(getFile());
+ }
}
}
}
*/
package com.owncloud.android.ui.preview;
-import android.app.Dialog;
-import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
}
private void initViewPager() {
- OCFile parentFolder = mStorageManager.getFileById(getFile().getParentId());
+ // get parent from path
+ String parentPath = getFile().getRemotePath().substring(0, getFile().getRemotePath().lastIndexOf(getFile().getFileName()));
+ OCFile parentFolder = mStorageManager.getFileByPath(parentPath);
+ //OCFile parentFolder = mStorageManager.getFileById(getFile().getParentId());
if (parentFolder == null) {
// should not be necessary
parentFolder = mStorageManager.getFileByPath(OCFile.ROOT_PATH);
Log_OC.d(TAG, "Simulating reselection of current page after connection of download binder");
onPageSelected(mViewPager.getCurrentItem());
}
-
+
} else if (component.equals(new ComponentName(PreviewImageActivity.this, FileUploader.class))) {
Log_OC.d(TAG, "Upload service connected");
mUploaderBinder = (FileUploaderBinder) service;
if (!file.isImage()) {
throw new IllegalArgumentException("Non-image file passed as argument");
}
- mStorageManager = new FileDataStorageManager(getAccount(), getContentResolver());
- file = mStorageManager.getFileById(file.getFileId());
+ mStorageManager = new FileDataStorageManager(getAccount(), getContentResolver());
+
+ // Update file according to DB file, if it is possible
+ if (file.getFileId() > FileDataStorageManager.ROOT_PARENT_ID)
+ file = mStorageManager.getFileById(file.getFileId());
+
if (file != null) {
/// Refresh the activity according to the Account and OCFile set
setFile(file); // reset after getting it fresh from mStorageManager
import com.owncloud.android.operations.RemoteOperation;
import com.owncloud.android.operations.RemoteOperationResult;
import com.owncloud.android.operations.RemoveFileOperation;
-import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.fragment.ConfirmationDialogFragment;
import com.owncloud.android.ui.fragment.FileFragment;