From 7f3b02a765ae8ffc683261c9740a005e6bbf94b9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 10 Feb 2017 23:44:10 +0100 Subject: [PATCH] added menu options for changing the column counts --- .../gallery/activities/MainActivity.kt | 19 +++++++++++++++++-- app/src/main/res/menu/menu_main.xml | 8 ++++++++ app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-es/strings.xml | 2 ++ app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values-it/strings.xml | 2 ++ app/src/main/res/values-ja/strings.xml | 2 ++ app/src/main/res/values-pt-rPT/strings.xml | 2 ++ app/src/main/res/values-ru/strings.xml | 2 ++ app/src/main/res/values-sk/strings.xml | 2 ++ app/src/main/res/values-sv/strings.xml | 2 ++ app/src/main/res/values-zh-rCN/strings.xml | 2 ++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 14 files changed, 49 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 771328743..c52cf7f6e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -70,6 +70,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { return false menuInflater.inflate(R.menu.menu_main, menu) + + menu.findItem(R.id.increase_column_count).isVisible = config.dirColumnCnt < 10 + menu.findItem(R.id.reduce_column_count).isVisible = config.dirColumnCnt > 1 return true } @@ -78,6 +81,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { R.id.sort -> showSortingDialog() R.id.open_camera -> launchCamera() R.id.show_all -> showAllMedia() + R.id.increase_column_count -> increaseColumnCount() + R.id.reduce_column_count -> reduceColumnCount() R.id.settings -> launchSettings() R.id.about -> launchAbout() else -> return super.onOptionsItemSelected(item) @@ -216,20 +221,30 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.ZoomListener { override fun zoomIn() { if (layoutManager.spanCount > 1) { - config.dirColumnCnt = --layoutManager.spanCount + reduceColumnCount() DirectoryAdapter.actMode?.finish() } } override fun zoomOut() { if (layoutManager.spanCount < 10) { - config.dirColumnCnt = ++layoutManager.spanCount + increaseColumnCount() DirectoryAdapter.actMode?.finish() } } } } + private fun increaseColumnCount() { + config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount + invalidateOptionsMenu() + } + + private fun reduceColumnCount() { + config.dirColumnCnt = --(directories_grid.layoutManager as GridLayoutManager).spanCount + invalidateOptionsMenu() + } + private fun isPickImageIntent(intent: Intent) = isPickIntent(intent) && (hasImageContentData(intent) || isImageType(intent)) private fun isPickVideoIntent(intent: Intent) = isPickIntent(intent) && (hasVideoContentData(intent) || isVideoType(intent)) diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 457ca6d8f..923659e73 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -15,6 +15,14 @@ android:id="@+id/show_all" android:title="@string/show_all" app:showAsAction="never"/> + + Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count Größe ändern diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 4e16fd6df..d4e6def5d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -23,6 +23,8 @@ Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count Resize diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index a479962b5..613f28cbc 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -23,6 +23,8 @@ Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count Redimensionner diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 64e5858c1..f8a9c118b 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -23,6 +23,8 @@ Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count Resize diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index f494df5f7..7b3473350 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -23,6 +23,8 @@ Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count Resize diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index be79e8f43..471590734 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -23,6 +23,8 @@ Localização desconhecida Não existe uma aplicação adequada No Camera app has been found + Increase column count + Reduce column count Redimensionar diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 30dd75d8e..7d1a88336 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -23,6 +23,8 @@ Место съёмки не указано Не найдено приложений с картами No Camera app has been found + Increase column count + Reduce column count Изменить размер diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 44ce64561..c487704ec 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -23,6 +23,8 @@ Neznáma poloha Nenašla sa žiadna mapová aplikácia Nenašla sa žiadna aplikácia pre fotoaparát + Zvýšiť počet stĺpcov + Znížiť počet stĺpcov Zmeniť veľkosť diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 862d080d6..7d7e988e0 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -46,6 +46,8 @@ Filnamnet innehåller ogiltiga tecken Filändelse Filändelsen får inte vara tom + Increase column count + Reduce column count Redigera diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0b2975704..64fca53f4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -23,6 +23,8 @@ Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count 缩放 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index b4cf0a7ff..22c92cb09 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -23,6 +23,8 @@ Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count 縮放 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f168bb0b1..ec36b1726 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -23,6 +23,8 @@ Unknown location No application with maps has been found No Camera app has been found + Increase column count + Reduce column count Resize