add a settings checkbox for cropping thumbnails

This commit is contained in:
tibbi 2017-03-23 20:32:52 +01:00
parent 6782f7b208
commit a5faf7a0a5
2 changed files with 37 additions and 8 deletions

View File

@ -33,6 +33,7 @@ class SettingsActivity : SimpleActivity() {
setupLoopVideos()
setupAnimateGifs()
setupMaxBrightness()
setupCropThumbnails()
setupShowMedia()
updateTextColors(settings_holder)
}
@ -87,6 +88,22 @@ 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 setupCropThumbnails() {
settings_crop_thumbnails.isChecked = config.cropThumbnails
settings_crop_thumbnails_holder.setOnClickListener {
settings_crop_thumbnails.toggle()
config.cropThumbnails = settings_crop_thumbnails.isChecked
}
}
private fun setupShowMedia() {
settings_show_media.text = getShowMediaText()
settings_show_media_holder.setOnClickListener {
@ -102,14 +119,6 @@ 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

View File

@ -168,6 +168,26 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_crop_thumbnails_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_crop_thumbnails"
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/crop_thumbnails"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_media_holder"
android:layout_width="match_parent"