diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/autodelete/AutoDeleteDialog.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/autodelete/AutoDeleteDialog.kt index 8f55c1413d37825910a4e83b5404ddf9c7042931..d5b0913b58ca5442132ef439875ad2784dc163a3 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/autodelete/AutoDeleteDialog.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/autodelete/AutoDeleteDialog.kt @@ -21,6 +21,7 @@ package com.moez.QKSMS.feature.settings.autodelete import android.app.Activity import android.content.DialogInterface import android.view.LayoutInflater +import android.widget.Toast import androidx.appcompat.app.AlertDialog import com.moez.QKSMS.R import kotlinx.android.synthetic.main.settings_auto_delete_dialog.view.* @@ -36,7 +37,11 @@ class AutoDeleteDialog(context: Activity, listener: (Int) -> Unit) : AlertDialog setButton(DialogInterface.BUTTON_NEUTRAL, context.getString(R.string.button_cancel)) { _, _ -> } setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.settings_auto_delete_never)) { _, _ -> listener(0) } setButton(DialogInterface.BUTTON_POSITIVE, context.getString(R.string.button_save)) { _, _ -> - listener(layout.field.text.toString().toIntOrNull() ?: 0) + if (!layout.field.text.toString().trim().isEmpty()) { + listener(layout.field.text.toString().toIntOrNull() ?: 0) + } else { + Toast.makeText(context, context.getString(R.string.not_able_to_add_empty_number), Toast.LENGTH_LONG).show() + } } } diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 727953d6c22f52c46be833b7d274d4498c171301..abd36c21322fbc8df8ac6d31e697d89da95bb89a 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -502,5 +502,9 @@ Share some love and rate us on Google Play! OKAY! DISMISS + + Not able to add empty number ! please try again + Not able to add empty text ! please try again +