update the FileProvider pattern

This commit is contained in:
tibbi 2017-11-07 19:08:16 +01:00
parent 54a5027b2a
commit 3fa5dc5300
4 changed files with 14 additions and 15 deletions

View File

@ -57,6 +57,11 @@
</intent-filter>
</activity>
<activity
android:name=".activities.SettingsActivity"
android:label="@string/settings"
android:parentActivityName=".activities.MainActivity"/>
<activity
android:name="com.simplemobiletools.commons.activities.AboutActivity"
android:label="@string/about"
@ -72,19 +77,14 @@
android:label="@string/customize_colors"
android:parentActivityName=".activities.SettingsActivity"/>
<activity
android:name=".activities.SettingsActivity"
android:label="@string/settings"
android:parentActivityName=".activities.MainActivity"/>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.simplemobiletools.draw.fileprovider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths"/>
android:resource="@xml/provider_paths"/>
</provider>
</application>
</manifest>

View File

@ -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() {

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path
name="shared_images"
path="images/"/>
</paths>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="shared_images" path="images/"/>
<external-path name="external_files" path="."/>
<root-path name="external_files" path="/storage/"/>
</paths>