From 3cae9361d6a5589de81c7ff0136f5013db96261a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 1 Apr 2017 21:55:33 +0200 Subject: [PATCH] implement screen rotation by aspect ratio --- .../gallery/activities/ViewPagerActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 8af9c5799..38ab79d3f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.activities import android.app.Activity import android.content.Intent +import android.content.pm.ActivityInfo import android.content.res.Configuration import android.database.Cursor import android.graphics.Bitmap @@ -31,6 +32,7 @@ import com.simplemobiletools.gallery.fragments.ViewPagerFragment import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER +import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.activity_medium.* import java.io.File @@ -402,14 +404,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun checkOrientation() { - /*if (config.screenRotation) { + if (config.screenRotation == ROTATE_BY_ASPECT_RATIO) { val res = getCurrentFile().getResolution() if (res.x > res.y) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE } else if (res.x < res.y) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT } - }*/ + } } override fun fragmentClicked() {