diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4272821c39e..cb594bcf8bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
## 0.4.5
+* `Android`
+ * `Alerts`
+ * Project has been created
+
## 0.4.4
* `Versions`:
diff --git a/android/alerts/build.gradle b/android/alerts/build.gradle
new file mode 100644
index 00000000000..b60575bd26f
--- /dev/null
+++ b/android/alerts/build.gradle
@@ -0,0 +1,17 @@
+plugins {
+ id "org.jetbrains.kotlin.multiplatform"
+ id "org.jetbrains.kotlin.plugin.serialization"
+ id "com.android.library"
+}
+
+apply from: "$mppAndroidProjectPresetPath"
+
+kotlin {
+ sourceSets {
+ androidMain {
+ dependencies {
+ api "androidx.appcompat:appcompat-resources:$appcompat_version"
+ }
+ }
+ }
+}
diff --git a/android/alerts/src/main/AndroidManifest.xml b/android/alerts/src/main/AndroidManifest.xml
new file mode 100644
index 00000000000..19c94569d08
--- /dev/null
+++ b/android/alerts/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/AlertDialog.kt b/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/AlertDialog.kt
new file mode 100644
index 00000000000..6ce0871c331
--- /dev/null
+++ b/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/AlertDialog.kt
@@ -0,0 +1,55 @@
+@file:Suppress("NOTHING_TO_INLINE", "unused")
+
+package dev.inmo.micro_utils.android.alerts
+
+import android.app.AlertDialog
+import android.content.Context
+import android.content.DialogInterface
+
+typealias AlertDialogCallback = (DialogInterface) -> Unit
+
+inline fun Context.createAlertDialogTemplate(
+ title: String? = null,
+ positivePair: Pair? = null,
+ neutralPair: Pair? = null,
+ negativePair: Pair? = null
+): AlertDialog.Builder {
+ val builder = AlertDialog.Builder(this)
+
+ title ?.let {
+ builder.setTitle(title)
+ }
+
+ positivePair ?. let {
+ builder.setPositiveButton(it.first) { di, _ -> it.second ?. invoke(di) }
+ }
+ negativePair ?. let {
+ builder.setNegativeButton(it.first) { di, _ -> it.second ?. invoke(di) }
+ }
+ neutralPair ?. let {
+ builder.setNeutralButton(it.first) { di, _ -> it.second ?. invoke(di) }
+ }
+
+ return builder
+}
+
+inline fun Context.createAlertDialogTemplateWithResources(
+ title: Int? = null,
+ positivePair: Pair? = null,
+ neutralPair: Pair? = null,
+ negativePair: Pair? = null
+): AlertDialog.Builder = createAlertDialogTemplate(
+ title ?.let { getString(it) },
+ positivePair ?.let { getString(it.first) to it.second },
+ neutralPair ?.let { getString(it.first) to it.second },
+ negativePair ?.let { getString(it.first) to it.second }
+)
+
+inline fun AlertDialog.setDismissChecker(noinline checker: () -> Boolean) : AlertDialog {
+ setOnDismissListener {
+ if (!checker()) {
+ show()
+ }
+ }
+ return this
+}
diff --git a/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/CustomAlertDialog.kt b/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/CustomAlertDialog.kt
new file mode 100644
index 00000000000..594de2cd760
--- /dev/null
+++ b/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/CustomAlertDialog.kt
@@ -0,0 +1,38 @@
+@file:Suppress("NOTHING_TO_INLINE", "unused")
+
+package dev.inmo.micro_utils.android.alerts
+
+import android.app.AlertDialog
+import android.content.Context
+import android.view.View
+
+inline fun Context.createCustomViewAlertDialog(
+ title: String? = null,
+ positivePair: Pair? = null,
+ neutralPair: Pair? = null,
+ negativePair: Pair? = null,
+ show: Boolean = true,
+ viewCreator: (Context) -> T
+): AlertDialog = createAlertDialogTemplate(
+ title, positivePair, neutralPair, negativePair
+).apply {
+ setView(viewCreator(this@createCustomViewAlertDialog))
+}.create().apply {
+ if (show) show()
+}
+
+inline fun Context.createCustomViewAlertDialogWithResources(
+ title: Int? = null,
+ positivePair: Pair? = null,
+ neutralPair: Pair? = null,
+ negativePair: Pair? = null,
+ show: Boolean = true,
+ viewCreator: (Context) -> T
+): AlertDialog = createCustomViewAlertDialog(
+ title ?.let { getString(it) },
+ positivePair ?.let { getString(it.first) to it.second },
+ neutralPair ?.let { getString(it.first) to it.second },
+ negativePair ?.let { getString(it.first) to it.second },
+ show,
+ viewCreator
+)
diff --git a/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/SimpleTextAlert.kt b/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/SimpleTextAlert.kt
new file mode 100644
index 00000000000..094d9969a7d
--- /dev/null
+++ b/android/alerts/src/main/kotlin/dev/inmo/micro_utils/android/alerts/SimpleTextAlert.kt
@@ -0,0 +1,45 @@
+@file:Suppress("NOTHING_TO_INLINE", "unused")
+
+package dev.inmo.micro_utils.android.alerts
+
+import android.app.AlertDialog
+import android.content.Context
+import androidx.annotation.StringRes
+
+inline fun Context.createSimpleTextAlertDialog(
+ text: String,
+ title: String? = null,
+ positivePair: Pair? = null,
+ neutralPair: Pair? = null,
+ negativePair: Pair? = null,
+ show: Boolean = true
+): AlertDialog = createAlertDialogTemplate(
+ title,
+ positivePair,
+ neutralPair,
+ negativePair
+).apply {
+ setMessage(text)
+}.create().apply {
+ if (show) {
+ show()
+ }
+}
+
+inline fun Context.createSimpleTextAlertDialog(
+ @StringRes
+ text: Int,
+ @StringRes
+ title: Int? = null,
+ positivePair: Pair? = null,
+ neutralPair: Pair? = null,
+ negativePair: Pair? = null,
+ show: Boolean = true
+): AlertDialog = createSimpleTextAlertDialog(
+ getString(text),
+ title ?.let { getString(it) },
+ positivePair ?.let { getString(it.first) to it.second },
+ neutralPair ?.let { getString(it.first) to it.second },
+ negativePair ?.let { getString(it.first) to it.second },
+ show
+)
diff --git a/gradle.properties b/gradle.properties
index 53481079204..a09a73d1708 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -24,6 +24,7 @@ uuidVersion=0.2.2
core_ktx_version=1.3.2
androidx_recycler_version=1.1.0
+appcompat_version=1.2.0
android_minSdkVersion=19
android_compileSdkVersion=30
diff --git a/settings.gradle b/settings.gradle
index 811699ed9eb..32dc161d3eb 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -18,6 +18,7 @@ String[] includes = [
":ktor:client",
":coroutines",
":android:recyclerview",
+ ":android:alerts",
":dokka"
]