X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/73f8797b7572e431037fd5ee55c24237c544dfcb..2b5785556e7f7c3cefc5f084949e091f80abed6d:/src/com/owncloud/android/ui/fragment/FileDetailFragment.java diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 8740f834..f6c25e2c 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -20,7 +20,6 @@ package com.owncloud.android.ui.fragment; import java.io.File; import org.apache.commons.httpclient.Credentials; -import org.apache.commons.httpclient.UsernamePasswordCredentials; import android.accounts.Account; import android.accounts.AccountManager; @@ -65,7 +64,6 @@ import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder; import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.network.BearerCredentials; -import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.operations.OnRemoteOperationListener; import com.owncloud.android.operations.RemoteOperation; import com.owncloud.android.operations.RemoteOperationResult; @@ -142,10 +140,6 @@ public class FileDetailFragment extends SherlockFragment implements mAccount = ocAccount; mStorageManager = null; // we need a context to init this; the container activity is not available yet at this moment mLayout = R.layout.file_details_empty; - - if(fileToDetail != null && ocAccount != null) { - mLayout = R.layout.file_details_fragment; - } } @@ -166,6 +160,10 @@ public class FileDetailFragment extends SherlockFragment implements mAccount = savedInstanceState.getParcelable(FileDetailFragment.EXTRA_ACCOUNT); } + if(mFile != null && mAccount != null) { + mLayout = R.layout.file_details_fragment; + } + View view = null; view = inflater.inflate(mLayout, container, false); mView = view; @@ -410,7 +408,6 @@ public class FileDetailFragment extends SherlockFragment implements true, mStorageManager); mLastRemoteOperation.execute(mAccount, getSherlockActivity(), this, mHandler, getSherlockActivity()); - boolean inDisplayActivity = getActivity() instanceof FileDisplayActivity; getActivity().showDialog((inDisplayActivity)? FileDisplayActivity.DIALOG_SHORT_WAIT : FileDetailActivity.DIALOG_SHORT_WAIT); } @@ -446,7 +443,7 @@ public class FileDetailFragment extends SherlockFragment implements * @return True when the fragment was created with the empty layout. */ public boolean isEmpty() { - return mLayout == R.layout.file_details_empty; + return (mLayout == R.layout.file_details_empty || mFile == null || mAccount == null); } @@ -721,14 +718,14 @@ public class FileDetailFragment extends SherlockFragment implements if (mFile.getRemotePath().equals(uploadRemotePath) || renamedInUpload) { if (uploadWasFine) { - mFile = mStorageManager.getFileByPath(mFile.getRemotePath()); + mFile = mStorageManager.getFileByPath(uploadRemotePath); } if (renamedInUpload) { String newName = (new File(uploadRemotePath)).getName(); Toast msg = Toast.makeText(getActivity().getApplicationContext(), String.format(getString(R.string.filedetails_renamed_in_upload_msg), newName), Toast.LENGTH_LONG); msg.show(); - getSherlockActivity().removeStickyBroadcast(intent); // not the best place to do this; a small refactorization of BroadcastReceivers should be done } + getSherlockActivity().removeStickyBroadcast(intent); // not the best place to do this; a small refactorization of BroadcastReceivers should be done updateFileDetails(false); // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server } }