adding a new checkbox for always opening the videos on a new screen

This commit is contained in:
tibbi 2019-01-09 20:49:45 +01:00
parent 65bb79fd71
commit 662dff67d6
4 changed files with 38 additions and 0 deletions

View file

@ -42,6 +42,7 @@ class SettingsActivity : SimpleActivity() {
setupAutoplayVideos() setupAutoplayVideos()
setupRememberLastVideo() setupRememberLastVideo()
setupLoopVideos() setupLoopVideos()
setupOpenVideosOnNewScreen()
setupAnimateGifs() setupAnimateGifs()
setupMaxBrightness() setupMaxBrightness()
setupCropThumbnails() setupCropThumbnails()
@ -174,6 +175,14 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupOpenVideosOnNewScreen() {
settings_open_videos_on_new_screen.isChecked = config.openVideosOnNewScreen
settings_open_videos_on_new_screen_holder.setOnClickListener {
settings_open_videos_on_new_screen.toggle()
config.openVideosOnNewScreen = settings_open_videos_on_new_screen.isChecked
}
}
private fun setupAnimateGifs() { private fun setupAnimateGifs() {
settings_animate_gifs.isChecked = config.animateGifs settings_animate_gifs.isChecked = config.animateGifs
settings_animate_gifs_holder.setOnClickListener { settings_animate_gifs_holder.setOnClickListener {

View file

@ -180,6 +180,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(LOOP_VIDEOS, false) get() = prefs.getBoolean(LOOP_VIDEOS, false)
set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).apply() set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).apply()
var openVideosOnNewScreen: Boolean
get() = prefs.getBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, false)
set(openVideosOnNewScreen) = prefs.edit().putBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, openVideosOnNewScreen).apply()
var displayFileNames: Boolean var displayFileNames: Boolean
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()

View file

@ -13,6 +13,7 @@ const val IS_THIRD_PARTY_INTENT = "is_third_party_intent"
const val AUTOPLAY_VIDEOS = "autoplay_videos" const val AUTOPLAY_VIDEOS = "autoplay_videos"
const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position" const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position"
const val LOOP_VIDEOS = "loop_videos" const val LOOP_VIDEOS = "loop_videos"
const val OPEN_VIDEOS_ON_NEW_SCREEN = "open_videos_on_new_screen"
const val ANIMATE_GIFS = "animate_gifs" const val ANIMATE_GIFS = "animate_gifs"
const val MAX_BRIGHTNESS = "max_brightness" const val MAX_BRIGHTNESS = "max_brightness"
const val CROP_THUMBNAILS = "crop_thumbnails" const val CROP_THUMBNAILS = "crop_thumbnails"

View file

@ -280,6 +280,30 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_open_videos_on_new_screen_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_open_videos_on_new_screen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin"
android:text="@string/open_videos_on_new_screen"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_allow_video_gestures_holder" android:id="@+id/settings_allow_video_gestures_holder"
android:layout_width="match_parent" android:layout_width="match_parent"