mirror of
https://github.com/mueller-ma/PrepaidBalance.git
synced 2024-09-20 00:12:15 +02:00
Add Context.prefs()
This commit is contained in:
parent
6d9c32840e
commit
c8f46e2181
@ -1,19 +1,19 @@
|
||||
package com.github.muellerma.prepaidbalance.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.text.format.DateFormat
|
||||
import androidx.preference.PreferenceManager
|
||||
|
||||
private const val TAG = "ExtensionFunctions"
|
||||
|
||||
fun Double.formatAsCurrency(): String {
|
||||
return "%1\$,.2f".format(this)
|
||||
}
|
||||
fun Double.formatAsCurrency() = "%1\$,.2f".format(this)
|
||||
|
||||
fun Long.timestampForUi(context: Context): String {
|
||||
return DateFormat.getTimeFormat(context).format(this) + " " +
|
||||
DateFormat.getDateFormat(context).format(this)
|
||||
}
|
||||
|
||||
fun String.isValidUssdCode(): Boolean {
|
||||
return matches("^\\*(\\d)+#$".toRegex())
|
||||
}
|
||||
fun String.isValidUssdCode() = matches("^\\*(\\d)+#$".toRegex())
|
||||
|
||||
fun Context.prefs() = PreferenceManager.getDefaultSharedPreferences(this)
|
Loading…
Reference in New Issue
Block a user