Merge remote-tracking branch 'remotes/upstream/avoidDuplicateFiles' into beta
authortobiasKaminsky <tobias@kaminsky.me>
Sat, 21 Nov 2015 08:35:19 +0000 (09:35 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Sat, 21 Nov 2015 08:35:19 +0000 (09:35 +0100)
1  2 
owncloud-android-library
res/values-th-rTH/strings.xml
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/operations/UploadFileOperation.java

diff --combined owncloud-android-library
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 4f9a7528cab0563cb234a8b817e8ee371dd6cc25
 -Subproject commit b09969d078b3a790b01c8d61a7298a37439a9f24
++Subproject commit ecc3415e3e3c13fa8f73fdd51a88c1ab7087b199
    <string name="unfavorite">ออกจากรายการโปรด</string>
    <string name="common_rename">เปลี่ยนชื่อ</string>
    <string name="common_remove">ลบออก</string>
 -  <string name="confirmation_remove_alert">คุณต้องการที่จะลบ %1$s?</string>
 +  <string name="confirmation_remove_file_alert">คุณต้องการที่จะลบ %1$s?</string>
    <string name="confirmation_remove_folder_alert">คุณต้องการที่จะลบ %1$s และเนื้อหาของมัน?</string>
    <string name="confirmation_remove_local">เฉพาะต้นทางเท่านั้น</string>
    <string name="confirmation_remove_folder_local">เฉพาะต้นทางเท่านั้น</string>
-   <string name="confirmation_remove_file_remote">จากเซิฟเวอร์</string>
+   <string name="confirmation_remove_remote">จากเซิร์ฟเวอร์</string>
    <string name="confirmation_remove_remote_and_local">รีโมท &amp; ต้นทาง</string>
    <string name="remove_success_msg">ลบเรียบร้อยแล้ว</string>
    <string name="remove_fail_msg">ไม่สามารถลบได้</string>
    <string name="conflict_message">ไฟล์ใดที่คุณต้องการที่จะเก็บ? หากคุณเลือกทั้งสองรุ่น ไฟล์ต้นทางจะมีจำนวนชื่อเพิ่ม</string>
    <string name="conflict_keep_both">เก็บไว้ทั้งสองอย่าง</string>
    <string name="conflict_use_local_version">เวอร์ชันต้นทาง</string>
-   <string name="conflict_use_server_version">เวอร์ชันเซิฟเวอร์</string>
+   <string name="conflict_use_server_version">à¹\80วอรà¹\8cà¸\8aัà¸\99à¹\80à¸\8bิรà¹\8cà¸\9fà¹\80วอรà¹\8c</string>
    <string name="preview_image_description">แสดงรูปภาพตัวอย่าง</string>
    <string name="preview_image_error_unknown_format">ไม่สามารถแสดงรูปภาพนี้ได้</string>
    <string name="error__upload__local_file_not_copied">%1$s ไม่สามารถคัดลอกไปยังโฟลเดอร์ %2$s ในเครื่อง</string>
@@@ -176,6 -176,7 +176,6 @@@ public class AuthenticatorActivity exte
      private EditText mUsernameInput;\r
      private EditText mPasswordInput;\r
      private View mOkButton;\r
 -    private View mCenteredRefreshButton;\r
      private TextView mAuthStatusView;\r
  \r
      private int mAuthStatusText = 0, mAuthStatusIcon = 0;\r
              }\r
          });\r
  \r
 -        mCenteredRefreshButton = findViewById(R.id.centeredRefreshButton);\r
 -        mCenteredRefreshButton.setOnClickListener(new View.OnClickListener() {\r
 +        findViewById(R.id.centeredRefreshButton).setOnClickListener(new View.OnClickListener() {\r
  \r
              @Override\r
              public void onClick(View v) {\r
                  checkOcServer();\r
              }\r
          });\r
 -        \r
 -        mOkButton = findViewById(R.id.buttonOK);\r
 +\r
 +        findViewById(R.id.embeddedRefreshButton).setOnClickListener(new View.OnClickListener() {\r
 +\r
 +            @Override\r
 +            public void onClick(View v) {\r
 +                checkOcServer();\r
 +            }\r
 +        });\r
 +\r
  \r
          /// initialize block to be moved to single Fragment to check server and get info about it \r
          initServerPreFragment(savedInstanceState);\r
          \r
          mHostUrlInput.removeTextChangedListener(mHostUrlInputWatcher);\r
          mHostUrlInput.setOnFocusChangeListener(null);\r
 -        \r
 +\r
          super.onPause();\r
      }\r
      \r
                  mOAuthTokenEndpointText.getText().toString().trim());\r
          \r
          getServerInfoIntent.putExtra(\r
-                 OperationsService.EXTRA_OAUTH2_QUERY_PARAMETERS, \r
+                 OperationsService.EXTRA_OAUTH2_QUERY_PARAMETERS,\r
                  queryParameters);\r
          \r
          if (mOperationsServiceBinder != null) {\r
          showRefreshButton(false);\r
  \r
          if (uri.length() != 0) {\r
+             uri = stripIndexPhpOrAppsFiles(uri, mHostUrlInput);\r
\r
              // Handle internationalized domain names\r
              uri = DisplayUtils.convertIdn(uri, true);\r
  \r
              Intent getServerInfoIntent = new Intent();\r
              getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);\r
              getServerInfoIntent.putExtra(\r
 -                OperationsService.EXTRA_SERVER_URL,\r
 -                normalizeUrlSuffix(uri)\r
 +                    OperationsService.EXTRA_SERVER_URL,\r
 +                    normalizeUrlSuffix(uri)\r
              );\r
              if (mOperationsServiceBinder != null) {\r
                  mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);\r
          return url;\r
      }\r
  \r
