add a setting for always using dark background at fullscreen media

This commit is contained in:
tibbi 2017-05-14 11:50:30 +02:00
parent 7aa7b6e2da
commit a780d36a6e
19 changed files with 49 additions and 15 deletions

View file

@ -32,6 +32,7 @@ class SettingsActivity : SimpleActivity() {
setupAnimateGifs() setupAnimateGifs()
setupMaxBrightness() setupMaxBrightness()
setupCropThumbnails() setupCropThumbnails()
setupDarkBackground()
setupScreenRotation() setupScreenRotation()
setupShowMedia() setupShowMedia()
updateTextColors(settings_holder) updateTextColors(settings_holder)
@ -103,6 +104,14 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupDarkBackground() {
settings_dark_background.isChecked = config.darkBackground
settings_dark_background_holder.setOnClickListener {
settings_dark_background.toggle()
config.darkBackground = settings_dark_background.isChecked
}
}
private fun setupScreenRotation() { private fun setupScreenRotation() {
settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation.text = getScreenRotationText()
settings_screen_rotation_holder.setOnClickListener { settings_screen_rotation_holder.setOnClickListener {

View file

@ -148,6 +148,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false) get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false)
set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply() set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply()
var darkBackground: Boolean
get() = prefs.getBoolean(DARK_BACKGROUND, false)
set(darkBackground) = prefs.edit().putBoolean(DARK_BACKGROUND, darkBackground).apply()
var showMedia: Int var showMedia: Int
get() = prefs.getInt(SHOW_MEDIA, IMAGES_AND_VIDEOS) get() = prefs.getInt(SHOW_MEDIA, IMAGES_AND_VIDEOS)
set(showMedia) = prefs.edit().putInt(SHOW_MEDIA, showMedia).apply() set(showMedia) = prefs.edit().putInt(SHOW_MEDIA, showMedia).apply()

View file

@ -13,6 +13,7 @@ val MAX_BRIGHTNESS = "max_brightness"
val CROP_THUMBNAILS = "crop_thumbnails" val CROP_THUMBNAILS = "crop_thumbnails"
val SCREEN_ROTATION = "screen_rotation" val SCREEN_ROTATION = "screen_rotation"
val DISPLAY_FILE_NAMES = "display_file_names" val DISPLAY_FILE_NAMES = "display_file_names"
val DARK_BACKGROUND = "dark_background"
val PINNED_FOLDERS = "pinned_folders" val PINNED_FOLDERS = "pinned_folders"
val DIR_COLUMN_CNT = "dir_column_cnt" val DIR_COLUMN_CNT = "dir_column_cnt"
val MEDIA_COLUMN_CNT = "media_column_cnt" val MEDIA_COLUMN_CNT = "media_column_cnt"

View file

@ -188,6 +188,26 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_dark_background_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_dark_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/dark_background_at_fullscreen"/>
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_screen_rotation_holder" android:id="@+id/settings_screen_rotation_holder"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">Systemeinstellung</string> <string name="screen_rotation_system_setting">Systemeinstellung</string>
<string name="screen_rotation_device_rotation">Gerätedrehung</string> <string name="screen_rotation_device_rotation">Gerätedrehung</string>
<string name="screen_rotation_aspect_ratio">Seitenverhältnis</string> <string name="screen_rotation_aspect_ratio">Seitenverhältnis</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">Paramètres système</string> <string name="screen_rotation_system_setting">Paramètres système</string>
<string name="screen_rotation_device_rotation">Rotation de l\'appareil</string> <string name="screen_rotation_device_rotation">Rotation de l\'appareil</string>
<string name="screen_rotation_aspect_ratio">Ratio d\'aspect</string> <string name="screen_rotation_aspect_ratio">Ratio d\'aspect</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">Impostazione di sistema</string> <string name="screen_rotation_system_setting">Impostazione di sistema</string>
<string name="screen_rotation_device_rotation">Rotazione dispositivo</string> <string name="screen_rotation_device_rotation">Rotazione dispositivo</string>
<string name="screen_rotation_aspect_ratio">Proporzioni</string> <string name="screen_rotation_aspect_ratio">Proporzioni</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">Padrão do sistema</string> <string name="screen_rotation_system_setting">Padrão do sistema</string>
<string name="screen_rotation_device_rotation">Sensor do aparelho</string> <string name="screen_rotation_device_rotation">Sensor do aparelho</string>
<string name="screen_rotation_aspect_ratio">Proporção da mídia</string> <string name="screen_rotation_aspect_ratio">Proporção da mídia</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">Системные настройки</string> <string name="screen_rotation_system_setting">Системные настройки</string>
<string name="screen_rotation_device_rotation">Поворот устройства</string> <string name="screen_rotation_device_rotation">Поворот устройства</string>
<string name="screen_rotation_aspect_ratio">Соотношение сторон</string> <string name="screen_rotation_aspect_ratio">Соотношение сторон</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">Systémového nastavenia</string> <string name="screen_rotation_system_setting">Systémového nastavenia</string>
<string name="screen_rotation_device_rotation">Otočenia zariadenia</string> <string name="screen_rotation_device_rotation">Otočenia zariadenia</string>
<string name="screen_rotation_aspect_ratio">Pomeru strán</string> <string name="screen_rotation_aspect_ratio">Pomeru strán</string>
<string name="dark_background_at_fullscreen">Stále použiť tmavé pozadie pri médiách na celú obrazovku</string> <string name="dark_background_at_fullscreen">Tmavé pozadie pri médiách na celú obrazovku</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">Sistem ayarı</string> <string name="screen_rotation_system_setting">Sistem ayarı</string>
<string name="screen_rotation_device_rotation">Cihaz döndürme</string> <string name="screen_rotation_device_rotation">Cihaz döndürme</string>
<string name="screen_rotation_aspect_ratio">En-boy oranı</string> <string name="screen_rotation_aspect_ratio">En-boy oranı</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->

View file

@ -92,7 +92,7 @@
<string name="screen_rotation_system_setting">System setting</string> <string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string> <string name="screen_rotation_device_rotation">Device rotation</string>
<string name="screen_rotation_aspect_ratio">Aspect ratio</string> <string name="screen_rotation_aspect_ratio">Aspect ratio</string>
<string name="dark_background_at_fullscreen">Always use dark background at fullscreen media</string> <string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars --> <!-- Short description has to have less than 80 chars -->