瀏覽代碼

Merge branch 'master' of https://github.com/nextcloud/android into lintConfig

AndyScherzinger 8 年之前
父節點
當前提交
3612523c12
共有 33 個文件被更改,包括 126 次插入81 次删除
  1. 1 1
      build.gradle
  2. 1 1
      scripts/lint/lint-results.txt
  3. 8 4
      src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java
  4. 1 1
      src/main/java/com/owncloud/android/authentication/PassCodeManager.java
  5. 0 3
      src/main/java/com/owncloud/android/db/OCUpload.java
  6. 6 1
      src/main/java/com/owncloud/android/db/UploadResult.java
  7. 2 2
      src/main/java/com/owncloud/android/files/services/IndexedForest.java
  8. 1 0
      src/main/java/com/owncloud/android/media/MediaControlView.java
  9. 0 3
      src/main/java/com/owncloud/android/media/MediaService.java
  10. 2 2
      src/main/java/com/owncloud/android/operations/UnshareOperation.java
  11. 8 3
      src/main/java/com/owncloud/android/operations/UploadFileOperation.java
  12. 1 0
      src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java
  13. 2 0
      src/main/java/com/owncloud/android/ui/CustomPopup.java
  14. 3 5
      src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java
  15. 3 3
      src/main/java/com/owncloud/android/ui/activity/Preferences.java
  16. 6 2
      src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java
  17. 14 6
      src/main/java/com/owncloud/android/ui/activity/ShareActivity.java
  18. 1 1
      src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java
  19. 4 0
      src/main/java/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java
  20. 0 1
      src/main/java/com/owncloud/android/ui/dialog/SslValidatorDialog.java
  21. 22 12
      src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java
  22. 1 2
      src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
  23. 4 4
      src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java
  24. 11 5
      src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java
  25. 0 2
      src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java
  26. 0 6
      src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java
  27. 2 2
      src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java
  28. 1 0
      src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java
  29. 1 0
      src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java
  30. 1 1
      src/main/java/com/owncloud/android/utils/DialogMenuItem.java
  31. 14 6
      src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java
  32. 1 1
      src/main/java/third_parties/michaelOrtiz/TouchImageViewCustom.java
  33. 4 1
      src/main/res/values/strings.xml

+ 1 - 1
build.gradle

@@ -179,7 +179,7 @@ dependencies {
     compile name: 'touch-image-view'
     compile 'com.android.support:multidex:1.0.1'
 
-    compile 'com.github.nextcloud:android-library:1.0.15'
+    compile 'com.github.nextcloud:android-library:1.0.17'
     compile "com.android.support:support-v4:${supportLibraryVersion}"
     compile "com.android.support:design:${supportLibraryVersion}"
     compile 'com.jakewharton:disklrucache:2.0.2'

+ 1 - 1
scripts/lint/lint-results.txt

@@ -1,2 +1,2 @@
 DO NOT TOUCH; GENERATED BY DRONE
-      <span class="mdl-layout-title">Lint Report: 698 errors and 861 warnings</span>
+      <span class="mdl-layout-title">Lint Report: 698 errors and 860 warnings</span>

+ 8 - 4
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -563,6 +563,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
                 @Override
                 public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                    // not used at the moment
                 }
 
                 @Override
@@ -1252,7 +1253,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             }
         } else {
             if (!webViewLoginMethod) {
-                updateStatusIconFailUserName();
+                int statusText = result.getCode() == ResultCode.MAINTENANCE_MODE ? R.string.maintenance_mode : R.string.auth_fail_get_user_name;
+                updateStatusIconFailUserName(statusText);
                 showAuthStatus();
             }
             Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage());
@@ -1452,6 +1454,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 mServerStatusIcon = R.drawable.ic_lock_open_white;
                 mServerStatusText = R.string.auth_redirect_non_secure_connection_title;
                 break;
+            case MAINTENANCE_MODE:
+                mServerStatusText = R.string.maintenance_mode;
+                break;
             default:
                 mServerStatusText = 0;
                 mServerStatusIcon = 0;
@@ -1541,10 +1546,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         }
     }
 
