mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Stop using deprecated method.
This commit is contained in:
parent
3f3c83a43d
commit
24e4f94e61
1 changed files with 8 additions and 5 deletions
|
@ -82,15 +82,18 @@ class RoomUploadsMediaFragment :
|
|||
controller.listener = this
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun getNumberOfColumns(): Int {
|
||||
val displayMetrics = DisplayMetrics()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
requireContext().display?.getMetrics(displayMetrics)
|
||||
val screenWidthInPx = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
val a = requireActivity().windowManager.currentWindowMetrics
|
||||
a.bounds.width()
|
||||
} else {
|
||||
val displayMetrics = DisplayMetrics()
|
||||
@Suppress("DEPRECATION")
|
||||
requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||
displayMetrics.widthPixels
|
||||
}
|
||||
return dimensionConverter.pxToDp(displayMetrics.widthPixels) / IMAGE_SIZE_DP
|
||||
val screenWidthInDp = dimensionConverter.pxToDp(screenWidthInPx)
|
||||
return screenWidthInDp / IMAGE_SIZE_DP
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
|
Loading…
Reference in a new issue