Fixed bad update of details view for an uploading file when it finishes, resulting...
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 9 Jan 2013 15:55:25 +0000 (16:55 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 9 Jan 2013 15:55:25 +0000 (16:55 +0100)
src/com/owncloud/android/ui/fragment/FileDetailFragment.java

index 5197d67..2c43278 100644 (file)
@@ -155,10 +155,6 @@ public class FileDetailFragment extends SherlockFragment implements
         mAccount = ocAccount;\r
         mStorageManager = null; // we need a context to init this; the container activity is not available yet at this moment \r
         mLayout = R.layout.file_details_empty;\r
-        \r
-        if(fileToDetail != null && ocAccount != null) {\r
-            mLayout = R.layout.file_details_fragment;\r
-        }\r
     }\r
     \r
     \r
@@ -179,6 +175,10 @@ public class FileDetailFragment extends SherlockFragment implements
             mAccount = savedInstanceState.getParcelable(FileDetailFragment.EXTRA_ACCOUNT);\r
         }\r
         \r
+        if(mFile != null && mAccount != null) {\r
+            mLayout = R.layout.file_details_fragment;\r
+        }\r
+        \r
         View view = null;\r
         view = inflater.inflate(mLayout, container, false);\r
         mView = view;\r
@@ -461,7 +461,7 @@ public class FileDetailFragment extends SherlockFragment implements
      * @return  True when the fragment was created with the empty layout.\r
      */\r
     public boolean isEmpty() {\r
-        return mLayout == R.layout.file_details_empty;\r
+        return (mLayout == R.layout.file_details_empty || mFile == null || mAccount == null);\r
     }\r
 \r
     \r
@@ -736,14 +736,14 @@ public class FileDetailFragment extends SherlockFragment implements
                 if (mFile.getRemotePath().equals(uploadRemotePath) ||\r
                     renamedInUpload) {\r
                     if (uploadWasFine) {\r
-                        mFile = mStorageManager.getFileByPath(mFile.getRemotePath());\r
+                        mFile = mStorageManager.getFileByPath(uploadRemotePath);\r
                     }\r
                     if (renamedInUpload) {\r
                         String newName = (new File(uploadRemotePath)).getName();\r
                         Toast msg = Toast.makeText(getActivity().getApplicationContext(), String.format(getString(R.string.filedetails_renamed_in_upload_msg), newName), Toast.LENGTH_LONG);\r
                         msg.show();\r
-                        getSherlockActivity().removeStickyBroadcast(intent);    // not the best place to do this; a small refactorization of BroadcastReceivers should be done\r
                     }\r
+                    getSherlockActivity().removeStickyBroadcast(intent);    // not the best place to do this; a small refactorization of BroadcastReceivers should be done\r
                     updateFileDetails(false);    // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server\r
                 }\r
             }\r