-
-    private void updateStatusIconFailUserName() {
+    private void updateStatusIconFailUserName(int failedStatusText){
         mAuthStatusIcon = R.drawable.ic_alert;
-        mAuthStatusText = R.string.auth_fail_get_user_name;
+        mAuthStatusText = failedStatusText;
     }
 
     private void updateServerStatusIconNoRegularAuth() {

+ 1 - 1
src/main/java/com/owncloud/android/authentication/PassCodeManager.java

@@ -60,7 +60,7 @@ public class PassCodeManager {
         return mPassCodeManagerInstance;
     }
 
-    protected PassCodeManager() {};
+    protected PassCodeManager() {}
 
     public void onActivityCreated(Activity activity) {
         if (passCodeIsEnabled() || fingerprintIsEnabled()) {

+ 0 - 3
src/main/java/com/owncloud/android/db/OCUpload.java

@@ -393,7 +393,4 @@ public class OCUpload implements Parcelable {
     }
 
     enum CanUploadFileNowStatus {NOW, LATER, FILE_GONE, ERROR}
-
-    ;
-
 }

+ 6 - 1
src/main/java/com/owncloud/android/db/UploadResult.java

@@ -34,7 +34,8 @@ public enum UploadResult {
     FILE_NOT_FOUND(8),
     DELAYED_FOR_WIFI(9),
     SERVICE_INTERRUPTED(10),
-    DELAYED_FOR_CHARGING(11);
+    DELAYED_FOR_CHARGING(11),
+    MAINTENANCE_MODE(12);
 
     private final int value;
 
@@ -74,6 +75,8 @@ public enum UploadResult {
                 return SERVICE_INTERRUPTED;
             case 11:
                 return DELAYED_FOR_CHARGING;
+            case 12:
+                return MAINTENANCE_MODE;
         }
         return null;
     }
@@ -115,6 +118,8 @@ public enum UploadResult {
                     return FILE_ERROR;
                 }
                 return UNKNOWN;
+            case MAINTENANCE_MODE:
+                return MAINTENANCE_MODE;
             default:
                 return UNKNOWN;
         }

+ 2 - 2
src/main/java/com/owncloud/android/files/services/IndexedForest.java

@@ -61,7 +61,7 @@ public class IndexedForest<V> {
 
         public Node<V> getParent() {
             return mParent;
-        };
+        }
 
         public Set<Node<V>> getChildren() {
             return mChildren;
@@ -143,7 +143,7 @@ public class IndexedForest<V> {
 
             return new Pair<String, String>(targetKey, linkedTo);
         }
-    };
+    }
 
 
     public Pair<V, String> removePayload(String accountName, String remotePath) {

+ 1 - 0
src/main/java/com/owncloud/android/media/MediaControlView.java

@@ -89,6 +89,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
 
     @Override
     public void onFinishInflate() {
+        super.onFinishInflate();
         /*
         if (mRoot != null)
             initControllerView(mRoot);

+ 0 - 3
src/main/java/com/owncloud/android/media/MediaService.java

@@ -98,9 +98,6 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         PAUSED
     }
 
-    ;
-
-
     /** Current state */
     private State mState = State.STOPPED;
 

+ 2 - 2
src/main/java/com/owncloud/android/operations/UnshareOperation.java

@@ -89,8 +89,8 @@ public class UnshareOperation extends SyncOperation {
 
                 getStorageManager().saveFile(file);
                 getStorageManager().removeShare(share);
-                
-            } else if (!existsFile(client, file.getRemotePath())) {
+
+            } else if (result.getCode() != ResultCode.MAINTENANCE_MODE && !existsFile(client, file.getRemotePath())) {
                 // unshare failed because file was deleted before
                 getStorageManager().removeFile(file, true, true);
             }

+ 8 - 3
src/main/java/com/owncloud/android/operations/UploadFileOperation.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2016 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud GmbH.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -323,6 +323,7 @@ public class UploadFileOperation extends SyncOperation {
             remoteParentPath = remoteParentPath.endsWith(OCFile.PATH_SEPARATOR) ?
                     remoteParentPath : remoteParentPath + OCFile.PATH_SEPARATOR;
             result = grantFolderExistence(remoteParentPath, client);
+
             if (!result.isSuccess()) {
 
                 return result;
@@ -370,15 +371,19 @@ public class UploadFileOperation extends SyncOperation {
                 throw new OperationCancelledException();
             }
 
+            // Get the last modification date of the file from the file system
+            Long timeStampLong = originalFile.lastModified()/1000;
+            String timeStamp = timeStampLong.toString();
+
             /// perform the upload
             if ( mChunked &&
                     (new File(mFile.getStoragePath())).length() >
                             ChunkedUploadRemoteFileOperation.CHUNK_SIZE ) {
                 mUploadOperation = new ChunkedUploadRemoteFileOperation(mContext, mFile.getStoragePath(),
-                        mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict());
+                        mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp);
             } else {
                 mUploadOperation = new UploadRemoteFileOperation(mFile.getStoragePath(),
-                        mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict());
+                        mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp);
             }
             Iterator <OnDatatransferProgressListener> listener = mDataTransferListeners.iterator();
             while (listener.hasNext()) {

+ 1 - 0
src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java

@@ -265,6 +265,7 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
                 // The Toast must be shown in the main thread to grant that will be hidden correctly; otherwise
                 // the thread may die before, an exception will occur, and the message will be left on the screen
                 // until the app dies
+
                 Toast.makeText(
                         getContext().getApplicationContext(),
                         ErrorMessageAdapter.getErrorCauseMessage(

+ 2 - 0
src/main/java/com/owncloud/android/ui/CustomPopup.java

@@ -63,9 +63,11 @@ public class CustomPopup {
     }
 
     public void onCreate() {
+        // not used at the moment
     }
 
     public void onShow() {
+        // not used at the moment
     }
 
     public void preShow() {

+ 3 - 5
src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -104,7 +104,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
             caption = getIntent().getStringExtra(EXTRA_ACTION);
         } else {
             caption = getString(R.string.default_display_name_for_root_folder);
-        };
+        }
         getSupportActionBar().setTitle(caption);
 
         setIndeterminate(mSyncInProgress);
@@ -518,8 +518,6 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         }
     }
 
-    
-
     /**
      * Shows the information of the {@link OCFile} received as a
      * parameter in the second fragment.
@@ -528,7 +526,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
      */
     @Override
     public void showDetails(OCFile file) {
-
+        // not used at the moment
     }
 
     /**
@@ -536,7 +534,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
      */
     @Override
     public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) {
-            
+        // not used at the moment
     }
 
     @Override

+ 3 - 3
src/main/java/com/owncloud/android/ui/activity/Preferences.java

@@ -869,7 +869,7 @@ public class Preferences extends PreferenceActivity
         MainApp.setStoragePath(mStoragePath);
         SharedPreferences.Editor editor = appPrefs.edit();
         editor.putString(PreferenceKeys.STORAGE_PATH, mStoragePath);
-        editor.commit();
+        editor.apply();
         String storageDescription = DataStorageProvider.getInstance().getStorageDescriptionByPath(mStoragePath);
         mPrefStoragePath.setSummary(storageDescription);
         mPrefStoragePath.setValue(newStoragePath);
@@ -895,7 +895,7 @@ public class Preferences extends PreferenceActivity
                 PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
         SharedPreferences.Editor editor = appPrefs.edit();
         editor.putString(PreferenceKeys.INSTANT_UPLOAD_PATH, mUploadPath);
-        editor.commit();
+        editor.apply();
     }
 
     /**
@@ -916,7 +916,7 @@ public class Preferences extends PreferenceActivity
                 PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
         SharedPreferences.Editor editor = appPrefs.edit();
         editor.putString(PreferenceKeys.INSTANT_VIDEO_UPLOAD_PATH, mUploadVideoPath);
-        editor.commit();
+        editor.apply();
     }
 
     @Override

+ 6 - 2
src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -1137,10 +1137,14 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 }
 
                 @Override
-                public void onNeutral(String callerTag) {}
+                public void onNeutral(String callerTag) {
+                    // not used at the moment
+                }
 
                 @Override
-                public void onCancel(String callerTag) {}
+                public void onCancel(String callerTag) {
+                    // not used at the moment
+                }
             }
         );
         errorDialog.show(getSupportFragmentManager(), FTAG_ERROR_FRAGMENT);

+ 14 - 6
src/main/java/com/owncloud/android/ui/activity/ShareActivity.java

@@ -38,6 +38,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.ShareType;
+import com.owncloud.android.lib.resources.status.OwnCloudVersion;
 import com.owncloud.android.operations.CreateShareViaLinkOperation;
 import com.owncloud.android.operations.GetSharesForFileOperation;
 import com.owncloud.android.operations.UnshareOperation;
@@ -53,7 +54,6 @@ import com.owncloud.android.utils.GetShareWithUsersAsyncTask;
 
 import java.util.ArrayList;
 
-
 /**
  * Activity for sharing files
  */
@@ -153,11 +153,19 @@ public class ShareActivity extends FileActivity
         if (getFile().isSharedWithMe()) {
             return OCShare.READ_PERMISSION_FLAG;    // minimum permissions
 
-        } else if (getFile().isFolder()) {
-            return (isFederated) ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER : OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER;
-
-        } else {    // isFile
-            return (isFederated) ? OCShare.FEDERATED_PERMISSIONS_FOR_FILE : OCShare.MAXIMUM_PERMISSIONS_FOR_FILE;
+        } else if (isFederated) {
+            OwnCloudVersion serverVersion = com.owncloud.android.authentication.AccountUtils.
+                    getServerVersion(getAccount());
+            if (serverVersion != null && serverVersion.isNotReshareableFederatedSupported()) {
+                return (getFile().isFolder() ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9 :
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FILE_AFTER_OC9);
+            } else {
+                return (getFile().isFolder() ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9 :
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FILE_UP_TO_OC9);
+            }
+        } else {
+            return (getFile().isFolder() ? OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER :
+                    OCShare.MAXIMUM_PERMISSIONS_FOR_FILE);
         }
     }
 

