From f7a2507e797d4da5c1093a25ad59db0f5f935410 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 10 Jul 2021 20:37:33 -0400 Subject: [PATCH] Add section headers to wifi ap config dialog --- mobile/build.gradle.kts | 2 +- .../net/wifi/WifiApDialogFragment.kt | 31 +- mobile/src/main/res/layout/dialog_wifi_ap.xml | 320 ++++++++++-------- mobile/src/main/res/values-zh-rCN/strings.xml | 2 + mobile/src/main/res/values/strings.xml | 2 + mobile/src/main/res/values/styles.xml | 11 + 6 files changed, 206 insertions(+), 162 deletions(-) diff --git a/mobile/build.gradle.kts b/mobile/build.gradle.kts index 836bce8e..ac996760 100644 --- a/mobile/build.gradle.kts +++ b/mobile/build.gradle.kts @@ -83,7 +83,7 @@ dependencies { implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") implementation("com.android.billingclient:billing-ktx:4.0.0") implementation("com.google.android.gms:play-services-oss-licenses:17.0.0") - implementation("com.google.android.material:material:1.4.0") + implementation("com.google.android.material:material:1.5.0-alpha01") implementation("com.google.firebase:firebase-analytics-ktx:19.0.0") implementation("com.google.firebase:firebase-crashlytics:18.1.0") implementation("com.google.zxing:core:3.4.1") diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt index 2307253c..4a280766 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt @@ -177,31 +177,24 @@ class WifiApDialogFragment : AlertDialogFragment= 23 || arg.p2pMode) { dialogView.band2G.configure(channels2G) dialogView.band5G.configure(currentChannels5G) - } else { - dialogView.bandWrapper2G.isGone = true - dialogView.bandWrapper5G.isGone = true - } - if (Build.VERSION.SDK_INT >= 30 && !arg.p2pMode) dialogView.band6G.configure(channels6G) - else dialogView.bandWrapper6G.isGone = true - if (BuildCompat.isAtLeastS() && !arg.p2pMode) dialogView.band60G.configure(channels60G) - else dialogView.bandWrapper60G.isGone = true - dialogView.bssid.addTextChangedListener(this@WifiApDialogFragment) - if (arg.p2pMode) dialogView.hiddenSsid.isGone = true - if (arg.p2pMode || Build.VERSION.SDK_INT < 30) { - dialogView.maxClientWrapper.isGone = true - dialogView.clientUserControl.isGone = true - dialogView.blockedListWrapper.isGone = true - dialogView.allowedListWrapper.isGone = true - } else { + if (Build.VERSION.SDK_INT >= 30 && !arg.p2pMode) dialogView.band6G.configure(channels6G) + else dialogView.bandWrapper6G.isGone = true + if (BuildCompat.isAtLeastS() && !arg.p2pMode) dialogView.band60G.configure(channels60G) else { + dialogView.bandWrapper60G.isGone = true + dialogView.bridgedMode.isGone = true + dialogView.bridgedModeOpportunisticShutdown.isGone = true + } + } else dialogView.bandGroup.isGone = true + if (!arg.p2pMode && Build.VERSION.SDK_INT >= 30) { dialogView.maxClient.addTextChangedListener(this@WifiApDialogFragment) dialogView.blockedList.addTextChangedListener(this@WifiApDialogFragment) dialogView.allowedList.addTextChangedListener(this@WifiApDialogFragment) - } + } else dialogView.accessControlGroup.isGone = true + dialogView.bssid.addTextChangedListener(this@WifiApDialogFragment) + if (arg.p2pMode) dialogView.hiddenSsid.isGone = true if (arg.p2pMode && Build.VERSION.SDK_INT >= 29) dialogView.macRandomization.isEnabled = false else if (arg.p2pMode || !BuildCompat.isAtLeastS()) dialogView.macRandomization.isGone = true if (arg.p2pMode || !BuildCompat.isAtLeastS()) { - dialogView.bridgedMode.isGone = true - dialogView.bridgedModeOpportunisticShutdown.isGone = true dialogView.ieee80211ax.isGone = true dialogView.userConfig.isGone = true } diff --git a/mobile/src/main/res/layout/dialog_wifi_ap.xml b/mobile/src/main/res/layout/dialog_wifi_ap.xml index 650b82a5..cff941e6 100644 --- a/mobile/src/main/res/layout/dialog_wifi_ap.xml +++ b/mobile/src/main/res/layout/dialog_wifi_ap.xml @@ -121,15 +121,25 @@ android:inputType="number" android:maxLength="19" /> + + + - - + + + + + + + + + + + + - + + + + + android:text="@string/wifi_client_user_control" /> + + + + + + + + + + + + - + android:text="@string/wifi_mac_randomization" /> + + + - - - - - - - - - - - - - - - - - - - diff --git a/mobile/src/main/res/values-zh-rCN/strings.xml b/mobile/src/main/res/values-zh-rCN/strings.xml index fb3af0f6..1e7be6c6 100644 --- a/mobile/src/main/res/values-zh-rCN/strings.xml +++ b/mobile/src/main/res/values-zh-rCN/strings.xml @@ -185,6 +185,8 @@ "5 GHz 频段" 6 GHz 频段 60 GHz 频段 + 访问控制 + 高级接入点设置 "MAC 地址" "隐藏的网络" 允许连接设备数上限 diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml index fe9c1dbd..0fbfb5fc 100644 --- a/mobile/src/main/res/values/strings.xml +++ b/mobile/src/main/res/values/strings.xml @@ -208,6 +208,8 @@ 5 GHz Band 6 GHz Band 60 GHz Band + Access Control + Advanced AP Options MAC address Hidden network Maximum number of clients diff --git a/mobile/src/main/res/values/styles.xml b/mobile/src/main/res/values/styles.xml index 013d57fa..8f249d97 100644 --- a/mobile/src/main/res/values/styles.xml +++ b/mobile/src/main/res/values/styles.xml @@ -43,5 +43,16 @@ 4dip 18sp + +