mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-09 10:15:33 +00:00
fixes
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package dev.inmo.micro_utils.android.alerts.common
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
fun Context.createProgressBarAlertDialog(
|
||||
text: String? = null,
|
||||
onClick: (() -> Unit)? = null
|
||||
) = createCustomViewAlertDialog {
|
||||
(it.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(
|
||||
R.layout.alert_dialog_progress_bar, null, false
|
||||
).apply {
|
||||
onClick ?.let {
|
||||
setOnClickListener { onClick() }
|
||||
} ?: setOnClickListener { /* do nothing */ }
|
||||
text ?.let {
|
||||
findViewById<TextView>(R.id.alertDialogProgressBarTitle).text = it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.createProgressBarAlertDialog(
|
||||
@StringRes textRes: Int,
|
||||
onClick: (() -> Unit)? = null
|
||||
) = createProgressBarAlertDialog(getString(textRes), onClick)
|
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/alertDialogProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alertDialogProgressBarTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
Reference in New Issue
Block a user