- // Get users and groups to fill the "share with" list
- private void getShares() {
- mShares = new ArrayList<>();
-
- // Get Users and Groups
- FileDataStorageManager fileDataStorageManager =
- new FileDataStorageManager(mAccount, getActivity().getContentResolver());
- mShares = fileDataStorageManager.getSharesWithForAFile(mFile.getRemotePath(), mAccount.name);
-
- // Update list of users/groups
- updateListOfUserGroups();
+ /**
+ * Get users and groups from the DB to fill in the "share with" list
+ *
+ * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
+ * instance ready to use. If not ready, does nothing.
+ */
+ public void refreshUsersOrGroupsListFromDB (){
+ if (((FileActivity) mListener).getStorageManager() != null) {
+ // Get Users and Groups
+ mShares = ((FileActivity) mListener).getStorageManager().getSharesWithForAFile(
+ mFile.getRemotePath(),
+ mAccount.name
+ );
+
+ // Update list of users/groups
+ updateListOfUserGroups();
+ }