From 3fa5dc530062e4a9af3a79846946bbed56358deb Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 7 Nov 2017 19:08:16 +0100 Subject: [PATCH] update the FileProvider pattern --- app/src/main/AndroidManifest.xml | 14 +++++++------- .../draw/activities/MainActivity.kt | 3 +-- app/src/main/res/xml/filepaths.xml | 6 ------ app/src/main/res/xml/provider_paths.xml | 6 ++++++ 4 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 app/src/main/res/xml/filepaths.xml create mode 100644 app/src/main/res/xml/provider_paths.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2d7e5ff..7072c89 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -57,6 +57,11 @@ + + - - + android:resource="@xml/provider_paths"/> diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/draw/activities/MainActivity.kt index fa8faba..64e12b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/activities/MainActivity.kt @@ -8,7 +8,6 @@ import android.graphics.drawable.ColorDrawable import android.net.Uri import android.os.Bundle import android.provider.MediaStore -import android.support.v4.content.FileProvider import android.view.Menu import android.view.MenuItem import android.webkit.MimeTypeMap @@ -291,7 +290,7 @@ class MainActivity : SimpleActivity(), MyCanvas.PathsChangedListener { fileOutputStream?.close() } - return FileProvider.getUriForFile(this, "com.simplemobiletools.draw.fileprovider", file) + return getFilePublicUri(file, BuildConfig.APPLICATION_ID) } private fun clearCanvas() { diff --git a/app/src/main/res/xml/filepaths.xml b/app/src/main/res/xml/filepaths.xml deleted file mode 100644 index b414b7d..0000000 --- a/app/src/main/res/xml/filepaths.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml new file mode 100644 index 0000000..94f2d04 --- /dev/null +++ b/app/src/main/res/xml/provider_paths.xml @@ -0,0 +1,6 @@ + + + + + +