Browse Source

Remove some deprecation warnings

video-rotation
Hardcore Sushi 12 months ago
parent
commit
4ede408aac
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
  1. 19
      app/src/main/java/sushi/hardcore/droidfs/file_viewers/FileViewerActivity.kt
  2. 3
      app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt
  3. 1
      app/src/main/java/sushi/hardcore/droidfs/file_viewers/MediaPlayer.kt

19
app/src/main/java/sushi/hardcore/droidfs/file_viewers/FileViewerActivity.kt

@ -1,7 +1,8 @@
package sushi.hardcore.droidfs.file_viewers
import android.os.Bundle
import android.view.View
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import sushi.hardcore.droidfs.BaseActivity
import sushi.hardcore.droidfs.ConstValues
import sushi.hardcore.droidfs.GocryptfsVolume
@ -15,6 +16,8 @@ abstract class FileViewerActivity: BaseActivity() {
protected lateinit var gocryptfsVolume: GocryptfsVolume
protected lateinit var filePath: String
private lateinit var originalParentPath: String
private lateinit var windowInsetsController: WindowInsetsControllerCompat
private var windowTypeMask = 0
private var isFinishingIntentionally = false
private var usf_keep_open = false
private var foldersFirst = true
@ -30,18 +33,16 @@ abstract class FileViewerActivity: BaseActivity() {
gocryptfsVolume = GocryptfsVolume(sessionID)
usf_keep_open = sharedPrefs.getBoolean("usf_keep_open", false)
foldersFirst = sharedPrefs.getBoolean("folders_first", true)
windowInsetsController = WindowInsetsControllerCompat(window, window.decorView)
windowInsetsController.addOnControllableInsetsChangedListener { _, typeMask ->
windowTypeMask = typeMask
}
hideSystemUi()
viewFile()
}
open fun hideSystemUi(){
window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_FULLSCREEN/* or
View.SYSTEM_UI_FLAG_LOW_PROFILE or
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION*/
windowInsetsController.hide(WindowInsetsCompat.Type.statusBars())
}
abstract fun getFileType(): String
@ -49,7 +50,7 @@ abstract class FileViewerActivity: BaseActivity() {
override fun onUserInteraction() {
super.onUserInteraction()
if (window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0){
if (windowTypeMask and WindowInsetsCompat.Type.statusBars() == 0) {
hideSystemUi()
}
}

3
app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt

@ -31,13 +31,13 @@ class ImageViewer: FileViewerActivity() {
}
private lateinit var fileName: String
private lateinit var handler: Handler
private lateinit var glideImage: RequestBuilder<Drawable>
private var x1 = 0F
private var x2 = 0F
private var slideshowActive = false
private var rotationAngle: Float = 0F
private var rotatedBitmap: Bitmap? = null
private val handler = Handler()
private val hideUI = Runnable {
binding.actionButtons.visibility = View.GONE
binding.actionBar.visibility = View.GONE
@ -57,6 +57,7 @@ class ImageViewer: FileViewerActivity() {
override fun viewFile() {
binding = ActivityImageViewerBinding.inflate(layoutInflater)
setContentView(binding.root)
handler = Handler(mainLooper)
binding.imageViewer.setOnInteractionListener(object : ZoomableImageView.OnInteractionListener {
override fun onSingleTap(event: MotionEvent?) {
handler.removeCallbacks(hideUI)

1
app/src/main/java/sushi/hardcore/droidfs/file_viewers/MediaPlayer.kt

@ -19,7 +19,6 @@ abstract class MediaPlayer: FileViewerActivity() {
private lateinit var player: SimpleExoPlayer
override fun viewFile() {
hideSystemUi()
initializePlayer()
}

Loading…
Cancel
Save