*/
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.PATH_SEPARATOR);
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;
finish();
}
-
-// @Override
-// protected Dialog onCreateDialog(int id) {
-// Dialog dialog = null;
-// switch (id) {
-// case DIALOG_SHORT_WAIT: {
-// ProgressDialog working_dialog = new ProgressDialog(this);
-// working_dialog.setMessage(getResources().getString(
-// R.string.wait_a_moment));
-// working_dialog.setIndeterminate(true);
-// working_dialog.setCancelable(false);
-// dialog = working_dialog;
-// break;
-// }
-// default:
-// dialog = null;
-// }
-// return dialog;
-// }
-
-
/**
* Show loading dialog
*/
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() > DataStorageManager.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