import com.owncloud.android.operations.UnshareOperation;
import com.owncloud.android.ui.fragment.SearchFragment;
import com.owncloud.android.ui.fragment.ShareFileFragment;
+import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.GetShareWithUsersAsyncTask;
import java.util.ArrayList;
*/
public class ShareActivity extends FileActivity
- implements GetShareWithUsersAsyncTask.OnGetSharesWithUsersTaskListener,
- ShareFileFragment.OnShareFragmentInteractionListener,
+ implements ShareFileFragment.OnShareFragmentInteractionListener,
SearchFragment.OnSearchFragmentInteractionListener {
private static final String TAG = ShareActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ onAccountSet(false);
setContentView(R.layout.share_activity);
if (mSearchFragment != null){
ft.hide(mShareFileFragment);
ft.add(R.id.share_fragment_container, mSearchFragment, TAG_SEARCH_FRAGMENT);
- ft.addToBackStack(TAG_SEARCH_FRAGMENT);
}
ft.commit();
}
handleIntent(getIntent());
- onAccountSet(false);
+
}
}
private void doShareWith(String shareeName, boolean isGroup) {
- if (isGroup) {
- Toast.makeText(this, "You want to SHARE with GROUP [" + shareeName + "]", Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(this, "You want to SHARE with USER [" + shareeName + "]", Toast.LENGTH_SHORT).show();
- }
getFileOperationsHelper().shareFileWithSharee(
getFile(),
shareeName,
public void onBackPressed() {
super.onBackPressed();
if (mSearchFragment != null){
- getSupportFragmentManager().popBackStackImmediate();
mSearchFragment = null;
+ getSupportFragmentManager().popBackStackImmediate();
mShareFileFragment.refreshUsersOrGroupsListFromDB();
}
}
@Override
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
super.onRemoteOperationFinish(operation, result);
- if (operation instanceof UnshareOperation) {
- refreshUsersInLists();
- } else if(operation instanceof CreateShareWithShareeOperation){
- refreshUsersInLists();
- }
- }
-
- @Override
- public void onGetDataShareWithFinish(RemoteOperationResult result) {
- // Remove loading
- dismissLoadingDialog();
- if (result != null && result.isSuccess()) {
- Log_OC.d(TAG, "Get Data Share With finishes sucessfully");
- } else {
- Toast.makeText(this, result.getLogMessage(), Toast.LENGTH_SHORT).show();
+ if (result.isSuccess()) {
+ refreshUsersInLists();
+ if (operation instanceof CreateShareWithShareeOperation) {
+ // Clean action
+ getIntent().setAction(null);
+ }
}
- // Data is on Database
- refreshUsersInLists();
}
private void refreshUsersInLists(){