- @Override
- public void onGetDataShareWithFinish(RemoteOperationResult result) {
- // Remove loading
- ((ShareActivity) getActivity()).dismissWaitingLoadDialog();
- if (result != null && result.isSuccess()) {
- // update local database
- for(Object obj: result.getData()) {
- if ( ((OCShare) obj).getShareType() == ShareType.USER ||
- ((OCShare) obj).getShareType() == ShareType.GROUP ){
- mShares.add((OCShare) obj);
+ private void registerLongClickListener(final ListView listView) {
+ listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
+ @Override
+ public boolean onItemLongClick(AdapterView<?> parent, View view, final int position,
+ long id) {
+ // Show unshare button
+ ImageView unshareButton = (ImageView) view.findViewById(R.id.unshareButton);
+ if (unshareButton.getVisibility() == View.GONE) {
+ unshareButton.setVisibility(View.VISIBLE);
+ unshareButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // Unshare
+ unshareWith(mShares.get(position));
+ Log_OC.d(TAG, "Unshare - " +
+ mShares.get(position).getSharedWithDisplayName());
+ }
+ });
+
+ } else {
+ unshareButton.setVisibility(View.GONE);