Option for max brightness when viewing media

This commit is contained in:
Andrew Rabert 2017-03-10 00:47:54 -05:00
parent d58ca64605
commit 19fd54b25a
22 changed files with 59 additions and 0 deletions

View file

@ -26,6 +26,7 @@ class SettingsActivity : SimpleActivity() {
setupAutoplayVideos()
setupLoopVideos()
setupAnimateGifs()
setupMaxBrightness()
setupShowMedia()
updateTextColors(settings_holder)
}
@ -86,9 +87,18 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupMaxBrightness() {
settings_max_brightness.isChecked = config.maxBrightness
settings_max_brightness_holder.setOnClickListener {
settings_max_brightness.toggle()
config.maxBrightness = settings_max_brightness.isChecked
}
}
private fun getShowMediaText() = getString(when (config.showMedia) {
IMAGES_AND_VIDEOS -> R.string.images_and_videos
IMAGES -> R.string.images
else -> R.string.videos
})
}

View file

@ -98,6 +98,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
finish()
}
supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background))
if (config.maxBrightness) {
var attributes = getWindow().getAttributes()
attributes.screenBrightness = 1F
getWindow().setAttributes(attributes)
}
}
override fun onPause() {

View file

@ -100,6 +100,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(ANIMATE_GIFS, false)
set(animateGifs) = prefs.edit().putBoolean(ANIMATE_GIFS, animateGifs).apply()
var maxBrightness: Boolean
get() = prefs.getBoolean(MAX_BRIGHTNESS, false)
set(maxBrightness) = prefs.edit().putBoolean(MAX_BRIGHTNESS, maxBrightness).apply()
var loopVideos: Boolean
get() = prefs.getBoolean(LOOP_VIDEOS, false)
set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).apply()

View file

@ -8,6 +8,7 @@ val SHOW_HIDDEN_FOLDERS = "show_hidden_folders"
val AUTOPLAY_VIDEOS = "autoplay_videos"
val LOOP_VIDEOS = "loop_videos"
val ANIMATE_GIFS = "animate_gifs"
val MAX_BRIGHTNESS = "max_brightness"
val DISPLAY_FILE_NAMES = "display_file_names"
val PINNED_FOLDERS = "pinned_folders"
val DIR_COLUMN_CNT = "dir_column_cnt"

View file

@ -129,6 +129,27 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_max_brightness_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_max_brightness"
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/max_brightness"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_media_holder"
android:layout_width="match_parent"

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images and videos</string>
<string name="loop_videos">Loop videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Bilder und Videos</string>
<string name="loop_videos">Video Endlos-Schleife</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images and videos</string>
<string name="loop_videos">Loop videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images et vidéos</string>
<string name="loop_videos">Tourner en boucle les vidéos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images and videos</string>
<string name="loop_videos">Loop videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images and videos</string>
<string name="loop_videos">Loop videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images and videos</string>
<string name="loop_videos">Loop videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images and videos</string>
<string name="loop_videos">Loop videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Obrazy i wideo</string>
<string name="loop_videos">Pętla wideo</string>
<string name="animate_gifs">Animowanie gify z miniaturkami</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Imagens e vídeos</string>
<string name="loop_videos">Vídeos em ciclo</string>
<string name="animate_gifs">Animação de gifs nas miniaturas</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Изображения и видео</string>
<string name="loop_videos">Повторять видео</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Obrázky aj videá</string>
<string name="loop_videos">Automaticky reštartovať videá</string>
<string name="animate_gifs">Animovať gif súbory pri náhľade</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Bilder och videos</string>
<string name="loop_videos">Återspela videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Resimler ve videolar</string>
<string name="loop_videos">Videolar döngüsü</string>
<string name="animate_gifs">Küçük resimlerde gif\'leri canlandırın</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">图像和视频</string>
<string name="loop_videos">循环播放视频</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">圖片和影片</string>
<string name="loop_videos">迴圈播放影片</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">

View file

@ -80,6 +80,7 @@
<string name="images_and_videos">Images and videos</string>
<string name="loop_videos">Loop videos</string>
<string name="animate_gifs">Animate gifs at thumbnails</string>
<string name="max_brightness">Maximum brightness when viewing media</string>
<!-- Release notes -->
<string name="release_83">