2020-05-14 20:14:41 +02:00
|
|
|
package com.h.pixeldroid.utils
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.net.ConnectivityManager
|
|
|
|
|
|
|
|
class Utils {
|
|
|
|
companion object {
|
|
|
|
fun hasInternet(context: Context): Boolean {
|
|
|
|
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
|
|
|
return cm.activeNetwork != null
|
|
|
|
}
|
|
|
|
|
2020-05-19 09:49:34 +02:00
|
|
|
fun normalizeDomain(domain: String): String {
|
|
|
|
return "https://" + domain
|
|
|
|
.replace("http://", "")
|
|
|
|
.replace("https://", "")
|
|
|
|
.trim(Char::isWhitespace)
|
|
|
|
}
|
|
|
|
|
2020-05-14 20:14:41 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|