Refine WifiApDialog

This commit is contained in:
Mygod
2020-06-28 06:49:03 +08:00
parent 6095185edf
commit a13a37a822
2 changed files with 10 additions and 4 deletions

View File

@@ -190,9 +190,9 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
dialogView.passwordWrapper.error = if (passwordValid) null else { dialogView.passwordWrapper.error = if (passwordValid) null else {
requireContext().getString(R.string.credentials_password_too_short) requireContext().getString(R.string.credentials_password_too_short)
} }
dialogView.bssidWrapper.error = null
val bssidValid = dialogView.bssid.length() == 0 || try { val bssidValid = dialogView.bssid.length() == 0 || try {
MacAddressCompat.fromString(dialogView.bssid.text.toString()) MacAddressCompat.fromString(dialogView.bssid.text.toString())
dialogView.bssidWrapper.error = null
true true
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
dialogView.bssidWrapper.error = e.readableMessage dialogView.bssidWrapper.error = e.readableMessage

View File

@@ -43,14 +43,16 @@
android:id="@+id/ssid_wrapper" android:id="@+id/ssid_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/wifi_ssid"> android:hint="@string/wifi_ssid"
app:counterEnabled="true"
app:counterMaxLength="32"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/ssid" android:id="@+id/ssid"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/wifi_item_edit_content" style="@style/wifi_item_edit_content"
android:inputType="textMultiLine|textNoSuggestions" android:inputType="textMultiLine|textNoSuggestions" />
android:maxLength="32" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<LinearLayout <LinearLayout
android:id="@+id/security_wrapper" android:id="@+id/security_wrapper"
@@ -76,6 +78,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dip" android:layout_marginTop="8dip"
android:hint="@string/wifi_password" android:hint="@string/wifi_password"
app:counterEnabled="true"
app:counterMaxLength="63"
app:passwordToggleEnabled="true" app:passwordToggleEnabled="true"
app:errorEnabled="true"> app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
@@ -112,6 +116,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dip" android:layout_marginTop="8dip"
app:counterEnabled="true"
app:counterMaxLength="17"
android:hint="BSSID"> android:hint="BSSID">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/bssid" android:id="@+id/bssid"