Selaa lähdekoodia

Code Review changes done

Juan Carlos González Cabrero 9 vuotta sitten
vanhempi
commit
f8f4c1ed43

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit 4d524100d5441610e8f5999aff4acdd129885df4
+Subproject commit 996660b88c4e2b3cef08604963cf2c29491efa1b

+ 2 - 1
src/com/owncloud/android/operations/CreateShareWithShareeOperation.java

@@ -60,7 +60,8 @@ public class CreateShareWithShareeOperation extends SyncOperation {
      *                      https://doc.owncloud.org/server/8.2/developer_manual/core/ocs-share-api.html .
      */
     public CreateShareWithShareeOperation(String path, String shareeName, ShareType shareType, int permissions) {
-        if (!ShareType.USER.equals(shareType) && !ShareType.GROUP.equals(shareType) && !ShareType.FEDERATED.equals(shareType)) {
+        if (!ShareType.USER.equals(shareType) && !ShareType.GROUP.equals(shareType)
+            && !ShareType.FEDERATED.equals(shareType)) {
             throw new IllegalArgumentException("Illegal share type " + shareType);
         }
         mPath = path;

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

@@ -78,7 +78,8 @@ public class UnshareOperation extends SyncOperation {
                 if (ShareType.PUBLIC_LINK.equals(mShareType)) {
                     file.setShareViaLink(false);
                     file.setPublicLink("");
-                } else if (ShareType.USER.equals(mShareType) || ShareType.GROUP.equals(mShareType) || ShareType.FEDERATED.equals(mShareType)){
+                } else if (ShareType.USER.equals(mShareType) || ShareType.GROUP.equals(mShareType)
+                    || ShareType.FEDERATED.equals(mShareType)){
                     // Check if it is the last share
                     ArrayList <OCShare> sharesWith = getStorageManager().
                             getSharesWithForAFile(mRemotePath,

+ 8 - 9
src/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java

@@ -93,10 +93,7 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
 
     public static ShareType getShareType(String authority) {
 
-        if (sShareTypes.containsKey(authority)) {
-            return sShareTypes.get(authority);
-        }
-        return null;
+        return sShareTypes.get(authority);
     }
 
     @Nullable
@@ -200,8 +197,9 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
                         if (userName.equals(shareWith)) {
                             displayName = getContext().getString(R.string.share_remote_clarification, userName);
                         } else {
+                            String[] uriSplitted = shareWith.split("@");
                             displayName = getContext().getString(R.string.share_known_remote_clarification, userName,
-                                    shareWith.split("@")[1]);
+                                uriSplitted[uriSplitted.length - 1]);
                         }
                         dataUri = Uri.withAppendedPath(remoteBaseUri, shareWith);
                     } else if (ShareType.USER.getValue() == type) {
@@ -209,11 +207,12 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
                         dataUri = Uri.withAppendedPath(userBaseUri, shareWith);
                     }
 
-                    if (displayName != null && dataUri != null)
+                    if (displayName != null && dataUri != null) {
                         response.newRow()
-                                .add(count++)             // BaseColumns._ID
-                                .add(displayName)         // SearchManager.SUGGEST_COLUMN_TEXT_1
-                                .add(dataUri);
+                            .add(count++)             // BaseColumns._ID
+                            .add(displayName)         // SearchManager.SUGGEST_COLUMN_TEXT_1
+                            .add(dataUri);
+                    }
                 }
 
             } catch (JSONException e) {