mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-27 22:22:17 +03:00
Take care of deprecation
This commit is contained in:
parent
d33bfdf28e
commit
755c83a6cb
@ -10,6 +10,7 @@ package org.moire.ultrasonic.fragment
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.graphics.Point
|
import android.graphics.Point
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
@ -209,12 +210,23 @@ class PlayerFragment :
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
cancellationToken = CancellationToken()
|
cancellationToken = CancellationToken()
|
||||||
setTitle(this, R.string.common_appname)
|
setTitle(this, R.string.common_appname)
|
||||||
|
|
||||||
val windowManager = requireActivity().windowManager
|
val windowManager = requireActivity().windowManager
|
||||||
|
val width: Int
|
||||||
|
val height: Int
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
val bounds = windowManager.currentWindowMetrics.bounds
|
||||||
|
width = bounds.width()
|
||||||
|
height = bounds.height()
|
||||||
|
} else {
|
||||||
val display = windowManager.defaultDisplay
|
val display = windowManager.defaultDisplay
|
||||||
val size = Point()
|
val size = Point()
|
||||||
display.getSize(size)
|
display.getSize(size)
|
||||||
val width = size.x
|
width = size.x
|
||||||
val height = size.y
|
height = size.y
|
||||||
|
}
|
||||||
|
|
||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
useFiveStarRating = Settings.useFiveStarRating
|
useFiveStarRating = Settings.useFiveStarRating
|
||||||
swipeDistance = (width + height) * PERCENTAGE_OF_SCREEN_FOR_SWIPE / 100
|
swipeDistance = (width + height) * PERCENTAGE_OF_SCREEN_FOR_SWIPE / 100
|
||||||
|
Loading…
x
Reference in New Issue
Block a user