use a different function for getting screen size on kitkat

This commit is contained in:
tibbi 2017-05-29 21:00:23 +02:00
parent ec22c274dd
commit 28a2f59514
1 changed files with 9 additions and 3 deletions

View File

@ -402,9 +402,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun measureScreen() {
val metrics = DisplayMetrics()
windowManager.defaultDisplay.getRealMetrics(metrics)
screenWidth = metrics.widthPixels
screenHeight = metrics.heightPixels
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
windowManager.defaultDisplay.getRealMetrics(metrics)
screenWidth = metrics.widthPixels
screenHeight = metrics.heightPixels
} else {
windowManager.defaultDisplay.getMetrics(metrics)
screenWidth = metrics.widthPixels
screenHeight = metrics.heightPixels
}
}
private fun reloadViewPager() {