FileProvider: attempt to work with sd cards
This commit is contained in:
parent
0e12b2d19a
commit
459cf09f06
|
@ -515,7 +515,7 @@ public class FileBackend {
|
||||||
return FileProvider.getUriForFile(context, packageId + FILE_PROVIDER, file);
|
return FileProvider.getUriForFile(context, packageId + FILE_PROVIDER, file);
|
||||||
} catch(IllegalArgumentException e) {
|
} catch(IllegalArgumentException e) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
throw new SecurityException();
|
throw new SecurityException(e);
|
||||||
} else {
|
} else {
|
||||||
return Uri.fromFile(file);
|
return Uri.fromFile(file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.text.style.RelativeSizeSpan;
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -967,6 +968,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||||
try {
|
try {
|
||||||
uri = FileBackend.getUriForFile(activity, file);
|
uri = FileBackend.getUriForFile(activity, file);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
|
Log.d(Config.LOGTAG,"No permission to access "+file.getAbsolutePath(),e);
|
||||||
Toast.makeText(activity, activity.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, activity.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<paths>
|
<paths>
|
||||||
<external-path name="external" path="/"/>
|
<external-path
|
||||||
<files-path path="Images/" name="pictures" />
|
name="external"
|
||||||
<files-path path="Videos" name="videos"/>
|
path="/"/>
|
||||||
<files-path path="Files/" name="files" />
|
<root-path
|
||||||
<cache-path path="Camera/" name="camera" />
|
name="storage"
|
||||||
|
path="/storage/"/>
|
||||||
|
<files-path
|
||||||
|
name="pictures"
|
||||||
|
path="Images/"/>
|
||||||
|
<files-path
|
||||||
|
name="videos"
|
||||||
|
path="Videos"/>
|
||||||
|
<files-path
|
||||||
|
name="files"
|
||||||
|
path="Files/"/>
|
||||||
|
<cache-path
|
||||||
|
name="camera"
|
||||||
|
path="Camera/"/>
|
||||||
</paths>
|
</paths>
|
Loading…
Reference in New Issue