From ce4c098e321a4d0c2ab814dc50cb37c605501991 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 10 Dec 2016 21:16:53 +0100 Subject: [PATCH] add a spinner for displaying images or videos only --- .../gallery/activities/SettingsActivity.kt | 15 ++++++++++ .../gallery/helpers/Config.kt | 4 +++ .../gallery/helpers/Constants.kt | 8 ++++- app/src/main/res/layout/activity_settings.xml | 29 +++++++++++++++++++ app/src/main/res/values-de/strings.xml | 4 +++ app/src/main/res/values-es/strings.xml | 4 +++ app/src/main/res/values-it/strings.xml | 4 +++ app/src/main/res/values-ja/strings.xml | 4 +++ app/src/main/res/values-pt-rPT/strings.xml | 4 +++ app/src/main/res/values-ru/strings.xml | 4 +++ app/src/main/res/values-sv/strings.xml | 4 +++ app/src/main/res/values-v23/styles.xml | 5 ++++ app/src/main/res/values-zh/strings.xml | 4 +++ app/src/main/res/values/array.xml | 8 +++++ app/src/main/res/values/strings.xml | 4 +++ app/src/main/res/values/styles.xml | 20 +++++++++++++ 16 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/values-v23/styles.xml create mode 100644 app/src/main/res/values/array.xml 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 a6859ba2b..b5a23356b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -2,6 +2,8 @@ package com.simplemobiletools.gallery.activities import android.os.Bundle import android.support.v4.app.TaskStackBuilder +import android.view.View +import android.widget.AdapterView import com.simplemobiletools.gallery.R import kotlinx.android.synthetic.main.activity_settings.* @@ -14,6 +16,7 @@ class SettingsActivity : SimpleActivity() { setupSameSorting() setupShowHiddenFolders() setupAutoplayVideos() + setupShowMedia() } private fun setupDarkTheme() { @@ -48,6 +51,18 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupShowMedia() { + settings_show_media.setSelection(mConfig.showMedia) + settings_show_media.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { + override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { + mConfig.showMedia = settings_show_media.selectedItemPosition + } + + override fun onNothingSelected(parent: AdapterView<*>?) { + } + } + } + private fun restartActivity() { TaskStackBuilder.create(applicationContext).addNextIntentWithParentStack(intent).startActivities() } 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 cd9627cc2..452408ea9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -96,4 +96,8 @@ class Config private constructor(context: Context) { var displayFileNames: Boolean get() = mPrefs.getBoolean(DISPLAY_FILE_NAMES, false) set(display) = mPrefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply() + + var showMedia: Int + get() = mPrefs.getInt(SHOW_MEDIA, IMAGES_AND_VIDEOS) + set(showMedia) = mPrefs.edit().putInt(SHOW_MEDIA, showMedia).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 a736fc33c..63b6b530f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -13,7 +13,8 @@ val AUTOPLAY_VIDEOS = "autoplay_videos" val TREE_URI = "tree_uri" val DISPLAY_FILE_NAMES = "display_file_names" val PINNED_FOLDERS = "pinned_folders" -val SHOW_ALL = "show_all" +val SHOW_ALL = "show_all" // display images and videos from all folders together +val SHOW_MEDIA = "show_media" // sorting val SORT_BY_NAME = 1 @@ -35,3 +36,8 @@ val SET_WALLPAPER_INTENT = "set_wallpaper_intent" val REQUEST_EDIT_IMAGE = 1 val REQUEST_SET_WALLPAPER = 2 + +// show media +val IMAGES_AND_VIDEOS = 0 +val IMAGES = 1 +val VIDEOS = 2 diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 26eb74bb6..c3a452360 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -122,5 +122,34 @@ android:clickable="false"/> + + + + + + + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index c4c145048..45326581c 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -130,6 +130,10 @@ Zeige versteckte Ordner Play videos automatically Toggle filename visibility + Show media + Images only + Videos only + Images and videos Diese App nutzt die folgenden Drittanbieterbilbiotheken, die mein Leben einfacher machen. Danke. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index fbe42c830..ad4547af3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -130,6 +130,10 @@ Mostrar carpetas ocultas Reproducir vídeos automáticamente Toggle filename visibility + Show media + Images only + Videos only + Images and videos Esta aplicación usa las siguientes bibliotecas de terceros que hacen mi vida más fácil. Gracias. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 4d740f0c9..efe7d1ce3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -130,6 +130,10 @@ Mostra cartelle nascoste Riproduci video automaticamente Visibilità nome del file + Show media + Images only + Videos only + Images and videos Questa app usa le seguenti librerie di terze parti per semplificarmi la vita. Grazie. diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index cb61b0b50..2cb25773c 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -130,6 +130,10 @@ 非表示フォルダーを表示 自動的にビデオを再生 ファイル名の表示を切り替え + Show media + Images only + Videos only + Images and videos このアプリは、私の暮らしにゆとりを持たせるために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。 diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index c6b53c987..668e7cbda 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -130,6 +130,10 @@ Mostrar pastas ocultas Reproduzir vídeos automaticamente Mostrar/ocultar nome do ficheiro + Show media + Images only + Videos only + Images and videos Esta aplicação usa as seguintes bibliotecas de terceiros para facilitar a minha vida. Obrigado. diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index a0f1e3e63..90f2fbd33 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -131,6 +131,10 @@ Показать скрытые папки Воспроизводить видео автоматически Переключить отображение имени файла + Show media + Images only + Videos only + Images and videos Это приложение использует следующие библиотеки сторонних разработчиков, чтобы облегчить мой труд. Спасибо. diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index f61e23e02..fdac25ed4 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -130,6 +130,10 @@ Show hidden folders Play videos automatically Toggle filename visibility + Show media + Images only + Videos only + Images and videos Denna app använder följande tredjepartsbibliotek för att göra mitt liv enklare. Tack. diff --git a/app/src/main/res/values-v23/styles.xml b/app/src/main/res/values-v23/styles.xml new file mode 100644 index 000000000..c7edc2551 --- /dev/null +++ b/app/src/main/res/values-v23/styles.xml @@ -0,0 +1,5 @@ + + + + + + + +