ulaserdegor / live-tools

Live-Tools is a library project which aims to convert some Android features to LiveData

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Live-Tools

Live-Tools is a library project which aims to convert some Android device features to LiveData.

List

live-orientation

Observes orientation change even if device is forced to portrait mode. It works based on sensors.

OrientationLiveData(this)
      .observe(this, Observer {
           it?.let {
               Toast.makeText(this, it.name, Toast.LENGTH_SHORT).show()
           }
      })

live-location

Observes location changes. It observers coarse and fine location internally. If user's GPS setting is disabled, live-location notifies you about this. If location permission is needed, live-location checks this internally and notifies you about this.

locationLiveData = LocationLiveData(this)
locationLiveData.observe(this,
        Observer {
            when (it?.status) {
                LocationData.Status.PERMISSION_REQUIRED -> // request permission. (it.permissionList)
                LocationData.Status.ENABLE_SETTINGS -> //enable location settings (it.resolvableApiException)
                LocationData.Status.LOCATION_SUCCESS -> // location is ready to use (it.location)
            }
        })

//Start observing
locationLiveData.start()

Dependency

maven { url 'https://jitpack.io' }
dependencies {
    implementation 'com.github.savepopulation:live-tools:v1.0.0'
}

Contributors:

Mert Şimşek
Efe Budak
Taylan Sbrcn
Aykut Asil

About

Live-Tools is a library project which aims to convert some Android features to LiveData

License:Apache License 2.0


Languages

Language:Kotlin 88.8%Language:Java 11.2%