Skip to content

Commit

Permalink
Merge pull request #1203 from Infomaniak/fix-gallery-landscape
Browse files Browse the repository at this point in the history
Compute screen width and height according to the app size and not the device
  • Loading branch information
KevinBoulongne authored Feb 21, 2024
2 parents a90780c + 1149539 commit 72daa8b
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions app/src/main/java/com/infomaniak/drive/utils/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.provider.MediaStore
import android.text.format.Formatter
import android.util.DisplayMetrics
import android.util.Patterns
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -167,17 +166,8 @@ fun ImageView.animateRotation(isDeployed: Boolean = false) {
* Return the screen size in DPs
*/
fun Activity.getScreenSizeInDp(): Point {
val displayMetrics = DisplayMetrics()
if (VERSION.SDK_INT >= VERSION_CODES.R) {
display?.apply {
getRealMetrics(displayMetrics)
}
} else {
windowManager.defaultDisplay.getMetrics(displayMetrics)
}

val point = Point()
displayMetrics.apply {
application.resources.displayMetrics.apply {
point.x = (widthPixels / density).roundToInt()
point.y = (heightPixels / density).roundToInt()
}
Expand Down

0 comments on commit 72daa8b

Please sign in to comment.