Fixed problem in first-ever synchronization introduced while refactoring list adapters
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileDisplayActivity.java
index b320297..77612e3 100644 (file)
@@ -222,7 +222,9 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
             mCurrentDir = mStorageManager.getFileByPath(mCurrentDir.getRemotePath());   // mCurrentDir == null if it is not in the current account\r
         }\r
         if (mCurrentFile != null) {\r
-            mCurrentFile = mStorageManager.getFileByPath(mCurrentFile.getRemotePath());   // mCurrentFile == null if it is not in the current account\r
+            if (mCurrentFile.fileExists()) {\r
+                mCurrentFile = mStorageManager.getFileByPath(mCurrentFile.getRemotePath());   // mCurrentFile == null if it is not in the current account\r
+            }   // else : keep mCurrentFile with the received value; this is currently the case of an upload in progress, when the user presses the status notification in a landscape tablet\r
         }\r
         \r
         /// Default to root if mCurrentDir was not found\r
@@ -442,9 +444,11 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         outState.putParcelable(FileDetailFragment.EXTRA_FILE, mCurrentDir);\r
         if (mDualPane) {\r
             FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
-            OCFile file = fragment.getDisplayedFile();\r
-            if (file != null) {\r
-                outState.putParcelable(FileDetailFragment.EXTRA_FILE, file);\r
+            if (fragment != null) {\r
+                OCFile file = fragment.getDisplayedFile();\r
+                if (file != null) {\r
+                    outState.putParcelable(FileDetailFragment.EXTRA_FILE, file);\r
+                }\r
             }\r
         }\r
         Log.d(getClass().toString(), "onSaveInstanceState() end");\r
@@ -967,13 +971,13 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                 return;\r
             }\r
             // a new chance to get the mDownloadBinder through getFileDownloadBinder() - THIS IS A MESS\r
-            mFileList.listDirectory();\r
+            if (mFileList != null)\r
+                mFileList.listDirectory();\r
             if (mDualPane) {\r
                 FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
                 if (fragment != null)\r
                     fragment.updateFileDetails();\r
             }\r
-            \r
         }\r
 \r
         @Override\r