check empty names
This commit is contained in:
parent
d28db41782
commit
17efdcafa2
|
@ -42,7 +42,7 @@ public class HSDataDialog extends DialogFragment {
|
|||
((EditText) dialog_view.findViewById(R.id.hsOnionPort)).getText().toString()
|
||||
);
|
||||
|
||||
if (checkInput(localPort, onionPort)) {
|
||||
if (checkInput(serverName, localPort, onionPort)) {
|
||||
saveData(serverName, localPort, onionPort);
|
||||
serviceDataDialog.dismiss();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class HSDataDialog extends DialogFragment {
|
|||
return serviceDataDialog;
|
||||
}
|
||||
|
||||
private boolean checkInput(Integer local, Integer remote) {
|
||||
private boolean checkInput(String serverName, Integer local, Integer remote) {
|
||||
boolean is_ok = true;
|
||||
Integer error_msg = 0;
|
||||
|
||||
|
@ -68,6 +68,11 @@ public class HSDataDialog extends DialogFragment {
|
|||
is_ok = false;
|
||||
}
|
||||
|
||||
if (serverName == null || serverName.length() < 1) {
|
||||
error_msg = R.string.name_can_t_be_empty;
|
||||
is_ok = false;
|
||||
}
|
||||
|
||||
if (!is_ok) {
|
||||
Toast.makeText(getContext(), error_msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
|
|
@ -349,4 +349,5 @@
|
|||
<string name="permission_denied">Permission denied</string>
|
||||
<string name="restore_backup">Restore Backup</string>
|
||||
<string name="create_a_backup_first">Create a backup first</string>
|
||||
<string name="name_can_t_be_empty">Name can't be empty</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue