projects
/
pub
/
Android
/
ownCloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f912415
)
Fixed NPE on list of shares in SearchShareesFragment; and some clean-up
author
David A. Velasco
<dvelasco@solidgear.es>
Wed, 28 Oct 2015 15:18:20 +0000
(16:18 +0100)
committer
David A. Velasco
<dvelasco@solidgear.es>
Fri, 30 Oct 2015 15:55:29 +0000
(16:55 +0100)
src/com/owncloud/android/ui/activity/ShareActivity.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/fragment/SearchShareesFragment.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/fragment/ShareFileFragment.java
patch
|
blob
|
blame
|
history
diff --git
a/src/com/owncloud/android/ui/activity/ShareActivity.java
b/src/com/owncloud/android/ui/activity/ShareActivity.java
index
13c4b75
..
9d4a769
100644
(file)
--- a/
src/com/owncloud/android/ui/activity/ShareActivity.java
+++ b/
src/com/owncloud/android/ui/activity/ShareActivity.java
@@
-147,9
+147,9
@@
public class ShareActivity extends FileActivity
}
@Override
}
@Override
- public void showSearchUsersAndGroups(
ArrayList<OCShare> shares
) {
+ public void showSearchUsersAndGroups() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- mSearchFragment = SearchShareesFragment.newInstance(getFile(), getAccount()
, shares
);
+ mSearchFragment = SearchShareesFragment.newInstance(getFile(), getAccount());
ft.hide(mShareFileFragment);
ft.add(R.id.share_fragment_container, mSearchFragment, TAG_SEARCH_FRAGMENT);
ft.addToBackStack(TAG_SEARCH_FRAGMENT);
ft.hide(mShareFileFragment);
ft.add(R.id.share_fragment_container, mSearchFragment, TAG_SEARCH_FRAGMENT);
ft.addToBackStack(TAG_SEARCH_FRAGMENT);
diff --git
a/src/com/owncloud/android/ui/fragment/SearchShareesFragment.java
b/src/com/owncloud/android/ui/fragment/SearchShareesFragment.java
index
7bbdf01
..
01c4728
100644
(file)
--- a/
src/com/owncloud/android/ui/fragment/SearchShareesFragment.java
+++ b/
src/com/owncloud/android/ui/fragment/SearchShareesFragment.java
@@
-60,11
+60,11
@@
public class SearchShareesFragment extends Fragment implements ShareUserListAdap
// the fragment initialization parameters
private static final String ARG_FILE = "FILE";
private static final String ARG_ACCOUNT = "ACCOUNT";
// the fragment initialization parameters
private static final String ARG_FILE = "FILE";
private static final String ARG_ACCOUNT = "ACCOUNT";
- private static final String ARG_SHARES = "SHARES";
// Parameters
private OCFile mFile;
private Account mAccount;
// Parameters
private OCFile mFile;
private Account mAccount;
+
private ArrayList<OCShare> mShares;
private ShareUserListAdapter mUserGroupsAdapter = null;
private ArrayList<OCShare> mShares;
private ShareUserListAdapter mUserGroupsAdapter = null;
@@
-73,18
+73,15
@@
public class SearchShareesFragment extends Fragment implements ShareUserListAdap
/**
* Public factory method to create new SearchShareesFragment instances.
*
/**
* Public factory method to create new SearchShareesFragment instances.
*
- * @param fileToShare An {@link OCFile} to
show in the fragment
+ * @param fileToShare An {@link OCFile} to
be shared
* @param account An ownCloud account
* @param account An ownCloud account
- * @param
* @return A new instance of fragment SearchShareesFragment.
*/
* @return A new instance of fragment SearchShareesFragment.
*/
- // TODO: Rename and change types and number of parameters
- public static SearchShareesFragment newInstance(OCFile fileToShare, Account account, ArrayList<OCShare> shares) {
+ public static SearchShareesFragment newInstance(OCFile fileToShare, Account account) {
SearchShareesFragment fragment = new SearchShareesFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_FILE, fileToShare);
args.putParcelable(ARG_ACCOUNT, account);
SearchShareesFragment fragment = new SearchShareesFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_FILE, fileToShare);
args.putParcelable(ARG_ACCOUNT, account);
- args.putParcelableArrayList(ARG_SHARES, shares);
fragment.setArguments(args);
return fragment;
}
fragment.setArguments(args);
return fragment;
}
@@
-99,7
+96,6
@@
public class SearchShareesFragment extends Fragment implements ShareUserListAdap
if (getArguments() != null) {
mFile = getArguments().getParcelable(ARG_FILE);
mAccount = getArguments().getParcelable(ARG_ACCOUNT);
if (getArguments() != null) {
mFile = getArguments().getParcelable(ARG_FILE);
mAccount = getArguments().getParcelable(ARG_ACCOUNT);
- mShares = getArguments().getParcelableArrayList(ARG_SHARES);
}
}
}
}
@@
-134,18
+130,19
@@
public class SearchShareesFragment extends Fragment implements ShareUserListAdap
}
});
}
});
- // Show data: Fill in list of users and groups
- ListView usersList = (ListView) view.findViewById(R.id.searchUsersListView);
- mUserGroupsAdapter = new ShareUserListAdapter(getActivity().getApplicationContext(),
- R.layout.share_user_item, mShares, this);
- if (mShares.size() > 0) {
- usersList.setVisibility(View.VISIBLE);
- usersList.setAdapter(mUserGroupsAdapter);
- }
-
return view;
}
return view;
}
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ // Load data into the list
+ refreshUsersOrGroupsListFromDB();
+ }
+
+
/**
* Get users and groups fromn the DB to fill in the "share with" list
*/
/**
* Get users and groups fromn the DB to fill in the "share with" list
*/
diff --git
a/src/com/owncloud/android/ui/fragment/ShareFileFragment.java
b/src/com/owncloud/android/ui/fragment/ShareFileFragment.java
index
7051767
..
5ee2a87
100644
(file)
--- a/
src/com/owncloud/android/ui/fragment/ShareFileFragment.java
+++ b/
src/com/owncloud/android/ui/fragment/ShareFileFragment.java
@@
-2,6
+2,7
@@
* ownCloud Android client application
*
* @author masensio
* 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
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
@@
-142,7
+143,7
@@
public class ShareFileFragment extends Fragment
boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount);
if (shareWithUsersEnable) {
// Show Search Fragment
boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount);
if (shareWithUsersEnable) {
// Show Search Fragment
- mListener.showSearchUsersAndGroups(
mShares
);
+ mListener.showSearchUsersAndGroups();
} else {
String message = getString(R.string.share_sharee_unavailable);
Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
} else {
String message = getString(R.string.share_sharee_unavailable);
Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
@@
-157,8
+158,13
@@
public class ShareFileFragment extends Fragment
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
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
}
@Override
@@
-192,8
+198,12
@@
public class ShareFileFragment extends Fragment
private void updateListOfUserGroups() {
// Update list of users/groups
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);
// Show data
TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers);
@@
-229,7
+239,7
@@
public class ShareFileFragment extends Fragment
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnShareFragmentInteractionListener {
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnShareFragmentInteractionListener {
- void showSearchUsersAndGroups(
ArrayList<OCShare> shares
);
+ void showSearchUsersAndGroups();
void refreshUsersOrGroupsListFromServer();
void unshareWith(OCShare share);
}
void refreshUsersOrGroupsListFromServer();
void unshareWith(OCShare share);
}