From: masensio Date: Mon, 26 Oct 2015 12:13:06 +0000 (+0100) Subject: Good behaviiour in servers not supporting SHAREE API: show the menu option and a... X-Git-Tag: oc-android-1.9^2~30^2~19 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/d1294ca584f69432d6b775668cb5e6844ae4bb03 Good behaviiour in servers not supporting SHAREE API: show the menu option and a messsage when try to share with a new user/group --- diff --git a/res/values/strings.xml b/res/values/strings.xml index 591527d6..2458d707 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -375,4 +375,7 @@ Search users and groups %1$s (group) + Sorry, your server version does not allow share with users within clients. + \nPlease contact your administrator + diff --git a/src/com/owncloud/android/files/FileMenuFilter.java b/src/com/owncloud/android/files/FileMenuFilter.java index 8c048425..66ada1c0 100644 --- a/src/com/owncloud/android/files/FileMenuFilter.java +++ b/src/com/owncloud/android/files/FileMenuFilter.java @@ -107,7 +107,6 @@ public class FileMenuFilter { * @param toHide List to save the options that must be shown in the menu. */ private void filter(List toShow, List toHide) { - boolean shareWithUsersEnable = false; boolean synchronizing = false; if (mComponentsGetter != null && mFile != null && mAccount != null) { OperationsServiceBinder opsBinder = mComponentsGetter.getOperationsServiceBinder(); @@ -121,7 +120,6 @@ public class FileMenuFilter { // uploading (uploaderBinder != null && uploaderBinder.isUploading(mAccount, mFile)) ); - shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount); } /// decision is taken for each possible action on a file in the menu @@ -202,7 +200,7 @@ public class FileMenuFilter { } // SHARE FILE, with Users - if (!shareAllowed || !shareWithUsersEnable || mFile == null) { + if (!shareAllowed || mFile == null) { toHide.add(R.id.action_share_with_users); } else { toShow.add(R.id.action_share_with_users); diff --git a/src/com/owncloud/android/ui/fragment/ShareFileFragment.java b/src/com/owncloud/android/ui/fragment/ShareFileFragment.java index 1b95186b..70517672 100644 --- a/src/com/owncloud/android/ui/fragment/ShareFileFragment.java +++ b/src/com/owncloud/android/ui/fragment/ShareFileFragment.java @@ -32,8 +32,10 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; +import android.widget.Toast; import com.owncloud.android.R; +import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.ThumbnailsCacheManager; import com.owncloud.android.lib.common.utils.Log_OC; @@ -137,8 +139,14 @@ public class ShareFileFragment extends Fragment addUserGroupButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - // Show Search Fragment - mListener.showSearchUsersAndGroups(mShares); + boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount); + if (shareWithUsersEnable) { + // Show Search Fragment + mListener.showSearchUsersAndGroups(mShares); + } else { + String message = getString(R.string.share_sharee_unavailable); + Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show(); + } } });