updated translations
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileDisplayActivity.java
index b320297..328d396 100644 (file)
@@ -68,6 +68,7 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;\r
 import com.owncloud.android.files.services.FileDownloader;\r
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;\r
 import com.owncloud.android.datamodel.OCFile;\r
 import com.owncloud.android.files.services.FileDownloader;\r
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;\r
+import com.owncloud.android.files.services.FileObserverService;\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.files.services.FileUploader;\r
 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;\r
 import com.owncloud.android.network.OwnCloudClientUtils;\r
@@ -154,10 +155,10 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         }\r
 \r
         // file observer\r
         }\r
 \r
         // file observer\r
-        /*Intent observer_intent = new Intent(this, FileObserverService.class);\r
+        Intent observer_intent = new Intent(this, FileObserverService.class);\r
         observer_intent.putExtra(FileObserverService.KEY_FILE_CMD, FileObserverService.CMD_INIT_OBSERVED_LIST);\r
         startService(observer_intent);\r
         observer_intent.putExtra(FileObserverService.KEY_FILE_CMD, FileObserverService.CMD_INIT_OBSERVED_LIST);\r
         startService(observer_intent);\r
-        */\r
+        \r
             \r
         /// USER INTERFACE\r
         requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);\r
             \r
         /// USER INTERFACE\r
         requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);\r
@@ -187,11 +188,11 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);\r
         actionBar.setListNavigationCallbacks(mDirectories, this);\r
         setSupportProgressBarIndeterminateVisibility(false);        // always AFTER setContentView(...) ; to workaround bug in its implementation\r
         actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);\r
         actionBar.setListNavigationCallbacks(mDirectories, this);\r
         setSupportProgressBarIndeterminateVisibility(false);        // always AFTER setContentView(...) ; to workaround bug in its implementation\r
-            \r
+        \r
         Log.d(getClass().toString(), "onCreate() end");\r
     }\r
 \r
         Log.d(getClass().toString(), "onCreate() end");\r
     }\r
 \r
-\r
+    \r
     /**\r
      * Launches the account creation activity. To use when no ownCloud account is available\r
      */\r
     /**\r
      * Launches the account creation activity. To use when no ownCloud account is available\r
      */\r
@@ -222,7 +223,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
             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
         }\r
         \r
         /// Default to root if mCurrentDir was not found\r
@@ -442,9 +445,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
         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
             }\r
         }\r
         Log.d(getClass().toString(), "onSaveInstanceState() end");\r
@@ -481,7 +486,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
             registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);\r
         \r
             // List current directory\r
             registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);\r
         \r
             // List current directory\r
-            mFileList.listDirectory(mCurrentDir);   // we should find the way to avoid the need of this\r
+            mFileList.listDirectory(mCurrentDir);   // TODO we should find the way to avoid the need of this (maybe it's not necessary yet; to check)\r
             \r
         } else {\r
             \r
             \r
         } else {\r
             \r
@@ -548,7 +553,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
             PackageInfo pkg;\r
             try {\r
                 pkg = getPackageManager().getPackageInfo(getPackageName(), 0);\r
             PackageInfo pkg;\r
             try {\r
                 pkg = getPackageManager().getPackageInfo(getPackageName(), 0);\r
-                builder.setMessage("ownCloud android client\n\nversion: " + pkg.versionName );\r
+                builder.setMessage(String.format(getString(R.string.about_message), pkg.versionName));\r
                 builder.setIcon(android.R.drawable.ic_menu_info_details);\r
                 dialog = builder.create();\r
             } catch (NameNotFoundException e) {\r
                 builder.setIcon(android.R.drawable.ic_menu_info_details);\r
                 dialog = builder.create();\r
             } catch (NameNotFoundException e) {\r
@@ -717,7 +722,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                         mStorageManager.saveFile(newDir);\r
     \r
                         // Display the new folder right away\r
                         mStorageManager.saveFile(newDir);\r
     \r
                         // Display the new folder right away\r
-                        mFileList.listDirectory(mCurrentDir);\r
+                        mFileList.listDirectory();\r
                     }\r
                 });\r
                 \r
                     }\r
                 });\r
                 \r
@@ -798,7 +803,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                     OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager()\r
                             .findFragmentById(R.id.fileList);\r
                     if (fileListFragment != null) {\r
                     OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager()\r
                             .findFragmentById(R.id.fileList);\r
                     if (fileListFragment != null) {\r
-                        fileListFragment.listDirectory(mCurrentDir);  \r
+                        fileListFragment.listDirectory(mCurrentDir);\r
                     }\r
                 }\r
                 \r
                     }\r
                 }\r
                 \r
@@ -967,13 +972,13 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                 return;\r
             }\r
             // a new chance to get the mDownloadBinder through getFileDownloadBinder() - THIS IS A MESS\r
                 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
             if (mDualPane) {\r
                 FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
                 if (fragment != null)\r
                     fragment.updateFileDetails();\r
             }\r
-            \r
         }\r
 \r
         @Override\r
         }\r
 \r
         @Override\r