add a settings toggle for autorotating the screen

This commit is contained in:
tibbi 2017-03-23 21:02:32 +01:00
parent 25a46f18f4
commit dda66bf127
2 changed files with 29 additions and 0 deletions

View file

@ -34,6 +34,7 @@ class SettingsActivity : SimpleActivity() {
setupAnimateGifs()
setupMaxBrightness()
setupCropThumbnails()
setupAutoRotateScreen()
setupShowMedia()
updateTextColors(settings_holder)
}
@ -104,6 +105,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupAutoRotateScreen() {
settings_auto_rotate_screen.isChecked = config.autoRotateScreen
settings_auto_rotate_screen_holder.setOnClickListener {
settings_auto_rotate_screen.toggle()
config.autoRotateScreen = settings_auto_rotate_screen.isChecked
}
}
private fun setupShowMedia() {
settings_show_media.text = getShowMediaText()
settings_show_media_holder.setOnClickListener {

View file

@ -188,6 +188,26 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_auto_rotate_screen_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_auto_rotate_screen"
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/auto_rotate_screen"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_media_holder"
android:layout_width="match_parent"