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 <external-files-path
name="files" name="files"
path="/"/> 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> </paths>

View file

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