Use some more KTX and Compat stuff (#3933)

* Use more KTX extensions

* Update Android Studio

* Use more Compat classes
This commit is contained in:
Taco
2020-10-12 16:46:25 -04:00
committed by GitHub
parent a689e4e041
commit 60755d0c26
29 changed files with 68 additions and 108 deletions
@@ -7,9 +7,9 @@ import android.content.Intent
import android.net.ConnectivityManager
import android.net.NetworkInfo.State.CONNECTED
import android.net.NetworkInfo.State.DISCONNECTED
import android.os.Build
import android.os.IBinder
import android.os.PowerManager
import androidx.core.content.ContextCompat
import com.github.pwittchen.reactivenetwork.library.Connectivity
import com.github.pwittchen.reactivenetwork.library.ReactiveNetwork
import com.jakewharton.rxrelay.BehaviorRelay
@@ -47,11 +47,7 @@ class DownloadService : Service() {
*/
fun start(context: Context) {
val intent = Intent(context, DownloadService::class.java)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
context.startService(intent)
} else {
context.startForegroundService(intent)
}
ContextCompat.startForegroundService(context, intent)
}
/**