+ 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);
+ }
+ view.setAlpha(0);
+ view.animate().alpha(1).setDuration(500).start();
+ return false;
+ }
+ });
+ }
+
+ // Call to Unshare operation
+ private void unshareWith(OCShare share){
+ OCFile file = ((FileActivity) getActivity()).getFile();
+
+ ((FileActivity) getActivity()).getFileOperationsHelper().
+ unshareFileWithUserOrGroup(
+ file, share.getShareType(), share.getShareWith()
+ );
+ }
+
+