瀏覽代碼

Added remote user suggestion when '@' is detected in the search field

Juan Carlos González Cabrero 9 年之前
父節點
當前提交
87c3ec4c60

+ 1 - 1
src/com/owncloud/android/db/ProviderMeta.java

@@ -85,7 +85,7 @@ public class ProviderMeta {
         public static final String OCSHARES_FILE_SOURCE = "file_source";
         public static final String OCSHARES_FILE_SOURCE = "file_source";
         public static final String OCSHARES_ITEM_SOURCE = "item_source";
         public static final String OCSHARES_ITEM_SOURCE = "item_source";
         public static final String OCSHARES_SHARE_TYPE = "share_type";
         public static final String OCSHARES_SHARE_TYPE = "share_type";
-        public static final String OCSHARES_SHARE_WITH = "shate_with";
+        public static final String OCSHARES_SHARE_WITH = "share_with";
         public static final String OCSHARES_PATH = "path";
         public static final String OCSHARES_PATH = "path";
         public static final String OCSHARES_PERMISSIONS = "permissions";
         public static final String OCSHARES_PERMISSIONS = "permissions";
         public static final String OCSHARES_SHARED_DATE = "shared_date";
         public static final String OCSHARES_SHARED_DATE = "shared_date";

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

@@ -140,6 +140,17 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
                 // Get JSonObjects from response
                 // Get JSonObjects from response
                 names.add((JSONObject) o);
                 names.add((JSONObject) o);
             }
             }
+            // add a remote user suggestion if the query has the character '@'
+            if (userQuery.contains("@")) {
+                try {
+                    names.add(new JSONObject("{\"" + GetRemoteShareesOperation.NODE_VALUE + "\":{\"" +
+                            GetRemoteShareesOperation.PROPERTY_SHARE_WITH + "\":" + userQuery + "\",\"" +
+                            GetRemoteShareesOperation.PROPERTY_SHARE_TYPE + "\":6}," +
+                            "\"" + GetRemoteShareesOperation.PROPERTY_LABEL + "\":\"" + userQuery + " (remote)\"}]}"));
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+            }
         } else {
         } else {
             showErrorMessage(result);
             showErrorMessage(result);
         }
         }