* ownCloud Android client application
*
* @author masensio
+ * @author David A. Velasco
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
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;
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();
+ } else {
+ String message = getString(R.string.share_sharee_unavailable);
+ Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
+ }
}
});
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- // Load data to the list (start process with an Async Task)
- mListener.refreshUsersOrGroupsListFromServer();
+ // Load data into the list
+ refreshUsersOrGroupsListFromDB();
+
+ // Request for a refresh of the data through the server (starts an Async Task)
+ if (mListener != null) {
+ mListener.refreshUsersOrGroupsListFromServer();
+ }
}
@Override
private void updateListOfUserGroups() {
// Update list of users/groups
- mUserGroupsAdapter = new ShareUserListAdapter(getActivity().getApplicationContext(),
- R.layout.share_user_item, mShares, this);
+ mUserGroupsAdapter = new ShareUserListAdapter(
+ getActivity(),
+ R.layout.share_user_item,
+ mShares,
+ this
+ );
// Show data
TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers);
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnShareFragmentInteractionListener {
- void showSearchUsersAndGroups(ArrayList<OCShare> shares);
+ void showSearchUsersAndGroups();
void refreshUsersOrGroupsListFromServer();
void unshareWith(OCShare share);
}