diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 82cc82658..76666d9b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -8,9 +8,7 @@ import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.helpers.IMAGES -import com.simplemobiletools.gallery.helpers.IMAGES_AND_VIDEOS -import com.simplemobiletools.gallery.helpers.VIDEOS +import com.simplemobiletools.gallery.helpers.* import kotlinx.android.synthetic.main.activity_settings.* class SettingsActivity : SimpleActivity() { @@ -34,7 +32,7 @@ class SettingsActivity : SimpleActivity() { setupAnimateGifs() setupMaxBrightness() setupCropThumbnails() - setupAutoRotateScreen() + setupScreenRotation() setupShowMedia() updateTextColors(settings_holder) } @@ -105,14 +103,27 @@ class SettingsActivity : SimpleActivity() { } } - private fun setupAutoRotateScreen() { - settings_auto_rotate_screen.isChecked = config.autoRotateScreen - settings_auto_rotate_screen_holder.setOnClickListener { - settings_auto_rotate_screen.toggle() - config.autoRotateScreen = settings_auto_rotate_screen.isChecked + private fun setupScreenRotation() { + settings_screen_rotation.text = getScreenRotationText() + settings_screen_rotation_holder.setOnClickListener { + val items = arrayListOf( + RadioItem(ROTATE_BY_SYSTEM_SETTING, res.getString(R.string.screen_rotation_system_setting)), + RadioItem(ROTATE_BY_DEVICE_ROTATION, res.getString(R.string.screen_rotation_device_rotation)), + RadioItem(ROTATE_BY_ASPECT_RATIO, res.getString(R.string.screen_rotation_aspect_ratio))) + + RadioGroupDialog(this@SettingsActivity, items, config.screenRotation) { + config.screenRotation = it as Int + settings_screen_rotation.text = getScreenRotationText() + } } } + private fun getScreenRotationText() = getString(when (config.screenRotation) { + ROTATE_BY_SYSTEM_SETTING -> R.string.screen_rotation_system_setting + ROTATE_BY_DEVICE_ROTATION -> R.string.screen_rotation_device_rotation + else -> R.string.screen_rotation_aspect_ratio + }) + private fun setupShowMedia() { settings_show_media.text = getShowMediaText() settings_show_media_holder.setOnClickListener { @@ -133,5 +144,4 @@ class SettingsActivity : SimpleActivity() { IMAGES -> R.string.images else -> R.string.videos }) - } 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 57767dcf5..8af9c5799 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -2,7 +2,6 @@ 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 @@ -403,14 +402,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun checkOrientation() { - if (config.autoRotateScreen) { + /*if (config.screenRotation) { 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() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 215f9dcc6..15fb9d960 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -136,9 +136,9 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(CROP_THUMBNAILS, true) set(cropThumbnails) = prefs.edit().putBoolean(CROP_THUMBNAILS, cropThumbnails).apply() - var autoRotateScreen: Boolean - get() = prefs.getBoolean(AUTO_ROTATE_SCREEN, false) - set(autoRotateScreen) = prefs.edit().putBoolean(AUTO_ROTATE_SCREEN, autoRotateScreen).apply() + var screenRotation: Int + get() = prefs.getInt(SCREEN_ROTATION, ROTATE_BY_SYSTEM_SETTING) + set(screenRotation) = prefs.edit().putInt(SCREEN_ROTATION, screenRotation).apply() var loopVideos: Boolean get() = prefs.getBoolean(LOOP_VIDEOS, false) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 4f61a9f62..3f06b615c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -11,7 +11,7 @@ val LOOP_VIDEOS = "loop_videos" val ANIMATE_GIFS = "animate_gifs" val MAX_BRIGHTNESS = "max_brightness" val CROP_THUMBNAILS = "crop_thumbnails" -val AUTO_ROTATE_SCREEN = "auto_rotate_screen" +val SCREEN_ROTATION = "screen_rotation" val DISPLAY_FILE_NAMES = "display_file_names" val PINNED_FOLDERS = "pinned_folders" val DIR_COLUMN_CNT = "dir_column_cnt" @@ -40,3 +40,8 @@ val REQUEST_SET_WALLPAPER = 2 val IMAGES_AND_VIDEOS = 0 val IMAGES = 1 val VIDEOS = 2 + +// rotations +val ROTATE_BY_SYSTEM_SETTING = 0 +val ROTATE_BY_DEVICE_ROTATION = 1 +val ROTATE_BY_ASPECT_RATIO = 2 diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 99b371696..97aad5b3d 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -189,22 +189,37 @@ + android:paddingBottom="@dimen/bigger_margin" + android:paddingLeft="@dimen/activity_margin" + android:paddingRight="@dimen/activity_margin" + android:paddingTop="@dimen/bigger_margin"> - + android:paddingRight="@dimen/medium_margin" + android:text="@string/screen_rotation_by"/> + + diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index c0f840763..35a525ab5 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -86,9 +86,12 @@ Obrázky i videa Přehrávat videa ve smyčce Animovat náhledy souborů GIF - Nastavit jas obrazovky na maximum při zobrazení médií + Nastavit jas obrazovky na max při zobrazení médií Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index e51263c22..0559dc67f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -86,9 +86,12 @@ Bilder und Videos Video Endlos-Schleife Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d0f0c09b0..2efabfb20 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -88,7 +88,10 @@ Animar las miniaturas de gifs Brillo máximo cuando se muestran los medios Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7c092c624..35f365460 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -86,9 +86,12 @@ Images et vidéos Tourner en boucle les vidéos Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 851987a61..0093fbf85 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -86,9 +86,12 @@ Images and videos Loop videos Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 82ed862e7..bc2a896fb 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -88,7 +88,10 @@ Animate gifs at thumbnails Maximum brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 0e8617e0c..85c13edbf 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -86,9 +86,12 @@ Images and videos Loop videos Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 1e13aaf14..7c12f1a3f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -86,9 +86,12 @@ Obrazy i wideo Pętla wideo Animowanie gify z miniaturkami - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f46ca7b74..29a9d80b2 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -88,7 +88,10 @@ Animação de gifs nas miniaturas    Brilho máximo ao visualizar midia Recortar miniaturas em quadrados -    Girar automaticamente quando em tela cheia + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 74a106f4b..83b6cee4a 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -88,7 +88,10 @@ Animação de gifs nas miniaturas Brilho máximo permitido Recortar miniaturas em quadrados - Rodar automaticamente se em ecrã completo + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 751b5542f..639298914 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -88,7 +88,10 @@ Анимировать эскизы gif-файлов Максимальная яркость при просмотре файлов Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index c4252b4ed..cdae6c973 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -88,7 +88,10 @@ Animovať gif súbory pri náhľade Maximálny jas pri prezeraní médií Orezať náhľady na štvorce - Automaticky otáčať obrazovku pri celoobrazovkovom zobrazení + Otáčať obrazovku podľa Rotate fullscreen media by + Systémového nastavenia + Otočenia zariadenia + Pomeru strán diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 15d5e57b9..6a92f31d7 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -86,9 +86,12 @@ Bilder och videos Återspela videos Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index bdf5da3bb..47c257050 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -88,7 +88,10 @@ Küçük resimlerde gif\'leri canlandırın Ortam görüntülerken azami parlaklık Küçük resimleri karelere kırp - Ekranı tam ekran görünümde otomatik döndür + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 76a644633..37e53ac54 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -86,9 +86,12 @@ 图像和视频 循环播放视频 Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8e4aec047..d550429b6 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -86,9 +86,12 @@ 圖片和影片 迴圈播放影片 Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 08fbd1fdb..728e7aee7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -86,9 +86,12 @@ Images and videos Loop videos Animate gifs at thumbnails - Maximum brightness when viewing media + Max brightness when viewing media Crop thumbnails into squares - Auto-rotate screen at fullscreen view + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio