add the looping Setting switchcompat

This commit is contained in:
tibbi 2016-12-28 20:31:18 +01:00
parent 62473089bd
commit 1bbca50bac
4 changed files with 34 additions and 0 deletions

View File

@ -20,6 +20,7 @@ class SettingsActivity : SimpleActivity() {
setupSameSorting()
setupShowHiddenFolders()
setupAutoplayVideos()
setupLoopVideos()
setupShowMedia()
updateTextColors(settings_holder)
}
@ -54,6 +55,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupLoopVideos() {
settings_loop_videos.isChecked = config.loopVideos
settings_loop_videos_holder.setOnClickListener {
settings_loop_videos.toggle()
config.loopVideos = settings_loop_videos.isChecked
}
}
private fun setupShowMedia() {
var isInitialSetup = true
settings_show_media.setSelection(config.showMedia)

View File

@ -76,6 +76,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(AUTOPLAY_VIDEOS, false)
set(autoplay) = prefs.edit().putBoolean(AUTOPLAY_VIDEOS, autoplay).apply()
var loopVideos: Boolean
get() = prefs.getBoolean(LOOP_VIDEOS, false)
set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).apply()
var displayFileNames: Boolean
get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false)
set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply()

View File

@ -8,6 +8,7 @@ val DIRECTORY_SORT_ORDER = "directory_sort_order"
val HIDDEN_FOLDERS = "hidden_folders"
val SHOW_HIDDEN_FOLDERS = "show_hidden_folders"
val AUTOPLAY_VIDEOS = "autoplay_videos"
val LOOP_VIDEOS = "loop_videos"
val DISPLAY_FILE_NAMES = "display_file_names"
val PINNED_FOLDERS = "pinned_folders"
val DIR_COLUMN_CNT = "dir_column_cnt"

View File

@ -90,6 +90,26 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_loop_videos_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_loop_videos"
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/loop_videos"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_media_holder"
android:layout_width="match_parent"