mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-02-21 13:50:48 +01:00
fix saving files on some SD cards
This commit is contained in:
parent
4040fe8c0a
commit
fab62ee3b8
@ -56,7 +56,7 @@ class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOr
|
|||||||
}
|
}
|
||||||
|
|
||||||
var document = activity.getDocumentFile(path.getParentPath())
|
var document = activity.getDocumentFile(path.getParentPath())
|
||||||
document = document?.createFile("", path.substring(path.lastIndexOf('/') + 1))
|
document = document?.createFile("", path.substring(path.lastIndexOf('/') + 1)) ?: activity.getDocumentFile(path)
|
||||||
if (document == null) {
|
if (document == null) {
|
||||||
activity.toast(R.string.save_error_internal_storage)
|
activity.toast(R.string.save_error_internal_storage)
|
||||||
return ""
|
return ""
|
||||||
|
@ -3,7 +3,6 @@ package com.simplemobiletools.camera.views
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.TextureView
|
import android.view.TextureView
|
||||||
import android.view.View
|
|
||||||
|
|
||||||
// taken from the official Camera2 sample at https://github.com/googlesamples/android-Camera2Basic
|
// taken from the official Camera2 sample at https://github.com/googlesamples/android-Camera2Basic
|
||||||
class AutoFitTextureView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : TextureView(context, attrs, defStyle) {
|
class AutoFitTextureView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : TextureView(context, attrs, defStyle) {
|
||||||
@ -23,8 +22,8 @@ class AutoFitTextureView @JvmOverloads constructor(context: Context, attrs: Attr
|
|||||||
|
|
||||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||||
val width = View.MeasureSpec.getSize(widthMeasureSpec)
|
val width = MeasureSpec.getSize(widthMeasureSpec)
|
||||||
val height = View.MeasureSpec.getSize(heightMeasureSpec)
|
val height = MeasureSpec.getSize(heightMeasureSpec)
|
||||||
|
|
||||||
if (mRatioWidth == 0 || mRatioHeight == 0) {
|
if (mRatioWidth == 0 || mRatioHeight == 0) {
|
||||||
setMeasuredDimension(width, height)
|
setMeasuredDimension(width, height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user