From 9ea9c772945687decc35b68ecc3086fd49dff686 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 9 Jul 2017 20:34:14 +0200 Subject: [PATCH] add a toggle for replacing Share with Rotate at fullscreen media --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/activities/ViewPagerActivity.kt | 4 ++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 22 files changed, 55 insertions(+) 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 8b12f419a..02cf907aa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -35,6 +35,7 @@ class SettingsActivity : SimpleActivity() { setupDarkBackground() setupScrollHorizontally() setupScreenRotation() + setupReplaceShare() setupShowMedia() setupHideSystemUI() updateTextColors(settings_holder) @@ -130,6 +131,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupReplaceShare() { + settings_replace_share.isChecked = config.replaceShare + settings_replace_share_holder.setOnClickListener { + settings_replace_share.toggle() + config.replaceShare = settings_replace_share.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { 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 72d5314af..cee4d7d42 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -179,6 +179,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } else if (config.screenRotation == ROTATE_BY_SYSTEM_SETTING) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED } + + invalidateOptionsMenu() } override fun onPause() { @@ -191,6 +193,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val currentMedium = getCurrentMedium() ?: return true menu.apply { + findItem(R.id.menu_share_1).isVisible = !config.replaceShare + findItem(R.id.menu_share_2).isVisible = config.replaceShare findItem(R.id.menu_set_as).isVisible = currentMedium.isImage() findItem(R.id.menu_edit).isVisible = currentMedium.isImage() findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() 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 18ab38067..b221d32da 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -228,4 +228,8 @@ class Config(context: Context) : BaseConfig(context) { var hideSystemUI: Boolean get() = prefs.getBoolean(HIDE_SYSTEM_UI, false) set(hideSystemUI) = prefs.edit().putBoolean(HIDE_SYSTEM_UI, hideSystemUI).apply() + + var replaceShare: Boolean + get() = prefs.getBoolean(REPLACE_SHARE_WITH_ROTATE, false) + set(replaceShare) = prefs.edit().putBoolean(REPLACE_SHARE_WITH_ROTATE, replaceShare).apply() } 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 d5fe939b0..30af458a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -32,6 +32,7 @@ val INCLUDED_FOLDERS = "included_folders" val ALBUM_COVERS = "album_covers" val SCROLL_HORIZONTALLY = "scroll_horizontally" val HIDE_SYSTEM_UI = "hide_system_ui" +val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" val NOMEDIA = ".nomedia" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index a71c63bf1..78e405aad 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -248,6 +248,26 @@ + + + + + + Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d1a6eeb5c..b2d21fe1a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -100,6 +100,7 @@ Schwarzer Hintergrund im Vollbild Kacheln horizontal scrollen Systemleisten ausblenden im Vollbild + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 739405284..6c54cc0b1 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -100,6 +100,7 @@ Utilizar siempre fondo oscuro en pantalla completa Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e69143f01..2622e160c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 6c149d411..e8e38ae06 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 9b9e85ac3..65de520a9 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -100,6 +100,7 @@ Sfondo scuro a schermo intero Scorri miniature orizzontalmente Nascondi UI di sistema con media a schermo intero + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 5306f014b..e4acc7a77 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 2667378be..6713484f2 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 91f6d6d79..d99f0285d 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -100,6 +100,7 @@ Fundo de tela escuro em mídia tela cheia Rolar miniaturas horizontalmente Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index dd3e9ccf7..38b62fd22 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -100,6 +100,7 @@ Usar sempre um fundo escuro se em ecrã completo Deslocação horizontal de miniaturas Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index acd50705f..deba93f66 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f8e13c2a0..a3f5716c3 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -100,6 +100,7 @@ Tmavé pozadie pri médiách na celú obrazovku Prehliadať miniatúry vodorovne Automaticky skrývať systémové lišty pri celoobrazovkových médiách + Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index a1ab856cd..c99df493f 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -100,6 +100,7 @@ Mörk bakgrund när media visas i helskärmsläge Rulla horisontellt genom miniatyrer Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f977c3114..667357ad5 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index fdc51b475..b9badef76 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -100,6 +100,7 @@ 全屏时黑色背景 水平滚动缩略图 Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index a510c5181..4cba28d07 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 209bcfbe9..5fb46bcb5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -100,6 +100,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu