add a spinner for displaying images or videos only

This commit is contained in:
tibbi 2016-12-10 21:16:53 +01:00
parent 9ca372818c
commit ce4c098e32
16 changed files with 124 additions and 1 deletions

View file

@ -2,6 +2,8 @@ package com.simplemobiletools.gallery.activities
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.TaskStackBuilder import android.support.v4.app.TaskStackBuilder
import android.view.View
import android.widget.AdapterView
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
@ -14,6 +16,7 @@ class SettingsActivity : SimpleActivity() {
setupSameSorting() setupSameSorting()
setupShowHiddenFolders() setupShowHiddenFolders()
setupAutoplayVideos() setupAutoplayVideos()
setupShowMedia()
} }
private fun setupDarkTheme() { 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() { private fun restartActivity() {
TaskStackBuilder.create(applicationContext).addNextIntentWithParentStack(intent).startActivities() TaskStackBuilder.create(applicationContext).addNextIntentWithParentStack(intent).startActivities()
} }

View file

@ -96,4 +96,8 @@ class Config private constructor(context: Context) {
var displayFileNames: Boolean var displayFileNames: Boolean
get() = mPrefs.getBoolean(DISPLAY_FILE_NAMES, false) get() = mPrefs.getBoolean(DISPLAY_FILE_NAMES, false)
set(display) = mPrefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply() 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()
} }

View file

@ -13,7 +13,8 @@ val AUTOPLAY_VIDEOS = "autoplay_videos"
val TREE_URI = "tree_uri" val TREE_URI = "tree_uri"
val DISPLAY_FILE_NAMES = "display_file_names" val DISPLAY_FILE_NAMES = "display_file_names"
val PINNED_FOLDERS = "pinned_folders" 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 // sorting
val SORT_BY_NAME = 1 val SORT_BY_NAME = 1
@ -35,3 +36,8 @@ val SET_WALLPAPER_INTENT = "set_wallpaper_intent"
val REQUEST_EDIT_IMAGE = 1 val REQUEST_EDIT_IMAGE = 1
val REQUEST_SET_WALLPAPER = 2 val REQUEST_SET_WALLPAPER = 2
// show media
val IMAGES_AND_VIDEOS = 0
val IMAGES = 1
val VIDEOS = 2

View file

@ -122,5 +122,34 @@
android:clickable="false"/> android:clickable="false"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_media_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_padding"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/settings_padding"
android:paddingTop="@dimen/activity_margin">
<TextView
android:id="@+id/settings_show_media_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/settings_padding"
android:paddingStart="@dimen/settings_padding"
android:text="@string/show_media"/>
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/settings_show_media"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:entries="@array/show_media_items"/>
</RelativeLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -130,6 +130,10 @@
<string name="show_hidden_folders">Zeige versteckte Ordner</string> <string name="show_hidden_folders">Zeige versteckte Ordner</string>
<string name="autoplay_videos">Play videos automatically</string> <string name="autoplay_videos">Play videos automatically</string>
<string name="toggle_filename">Toggle filename visibility</string> <string name="toggle_filename">Toggle filename visibility</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">Diese App nutzt die folgenden Drittanbieterbilbiotheken, die mein Leben einfacher machen. Danke.</string> <string name="notice">Diese App nutzt die folgenden Drittanbieterbilbiotheken, die mein Leben einfacher machen. Danke.</string>

View file

@ -130,6 +130,10 @@
<string name="show_hidden_folders">Mostrar carpetas ocultas</string> <string name="show_hidden_folders">Mostrar carpetas ocultas</string>
<string name="autoplay_videos">Reproducir vídeos automáticamente</string> <string name="autoplay_videos">Reproducir vídeos automáticamente</string>
<string name="toggle_filename">Toggle filename visibility</string> <string name="toggle_filename">Toggle filename visibility</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">Esta aplicación usa las siguientes bibliotecas de terceros que hacen mi vida más fácil. Gracias.</string> <string name="notice">Esta aplicación usa las siguientes bibliotecas de terceros que hacen mi vida más fácil. Gracias.</string>

View file

@ -130,6 +130,10 @@
<string name="show_hidden_folders">Mostra cartelle nascoste</string> <string name="show_hidden_folders">Mostra cartelle nascoste</string>
<string name="autoplay_videos">Riproduci video automaticamente</string> <string name="autoplay_videos">Riproduci video automaticamente</string>
<string name="toggle_filename">Visibilità nome del file</string> <string name="toggle_filename">Visibilità nome del file</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">Questa app usa le seguenti librerie di terze parti per semplificarmi la vita. Grazie.</string> <string name="notice">Questa app usa le seguenti librerie di terze parti per semplificarmi la vita. Grazie.</string>

View file

@ -130,6 +130,10 @@
<string name="show_hidden_folders">非表示フォルダーを表示</string> <string name="show_hidden_folders">非表示フォルダーを表示</string>
<string name="autoplay_videos">自動的にビデオを再生</string> <string name="autoplay_videos">自動的にビデオを再生</string>
<string name="toggle_filename">ファイル名の表示を切り替え</string> <string name="toggle_filename">ファイル名の表示を切り替え</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">このアプリは、私の暮らしにゆとりを持たせるために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。</string> <string name="notice">このアプリは、私の暮らしにゆとりを持たせるために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。</string>

