mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-01 15:23:54 +01:00
feat:Removed Unnecessary imports
This commit is contained in:
parent
b99f3006bf
commit
baaa0d86c8
1 changed files with 0 additions and 36 deletions
|
|
@ -2,11 +2,6 @@ package fr.free.nrw.commons.feedback
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.ConnectivityManager
|
|
||||||
import android.net.Network
|
|
||||||
import android.net.NetworkCapabilities
|
|
||||||
import android.net.NetworkInfo
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
|
|
@ -70,37 +65,6 @@ class FeedbackDialog(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is to check whether internet connection is available or not
|
|
||||||
*/
|
|
||||||
fun isInternetConnectionAvailable(context: Context): Boolean {
|
|
||||||
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
val activeNetwork: Network? = connectivityManager.activeNetwork
|
|
||||||
val networkCapabilities = connectivityManager.getNetworkCapabilities(activeNetwork)
|
|
||||||
|
|
||||||
return if (networkCapabilities != null) {
|
|
||||||
val hasInternet = networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
|
||||||
val hasValidation = networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)
|
|
||||||
val downlinkBandwidth = networkCapabilities.linkDownstreamBandwidthKbps
|
|
||||||
val uplinkBandwidth = networkCapabilities.linkUpstreamBandwidthKbps
|
|
||||||
val isBandwidthSufficient = downlinkBandwidth >= 150 && uplinkBandwidth >= 100
|
|
||||||
|
|
||||||
hasInternet && hasValidation && isBandwidthSufficient
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
val activeNetworkInfo: NetworkInfo? = connectivityManager.activeNetworkInfo
|
|
||||||
return activeNetworkInfo != null && activeNetworkInfo.isConnected
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun submitFeedback() {
|
fun submitFeedback() {
|
||||||
if (binding.feedbackItemEditText.getText().toString() == "") {
|
if (binding.feedbackItemEditText.getText().toString() == "") {
|
||||||
binding.feedbackItemEditText.error = context.getString(R.string.enter_description)
|
binding.feedbackItemEditText.error = context.getString(R.string.enter_description)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue