From 1290d3c4dd07f2569085f9315479fb32727b111d Mon Sep 17 00:00:00 2001 From: davidoskky Date: Sat, 20 Aug 2022 12:40:38 +0200 Subject: [PATCH] Remove unused function --- .../android/utils/network/NetworkUtils.kt | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/network/NetworkUtils.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/network/NetworkUtils.kt index 4463626..3ed5c53 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/network/NetworkUtils.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/network/NetworkUtils.kt @@ -1,51 +1,13 @@ package bou.amine.apps.readerforselfossv2.android.utils.network import android.content.Context -import android.graphics.Color import android.net.ConnectivityManager import android.net.NetworkCapabilities import android.os.Build -import android.view.View -import android.widget.TextView -import bou.amine.apps.readerforselfossv2.android.R import com.google.android.material.snackbar.Snackbar -var snackBarShown = false -var view: View? = null lateinit var s: Snackbar -fun Context.isNetworkAvailable( - v: View? = null, - overrideOffline: Boolean = false -): Boolean { - val networkIsAccessible = isNetworkAccessible(this) - - if (v != null && (!networkIsAccessible || overrideOffline) && (!snackBarShown || v != view)) { - view = v - s = Snackbar - .make( - v, - R.string.no_network_connectivity, - Snackbar.LENGTH_INDEFINITE - ) - - s.setAction(android.R.string.ok) { - snackBarShown = false - s.dismiss() - } - - val view = s.view - val tv: TextView = view.findViewById(com.google.android.material.R.id.snackbar_text) - tv.setTextColor(Color.WHITE) - s.show() - snackBarShown = true - } - if (snackBarShown && networkIsAccessible && !overrideOffline) { - s.dismiss() - } - return if(overrideOffline) overrideOffline else networkIsAccessible -} - fun isNetworkAccessible(context: Context): Boolean { val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager