*/
public void requestPasswordForShareViaLink(OCFile file) {
SharePasswordDialogFragment dialog =
- SharePasswordDialogFragment.newInstance(
- file,
- null
- );
+ SharePasswordDialogFragment.newInstance(file);
dialog.show(
mFileActivity.getSupportFragmentManager(),
SharePasswordDialogFragment.PASSWORD_FRAGMENT
// 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);
chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
} else {
if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
if (!isTryShareAgain()) {
SharePasswordDialogFragment dialog =
- SharePasswordDialogFragment.newInstance(new OCFile(operation.getPath()),
- operation.getSendIntent());
+ SharePasswordDialogFragment.newInstance(new OCFile(operation.getPath()));
dialog.show(getSupportFragmentManager(), DIALOG_SHARE_PASSWORD);
} else {
Toast t = Toast.makeText(this,
intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE);
String[] packagesToExclude = new String[]{getPackageName()};
- DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink,
- packagesToExclude, getFile());
+ DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
}
}
import android.widget.TextView;
import com.owncloud.android.R;
-import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.CopyToClipboardActivity;
-import com.owncloud.android.ui.activity.FileActivity;
/**
* Dialog showing a list activities able to resolve a given Intent,
".ARG_INTENT";
private final static String ARG_PACKAGES_TO_EXCLUDE = ShareLinkToDialog.class.getSimpleName() +
".ARG_PACKAGES_TO_EXCLUDE";
- private final static String ARG_FILE_TO_SHARE = ShareLinkToDialog.class.getSimpleName() +
- ".FILE_TO_SHARE";
-
+
private ActivityAdapter mAdapter;
- private OCFile mFile;
private Intent mIntent;
- public static ShareLinkToDialog newInstance(Intent intent, String[] packagesToExclude,
- OCFile fileToShare) {
+ public static ShareLinkToDialog newInstance(Intent intent, String[] packagesToExclude) {
ShareLinkToDialog f = new ShareLinkToDialog();
Bundle args = new Bundle();
args.putParcelable(ARG_INTENT, intent);
args.putStringArray(ARG_PACKAGES_TO_EXCLUDE, packagesToExclude);
- args.putParcelable(ARG_FILE_TO_SHARE, fileToShare);
f.setArguments(args);
return f;
}
String[] packagesToExclude = getArguments().getStringArray(ARG_PACKAGES_TO_EXCLUDE);
List<String> packagesToExcludeList = Arrays.asList(packagesToExclude != null ?
packagesToExclude : new String[0]);
- mFile = getArguments().getParcelable(ARG_FILE_TO_SHARE);
-
+
PackageManager pm= getActivity().getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(mIntent,
PackageManager.MATCH_DEFAULT_ONLY);
actInfo.name);
mIntent.setComponent(name);
- // Send the intent
- dialog.dismiss(); // explicitly added for Android 2.x devices
-
// Send the file
- ((FileActivity)getActivity()).startActivity(mIntent);
+ getActivity().startActivity(mIntent);
}
})
.create();
import android.support.v7.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
-import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
implements DialogInterface.OnClickListener {
private static final String ARG_FILE = "FILE";
- private static final String ARG_SEND_INTENT = "SEND_INTENT";
public static final String PASSWORD_FRAGMENT = "PASSWORD_FRAGMENT";
private OCFile mFile;
- private Intent mSendIntent;
/**
* Public factory method to create new SharePasswordDialogFragment instances.
*
* @param file
- * @param sendIntent
* @return Dialog ready to show.
*/
- public static SharePasswordDialogFragment newInstance(OCFile file, Intent sendIntent) {
+ public static SharePasswordDialogFragment newInstance(OCFile file) {
SharePasswordDialogFragment frag = new SharePasswordDialogFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_FILE, file);
- args.putParcelable(ARG_SEND_INTENT, sendIntent);
frag.setArguments(args);
return frag;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mFile = getArguments().getParcelable(ARG_FILE);
- mSendIntent = getArguments().getParcelable(ARG_SEND_INTENT);
// Inflate the layout for the dialog
LayoutInflater inflater = getActivity().getLayoutInflater();
}
// Share the file
- if (mSendIntent == null) {
- ((FileActivity) getActivity()).getFileOperationsHelper().
- setPasswordToShareViaLink(mFile, password);
-
- }
+ ((FileActivity) getActivity()).getFileOperationsHelper().
+ setPasswordToShareViaLink(mFile, password);
} else {
// Disable the flag "Share again"