Workaround to show hidden accents in options menu
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / fragment / FileDetailFragment.java
index 60d6340..9338b93 100644 (file)
@@ -707,15 +707,22 @@ public class FileDetailFragment extends SherlockFragment implements
     private class UploadFinishReceiver extends BroadcastReceiver {\r
         @Override\r
         public void onReceive(Context context, Intent intent) {\r
     private class UploadFinishReceiver extends BroadcastReceiver {\r
         @Override\r
         public void onReceive(Context context, Intent intent) {\r
+            Log.d(TAG, "Received broacast! : " + intent.getStringExtra(FileUploader.EXTRA_REMOTE_PATH));\r
             String accountName = intent.getStringExtra(FileUploader.ACCOUNT_NAME);\r
 \r
             if (!isEmpty() && accountName.equals(mAccount.name)) {\r
                 boolean uploadWasFine = intent.getBooleanExtra(FileUploader.EXTRA_UPLOAD_RESULT, false);\r
                 String uploadRemotePath = intent.getStringExtra(FileUploader.EXTRA_REMOTE_PATH);\r
             String accountName = intent.getStringExtra(FileUploader.ACCOUNT_NAME);\r
 \r
             if (!isEmpty() && accountName.equals(mAccount.name)) {\r
                 boolean uploadWasFine = intent.getBooleanExtra(FileUploader.EXTRA_UPLOAD_RESULT, false);\r
                 String uploadRemotePath = intent.getStringExtra(FileUploader.EXTRA_REMOTE_PATH);\r
-                if (mFile.getRemotePath().equals(uploadRemotePath)) {\r
+                boolean renamedInUpload = mFile.getRemotePath().equals(intent.getStringExtra(FileUploader.EXTRA_OLD_REMOTE_PATH));\r
+                if (mFile.getRemotePath().equals(uploadRemotePath) ||\r
+                    renamedInUpload) {\r
                     if (uploadWasFine) {\r
                     if (uploadWasFine) {\r
-                        FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver());\r
-                        mFile = fdsm.getFileByPath(mFile.getRemotePath());\r
+                        mFile = mStorageManager.getFileByPath(mFile.getRemotePath());\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
                     }\r
                     updateFileDetails();    // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server\r
                 }\r
                     }\r
                     updateFileDetails();    // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server\r
                 }\r
@@ -992,10 +999,8 @@ public class FileDetailFragment extends SherlockFragment implements
         if (!result.isSuccess()) {\r
             if (result.getCode() == ResultCode.SYNC_CONFLICT) {\r
                 Intent i = new Intent(getActivity(), ConflictsResolveActivity.class);\r
         if (!result.isSuccess()) {\r
             if (result.getCode() == ResultCode.SYNC_CONFLICT) {\r
                 Intent i = new Intent(getActivity(), ConflictsResolveActivity.class);\r
-                //i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);\r
-                i.putExtra("remotepath", mFile.getRemotePath());\r
-                i.putExtra("localpath", mFile.getStoragePath());\r
-                i.putExtra("account", mAccount);\r
+                i.putExtra(ConflictsResolveActivity.EXTRA_FILE, mFile);\r
+                i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, mAccount);\r
                 startActivity(i);\r
                 \r
             } else {\r
                 startActivity(i);\r
                 \r
             } else {\r