Skip to content
Snippets Groups Projects
Commit d31eecef authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko
Browse files

#422 added regex

parent d447a33d
Branches
Tags
No related merge requests found
......@@ -61,6 +61,8 @@ public class UserMenu extends AbstractMenu {
private static final int SYNC_REQUEST_DIALOG_MAXIMUM_LENGTH = 36;
private static final float SYNC_DIALOG_TITLE_PAD = 0.15f;
private static final float SYNC_DIALOG_TEXT_FIELD_PAD = 0.05f;
public static final String CODE_REGEX = "(([0-9]|[a-f]){8})-(([0-9]|[a-f]){4})-(([0-9]|[a-f]){4})-(([0-9]|[a-f]){4})-(([0-9]|[a-f]){12})$";
private List<User> users;
......@@ -166,14 +168,16 @@ public class UserMenu extends AbstractMenu {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
DownloadUser syncWork = new DownloadUser(textFiledDialogComponent.getText());
syncWork.registerListener(new SyncWork.RestSyncListener() {
@Override
public void onSuccess(User user) {
ApplicationBus.getInstance().post(new RefreshUserMenu()).asynchronously();
}
});
RestSynchronizationService.doSyncWork(syncWork);
if (textFiledDialogComponent.getText().length()>0 && textFiledDialogComponent.getText().toLowerCase().matches(CODE_REGEX)) {
DownloadUser syncWork = new DownloadUser(textFiledDialogComponent.getText());
syncWork.registerListener(new SyncWork.RestSyncListener() {
@Override
public void onSuccess(User user) {
ApplicationBus.getInstance().post(new RefreshUserMenu()).asynchronously();
}
});
RestSynchronizationService.doSyncWork(syncWork);
}
//Prevents keyboard getting stuck
Gdx.input.setOnscreenKeyboardVisible(false);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment