Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Added option to specify file name to import/export intent
Browse files Browse the repository at this point in the history
Fixes #1784
  • Loading branch information
M66B committed Jul 4, 2014
1 parent 19abf11 commit 1816260
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Changelog

**Next release**

* Added option to specify file name to import/export intent ([issue](/../../issues/1784))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

**Version 2.1.20 BETA**
Expand Down
27 changes: 15 additions & 12 deletions src/biz/bokhorst/xprivacy/ActivityShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public class ActivityShare extends ActivityBase {
public static final String cRestriction = "Restriction";
public static final String cInteractive = "Interactive";
public static final String cChoice = "Choice";
public static final String cFileName = "FileName";
public static final String HTTP_BASE_URL = "http://crowd.xprivacy.eu/";
public static final String HTTPS_BASE_URL = "https://crowd.xprivacy.eu/";

Expand Down Expand Up @@ -152,6 +153,7 @@ protected void onCreate(Bundle savedInstanceState) {
final int[] uids = (extras != null && extras.containsKey(cUidList) ? extras.getIntArray(cUidList) : new int[0]);
final String restrictionName = (extras != null ? extras.getString(cRestriction) : null);
int choice = (extras != null && extras.containsKey(cChoice) ? extras.getInt(cChoice) : -1);
mFileName = (extras != null && extras.containsKey(cFileName) ? extras.getString(cFileName) : null);

// License check
if (action.equals(ACTION_IMPORT) || action.equals(ACTION_EXPORT)
Expand Down Expand Up @@ -257,18 +259,19 @@ protected void onCreate(Bundle savedInstanceState) {
boolean hasIntent = Util.isIntentAvailable(ActivityShare.this, file);

// Get file name
if (action.equals(ACTION_EXPORT)) {
String packageName = null;
if (uids.length == 1)
try {
ApplicationInfoEx appInfo = new ApplicationInfoEx(this, uids[0]);
packageName = appInfo.getPackageName().get(0);
} catch (Throwable ex) {
Util.bug(null, ex);
}
mFileName = getFileName(this, hasIntent, packageName);
} else
mFileName = (hasIntent ? null : getFileName(this, false, null));
if (mFileName == null)
if (action.equals(ACTION_EXPORT)) {
String packageName = null;
if (uids.length == 1)
try {
ApplicationInfoEx appInfo = new ApplicationInfoEx(this, uids[0]);
packageName = appInfo.getPackageName().get(0);
} catch (Throwable ex) {
Util.bug(null, ex);
}
mFileName = getFileName(this, hasIntent, packageName);
} else
mFileName = (hasIntent ? null : getFileName(this, false, null));

if (mFileName == null)
fileChooser();
Expand Down

0 comments on commit 1816260

Please sign in to comment.