- // TODO: Rename method, update argument and hook method into UI event
- public void onButtonPressed(Uri uri) {
- if (mListener != null) {
- mListener.onSearchFragmentInteraction(uri);
+ /**
+ * Get users and groups fromn the DB to fill in the "share with" list
+ */
+ public void refreshUsersOrGroupsListFromDB (){
+ // Get Users and Groups
+ mShares = ((ShareActivity) mListener).getStorageManager().getSharesWithForAFile(mFile.getRemotePath(),
+ mAccount.name);
+
+ // Update list of users/groups
+ updateListOfUserGroups();
+ }
+
+ private void updateListOfUserGroups() {
+ // Update list of users/groups
+ mUserGroupsAdapter = new ShareUserListAdapter(getActivity().getApplicationContext(),
+ R.layout.share_user_item, mShares, this);
+
+ // Show data
+ ListView usersList = (ListView) getView().findViewById(R.id.searchUsersListView);
+
+ if (mShares.size() > 0) {
+ usersList.setVisibility(View.VISIBLE);
+ usersList.setAdapter(mUserGroupsAdapter);
+
+ } else {
+ usersList.setVisibility(View.GONE);