fix #77, add a toggle for keeping the setting buttons always visible

This commit is contained in:
tibbi 2017-10-21 21:29:18 +02:00
parent dcca4b1250
commit e1528e5416
5 changed files with 38 additions and 1 deletions

View File

@ -73,4 +73,8 @@ class Config(context: Context) : BaseConfig(context) {
var wasPhotoPreviewHintShown: Boolean
get() = prefs.getBoolean(PHOTO_PREVIEW_HINT_SHOWN, false)
set(wasPhotoPreviewHintShown) = prefs.edit().putBoolean(PHOTO_PREVIEW_HINT_SHOWN, wasPhotoPreviewHintShown).apply()
var keepSettingsVisible: Boolean
get() = prefs.getBoolean(KEEP_SETTINGS_VISIBLE, false)
set(keepSettingsVisible) = prefs.edit().putBoolean(KEEP_SETTINGS_VISIBLE, keepSettingsVisible).apply()
}

View File

@ -19,6 +19,7 @@ val BACK_VIDEO_RESOLUTION_INDEX = "back_video_resolution_index"
val FRONT_PHOTO_RESOLUTION_INDEX = "front_photo_resolution_index"
val FRONT_VIDEO_RESOLUTION_INDEX = "front_video_resolution_index"
val PHOTO_PREVIEW_HINT_SHOWN = "photo_preview_hint_shown"
val KEEP_SETTINGS_VISIBLE = "keep_settings_visible"
val FLASH_OFF = 0
val FLASH_ON = 1

View File

@ -378,7 +378,10 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
}
}
private fun scheduleFadeOut() = mFadeHandler.postDelayed({ fadeOutButtons() }, FADE_DELAY.toLong())
private fun scheduleFadeOut() {
if (!config.keepSettingsVisible)
mFadeHandler.postDelayed({ fadeOutButtons() }, FADE_DELAY.toLong())
}
private fun fadeOutButtons() {
fadeAnim(settings, .5f)

View File

@ -31,6 +31,7 @@ class SettingsActivity : SimpleActivity() {
setupVolumeButtonsAsShutter()
setupTurnFlashOffAtStartup()
setupFlipPhotos()
setupKeepSettingsVisible()
updateTextColors(settings_holder)
}
@ -117,4 +118,12 @@ class SettingsActivity : SimpleActivity() {
config.flipPhotos = settings_flip_photos.isChecked
}
}
private fun setupKeepSettingsVisible() {
settings_keep_settings_visible.isChecked = config.keepSettingsVisible
settings_keep_settings_visible_holder.setOnClickListener {
settings_keep_settings_visible.toggle()
config.keepSettingsVisible = settings_keep_settings_visible.isChecked
}
}
}

View File

@ -184,5 +184,25 @@
android:text="@string/flip_front_camera_photos_horizontally"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_keep_settings_visible_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_keep_settings_visible"
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/keep_settings_visible"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>