Merge branch 'v3' into q-beta
This commit is contained in:
@@ -4,7 +4,6 @@ import android.annotation.TargetApi
|
|||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.net.wifi.WifiConfiguration
|
import android.net.wifi.WifiConfiguration
|
||||||
import android.net.wifi.WifiConfiguration.AuthAlgorithm
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
@@ -21,6 +20,7 @@ import androidx.core.view.isGone
|
|||||||
import be.mygod.vpnhotspot.AlertDialogFragment
|
import be.mygod.vpnhotspot.AlertDialogFragment
|
||||||
import be.mygod.vpnhotspot.App.Companion.app
|
import be.mygod.vpnhotspot.App.Companion.app
|
||||||
import be.mygod.vpnhotspot.R
|
import be.mygod.vpnhotspot.R
|
||||||
|
import be.mygod.vpnhotspot.RepeaterService
|
||||||
import be.mygod.vpnhotspot.util.QRCodeDialog
|
import be.mygod.vpnhotspot.util.QRCodeDialog
|
||||||
import be.mygod.vpnhotspot.util.toByteArray
|
import be.mygod.vpnhotspot.util.toByteArray
|
||||||
import be.mygod.vpnhotspot.util.toParcelable
|
import be.mygod.vpnhotspot.util.toParcelable
|
||||||
@@ -79,7 +79,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
|||||||
SSID = dialogView.ssid.text.toString()
|
SSID = dialogView.ssid.text.toString()
|
||||||
allowedKeyManagement.set(
|
allowedKeyManagement.set(
|
||||||
if (arg.p2pMode) WifiConfiguration.KeyMgmt.WPA_PSK else dialogView.security.selectedItemPosition)
|
if (arg.p2pMode) WifiConfiguration.KeyMgmt.WPA_PSK else dialogView.security.selectedItemPosition)
|
||||||
allowedAuthAlgorithms.set(AuthAlgorithm.OPEN)
|
allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN)
|
||||||
if (dialogView.password.length() != 0) preSharedKey = dialogView.password.text.toString()
|
if (dialogView.password.length() != 0) preSharedKey = dialogView.password.text.toString()
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
val bandOption = dialogView.band.selectedItem as BandOption
|
val bandOption = dialogView.band.selectedItem as BandOption
|
||||||
@@ -111,7 +111,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!arg.readOnly) dialogView.password.addTextChangedListener(this@WifiApDialogFragment)
|
if (!arg.readOnly) dialogView.password.addTextChangedListener(this@WifiApDialogFragment)
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23 || arg.p2pMode) dialogView.band.apply {
|
||||||
bandOptions = mutableListOf<BandOption>().apply {
|
bandOptions = mutableListOf<BandOption>().apply {
|
||||||
if (arg.p2pMode) {
|
if (arg.p2pMode) {
|
||||||
add(BandOption.BandAny)
|
add(BandOption.BandAny)
|
||||||
@@ -126,11 +126,13 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
|||||||
}
|
}
|
||||||
addAll(channels)
|
addAll(channels)
|
||||||
}
|
}
|
||||||
dialogView.band.adapter = ArrayAdapter(activity, android.R.layout.simple_spinner_item, 0,
|
adapter = ArrayAdapter(activity, android.R.layout.simple_spinner_item, 0, bandOptions).apply {
|
||||||
bandOptions).apply {
|
|
||||||
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
}
|
}
|
||||||
} else dialogView.band_wrapper.isGone = true
|
if (Build.VERSION.SDK_INT < 23) {
|
||||||
|
setSelection(bandOptions.indexOfFirst { it.apChannel == RepeaterService.operatingChannel })
|
||||||
|
}
|
||||||
|
}
|
||||||
populateFromConfiguration(arg.configuration)
|
populateFromConfiguration(arg.configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,4 +196,11 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
|||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onClick(dialog: DialogInterface?, which: Int) {
|
||||||
|
super.onClick(dialog, which)
|
||||||
|
if (Build.VERSION.SDK_INT < 23 && which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
|
RepeaterService.operatingChannel = (dialogView.band.selectedItem as BandOption).apChannel
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<layout
|
<layout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<data>
|
<data>
|
||||||
<import type="android.view.View"/>
|
|
||||||
<variable
|
<variable
|
||||||
name="data"
|
name="data"
|
||||||
type="be.mygod.vpnhotspot.manage.ManageBar.Data"/>
|
type="be.mygod.vpnhotspot.manage.ManageBar.Data"/>
|
||||||
@@ -42,7 +41,7 @@
|
|||||||
android:id="@+id/offloadEnabled"
|
android:id="@+id/offloadEnabled"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="@{data.offloadEnabled ? View.VISIBLE : View.GONE}"
|
android:visibility="@{data.offloadEnabled}"
|
||||||
android:text="@string/tethering_manage_offload_enabled"/>
|
android:text="@string/tethering_manage_offload_enabled"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user