Fix lint and incorrect lifecycle owner
This commit is contained in:
@@ -31,14 +31,14 @@ class EBegFragment : AppCompatDialogFragment() {
|
||||
}.setListener(this).build().also { it.startConnection(this) }
|
||||
}
|
||||
|
||||
override fun onBillingSetupFinished(billingResult: BillingResult?) {
|
||||
if (billingResult?.responseCode == BillingClient.BillingResponseCode.OK) {
|
||||
override fun onBillingSetupFinished(billingResult: BillingResult) {
|
||||
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
|
||||
billingClient.queryPurchases(BillingClient.SkuType.INAPP).apply {
|
||||
if (responseCode == BillingClient.BillingResponseCode.OK) {
|
||||
onPurchasesUpdated(this.billingResult, purchasesList)
|
||||
}
|
||||
}
|
||||
} else Timber.e("onBillingSetupFinished: ${billingResult?.responseCode}")
|
||||
} else Timber.e("onBillingSetupFinished: ${billingResult.responseCode}")
|
||||
}
|
||||
|
||||
override fun onBillingServiceDisconnected() {
|
||||
@@ -46,11 +46,11 @@ class EBegFragment : AppCompatDialogFragment() {
|
||||
billingClient.startConnection(this)
|
||||
}
|
||||
|
||||
override fun onPurchasesUpdated(billingResult: BillingResult?, purchases: MutableList<Purchase>?) {
|
||||
if (billingResult?.responseCode == BillingClient.BillingResponseCode.OK && purchases != null) {
|
||||
override fun onPurchasesUpdated(billingResult: BillingResult, purchases: MutableList<Purchase>?) {
|
||||
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK && purchases != null) {
|
||||
// directly consume in-app purchase, so that people can donate multiple times
|
||||
purchases.filter { it.purchaseState == Purchase.PurchaseState.PURCHASED }.map(this::consumePurchase)
|
||||
} else Timber.e("onPurchasesUpdated: ${billingResult?.responseCode}")
|
||||
} else Timber.e("onPurchasesUpdated: ${billingResult.responseCode}")
|
||||
}
|
||||
|
||||
private fun consumePurchase(purchase: Purchase) = GlobalScope.launch(Dispatchers.Main.immediate) {
|
||||
|
||||
@@ -241,6 +241,7 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene
|
||||
if (!safeMode && key == KEY_OPERATING_CHANNEL) setOperatingChannel()
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi") // networkId is available since Android 4.2
|
||||
private fun onPersistentGroupsChanged() {
|
||||
val channel = channel ?: return
|
||||
val device = binder.thisDevice ?: return
|
||||
|
||||
@@ -109,10 +109,11 @@ class ClientsFragment : Fragment() {
|
||||
"▲ ${Formatter.formatFileSize(app, send)}/s\t\t▼ ${Formatter.formatFileSize(app, receive)}/s"
|
||||
}
|
||||
|
||||
private inner class ClientViewHolder(val binding: ListitemClientBinding) : RecyclerView.ViewHolder(binding.root),
|
||||
View.OnClickListener, PopupMenu.OnMenuItemClickListener {
|
||||
private inner class ClientViewHolder(parent: ViewGroup, val binding: ListitemClientBinding =
|
||||
ListitemClientBinding.inflate(LayoutInflater.from(parent.context), parent, false)) :
|
||||
RecyclerView.ViewHolder(binding.root), View.OnClickListener, PopupMenu.OnMenuItemClickListener {
|
||||
init {
|
||||
binding.lifecycleOwner = binding.root.findViewTreeLifecycleOwner()
|
||||
binding.lifecycleOwner = parent.findViewTreeLifecycleOwner()!!
|
||||
binding.root.setOnClickListener(this)
|
||||
binding.description.movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
@@ -178,9 +179,7 @@ class ClientsFragment : Fragment() {
|
||||
binding.swipeRefresher.isRefreshing = false
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
|
||||
ClientViewHolder(ListitemClientBinding.inflate(LayoutInflater.from(parent.context), parent, false))
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ClientViewHolder(parent)
|
||||
override fun onBindViewHolder(holder: ClientViewHolder, position: Int) {
|
||||
val client = getItem(position)
|
||||
holder.binding.client = client
|
||||
|
||||
@@ -59,8 +59,8 @@ enum class TetherType(@DrawableRes val icon: Int) {
|
||||
}
|
||||
|
||||
@RequiresApi(30)
|
||||
override fun onTetherableInterfaceRegexpsChanged() {
|
||||
Timber.i("onTetherableInterfaceRegexpsChanged")
|
||||
override fun onTetherableInterfaceRegexpsChanged(args: Array<out Any?>?) {
|
||||
Timber.i("onTetherableInterfaceRegexpsChanged: ${args?.contentToString()}")
|
||||
TetheringManager.unregisterTetheringEventCallback(this)
|
||||
requiresUpdate = true
|
||||
listener()
|
||||
|
||||
@@ -333,7 +333,7 @@ object TetheringManager {
|
||||
* *@param reg The new regular expressions.
|
||||
* @hide
|
||||
*/
|
||||
fun onTetherableInterfaceRegexpsChanged() {}
|
||||
fun onTetherableInterfaceRegexpsChanged(args: Array<out Any?>?) {}
|
||||
|
||||
/**
|
||||
* Called when there was a change in the list of tetherable interfaces. Tetherable
|
||||
@@ -437,7 +437,7 @@ object TetheringManager {
|
||||
callback?.onUpstreamChanged(args!![0] as Network?)
|
||||
}
|
||||
"onTetherableInterfaceRegexpsChanged" -> {
|
||||
if (regexpsSent) callback?.onTetherableInterfaceRegexpsChanged()
|
||||
if (regexpsSent) callback?.onTetherableInterfaceRegexpsChanged(args)
|
||||
regexpsSent = true
|
||||
}
|
||||
"onTetherableInterfacesChanged" -> {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package be.mygod.vpnhotspot.net.wifi
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.net.MacAddress
|
||||
import android.net.wifi.SoftApConfiguration
|
||||
@@ -237,6 +238,7 @@ data class SoftApConfigurationCompat(
|
||||
* https://android.googlesource.com/platform/packages/apps/Settings/+/android-5.0.0_r1/src/com/android/settings/wifi/WifiApDialog.java#88
|
||||
* https://android.googlesource.com/platform/packages/apps/Settings/+/b1af85d/src/com/android/settings/wifi/tether/WifiTetherSettings.java#162
|
||||
*/
|
||||
@SuppressLint("NewApi") // https://android.googlesource.com/platform/frameworks/base/+/android-5.0.0_r1/wifi/java/android/net/wifi/WifiConfiguration.java#1385
|
||||
@Deprecated("Class deprecated in framework")
|
||||
@Suppress("DEPRECATION")
|
||||
fun toWifiConfiguration(): android.net.wifi.WifiConfiguration {
|
||||
|
||||
Reference in New Issue
Block a user