/* ownCloud Android client application\r
* Copyright (C) 2011 Bartek Przybylski\r
+ * Copyright (C) 2012-2013 ownCloud Inc.\r
*\r
* This program is free software: you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
+ * the Free Software Foundation, either version 2 of the License, or\r
* (at your option) any later version.\r
*\r
* This program is distributed in the hope that it will be useful,\r
import android.content.IntentFilter;\r
import android.content.ServiceConnection;\r
import android.content.SharedPreferences;\r
+import android.content.SharedPreferences.Editor;\r
import android.content.pm.PackageInfo;\r
import android.content.pm.PackageManager.NameNotFoundException;\r
import android.content.res.Resources.NotFoundException;\r
import android.database.Cursor;\r
+import android.graphics.Bitmap;\r
+import android.graphics.drawable.BitmapDrawable;\r
import android.net.Uri;\r
import android.os.Bundle;\r
import android.os.Handler;\r
import com.owncloud.android.files.services.FileUploader;\r
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;\r
import com.owncloud.android.network.OwnCloudClientUtils;\r
+import com.owncloud.android.operations.OnRemoteOperationListener;\r
+import com.owncloud.android.operations.RemoteOperation;\r
+import com.owncloud.android.operations.RemoteOperationResult;\r
+import com.owncloud.android.operations.RemoveFileOperation;\r
+import com.owncloud.android.operations.RenameFileOperation;\r
+import com.owncloud.android.operations.SynchronizeFileOperation;\r
+import com.owncloud.android.operations.RemoteOperationResult.ResultCode;\r
import com.owncloud.android.syncadapter.FileSyncService;\r
+import com.owncloud.android.ui.dialog.ChangelogDialog;\r
+import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
+import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;\r
import com.owncloud.android.ui.fragment.FileDetailFragment;\r
import com.owncloud.android.ui.fragment.OCFileListFragment;\r
\r
*/\r
\r
public class FileDisplayActivity extends SherlockFragmentActivity implements\r
- OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener {\r
+ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, OnRemoteOperationListener {\r
\r
private ArrayAdapter<String> mDirectories;\r
private OCFile mCurrentDir = null;\r
private FileDownloaderBinder mDownloaderBinder = null;\r
private FileUploaderBinder mUploaderBinder = null;\r
private ServiceConnection mDownloadConnection = null, mUploadConnection = null;\r
+ private RemoteOperationResult mLastSslUntrustedServerResult = null;\r
\r
private OCFileListFragment mFileList;\r
\r
private static final int DIALOG_ABOUT_APP = 2;\r
public static final int DIALOG_SHORT_WAIT = 3;\r
private static final int DIALOG_CHOOSE_UPLOAD_SOURCE = 4;\r
+ private static final int DIALOG_SSL_VALIDATOR = 5;\r
+ private static final int DIALOG_CERT_NOT_SAVED = 6;\r
+ private static final String DIALOG_CHANGELOG_TAG = "DIALOG_CHANGELOG";\r
+\r
\r
private static final int ACTION_SELECT_CONTENT_FROM_APPS = 1;\r
private static final int ACTION_SELECT_MULTIPLE_FILES = 2;\r
\r
private static final String TAG = "FileDisplayActivity";\r
+\r
+ private static int[] mMenuIdentifiersToPatch = {R.id.about_app};\r
\r
@Override\r
public void onCreate(Bundle savedInstanceState) {\r
super.onCreate(savedInstanceState);\r
\r
/// Load of parameters from received intent\r
- mCurrentDir = getIntent().getParcelableExtra(FileDetailFragment.EXTRA_FILE); // no check necessary, mCurrenDir == null if the parameter is not in the intent\r
Account account = getIntent().getParcelableExtra(FileDetailFragment.EXTRA_ACCOUNT);\r
- if (account != null)\r
- AccountUtils.setCurrentOwnCloudAccount(this, account.name);\r
+ if (account != null && AccountUtils.setCurrentOwnCloudAccount(this, account.name)) {\r
+ mCurrentDir = getIntent().getParcelableExtra(FileDetailFragment.EXTRA_FILE); \r
+ }\r
\r
/// Load of saved instance state: keep this always before initDataFromCurrentAccount()\r
if(savedInstanceState != null) {\r
// Drop-down navigation \r
mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);\r
OCFile currFile = mCurrentDir;\r
- while(currFile != null && currFile.getFileName() != OCFile.PATH_SEPARATOR) {\r
+ while(mStorageManager != null && currFile != null && currFile.getFileName() != OCFile.PATH_SEPARATOR) {\r
mDirectories.add(currFile.getFileName());\r
currFile = mStorageManager.getFileById(currFile.getParentId());\r
}\r
actionBar.setListNavigationCallbacks(mDirectories, this);\r
setSupportProgressBarIndeterminateVisibility(false); // always AFTER setContentView(...) ; to workaround bug in its implementation\r
\r
+ \r
+ // show changelog, if needed\r
+ //showChangeLog();\r
+ \r
Log.d(getClass().toString(), "onCreate() end");\r
}\r
\r
\r
/**\r
+ * Shows a dialog with the change log of the current version after each app update\r
+ * \r
+ * TODO make it permanent; by now, only to advice the workaround app for 4.1.x\r
+ */\r
+ private void showChangeLog() {\r
+ if (android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.JELLY_BEAN) {\r
+ final String KEY_VERSION = "version";\r
+ SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());\r
+ int currentVersionNumber = 0;\r
+ int savedVersionNumber = sharedPref.getInt(KEY_VERSION, 0);\r
+ try {\r
+ PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);\r
+ currentVersionNumber = pi.versionCode;\r
+ } catch (Exception e) {}\r
+ \r
+ if (currentVersionNumber > savedVersionNumber) {\r
+ ChangelogDialog.newInstance(true).show(getSupportFragmentManager(), DIALOG_CHANGELOG_TAG);\r
+ Editor editor = sharedPref.edit();\r
+ editor.putInt(KEY_VERSION, currentVersionNumber);\r
+ editor.commit();\r
+ }\r
+ }\r
+ }\r
+ \r
+\r
+ /**\r
* Launches the account creation activity. To use when no ownCloud account is available\r
*/\r
private void createFirstAccount() {\r
public boolean onCreateOptionsMenu(Menu menu) {\r
MenuInflater inflater = getSherlock().getMenuInflater();\r
inflater.inflate(R.menu.menu, menu);\r
+ \r
+ patchHiddenAccents(menu);\r
+ \r
return true;\r
}\r
\r
+ /**\r
+ * Workaround for this: <a href="http://code.google.com/p/android/issues/detail?id=3974">http://code.google.com/p/android/issues/detail?id=3974</a> \r
+ * \r
+ * @param menu Menu to patch\r
+ */\r
+ private void patchHiddenAccents(Menu menu) {\r
+ for (int i = 0; i < mMenuIdentifiersToPatch.length ; i++) {\r
+ MenuItem aboutItem = menu.findItem(mMenuIdentifiersToPatch[i]);\r
+ if (aboutItem != null && aboutItem.getIcon() instanceof BitmapDrawable) {\r
+ // Clip off the bottom three (density independent) pixels of transparent padding\r
+ Bitmap original = ((BitmapDrawable) aboutItem.getIcon()).getBitmap();\r
+ float scale = getResources().getDisplayMetrics().density;\r
+ int clippedHeight = (int) (original.getHeight() - (3 * scale));\r
+ Bitmap scaled = Bitmap.createBitmap(original, 0, 0, original.getWidth(), clippedHeight);\r
+ aboutItem.setIcon(new BitmapDrawable(getResources(), scaled));\r
+ }\r
+ }\r
+ }\r
+\r
+\r
@Override\r
public boolean onOptionsItemSelected(MenuItem item) {\r
boolean retval = true;\r
break;\r
}\r
case R.id.startSync: {\r
- ContentResolver.cancelSync(null, AccountAuthenticator.AUTH_TOKEN_TYPE); // cancel the current synchronizations of any ownCloud account\r
- Bundle bundle = new Bundle();\r
- bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);\r
- ContentResolver.requestSync(\r
- AccountUtils.getCurrentOwnCloudAccount(this),\r
- AccountAuthenticator.AUTH_TOKEN_TYPE, bundle);\r
+ startSynchronization();\r
break;\r
}\r
case R.id.action_upload: {\r
break;\r
}\r
default:\r
- retval = false;\r
+ retval = super.onOptionsItemSelected(item);\r
}\r
return retval;\r
}\r
\r
+ private void startSynchronization() {\r
+ ContentResolver.cancelSync(null, AccountAuthenticator.AUTH_TOKEN_TYPE); // cancel the current synchronizations of any ownCloud account\r
+ Bundle bundle = new Bundle();\r
+ bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);\r
+ ContentResolver.requestSync(\r
+ AccountUtils.getCurrentOwnCloudAccount(this),\r
+ AccountAuthenticator.AUTH_TOKEN_TYPE, bundle);\r
+ }\r
+\r
+\r
@Override\r
public boolean onNavigationItemSelected(int itemPosition, long itemId) {\r
int i = itemPosition;\r
*/\r
public void onActivityResult(int requestCode, int resultCode, Intent data) {\r
\r
- if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && resultCode == RESULT_OK) {\r
- requestSimpleUpload(data);\r
+ if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {\r
+ requestSimpleUpload(data, resultCode);\r
\r
- } else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && resultCode == RESULT_OK) {\r
- requestMultipleUpload(data);\r
+ } else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {\r
+ requestMultipleUpload(data, resultCode);\r
\r
}\r
}\r
\r
- private void requestMultipleUpload(Intent data) {\r
+ private void requestMultipleUpload(Intent data, int resultCode) {\r
String[] filePaths = data.getStringArrayExtra(UploadFilesActivity.EXTRA_CHOSEN_FILES);\r
if (filePaths != null) {\r
String[] remotePaths = new String[filePaths.length];\r
i.putExtra(FileUploader.KEY_LOCAL_FILE, filePaths);\r
i.putExtra(FileUploader.KEY_REMOTE_FILE, remotePaths);\r
i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_MULTIPLE_FILES);\r
+ if (resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)\r
+ i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE);\r
startService(i);\r
\r
} else {\r
}\r
\r
\r
- private void requestSimpleUpload(Intent data) {\r
+ private void requestSimpleUpload(Intent data, int resultCode) {\r
String filepath = null;\r
try {\r
Uri selectedImageUri = data.getData();\r
i.putExtra(FileUploader.KEY_LOCAL_FILE, filepath);\r
i.putExtra(FileUploader.KEY_REMOTE_FILE, remotepath);\r
i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_SINGLE_FILE);\r
+ if (resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)\r
+ i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE);\r
startService(i);\r
}\r
\r
Log.d(getClass().toString(), "onPause() end");\r
}\r
\r
+ \r
+ @Override\r
+ protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {\r
+ if (id == DIALOG_SSL_VALIDATOR && mLastSslUntrustedServerResult != null) {\r
+ ((SslValidatorDialog)dialog).updateResult(mLastSslUntrustedServerResult);\r
+ }\r
+ }\r
+\r
+ \r
@Override\r
protected Dialog onCreateDialog(int id) {\r
Dialog dialog = null;\r
dialog.dismiss();\r
}\r
});\r
- builder.setNegativeButton(R.string.common_exit, new OnClickListener() {\r
+ String message = String.format(getString(R.string.common_exit), getString(R.string.app_name));\r
+ builder.setNegativeButton(message, new OnClickListener() {\r
public void onClick(DialogInterface dialog, int which) {\r
dialog.dismiss();\r
finish();\r
PackageInfo pkg;\r
try {\r
pkg = getPackageManager().getPackageInfo(getPackageName(), 0);\r
- builder.setMessage(String.format(getString(R.string.about_message), pkg.versionName));\r
+ builder.setMessage(String.format(getString(R.string.about_message), getString(R.string.app_name), pkg.versionName));\r
builder.setIcon(android.R.drawable.ic_menu_info_details);\r
dialog = builder.create();\r
} catch (NameNotFoundException e) {\r
if (item == 0) {\r
//if (!mDualPane) { \r
Intent action = new Intent(FileDisplayActivity.this, UploadFilesActivity.class);\r
+ action.putExtra(UploadFilesActivity.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(FileDisplayActivity.this));\r
startActivityForResult(action, ACTION_SELECT_MULTIPLE_FILES);\r
//} else {\r
// TODO create and handle new fragment LocalFileListFragment\r
dialog = builder.create();\r
break;\r
}\r
+ case DIALOG_SSL_VALIDATOR: {\r
+ dialog = SslValidatorDialog.newInstance(this, mLastSslUntrustedServerResult, this);\r
+ break;\r
+ }\r
+ case DIALOG_CERT_NOT_SAVED: {\r
+ builder = new AlertDialog.Builder(this);\r
+ builder.setMessage(getResources().getString(R.string.ssl_validator_not_saved));\r
+ builder.setCancelable(false);\r
+ builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {\r
+ @Override\r
+ public void onClick(DialogInterface dialog, int which) {\r
+ dialog.dismiss();\r
+ };\r
+ });\r
+ dialog = builder.create();\r
+ break;\r
+ }\r
default:\r
dialog = null;\r
}\r
}\r
\r
private class SyncBroadcastReceiver extends BroadcastReceiver {\r
+\r
/**\r
* {@link BroadcastReceiver} to enable syncing feedback in UI\r
*/\r
}\r
\r
setSupportProgressBarIndeterminateVisibility(inProgress);\r
+ removeStickyBroadcast(intent);\r
\r
}\r
+ \r
+ RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncService.SYNC_RESULT);\r
+ if (synchResult != null) {\r
+ if (synchResult.getCode().equals(RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED)) {\r
+ mLastSslUntrustedServerResult = synchResult;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+ }\r
}\r
}\r
\r
*/\r
@Override\r
public void onReceive(Context context, Intent intent) {\r
- long parentDirId = intent.getLongExtra(FileUploader.EXTRA_PARENT_DIR_ID, -1);\r
- OCFile parentDir = mStorageManager.getFileById(parentDirId);\r
+ String uploadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);\r
String accountName = intent.getStringExtra(FileUploader.ACCOUNT_NAME);\r
-\r
- if (accountName.equals(AccountUtils.getCurrentOwnCloudAccount(context).name) &&\r
- parentDir != null && \r
- ( (mCurrentDir == null && parentDir.getFileName().equals("/")) ||\r
- parentDir.equals(mCurrentDir)\r
- )\r
- ) {\r
+ boolean sameAccount = accountName.equals(AccountUtils.getCurrentOwnCloudAccount(context).name);\r
+ boolean isDescendant = (mCurrentDir != null) && (uploadedRemotePath != null) && (uploadedRemotePath.startsWith(mCurrentDir.getRemotePath()));\r
+ if (sameAccount && isDescendant) {\r
OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList);\r
if (fileListFragment != null) { \r
fileListFragment.listDirectory();\r
public void onReceive(Context context, Intent intent) {\r
String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);\r
String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);\r
-\r
- if (accountName.equals(AccountUtils.getCurrentOwnCloudAccount(context).name) &&\r
- mCurrentDir != null && mCurrentDir.getFileId() == mStorageManager.getFileByPath(downloadedRemotePath).getParentId()) {\r
+ boolean sameAccount = accountName.equals(AccountUtils.getCurrentOwnCloudAccount(context).name);\r
+ boolean isDescendant = (mCurrentDir != null) && (downloadedRemotePath != null) && (downloadedRemotePath.startsWith(mCurrentDir.getRemotePath()));\r
+ if (sameAccount && isDescendant) {\r
OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList);\r
if (fileListFragment != null) { \r
fileListFragment.listDirectory();\r
if (mDualPane) {\r
FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
if (fragment != null)\r
- fragment.updateFileDetails();\r
+ fragment.updateFileDetails(false);\r
}\r
}\r
\r
}\r
\r
\r
+ @Override\r
+ public void onSavedCertificate() {\r
+ startSynchronization(); \r
+ }\r
+\r
+\r
+ @Override\r
+ public void onFailedSavingCertificate() {\r
+ showDialog(DIALOG_CERT_NOT_SAVED);\r
+ }\r
+\r
+\r
+ /**\r
+ * Updates the view associated to the activity after the finish of some operation over files\r
+ * in the current account.\r
+ * \r
+ * @param operation Removal operation performed.\r
+ * @param result Result of the removal.\r
+ */\r
+ @Override\r
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {\r
+ if (operation instanceof RemoveFileOperation) {\r
+ onRemoveFileOperationFinish((RemoveFileOperation)operation, result);\r
+ \r
+ } else if (operation instanceof RenameFileOperation) {\r
+ onRenameFileOperationFinish((RenameFileOperation)operation, result);\r
+ \r
+ } else if (operation instanceof SynchronizeFileOperation) {\r
+ onSynchronizeFileOperationFinish((SynchronizeFileOperation)operation, result);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Updates the view associated to the activity after the finish of an operation trying to remove a \r
+ * file. \r
+ * \r
+ * @param operation Removal operation performed.\r
+ * @param result Result of the removal.\r
+ */\r
+ private void onRemoveFileOperationFinish(RemoveFileOperation operation, RemoteOperationResult result) {\r
+ dismissDialog(DIALOG_SHORT_WAIT);\r
+ if (result.isSuccess()) {\r
+ Toast msg = Toast.makeText(this, R.string.remove_success_msg, Toast.LENGTH_LONG);\r
+ msg.show();\r
+ OCFile removedFile = operation.getFile();\r
+ if (mDualPane) {\r
+ FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (details != null && removedFile.equals(details.getDisplayedFile()) ) {\r
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
+ transaction.replace(R.id.file_details_container, new FileDetailFragment(null, null)); // empty FileDetailFragment\r
+ transaction.commit();\r
+ }\r
+ }\r
+ if (mStorageManager.getFileById(removedFile.getParentId()).equals(mCurrentDir)) {\r
+ mFileList.listDirectory();\r
+ }\r
+ \r
+ } else {\r
+ Toast msg = Toast.makeText(this, R.string.remove_fail_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ if (result.isSslRecoverableException()) {\r
+ mLastSslUntrustedServerResult = result;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Updates the view associated to the activity after the finish of an operation trying to rename a \r
+ * file. \r
+ * \r
+ * @param operation Renaming operation performed.\r
+ * @param result Result of the renaming.\r
+ */\r
+ private void onRenameFileOperationFinish(RenameFileOperation operation, RemoteOperationResult result) {\r
+ dismissDialog(DIALOG_SHORT_WAIT);\r
+ OCFile renamedFile = operation.getFile();\r
+ if (result.isSuccess()) {\r
+ if (mDualPane) {\r
+ FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (details != null && renamedFile.equals(details.getDisplayedFile()) ) {\r
+ details.updateFileDetails(renamedFile, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ }\r
+ }\r
+ if (mStorageManager.getFileById(renamedFile.getParentId()).equals(mCurrentDir)) {\r
+ mFileList.listDirectory();\r
+ }\r
+ \r
+ } else {\r
+ if (result.getCode().equals(ResultCode.INVALID_LOCAL_FILE_NAME)) {\r
+ Toast msg = Toast.makeText(this, R.string.rename_local_fail_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ // TODO throw again the new rename dialog\r
+ } else {\r
+ Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ if (result.isSslRecoverableException()) {\r
+ mLastSslUntrustedServerResult = result;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation, RemoteOperationResult result) {\r
+ dismissDialog(DIALOG_SHORT_WAIT);\r
+ OCFile syncedFile = operation.getLocalFile();\r
+ if (!result.isSuccess()) {\r
+ if (result.getCode() == ResultCode.SYNC_CONFLICT) {\r
+ Intent i = new Intent(this, ConflictsResolveActivity.class);\r
+ i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile);\r
+ i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ startActivity(i);\r
+ \r
+ } else {\r
+ Toast msg = Toast.makeText(this, R.string.sync_file_fail_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ }\r
+ \r
+ } else {\r
+ if (operation.transferWasRequested()) {\r
+ mFileList.listDirectory();\r
+ onTransferStateChanged(syncedFile, true, true);\r
+ \r
+ } else {\r
+ Toast msg = Toast.makeText(this, R.string.sync_file_nothing_to_do_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * {@inheritDoc}\r
+ */\r
+ @Override\r
+ public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) {\r
+ /*OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList);\r
+ if (fileListFragment != null) { \r
+ fileListFragment.listDirectory();\r
+ }*/\r
+ if (mDualPane) {\r
+ FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (details != null && file.equals(details.getDisplayedFile()) ) {\r
+ if (downloading || uploading) {\r
+ details.updateFileDetails(file, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ } else {\r
+ details.updateFileDetails(downloading || uploading);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ \r
+\r
+\r
}\r