Package org.dexcare.dal.exts

Functions

displayToast
Link copied to clipboard
fun Context.displayToast(text: String)
An extension function that can be used to display a simple toast message to the user.
getNetworkLinkBandwidthKbps
Link copied to clipboard
fun Context.getNetworkLinkBandwidthKbps(): Pair<Int, Int>
Gets the current mobile network link's bandwidth.
getWiFiLinkBandwidthKbps
Link copied to clipboard
fun Context.getWiFiLinkBandwidthKbps(): Int
Gets the current wifi network link's bandwidth.
isConnectedToMobileNetwork
Link copied to clipboard
fun Context.isConnectedToMobileNetwork(): Boolean
Check if the device is connected to mobile data, vs.
observeOnMain
Link copied to clipboard
fun Completable.observeOnMain(): Completable
fun <T> Flowable<T>.observeOnMain(): Flowable<T>
fun <T> Observable<T>.observeOnMain(): Observable<T>
fun <T> Single<T>.observeOnMain(): Single<T>
readFromRaw
Link copied to clipboard
fun Context.readFromRaw(@RawRes() rawID: Int): String
An extension function for reading files in the Raw resource folder and converting them to a string
retryWithDelay
Link copied to clipboard
fun Completable.retryWithDelay(retryAttempts: Int = 2, retryDelayMS: Long = 1000L): Completable
fun <T> Flowable<T>.retryWithDelay(retryAttempts: Int = 2, retryDelayMS: Long = 1000L): Flowable<T>
fun <T> Single<T>.retryWithDelay(retryAttempts: Int = 2, retryDelayMS: Long = 1000L): Single<T>
sendEmail
Link copied to clipboard
fun Context.sendEmail(subject: String, addresses: Array<String>)
An extension function which can be used to open the user's email app to a draft email with the provided subject and address fields pre-populated.
showMaterialDialog
Link copied to clipboard
fun Context.showMaterialDialog(title: String? = null, message: String? = null, positiveButtonText: String? = null, positiveButtonCallback: () -> Unit = {}, negativeButtonText: String? = null, negativeButtonCallback: () -> Unit = {}, isCancelable: Boolean = true)
An extension function that can be used to display a material dialog to the user.
subscribeForDataObs
Link copied to clipboard
fun Completable.subscribeForDataObs(): DataObserver<Unit>
Provides an extension function for generating a dataObserver for your data class
fun <T> Observable<T>.subscribeForDataObs(): DataObserver<T>
Provides an extension function for generating a dataObserver for your data class
fun <T> Single<T>.subscribeForDataObs(): DataObserver<T>
Provides an extension function for generating a dataObserver for your data class
subscribeOnIO
Link copied to clipboard
fun Completable.subscribeOnIO(): Completable
fun <T> Flowable<T>.subscribeOnIO(): Flowable<T>
fun <T> Observable<T>.subscribeOnIO(): Observable<T>
fun <T> Single<T>.subscribeOnIO(): Single<T>