diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 26cea909e..8a082817f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -808,7 +808,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener if (newPath.isEmpty()) { val filename = applicationContext.getFilenameFromContentUri(saveUri) ?: "" if (filename.isNotEmpty()) { - val path = if (intent.extras?.containsKey(REAL_FILE_PATH) == true) intent.getStringExtra(REAL_FILE_PATH).getParentPath() else internalStoragePath + val path = if (intent.extras?.containsKey(REAL_FILE_PATH) == true) intent.getStringExtra(REAL_FILE_PATH)?.getParentPath() else internalStoragePath newPath = "$path/$filename" shouldAppendFilename = false } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 731ac3e6d..48395d4f0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -97,7 +97,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { media_refresh_layout.setOnRefreshListener { getMedia() } try { - mPath = intent.getStringExtra(DIRECTORY) + mPath = intent.getStringExtra(DIRECTORY) ?: "" } catch (e: Exception) { showErrorToast(e) finish() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt index 6824b7038..66abce29d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt @@ -20,13 +20,15 @@ import com.simplemobiletools.gallery.pro.extensions.updateDirectoryPath open class SimpleActivity : BaseSimpleActivity() { val observer = object : ContentObserver(null) { - override fun onChange(selfChange: Boolean, uri: Uri) { + override fun onChange(selfChange: Boolean, uri: Uri?) { super.onChange(selfChange, uri) - val path = getRealPathFromURI(uri) - if (path != null) { - updateDirectoryPath(path.getParentPath()) - addPathToDB(path) - } + if (uri != null) { + val path = getRealPathFromURI(uri) + if (path != null) { + updateDirectoryPath(path.getParentPath()) + addPathToDB(path) + } + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index b1c319a1e..879f5bd4f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -618,16 +618,16 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen mIsDragged = false } - override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) { + override fun onSurfaceTextureUpdated(surface: SurfaceTexture) { } - override fun onSurfaceTextureDestroyed(surface: SurfaceTexture?) = false + override fun onSurfaceTextureDestroyed(surface: SurfaceTexture) = false - override fun onSurfaceTextureAvailable(surface: SurfaceTexture?, width: Int, height: Int) { + override fun onSurfaceTextureAvailable(surface: SurfaceTexture, width: Int, height: Int) { ensureBackgroundThread { mExoPlayer?.setVideoSurface(Surface(video_surface!!.surfaceTexture)) } } - override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {} + override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture, width: Int, height: Int) {} } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 264133ecd..37fc55029 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -272,7 +272,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } else { try { - mPath = intent.getStringExtra(PATH) + mPath = intent.getStringExtra(PATH) ?: "" mShowAll = config.showAll } catch (e: Exception) { showErrorToast(e) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 35c1b8913..bf68ff8cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -759,13 +759,13 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } } - override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {} + override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture, width: Int, height: Int) {} - override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) {} + override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {} - override fun onSurfaceTextureDestroyed(surface: SurfaceTexture?) = false + override fun onSurfaceTextureDestroyed(surface: SurfaceTexture) = false - override fun onSurfaceTextureAvailable(surface: SurfaceTexture?, width: Int, height: Int) { + override fun onSurfaceTextureAvailable(surface: SurfaceTexture, width: Int, height: Int) { ensureBackgroundThread { mExoPlayer?.setVideoSurface(Surface(mTextureView.surfaceTexture)) }