RichUtils / pyxis.uzuki.live.richutilskt.service / RLocationService

RLocationService

class RLocationService : Service

Types

LocalBinder

inner class LocalBinder : Binder

LocationCallback

interface LocationCallback

Constructors

<init>

RLocationService()

Properties

currentBestLocation

var currentBestLocation: Location?

Functions

getAddressLine

fun Context.getAddressLine(): String

get AddressLine

getCountryName

fun Context.getCountryName(): String

get country name

getGeoCoderAddress

fun Context.getGeoCoderAddress(): List<Address>?

get Address from CurrentBestLocation

getLocality

fun Context.getLocality(): String

get locality

getLocation

fun getLocation(): Unit

get location of user. this service using 3 methods for fetch location. (Mobile, GPS, Sensor)

getPostalCode

fun Context.getPostalCode(): String

get postal code

onBind

fun onBind(intent: Intent?): LocalBinder

onCreate

fun onCreate(): Unit

onDestroy

fun onDestroy(): Unit

onStartCommand

fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int

setLocationCallback

fun setLocationCallback(callback: (Location) -> Unit): Unit
fun setLocationCallback(callback: F1<Location>): Unit

Set callback for location service. any location updates will invoke this callback (except new location data is not-best-location.)

stopUpdates

fun stopUpdates(): Unit

stop location update service

Extension Functions

alert

fun Context.alert(message: String, title: String? = "", positiveButton: String? = null, cancelable: Boolean = true, callback: (DialogInterface) -> Unit = {}): Builder

Display AlertDialog instantly

fun Context.alert(message: String, title: String? = "", positiveButton: String? = null, cancelable: Boolean = true, callback: F1<DialogInterface>?): Builder

Display AlertDialog instantly for SAM Conversion

applyUnReadCount

fun Context.applyUnReadCount(count: Int): Unit

apply count of UnRead

bitmapToDrawable

fun Context.bitmapToDrawable(bitmap: Bitmap?): Drawable?

Bitmap to Drawable

checkNetwork

fun Context.checkNetwork(): Int

get network connection check

confirm

fun Context.confirm(message: String, callback: DialogInterface.() -> Unit, title: String? = "", positiveButton: String? = null, negativeButton: String? = null, cancelable: Boolean = true): Builder

Display AlertDialog instantly with confirm

fun Context.confirm(message: String, callback: F1<DialogInterface>?, title: String? = "", positiveButton: String? = null, negativeButton: String? = null, cancelable: Boolean = true): Builder

Display AlertDialog instantly with confirm for SAM Conversion

copyAssets

fun Context.copyAssets(path: String): Unit

Assets to Internal storage

copyText

fun Context.copyText(text: CharSequence): Unit

copy text to clipboard

dimen

fun Context.dimen(resource: Int): Int

get pixel size from DimenRes

dip2px

fun Context.dip2px(value: Int): Int
fun Context.dip2px(value: Float): Int

convert dip to px

getAndroidId

fun Context.getAndroidId(): String

get androidId of device

getContactsList

fun Context.getContactsList(): List<ContactItem>

load contact data from device

getIMEI

fun Context.getIMEI(): String

get IMEI of device

getKeyHash

fun Context.getKeyHash(): String

get key hash of application

getLine1Number

fun Context.getLine1Number(): String

get Line1Number (as know as PhoneNumber) of device

getStatusBarHeight

fun Context.getStatusBarHeight(): Int

get Height of status bar

getTextFromClipboard

fun Context.getTextFromClipboard(): String

get text of clipboard list

inflate

fun Context.inflate(layoutRes: Int, parent: ViewGroup? = null, attachToRoot: Boolean = false): View

inflate view

progress

fun Context.progress(message: String, cancelable: Boolean = true, title: String? = null): DialogInterface

Display ProgressDialog

px2dip

fun Context.px2dip(px: Int): Float

convert px to dip

px2sp

fun Context.px2sp(px: Int): Float

convert px to sp

reboot

fun Context.reboot(restartIntent: Intent = this.packageManager.getLaunchIntentForPackage(this.packageName)): Unit

Reboot application

removeUnReadCount

fun Context.removeUnReadCount(): Unit

remove count of UnRead

requestMediaScanner

fun Context.requestMediaScanner(url: String): Unit

Request MediaScanning

saveBitmapToFile

fun Context.saveBitmapToFile(bitmap: Bitmap): File?

selector

fun <T> Context.selector(items: List<T>, callback: (DialogInterface, item: T, Int) -> Unit, title: String? = "", cancelable: Boolean = true): Builder

Display SelectorDialog instantly

fun <T> Context.selector(items: List<T>, callback: F3<DialogInterface, T, Int>?, title: String? = "", cancelable: Boolean = true): Builder

Display SelectorDialog instantly for SAM Conversion

setTypeface

fun Context.setTypeface(layoutRes: Int, parent: ViewGroup? = null, isAttachedRoot: Boolean = false): View?
fun Context.setTypeface(view: ViewGroup, parent: ViewGroup? = null, isAttachedRoot: Boolean = false): View?

Set system font into ViewGroup

sp2px

fun Context.sp2px(value: Int): Int
fun Context.sp2px(value: Float): Int

convert sp to px

toast

fun Context.toast(message: String, length: Int = Toast.LENGTH_SHORT): Unit
fun Context.toast(message: Int, length: Int = Toast.LENGTH_SHORT): Unit

Display Toast Message

versionCode

fun Context.versionCode(): Int

get version code of this application

versionName

fun Context.versionName(): String

get version name of this application

vibrate

fun Context.vibrate(millSec: Long): Unit
fun Context.vibrate(pattern: LongArray, repeat: Int = -1): Unit

Vibrate need VIBRATE permission