This commit is contained in:
Tommaso Berlose
2020-10-18 11:20:40 +02:00
parent 331d5772af
commit c95f9fb943
3 changed files with 23 additions and 42 deletions

View File

@ -66,7 +66,6 @@ object IntentHelper {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
} catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent()
}
}
@ -96,7 +95,6 @@ object IntentHelper {
data = calendarUri
}
} catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent()
}
}
@ -181,7 +179,6 @@ object IntentHelper {
addCategory(Intent.CATEGORY_LAUNCHER)
}
} catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent()
}
}
@ -204,7 +201,6 @@ object IntentHelper {
addCategory(Intent.CATEGORY_LAUNCHER)
}
} catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent()
}
}
@ -218,7 +214,6 @@ object IntentHelper {
addCategory(Intent.CATEGORY_LAUNCHER)
}
} catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent()
}
}
@ -230,7 +225,6 @@ object IntentHelper {
addCategory(Intent.CATEGORY_LAUNCHER)
}
} catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent()
}
}

View File

@ -90,7 +90,7 @@ class CustomDateActivity : AppCompatActivity() {
ERROR_STRING
}
} else {
"__"
ERROR_STRING
}
if (viewModel.isDateCapitalize.value == true) {
@ -102,7 +102,6 @@ class CustomDateActivity : AppCompatActivity() {
}
withContext(Dispatchers.Main) {
action_save.isVisible = text != ERROR_STRING
loader.visibility = View.INVISIBLE
date_format_value.text = text
}
@ -143,15 +142,6 @@ class CustomDateActivity : AppCompatActivity() {
onBackPressed()
}
action_save.setOnClickListener {
Preferences.blockingBulk {
dateFormat = viewModel.dateInput.value ?: ""
isDateCapitalize = viewModel.isDateCapitalize.value ?: true
isDateUppercase = viewModel.isDateUppercase.value ?: false
}
finish()
}
action_capitalize.setOnClickListener {
when {
viewModel.isDateUppercase.value == true -> {
@ -179,6 +169,15 @@ class CustomDateActivity : AppCompatActivity() {
}
}
override fun onBackPressed() {
Preferences.blockingBulk {
dateFormat = viewModel.dateInput.value ?: ""
isDateCapitalize = viewModel.isDateCapitalize.value ?: true
isDateUppercase = viewModel.isDateUppercase.value ?: false
}
super.onBackPressed()
}
companion object {
const val ERROR_STRING = "--"
val DATE: Calendar = Calendar.getInstance().apply {