Merge pull request #2008 from Bnyro/remember-share-with-time-code

Remember last user choice on sharing with time code
This commit is contained in:
Bnyro 2022-11-23 17:40:02 +01:00 committed by GitHub
commit 5bf62e12b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -83,6 +83,7 @@ class ShareDialog(
)
binding!!.timeCodeSwitch.setOnCheckedChangeListener { _, isChecked ->
binding!!.timeStampLayout.visibility = if (isChecked) View.VISIBLE else View.GONE
PreferenceHelper.putBoolean(PreferenceKeys.SHARE_WITH_TIME_CODE, isChecked)
}
binding!!.timeStamp.setText((shareData.currentPosition ?: 0L).toString())
if (binding!!.timeCodeSwitch.isChecked) binding!!.timeStampLayout.visibility = View.VISIBLE

View File

@ -29,10 +29,14 @@ object PreferenceHelper {
authEditor = authSettings.edit()
}
fun putString(key: String?, value: String) {
fun putString(key: String, value: String) {
editor.putString(key, value).commit()
}
fun putBoolean(key: String, value: Boolean) {
editor.putBoolean(key, value).commit()
}
fun getString(key: String?, defValue: String): String {
return settings.getString(key, defValue) ?: defValue
}