+     private String stripIndexPhpOrAppsFiles(String url, EditText mHostUrlInput) {\r
+         if (url.endsWith("/index.php")) {\r
+             url = url.substring(0, url.lastIndexOf("/index.php"));\r
+             mHostUrlInput.setText(url);\r
+         } else if (url.contains("/index.php/apps/")) {\r
+             url = url.substring(0, url.lastIndexOf("/index.php/apps/"));\r
+             mHostUrlInput.setText(url);\r
+         }\r
\r
+         return url;\r
+     }\r
  \r
      // TODO remove, if possible\r
      private String trimUrlWebdav(String url){       \r
      }\r
  \r
      /**\r
 -     * Called when the refresh button in the input field for ownCloud host is clicked.\r
 -     * \r
 -     * Performs a new check on the URL in the input field.\r
 -     * \r
 -     * @param view      Refresh 'button'\r
 -     */\r
 -    public void onRefreshClick(View view) {\r
 -        checkOcServer();\r
 -    }\r
 -\r
 -\r
 -    /**\r
       * Called when the eye icon in the password field is clicked.\r
       * \r
       * Toggles the visibility of the password in the field. \r
@@@ -325,14 -325,14 +325,14 @@@ public class UploadFileOperation extend
                  throw new OperationCancelledException();
              }
  
-             result = mUploadOperation.execute(client);
              /// move local temporal file or original file to its corresponding
              // location in the ownCloud local folder
              if (result.isSuccess()) {
                  if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_FORGET) {
                      mFile.setStoragePath(null);
+                 } else if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_REMOVE){
+                     mFile.setStoragePath(null);
+                     originalFile.delete();
                  } else {
                      mFile.setStoragePath(expectedPath);
                      File fileToMove = null;
                              // return result;
                          }
                      }
-                     FileDataStorageManager.triggerMediaScan(originalFile.getAbsolutePath());
-                     FileDataStorageManager.triggerMediaScan(expectedFile.getAbsolutePath());
                  }
+                 FileDataStorageManager.triggerMediaScan(originalFile.getAbsolutePath());
+                 FileDataStorageManager.triggerMediaScan(expectedFile.getAbsolutePath());
              } else if (result.getHttpCode() == HttpStatus.SC_PRECONDITION_FAILED ) {
                  result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
              }
              if (temporalFile != null && !originalFile.equals(temporalFile)) {
                  temporalFile.delete();
              }
 +            if (result == null){
 +                return new RemoteOperationResult(false, 404, null);
 +            }
              if (result.isSuccess()) {
                  Log_OC.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " +
                          result.getLogMessage());