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.ComponentsGetter;
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);
ComponentName name=new ComponentName(
actInfo.applicationInfo.packageName,
actInfo.name);
- mIntent.setComponent(name);
-
- if (sendAction) {
- dialog.dismiss(); // explicitly added for Android 2.x devices
-
- // Send the file
- ((FileActivity)getActivity()).startActivity(mIntent);
+ mIntent.setComponent(name);
- } else {
- // Create a new share resource
- ((ComponentsGetter)getActivity()).getFileOperationsHelper()
- .shareFileWithLinkToApp(mFile, "", mIntent);
- }
+ // Send the file
+ getActivity().startActivity(mIntent);
}
})
.create();