-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return content:// instead of file:// based URIs for share inten… (#1812)
Return content:// instead of file:// based URIs for share intents
- Loading branch information
1 parent
7f03ccf
commit a7ad4ae
Showing
5 changed files
with
33 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
app/src/main/java/com/amaze/filemanager/utils/GenericFileProvider.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* | ||
* Copyright (C) 2014 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>, | ||
* Marcin Zasuwa <[email protected]> | ||
* Copyright (C) 2014-2020 Arpit Khurana <[email protected]>, | ||
* Vishal Nehra <[email protected]>, Marcin Zasuwa <[email protected]>, | ||
* Raymond Lai <airwave209gt at gmail.com> and contributors. | ||
* | ||
* This file is part of Amaze File Manager. | ||
* | ||
|
@@ -97,6 +98,7 @@ | |
*/ | ||
public class FileUtils { | ||
|
||
public static final String FILE_PROVIDER_AUTHORITY = "com.amaze.filemanager"; | ||
public static final String NOMEDIA_FILE = ".nomedia"; | ||
|
||
public static long folderSize(File directory, OnProgressUpdate<Long> updateState) { | ||
|
@@ -357,7 +359,7 @@ public static void shareFiles(ArrayList<File> a, Activity c,AppTheme appTheme,in | |
ArrayList<Uri> uris = new ArrayList<>(); | ||
boolean b = true; | ||
for (File f : a) { | ||
uris.add(Uri.fromFile(f)); | ||
uris.add(FileProvider.getUriForFile(c, FILE_PROVIDER_AUTHORITY, f)); | ||
} | ||
|
||
String mime = MimeTypes.getMimeType(a.get(0).getPath(), a.get(0).isDirectory()); | ||
|
@@ -523,7 +525,7 @@ public static Uri fileToContentUri(Context context, File file, Intent chooserInt | |
} | ||
|
||
chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||
return FileProvider.getUriForFile(context, "com.amaze.filemanager", file); | ||
return FileProvider.getUriForFile(context, FILE_PROVIDER_AUTHORITY, file); | ||
} | ||
|
||
private static Uri fileToContentUri(Context context, String path, boolean isDirectory, String volume) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
/* | ||
* Copyright (C) 2015-2020 Arpit Khurana <[email protected]>, | ||
* Vishal Nehra <[email protected]>, Rémi Piotaix <[email protected]>, | ||
* John Carlson <[email protected]>, Emmanuel Messulam<[email protected]>, | ||
* James Downs <[email protected]>, Bowie Chen <[email protected]>, | ||
* Raymond Lai <airwave209gt at gmail.com> and contributors. | ||
* | ||
* This file is part of Amaze File Manager. | ||
* | ||
* Amaze File Manager is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* 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.amaze.filemanager.utils.share; | ||
|
||
import android.app.Activity; | ||
|
@@ -53,9 +76,9 @@ protected Void doInBackground(String... strings) { | |
arrayList1.add(resInfo.loadLabel(packageManager).toString()); | ||
if (packageName.contains("android.bluetooth")) bluetooth_present = true; | ||
Intent intent = new Intent(); | ||
System.out.println(resInfo.activityInfo.packageName + "\t" + resInfo.activityInfo.name); | ||
intent.setComponent(new ComponentName(packageName, resInfo.activityInfo.name)); | ||
intent.setAction(Intent.ACTION_SEND_MULTIPLE); | ||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||
intent.setType(mime); | ||
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, arrayList); | ||
intent.setPackage(packageName); | ||
|