--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ownCloud Android client application
+ Copyright (C) 2015 ownCloud Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2,
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.owncloud.android.ui.dialog.ShareFileDialogFragment">
+
+ <ScrollView
+ android:id="@+id/shareScrollView"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginBottom="8dp">
+
+ <RelativeLayout
+ android:id="@+id/shareHeaderContainer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp">
+
+ <ImageView
+ android:id="@+id/shareFileIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/file"
+ android:layout_margin="8dp"
+ android:maxHeight="96dp"
+ android:maxWidth="96dp"/>
+
+ <TextView
+ android:id="@+id/shareFileName"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/placeholder_filename"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:layout_marginTop="39dp"
+ android:layout_alignParentTop="true"
+ android:layout_toRightOf="@+id/shareFileIcon"
+ android:layout_toEndOf="@+id/shareFileIcon" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/placeholder_filesize"
+ android:id="@+id/shareFileSize"
+ android:layout_below="@+id/shareFileName"
+ android:layout_toRightOf="@+id/shareFileIcon"
+ android:layout_toEndOf="@+id/shareFileIcon"
+ android:layout_marginTop="12dp" />
+
+ </RelativeLayout>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/share_with_user_section_title"
+ android:id="@+id/shareWithUsersSectionTitle"
+ android:layout_gravity="left"
+ android:padding="8dp"
+ android:background="@color/actionbar_start_color"
+ android:textColor="@color/white"/>
+
+ <ListView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/shareUsersList"
+ android:visibility="gone" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/shareNoUsers"
+ android:text="@string/share_no_users"
+ android:padding="12dp" />
+
+ <android.support.v7.widget.AppCompatButton
+ android:id="@+id/addUserButton"
+ style="@style/ownCloud.Button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:text="@string/share_add_user_or_group"
+ android:contentDescription="shareAddUserButton"/>
+ </LinearLayout>
+ </ScrollView>
+</FrameLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ownCloud Android client application
- Copyright (C) 2015 ownCloud Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2,
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
--->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/shareScrollView"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true"
- style="Theme.owncloud">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@color/background_material_light"
- android:orientation="vertical">
-
- <RelativeLayout
- android:id="@+id/shareHeaderContainer"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="8dp"
- android:background="@color/background_color">
-
- <ImageView
- android:id="@+id/shareFileIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/file" />
-
- <TextView
- android:id="@+id/shareFileName"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/placeholder_filename"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:layout_marginTop="39dp"
- android:layout_alignParentTop="true"
- android:layout_toRightOf="@+id/shareFileIcon"
- android:layout_toEndOf="@+id/shareFileIcon" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/placeholder_filesize"
- android:id="@+id/shareFileSize"
- android:layout_below="@+id/shareFileName"
- android:layout_toRightOf="@+id/shareFileIcon"
- android:layout_toEndOf="@+id/shareFileIcon"
- android:layout_marginTop="12dp" />
-
- </RelativeLayout>
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/share_with_user_section_title"
- android:id="@+id/shareWithUsersSectionTitle"
- android:layout_gravity="left"
- android:padding="8dp"
- android:background="@color/actionbar_start_color"
- android:textColor="@color/white"/>
-
- <ListView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/shareUsersList"
- android:visibility="gone" />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/shareNoUsers"
- android:text="@string/share_no_users"
- android:padding="12dp" />
-
- <android.support.v7.widget.AppCompatButton
- android:id="@+id/addUserButton"
- style="@style/ownCloud.Button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:text="@string/share_add_user_or_group"
- android:contentDescription="shareAddUserButton"/>
- </LinearLayout>
-</ScrollView>
\ No newline at end of file
<string name="file_list__footer__files_and_folder">%1$d files, 1 folder</string>
<string name="file_list__footer__files_and_folders">%1$d files, %2$d folders</string>
+ <string name="share_link_title">Share link</string>
<string name="share_with_user_section_title">Share with Users and Groups</string>
<string name="share_no_users">No data shared with users yet</string>
<string name="share_add_user_or_group">Add User or Group</string>
+<!-- TODO: Remove or change this placeholder text -->
+ <string name="hello_blank_fragment">Hello blank fragment</string>
+
</resources>
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.ui.activity.FileActivity;
+import com.owncloud.android.ui.dialog.ShareFileDialogFragment;
import com.owncloud.android.ui.dialog.ShareLinkToDialog;
import org.apache.http.protocol.HTTP;
String encodedStoragePath = WebdavUtils.encodePath(storagePath);
Intent intentForSavedMimeType = new Intent(Intent.ACTION_VIEW);
- intentForSavedMimeType.setDataAndType(Uri.parse("file://"+ encodedStoragePath), file.getMimetype());
+ intentForSavedMimeType.setDataAndType(Uri.parse("file://"+ encodedStoragePath),
+ file.getMimetype());
intentForSavedMimeType.setFlags(
Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
);
);
if (guessedMimeType != null && !guessedMimeType.equals(file.getMimetype())) {
intentForGuessedMimeType = new Intent(Intent.ACTION_VIEW);
- intentForGuessedMimeType.setDataAndType(Uri.parse("file://"+ encodedStoragePath), guessedMimeType);
+ intentForGuessedMimeType.
+ setDataAndType(Uri.parse("file://"+ encodedStoragePath),
+ guessedMimeType);
intentForGuessedMimeType.setFlags(
- Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
+ Intent.FLAG_GRANT_READ_URI_PERMISSION |
+ Intent.FLAG_GRANT_WRITE_URI_PERMISSION
);
}
}
String link = "https://fake.url";
Intent intent = createShareWithLinkIntent(link);
String[] packagesToExclude = new String[]{mFileActivity.getPackageName()};
- DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intent, packagesToExclude, file);
+ DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intent,
+ packagesToExclude, file);
chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
} else {
} else {
// Show a Message
Toast t = Toast.makeText(
- mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api), Toast.LENGTH_LONG
+ mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api),
+ Toast.LENGTH_LONG
);
t.show();
}
} else {
// Show a Message
- Toast t = Toast.makeText(mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api), Toast.LENGTH_LONG);
+ Toast t = Toast.makeText(mFileActivity,
+ mFileActivity.getString(R.string.share_link_no_support_share_api),
+ Toast.LENGTH_LONG);
t.show();
}
}
+ public void showShareFile(OCFile file){
+ ShareFileDialogFragment dialog =
+ ShareFileDialogFragment.newInstance(file, mFileActivity.getAccount());
+ dialog.show(mFileActivity.getSupportFragmentManager(), mFileActivity.DIALOG_SHARE_FILE);
+
+ }
+
public void sendDownloadedFile(OCFile file) {
if (file != null) {
String storagePath = file.getStoragePath();
// Show dialog, without the own app
String[] packagesToExclude = new String[]{mFileActivity.getPackageName()};
- DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude, file);
+ DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent,
+ packagesToExclude, file);
chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
} else {
public void cancelTransference(OCFile file) {
Account account = mFileActivity.getAccount();
if (file.isFolder()) {
- OperationsService.OperationsServiceBinder opsBinder = mFileActivity.getOperationsServiceBinder();
+ OperationsService.OperationsServiceBinder opsBinder =
+ mFileActivity.getOperationsServiceBinder();
if (opsBinder != null) {
opsBinder.cancel(account, file);
}
*/
public boolean isVersionWithForbiddenCharacters() {
if (mFileActivity.getAccount() != null) {
- OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mFileActivity.getAccount());
+ OwnCloudVersion serverVersion =
+ AccountUtils.getServerVersion(mFileActivity.getAccount());
return (serverVersion != null && serverVersion.isVersionWithForbiddenCharacters());
}
return false;
public static final String TAG = FileActivity.class.getSimpleName();
private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT";
+ public static final String DIALOG_SHARE_FILE = "DIALOG_SHARE_FILE";
+
private static final String KEY_WAITING_FOR_OP_ID = "WAITING_FOR_OP_ID";
private static final String DIALOG_SHARE_PASSWORD = "DIALOG_SHARE_PASSWORD";
private static final String KEY_TRY_SHARE_AGAIN = "TRY_SHARE_AGAIN";
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
+import com.owncloud.android.ui.dialog.ShareFileDialogFragment;
+import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
import com.owncloud.android.ui.dialog.UploadSourceDialogFragment;
implements FileFragment.ContainerActivity,
OnSslUntrustedCertListener, OnEnforceableRefreshListener {
-
-
private SyncBroadcastReceiver mSyncBroadcastReceiver;
private UploadFinishReceiver mUploadFinishReceiver;
private DownloadFinishReceiver mDownloadFinishReceiver;
setFile(file);
}
+ /**
+ * Shows the share view for sharing {@link OCFile} received as a
+ * parameter in the second fragment.
+ *
+ * @param file {@link OCFile} File to share with
+ */
+ @Override
+ public void showShareFile(OCFile file) {
+ ShareFileDialogFragment dialog =
+ ShareFileDialogFragment.newInstance(file, getAccount());
+ dialog.show(getSupportFragmentManager(), DIALOG_SHARE_FILE);
+ }
+
@Override
protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) {
if (mDualPane) {
actionBar.setDisplayHomeAsUpEnabled(!atRoot);
actionBar.setHomeButtonEnabled(!atRoot);
actionBar.setTitle(
- atRoot
- ? getString(R.string.default_display_name_for_root_folder)
- : currentDir.getFileName()
+ atRoot
+ ? getString(R.string.default_display_name_for_root_folder)
+ : currentDir.getFileName()
);
}
super.onRemoteOperationFinish(operation, result);
if (operation instanceof CreateFolderOperation) {
- onCreateFolderOperationFinish((CreateFolderOperation)operation, result);
+ onCreateFolderOperationFinish((CreateFolderOperation) operation, result);
}
}
/**
- * Shows the information of the {@link OCFile} received as a
+ * Shows the information of the {@link OCFile} received as a
* parameter in the second fragment.
- *
+ *
* @param file {@link OCFile} whose details will be shown
*/
@Override
}
+ /**
+ * Shows the share view for sharing {@link OCFile} received as a
+ * parameter in the second fragment.
+ *
+ * @param file {@link OCFile} File to share with
+ */
+ @Override
+ public void showShareFile(OCFile file) {
+
+ }
+
@Override
public void onRefresh() {
refreshList(true);
--- /dev/null
+/**
+ * ownCloud Android client application
+ *
+ * @author masensio
+ * Copyright (C) 2015 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.ui.dialog;
+
+import android.accounts.Account;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Bundle;
+import android.app.Fragment;
+import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.datamodel.ThumbnailsCacheManager;
+import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.MimetypeIconUtil;
+
+/**
+ * A simple {@link Fragment} subclass.
+ * Activities that contain this fragment must implement the
+ * {@link ShareFileDialogFragment.OnFragmentInteractionListener} interface
+ * to handle interaction events.
+ * Use the {@link ShareFileDialogFragment#newInstance} factory method to
+ * create an instance of this fragment.
+ *
+ * Dialog Fragment to show the share options of a file/folder
+ *
+ * Search the users and share with them
+ */
+public class ShareFileDialogFragment extends DialogFragment
+ implements DialogInterface.OnClickListener{
+ private static final String TAG = ShareFileDialogFragment.class.getSimpleName();
+
+ // the fragment initialization parameters
+ private static final String ARG_FILE = "FILE";
+ private static final String ARG_ACCOUNT = "ACCOUNT";
+
+ // Parameters
+ private OCFile mFile;
+ private Account mAccount;
+
+ private OnFragmentInteractionListener mListener;
+
+ /**
+ * Public factory method to create new ShareFileDialogFragment instances.
+ *
+ * @param fileToShare An {@link OCFile} to show in the fragment
+ * @param account An ownCloud account
+ * @return A new instance of fragment ShareFragment.
+ */
+ public static ShareFileDialogFragment newInstance(OCFile fileToShare, Account account) {
+ ShareFileDialogFragment fragment = new ShareFileDialogFragment();
+ Bundle args = new Bundle();
+ args.putParcelable(ARG_FILE, fileToShare);
+ args.putParcelable(ARG_ACCOUNT, account);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ public ShareFileDialogFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mFile = getArguments().getParcelable(ARG_FILE);
+ mAccount = getArguments().getParcelable(ARG_ACCOUNT);
+ }
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+
+ // Inflate the layout for the dialog
+ LayoutInflater inflater = getActivity().getLayoutInflater();
+ View view = inflater.inflate(R.layout.share_file_dialog, null);
+
+ // Setup layout
+ // Image
+ ImageView icon = (ImageView) view.findViewById(R.id.shareFileIcon);
+ icon.setImageResource(MimetypeIconUtil.getFileTypeIconId(mFile.getMimetype(),
+ mFile.getFileName()));
+ if (mFile.isImage()) {
+ String remoteId = String.valueOf(mFile.getRemoteId());
+ Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId);
+ if (thumbnail != null){
+ icon.setImageBitmap(thumbnail);
+ }
+ }
+ // Name
+ TextView filename = (TextView) view.findViewById(R.id.shareFileName);
+ filename.setText(mFile.getFileName());
+ // Size
+ TextView size = (TextView) view.findViewById(R.id.shareFileSize);
+ if (mFile.isFolder()){
+ size.setVisibility(View.GONE);
+ } else {
+ size.setText(DisplayUtils.bytesToHumanReadable(mFile.getFileLength()));
+ }
+
+ // Build the dialog
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ builder.setView(view)
+ .setPositiveButton(R.string.common_ok, this)
+ .setTitle(R.string.share_link_title);
+
+ Dialog d = builder.create();
+ return d;
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ }
+
+ /**
+ * This interface must be implemented by activities that contain this
+ * fragment to allow an interaction in this fragment to be communicated
+ * to the activity and potentially other fragments contained in that
+ * activity.
+ * <p/>
+ * See the Android Training lesson <a href=
+ * "http://developer.android.com/training/basics/fragments/communicating.html"
+ * >Communicating with Other Fragments</a> for more information.
+ */
+ public interface OnFragmentInteractionListener {
+ // TODO: Update argument type and name
+ public void onFragmentInteraction(Uri uri);
+ }
+
+}
mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
return true;
}
+ case R.id.action_share_with_users: {
+ mContainerActivity.getFileOperationsHelper().showShareFile(getFile());
+ return true;
+ }
case R.id.action_unshare_file: {
mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
return true;
}
+
case R.id.action_open_file_with: {
mContainerActivity.getFileOperationsHelper().openFile(getFile());
return true;
if (!getFile().isDown()) { // Download the file
Log_OC.d(TAG, getFile().getRemotePath() + " : File must be downloaded");
((FileDisplayActivity) mContainerActivity).startDownloadForSending(getFile());
-
}
else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(getFile());
* @param downloading Flag signaling if the file is now downloading.
* @param uploading Flag signaling if the file is now uploading.
*/
- public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading);
+ public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading);
-
+ /**
+ * Request the parent activity to show the view for sharing an {@link OCFile}.
+ *
+ * @param file File to share
+ */
+ public void showShareFile(OCFile file);
}
}
*
* TODO refactor to get rid of direct dependency on FileDisplayActivity
*/
-public class OCFileListFragment extends ExtendedListFragment implements FileActionsDialogFragment.FileActionsDialogFragmentListener {
+public class OCFileListFragment extends ExtendedListFragment
+ implements FileActionsDialogFragment.FileActionsDialogFragmentListener {
private static final String TAG = OCFileListFragment.class.getSimpleName();
}
}
- FileActionsDialogFragment dialog = FileActionsDialogFragment.newInstance(menu, fileIndex, targetFile.getFileName());
+ FileActionsDialogFragment dialog = FileActionsDialogFragment.newInstance(menu,
+ fileIndex, targetFile.getFileName());
dialog.setTargetFragment(this, 0);
dialog.show(getFragmentManager(), FileActionsDialogFragment.FTAG_FILE_ACTIONS);
}
mContainerActivity.getFileOperationsHelper().shareFileWithLink(mTargetFile);
return true;
}
+ case R.id.action_share_with_users: {
+ mContainerActivity.showShareFile(mTargetFile);
+ return true;
+ }
case R.id.action_open_file_with: {
mContainerActivity.getFileOperationsHelper().openFile(mTargetFile);
return true;
@Override
public boolean onContextItemSelected (MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
- boolean matched = onFileActionChosen(item.getItemId(), ((AdapterContextMenuInfo) item.getMenuInfo()).position);
+ boolean matched = onFileActionChosen(item.getItemId(),
+ ((AdapterContextMenuInfo) item.getMenuInfo()).position);
if(!matched) {
return super.onContextItemSelected(item);
} else {
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
-import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
+import com.owncloud.android.ui.dialog.ShareFileDialogFragment;
import com.owncloud.android.ui.fragment.FileFragment;
-import com.owncloud.android.utils.DisplayUtils;
/**
}
-
+ /**
+ * Shows the share view for sharing {@link OCFile} received as a
+ * parameter in the second fragment.
+ *
+ * @param file {@link OCFile} File to share with
+ */
+ @Override
+ public void showShareFile(OCFile file) {
+ ShareFileDialogFragment dialog =
+ ShareFileDialogFragment.newInstance(file, getAccount());
+ dialog.show(getSupportFragmentManager(), DIALOG_SHARE_FILE);
+ }
private void requestForDownload(OCFile file) {
if (mDownloaderBinder == null) {
Log_OC.d(TAG, "requestForDownload called without binder to download service");
mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
return true;
}
+ case R.id.action_share_with_users: {
+ seeShareFile();
+ return true;
+ }
case R.id.action_unshare_file: {
mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
return true;
mContainerActivity.showDetails(getFile());
}
+ private void seeShareFile(){
+ mContainerActivity.showShareFile(getFile());
+ }
@Override
public void onResume() {
mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
return true;
}
+ case R.id.action_share_with_users: {
+ seeShareFile();
+ return true;
+ }
case R.id.action_unshare_file: {
stopPreview(false);
mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
mContainerActivity.showDetails(getFile());
}
+ private void seeShareFile() {
+ stopPreview(false);
+ mContainerActivity.showShareFile(getFile());
+ }
private void prepareVideo() {
// create helper to get more control on the playback
mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
return true;
}
+ case R.id.action_share_with_users: {
+ seeShareFile();
+ return true;
+ }
case R.id.action_unshare_file: {
mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
return true;
mContainerActivity.showDetails(getFile());
}
+ private void seeShareFile(){
+ mContainerActivity.showShareFile(getFile());
+ }
+
@Override
public void onPause() {
Log_OC.e(TAG, "onPause");