Merge pull request #5455 from osmandapp/FixFileProvider

Add pathes for fileprovider
This commit is contained in:
Alexey 2018-05-22 14:23:52 +03:00 committed by GitHub
commit 64e415a894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 7 deletions

View file

@ -8,4 +8,21 @@
<external-files-path
name="files"
path="/"/>
<external-path
name="external_files"
path="." />
<files-path
name="files_path"
path="." />
<external-cache-path
name="external_cache_path"
path="." />
<root-path
name="root"
path="." />
</paths>

View file

@ -827,7 +827,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
public void captureImage(double lat, double lon, final MapActivity mapActivity) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri fileUri = AndroidUtils.getUriForFile(getMapActivity(), getBaseFileName(lat, lon, app, IMG_EXTENSION));
Uri fileUri = AndroidUtils.getUriForFile(mapActivity, getBaseFileName(lat, lon, app, IMG_EXTENSION));
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
// start the image capture Intent
@ -841,7 +841,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
// if (AV_VIDEO_FORMAT.get() == VIDEO_OUTPUT_3GP) {
// ext = THREEGP_EXTENSION;
// }
Uri fileUri = AndroidUtils.getUriForFile(getMapActivity(), getBaseFileName(lat, lon, app, ext));
Uri fileUri = AndroidUtils.getUriForFile(mapActivity, getBaseFileName(lat, lon, app, ext));
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high
@ -1503,7 +1503,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
final File f = getBaseFileName(lat, lon, app, IMG_EXTENSION);
lastTakingPhoto = f;
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, AndroidUtils.getUriForFile(getMapActivity(),f));
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, AndroidUtils.getUriForFile(mapActivity,f));
takePictureIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try {
mapActivity.startActivityForResult(takePictureIntent, 205);
@ -1880,9 +1880,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
public void playRecording(final Context ctx, final Recording r) {
if (r.isVideo()) {
Intent vint = new Intent(Intent.ACTION_VIEW);
vint.setDataAndType(AndroidUtils.getUriForFile(mapActivity, r.file), "video/*");
vint.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
vint.setDataAndType(AndroidUtils.getUriForFile(ctx, r.file), "video/*");
vint.setFlags(0x10000000);
vint.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try {
ctx.startActivity(vint);
} catch (Exception e) {
@ -1891,9 +1891,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
return;
} else if (r.isPhoto()) {
Intent vint = new Intent(Intent.ACTION_VIEW);
vint.setDataAndType(AndroidUtils.getUriForFile(mapActivity, r.file), "image/*");
vint.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
vint.setDataAndType(AndroidUtils.getUriForFile(ctx, r.file), "image/*");
vint.setFlags(0x10000000);
vint.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
ctx.startActivity(vint);
return;
}