diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt
index 4bb7752..f7bd450 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt
@@ -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()
}
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomDateActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomDateActivity.kt
index a29ca89..915a412 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomDateActivity.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomDateActivity.kt
@@ -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 {
diff --git a/app/src/main/res/layout/activity_custom_date.xml b/app/src/main/res/layout/activity_custom_date.xml
index 663ceba..5d181a9 100644
--- a/app/src/main/res/layout/activity_custom_date.xml
+++ b/app/src/main/res/layout/activity_custom_date.xml
@@ -29,7 +29,8 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
- android:layout_marginTop="2dp"
+ android:clickable="true"
+ android:focusable="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_back"
app:tint="@color/colorPrimaryText"
@@ -39,6 +40,7 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/custom_date_format"
+ android:paddingStart="8dp"
android:layout_marginEnd="48dp"
android:gravity="center"
style="@style/AnotherWidget.Main.Title"/>
@@ -102,11 +104,16 @@
app:cardElevation="2dp"
app:cardCornerRadius="0dp"
app:cardBackgroundColor="@color/colorPrimary">
-
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="16dp">
+ android:layout_marginRight="32dp" />
-
+
-