Merge pull request #2073 from fgndev/master

Several fixes to make code work with platform 30
This commit is contained in:
Tibor Kaputa 2021-02-18 18:25:15 +01:00 committed by GitHub
commit 1b754d68b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 17 deletions

View file

@ -808,7 +808,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
if (newPath.isEmpty()) { if (newPath.isEmpty()) {
val filename = applicationContext.getFilenameFromContentUri(saveUri) ?: "" val filename = applicationContext.getFilenameFromContentUri(saveUri) ?: ""
if (filename.isNotEmpty()) { 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" newPath = "$path/$filename"
shouldAppendFilename = false shouldAppendFilename = false
} }

View file

@ -97,7 +97,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
media_refresh_layout.setOnRefreshListener { getMedia() } media_refresh_layout.setOnRefreshListener { getMedia() }
try { try {
mPath = intent.getStringExtra(DIRECTORY) mPath = intent.getStringExtra(DIRECTORY) ?: ""
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
finish() finish()

View file

@ -20,8 +20,9 @@ import com.simplemobiletools.gallery.pro.extensions.updateDirectoryPath
open class SimpleActivity : BaseSimpleActivity() { open class SimpleActivity : BaseSimpleActivity() {
val observer = object : ContentObserver(null) { val observer = object : ContentObserver(null) {
override fun onChange(selfChange: Boolean, uri: Uri) { override fun onChange(selfChange: Boolean, uri: Uri?) {
super.onChange(selfChange, uri) super.onChange(selfChange, uri)
if (uri != null) {
val path = getRealPathFromURI(uri) val path = getRealPathFromURI(uri)
if (path != null) { if (path != null) {
updateDirectoryPath(path.getParentPath()) updateDirectoryPath(path.getParentPath())
@ -29,6 +30,7 @@ open class SimpleActivity : BaseSimpleActivity() {
} }
} }
} }
}
override fun getAppIconIDs() = arrayListOf( override fun getAppIconIDs() = arrayListOf(
R.mipmap.ic_launcher_red, R.mipmap.ic_launcher_red,

View file

@ -618,16 +618,16 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
mIsDragged = false 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 { ensureBackgroundThread {
mExoPlayer?.setVideoSurface(Surface(video_surface!!.surfaceTexture)) mExoPlayer?.setVideoSurface(Surface(video_surface!!.surfaceTexture))
} }
} }
override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {} override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture, width: Int, height: Int) {}
} }

View file

@ -272,7 +272,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
} else { } else {
try { try {
mPath = intent.getStringExtra(PATH) mPath = intent.getStringExtra(PATH) ?: ""
mShowAll = config.showAll mShowAll = config.showAll
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)

View file

@ -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 { ensureBackgroundThread {
mExoPlayer?.setVideoSurface(Surface(mTextureView.surfaceTexture)) mExoPlayer?.setVideoSurface(Surface(mTextureView.surfaceTexture))
} }