|
@@ -14,11 +14,13 @@ import javax.inject.Inject;
|
|
import javax.inject.Named;
|
|
import javax.inject.Named;
|
|
import javax.inject.Singleton;
|
|
import javax.inject.Singleton;
|
|
|
|
|
|
-import org.apache.commons.lang3.CharUtils;
|
|
|
|
import org.apache.commons.lang3.SystemUtils;
|
|
import org.apache.commons.lang3.SystemUtils;
|
|
import org.cryptomator.common.settings.Settings;
|
|
import org.cryptomator.common.settings.Settings;
|
|
import org.cryptomator.ui.settings.Localization;
|
|
import org.cryptomator.ui.settings.Localization;
|
|
|
|
|
|
|
|
+import com.google.common.base.CharMatcher;
|
|
|
|
+import com.google.common.base.Strings;
|
|
|
|
+
|
|
import javafx.beans.binding.Bindings;
|
|
import javafx.beans.binding.Bindings;
|
|
import javafx.event.ActionEvent;
|
|
import javafx.event.ActionEvent;
|
|
import javafx.fxml.FXML;
|
|
import javafx.fxml.FXML;
|
|
@@ -34,6 +36,8 @@ import javafx.scene.layout.VBox;
|
|
@Singleton
|
|
@Singleton
|
|
public class SettingsController implements ViewController {
|
|
public class SettingsController implements ViewController {
|
|
|
|
|
|
|
|
+ private static final CharMatcher DIGITS_MATCHER = CharMatcher.inRange('0', '9');
|
|
|
|
+
|
|
private final Localization localization;
|
|
private final Localization localization;
|
|
private final Settings settings;
|
|
private final Settings settings;
|
|
private final Optional<String> applicationVersion;
|
|
private final Optional<String> applicationVersion;
|
|
@@ -130,11 +134,7 @@ public class SettingsController implements ViewController {
|
|
}
|
|
}
|
|
|
|
|
|
private void filterNumericKeyEvents(KeyEvent t) {
|
|
private void filterNumericKeyEvents(KeyEvent t) {
|
|
- if (t.getCharacter() == null || t.getCharacter().length() == 0) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- char c = CharUtils.toChar(t.getCharacter());
|
|
|
|
- if (!(CharUtils.isAsciiNumeric(c) || c == '_')) {
|
|
|
|
|
|
+ if (!Strings.isNullOrEmpty(t.getCharacter()) && !DIGITS_MATCHER.matchesAllOf(t.getCharacter())) {
|
|
t.consume();
|
|
t.consume();
|
|
}
|
|
}
|
|
}
|
|
}
|