View file

@ -130,6 +130,10 @@
<string name="show_hidden_folders">Mostrar pastas ocultas</string> <string name="show_hidden_folders">Mostrar pastas ocultas</string>
<string name="autoplay_videos">Reproduzir vídeos automaticamente</string> <string name="autoplay_videos">Reproduzir vídeos automaticamente</string>
<string name="toggle_filename">Mostrar/ocultar nome do ficheiro</string> <string name="toggle_filename">Mostrar/ocultar nome do ficheiro</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">Esta aplicação usa as seguintes bibliotecas de terceiros para facilitar a minha vida. Obrigado.</string> <string name="notice">Esta aplicação usa as seguintes bibliotecas de terceiros para facilitar a minha vida. Obrigado.</string>

View file

@ -131,6 +131,10 @@
<string name="show_hidden_folders">Показать скрытые папки</string> <string name="show_hidden_folders">Показать скрытые папки</string>
<string name="autoplay_videos">Воспроизводить видео автоматически</string> <string name="autoplay_videos">Воспроизводить видео автоматически</string>
<string name="toggle_filename">Переключить отображение имени файла</string> <string name="toggle_filename">Переключить отображение имени файла</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">Это приложение использует следующие библиотеки сторонних разработчиков, чтобы облегчить мой труд. Спасибо.</string> <string name="notice">Это приложение использует следующие библиотеки сторонних разработчиков, чтобы облегчить мой труд. Спасибо.</string>

View file

@ -130,6 +130,10 @@
<string name="show_hidden_folders">Show hidden folders</string> <string name="show_hidden_folders">Show hidden folders</string>
<string name="autoplay_videos">Play videos automatically</string> <string name="autoplay_videos">Play videos automatically</string>
<string name="toggle_filename">Toggle filename visibility</string> <string name="toggle_filename">Toggle filename visibility</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">Denna app använder följande tredjepartsbibliotek för att göra mitt liv enklare. Tack.</string> <string name="notice">Denna app använder följande tredjepartsbibliotek för att göra mitt liv enklare. Tack.</string>

View file

@ -0,0 +1,5 @@
<resources>
<style name="SpinnerItem" parent="@android:style/Widget.TextView"/>
</resources>

View file

@ -131,6 +131,10 @@
<string name="show_hidden_folders">显示所有</string> <string name="show_hidden_folders">显示所有</string>
<string name="autoplay_videos">自动播放</string> <string name="autoplay_videos">自动播放</string>
<string name="toggle_filename">显示文件名</string> <string name="toggle_filename">显示文件名</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string> <string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="show_media_items" translatable="false">
<item>@string/images_and_videos</item>
<item>@string/images</item>
<item>@string/videos</item>
</string-array>
</resources>

View file

@ -131,6 +131,10 @@
<string name="show_hidden_folders">Show hidden folders</string> <string name="show_hidden_folders">Show hidden folders</string>
<string name="autoplay_videos">Play videos automatically</string> <string name="autoplay_videos">Play videos automatically</string>
<string name="toggle_filename">Toggle filename visibility</string> <string name="toggle_filename">Toggle filename visibility</string>
<string name="show_media">Show media</string>
<string name="images">Images only</string>
<string name="videos">Videos only</string>
<string name="images_and_videos">Images and videos</string>
<!-- License --> <!-- License -->
<string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string> <string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string>

View file

@ -6,6 +6,9 @@
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item> <item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item>
<item name="android:textSize">@dimen/normal_text_size</item> <item name="android:textSize">@dimen/normal_text_size</item>
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
</style> </style>
<style name="AppTheme.Dark" parent="Theme.AppCompat"> <style name="AppTheme.Dark" parent="Theme.AppCompat">
@ -15,6 +18,9 @@
<item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item> <item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item>
<item name="android:textSize">@dimen/normal_text_size</item> <item name="android:textSize">@dimen/normal_text_size</item>
<item name="android:windowBackground">@android:color/black</item> <item name="android:windowBackground">@android:color/black</item>
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
</style> </style>
<style name="FullScreenTheme.Base" parent="AppTheme"> <style name="FullScreenTheme.Base" parent="AppTheme">
@ -50,4 +56,18 @@
<item name="android:textSize">20sp</item> <item name="android:textSize">20sp</item>
</style> </style>
<style name="SpinnerItem" parent="@android:style/Widget.TextView">
<item name="android:paddingRight">@dimen/activity_margin</item>
<item name="android:gravity">end</item>
</style>
<style name="SpinnerItem.DropDownItem" parent="@android:style/Widget.TextView">
<item name="android:gravity">center_vertical</item>
<item name="android:paddingTop">@dimen/settings_padding</item>
<item name="android:paddingBottom">@dimen/settings_padding</item>
<item name="android:paddingLeft">@dimen/activity_margin</item>
<item name="android:paddingRight">@dimen/activity_margin</item>
</style>
</resources> </resources>