mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-22 16:23:50 +00:00
fixes
This commit is contained in:
parent
e0d5eb45b7
commit
04a95867e2
@ -2,6 +2,14 @@
|
||||
|
||||
## 0.5.7
|
||||
|
||||
* `Android`
|
||||
* `Alerts`
|
||||
* `Common`
|
||||
* New extension `progressBarAlertDialog`
|
||||
* `Pagination`
|
||||
* `Ktor`
|
||||
* `Server`
|
||||
* Fixes in extension `extractPagination`
|
||||
* `Repos`
|
||||
* `Cache`
|
||||
* All standard cache repos have been separated to read and read/write repos
|
||||
|
@ -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>
|
@ -5,8 +5,8 @@ import io.ktor.http.Parameters
|
||||
|
||||
val Parameters.extractPagination: Pagination
|
||||
get() = SimplePagination(
|
||||
get("page") ?.toIntOrNull() ?: 0,
|
||||
get("size") ?.toIntOrNull() ?: defaultPaginationPageSize
|
||||
get(paginationPageKey) ?.toIntOrNull() ?: 0,
|
||||
get(paginationSizeKey) ?.toIntOrNull() ?: defaultPaginationPageSize
|
||||
)
|
||||
|
||||
val ApplicationCall.extractPagination: Pagination
|
||||
|
Loading…
Reference in New Issue
Block a user