+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java

@@ -334,7 +334,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
                 mUploaderBinder = null;
             }
         }
-    };
+    }
 
     /**
      * Once the file upload has changed its status -> update uploads list view

+ 4 - 0
src/main/java/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java

@@ -514,6 +514,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
      * @return              Text describing the status of the given upload.
      */
     private String getStatusText(OCUpload upload) {
+
         String status;
         switch (upload.getUploadStatus()) {
 
@@ -596,6 +597,9 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                         // should not get here ; status should be UPLOAD_SUCCESS
                         status =  mParentActivity.getString(R.string.uploads_view_upload_status_succeeded);
                         break;
+                    case MAINTENANCE_MODE:
+                        status = mParentActivity.getString(R.string.maintenance_mode);
+                        break;
                     default:
                         status = "Naughty devs added a new fail result but no description for the user";
                         break;

+ 0 - 1
src/main/java/com/owncloud/android/ui/dialog/SslValidatorDialog.java

@@ -82,7 +82,6 @@ public class SslValidatorDialog extends Dialog {
      * Instances have to be created through static {@link SslValidatorDialog#newInstance}.
      * 
      * @param context       Android context where the dialog will live
-     * @param e             Exception causing the need of prompt the user about the server certificate.
      * @param listener      Object to notice when the server certificate was added to the local certificates store.
      */
     private SslValidatorDialog(Context context, OnSslValidatorListener listener) {

+ 22 - 12
src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java

@@ -33,6 +33,7 @@ import android.widget.CompoundButton;
 import android.widget.TextView;
 
 import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -40,6 +41,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.SharePermissionsBuilder;
 import com.owncloud.android.lib.resources.shares.ShareType;
+import com.owncloud.android.lib.resources.status.OwnCloudVersion;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.utils.AnalyticsUtils;
 
@@ -67,6 +69,9 @@ public class EditShareFragment extends Fragment {
     /** File bound to mShare, received as a parameter in construction time */
     private OCFile mFile;
 
+    /** Account of the shared file, received as a parameter in construction time */
+    private Account mAccount;
+
     /** Listener for changes on privilege checkboxes */
     private CompoundButton.OnCheckedChangeListener mOnPrivilegeChangeListener;
     
@@ -99,7 +104,7 @@ public class EditShareFragment extends Fragment {
             mShare = getArguments().getParcelable(ARG_SHARE);
             mFile = getArguments().getParcelable(ARG_FILE);
             /* OC account holding the shared file, received as a parameter in construction time */
-            //Account mAccount = getArguments().getParcelable(ARG_ACCOUNT);
+            mAccount = getArguments().getParcelable(ARG_ACCOUNT);
         }
     }
 
@@ -145,34 +150,39 @@ public class EditShareFragment extends Fragment {
 
             int sharePermissions = mShare.getPermissions();
             boolean isFederated = ShareType.FEDERATED.equals(mShare.getShareType());
-            CompoundButton compound;
+            OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mAccount);
+            boolean isNotReshareableFederatedSupported = (serverVersion != null &&
+                    serverVersion.isNotReshareableFederatedSupported());
+
+            CompoundButton compound = (CompoundButton) editShareView.findViewById(R.id.canShareSwitch);
 
-            compound = (CompoundButton) editShareView.findViewById(R.id.canShareSwitch);
-            if(isFederated) {
+            if (isFederated) {
                 compound.setVisibility(View.INVISIBLE);
             }
             compound.setChecked((sharePermissions & OCShare.SHARE_PERMISSION_FLAG) > 0);
 
             compound = (CompoundButton) editShareView.findViewById(R.id.canEditSwitch);
-            int anyUpdatePermission =
-                    OCShare.CREATE_PERMISSION_FLAG |
-                            OCShare.UPDATE_PERMISSION_FLAG |
-                            OCShare.DELETE_PERMISSION_FLAG;
+            int anyUpdatePermission = OCShare.CREATE_PERMISSION_FLAG | OCShare.UPDATE_PERMISSION_FLAG |
+                    OCShare.DELETE_PERMISSION_FLAG;
             boolean canEdit = (sharePermissions & anyUpdatePermission) > 0;
             compound.setChecked(canEdit);
 
-            if (mFile.isFolder() && !isFederated) {
+            boolean areEditOptionsAvailable = !isFederated || isNotReshareableFederatedSupported;
+
+            if (mFile.isFolder() && areEditOptionsAvailable) {
+                /// TODO change areEditOptionsAvailable in order to delete !isFederated
+                // from checking when iOS is ready
                 compound = (CompoundButton) editShareView.findViewById(R.id.canEditCreateCheckBox);
                 compound.setChecked((sharePermissions & OCShare.CREATE_PERMISSION_FLAG) > 0);
-                compound.setVisibility(canEdit ? View.VISIBLE : View.GONE);
+                compound.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
 
                 compound = (CompoundButton) editShareView.findViewById(R.id.canEditChangeCheckBox);
                 compound.setChecked((sharePermissions & OCShare.UPDATE_PERMISSION_FLAG) > 0);
-                compound.setVisibility(canEdit ? View.VISIBLE : View.GONE);
+                compound.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
 
                 compound = (CompoundButton) editShareView.findViewById(R.id.canEditDeleteCheckBox);
                 compound.setChecked((sharePermissions & OCShare.DELETE_PERMISSION_FLAG) > 0);
-                compound.setVisibility(canEdit ? View.VISIBLE : View.GONE);
+                compound.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
             }
 
             setPermissionsListening(editShareView, true);

+ 1 - 2
src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -118,11 +118,10 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
 
     @Override
     public void onActivityCreated(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
+        super.onActivityCreated(savedInstanceState);
         setHasOptionsMenu(true);
     }
 
-
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {

+ 4 - 4
src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java

@@ -141,7 +141,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
             } else {    /// Click on a file
                 ImageView checkBoxV = (ImageView) v.findViewById(R.id.custom_checkbox);
                 if (checkBoxV != null) {
-                    if (((AbsListView)getListView()).isItemChecked(position)) {
+                    if (getListView().isItemChecked(position)) {
                         checkBoxV.setImageResource(R.drawable.ic_checkbox_marked);
                     } else {
                         checkBoxV.setImageResource(R.drawable.ic_checkbox_blank_outline);
@@ -222,7 +222,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
         }
 
         // by now, only files in the same directory will be kept as selected
-        ((AbsListView)mCurrentListView).clearChoices();
+        mCurrentListView.clearChoices();
         mAdapter.swapDirectory(directory);
         if (mDirectory == null || !mDirectory.equals(directory)) {
             mCurrentListView.setSelection(0);
@@ -238,7 +238,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
      */
     public String[] getCheckedFilePaths() {
         ArrayList<String> result = new ArrayList<String>();
-        SparseBooleanArray positions = ((AbsListView)mCurrentListView).getCheckedItemPositions();
+        SparseBooleanArray positions = mCurrentListView.getCheckedItemPositions();
         if (positions.size() > 0) {
             for (int i = 0; i < positions.size(); i++) {
                 if (positions.get(positions.keyAt(i)) == true) {
@@ -270,7 +270,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
      * @param select <code>true</code> to select all, <code>false</code> to deselect all
      */
     public void selectAllFiles(boolean select) {
-        AbsListView listView = (AbsListView) getListView();
+        AbsListView listView = getListView();
         for (int position = 0; position < listView.getCount(); position++) {
             File file = (File) mAdapter.getItem(position);
             if (file.isFile()) {

+ 11 - 5
src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java

@@ -29,7 +29,6 @@ import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
-import android.os.Parcelable;
 import android.support.annotation.Nullable;
 import android.support.v4.app.DialogFragment;
 import android.webkit.MimeTypeMap;
@@ -373,8 +372,8 @@ public class FileOperationsHelper {
      */
     public void showShareFile(OCFile file){
         Intent intent = new Intent(mFileActivity, ShareActivity.class);
-        intent.putExtra(mFileActivity.EXTRA_FILE, (Parcelable) file);
-        intent.putExtra(mFileActivity.EXTRA_ACCOUNT, mFileActivity.getAccount());
+        intent.putExtra(FileActivity.EXTRA_FILE, file);
+        intent.putExtra(FileActivity.EXTRA_ACCOUNT, mFileActivity.getAccount());
         mFileActivity.startActivity(intent);
 
     }
@@ -478,8 +477,15 @@ public class FileOperationsHelper {
         if (hideFileListing) {
             updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS, OCShare.CREATE_PERMISSION_FLAG);
         } else {
-            updateShareIntent.
-                    putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS, OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER);
+            OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mFileActivity.getAccount());
+
+            if (serverVersion != null && serverVersion.isNotReshareableFederatedSupported()) {
+                updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS,
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9);
+            } else {
+                updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS,
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9);
+            }
         }
 
         queueShareIntent(updateShareIntent);

+ 0 - 2
src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java

@@ -74,6 +74,4 @@ public class NotificationUtils {
         }, delayInMillis); 
     
     }
-    
-
 }

+ 0 - 6
src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java

@@ -323,15 +323,9 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
             }
             mLastPercent = percent;
         }
-
     }
 
-
     public void setError(boolean error) {
         mError = error;
     }
-
-    ;
-
-
 }

+ 2 - 2
src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -358,6 +358,7 @@ public class PreviewImageActivity extends FileActivity implements
      */
     @Override
     public void onPageScrollStateChanged(int state) {
+        // not used at the moment
     }
 
     /**
@@ -367,15 +368,14 @@ public class PreviewImageActivity extends FileActivity implements
      * @param   position                Position index of the first page currently being displayed. 
      *                                  Page position+1 will be visible if positionOffset is
      *                                  nonzero.
-     *                                  
      * @param   positionOffset          Value from [0, 1) indicating the offset from the page
      *                                  at position.
      * @param   positionOffsetPixels    Value in pixels indicating the offset from position. 
      */
     @Override
     public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+        // not used at the moment
     }
-    
 
     /**
      * Class waiting for broadcast events from the {@link FileDownloader} service.

+ 1 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java

@@ -620,6 +620,7 @@ public class PreviewMediaFragment extends FileFragment implements
 
     @Override
     public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
         Log_OC.v(TAG, "onConfigurationChanged " + this);
     }
 

+ 1 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java

@@ -202,6 +202,7 @@ public class PreviewTextFragment extends FileFragment {
 
         @Override
         protected void onPreExecute() {
+            // not used at the moment
         }
 
         @Override

+ 1 - 1
src/main/java/com/owncloud/android/utils/DialogMenuItem.java

@@ -191,7 +191,7 @@ public class DialogMenuItem implements MenuItem {
 
     @Override
     public void setShowAsAction(int actionEnum) {
-
+        // not used at the moment
     }
 
     @Override

+ 14 - 6
src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java

@@ -17,7 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 package com.owncloud.android.utils;
 
 import android.content.res.Resources;
@@ -57,8 +56,8 @@ public class ErrorMessageAdapter {
 
         String message = null;
 
-        if (!result.isSuccess() && isNetworkError(result.getCode())) {
-            message = getErrorMessage(result, res);
+        if (!result.isSuccess() && isCommonError(result.getCode())) {
+            message = getCommonErrorMessage(result, res);
 
         } else if (operation instanceof UploadFileOperation) {
 
@@ -119,6 +118,7 @@ public class ErrorMessageAdapter {
                     // Error --> No permissions
                     message = String.format(res.getString(R.string.forbidden_permissions),
                             res.getString(R.string.forbidden_permissions_delete));
+
                 } else {
                     message = res.getString(R.string.remove_fail_msg);
                 }
@@ -158,9 +158,11 @@ public class ErrorMessageAdapter {
 
             } else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
                 message = res.getString(R.string.filename_forbidden_charaters_from_server);
+
             } else {
                 message = res.getString(R.string.create_dir_fail_msg);
             }
+
         } else if (operation instanceof CreateShareViaLinkOperation ||
                 operation instanceof CreateShareWithShareeOperation) {
 
@@ -238,6 +240,7 @@ public class ErrorMessageAdapter {
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.move_file_error);
             }
+
         } else if (operation instanceof SynchronizeFolderOperation) {
 
             if (!result.isSuccess()) {
@@ -253,9 +256,11 @@ public class ErrorMessageAdapter {
                             folderPathName);
                 }
             }
+
         } else if (operation instanceof CopyFileOperation) {
             if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
                 message = res.getString(R.string.copy_file_not_found);
+
             } else if (result.getCode() == ResultCode.INVALID_COPY_INTO_DESCENDANT) {
                 message = res.getString(R.string.copy_file_invalid_into_descendent);
 
@@ -275,7 +280,7 @@ public class ErrorMessageAdapter {
         return message;
     }
 
-    private static String getErrorMessage(RemoteOperationResult result, Resources res) {
+    private static String getCommonErrorMessage(RemoteOperationResult result, Resources res) {
 
         String message = null;
 
@@ -295,15 +300,18 @@ public class ErrorMessageAdapter {
 
             } else if (result.getCode() == ResultCode.HOST_NOT_AVAILABLE) {
                 message = res.getString(R.string.network_host_not_available);
+            } else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                message = res.getString(R.string.maintenance_mode);
             }
         }
 
         return message;
     }
 
-    private static boolean isNetworkError(RemoteOperationResult.ResultCode code) {
+    private static boolean isCommonError(RemoteOperationResult.ResultCode code) {
         return code == ResultCode.WRONG_CONNECTION ||
                 code == ResultCode.TIMEOUT ||
-                code == ResultCode.HOST_NOT_AVAILABLE;
+                code == ResultCode.HOST_NOT_AVAILABLE ||
+                code == ResultCode.MAINTENANCE_MODE;
     }
 }

+ 1 - 1
src/main/java/third_parties/michaelOrtiz/TouchImageViewCustom.java

@@ -64,7 +64,7 @@ public class TouchImageViewCustom extends ImageViewCustom {
     //
 	private Matrix matrix, prevMatrix;
 
-    private static enum State { NONE, DRAG, ZOOM, FLING, ANIMATE_ZOOM };
+    private static enum State { NONE, DRAG, ZOOM, FLING, ANIMATE_ZOOM }
     private State state;
 
     private float minScale;

+ 4 - 1
src/main/res/values/strings.xml

@@ -276,7 +276,8 @@
 	<string name="auth_fail_get_user_name">Your server is not returning a correct user ID, please contact an administrator</string>
 	<string name="auth_can_not_auth_against_server">Cannot authenticate to this server</string>
     <string name="auth_account_does_not_exist">Account does not exist on the device yet</string>
-    
+
+
     <string name="favorite">Set as available offline</string>
     <string name="unfavorite">Unset as available offline</string>
     <string name="favorite_real">Set as favorite</string>
@@ -543,6 +544,8 @@
     <string name="local_file_not_found_toast">File not found in local file system</string>
     <string name="confirmation_remove_files_alert">Do you really want to remove the selected items?</string>
     <string name="confirmation_remove_folders_alert">Do you really want to remove the selected items and their contents?</string>
+    <string name="maintenance_mode">Server in maintenance mode</string>
+
     <string name="uploads_view_upload_status_waiting_for_charging">Awaiting charge</string>
     <string name="actionbar_search">Search</string>
     <string name="files_drop_not_supported">This is a Nextcloud feature, please update.</string>