fixed locale selection in autoplay mode

This commit is contained in:
fmittag committed 2014-10-14 13:33:29 +02:00
1 parent 1d4a5a2dc0
commit 2632613c89
1 file changed
+7 -1
@@ -65,10 +65,16 @@ public class DesktopStartView extends Composite implements StartView {
eventSelectionBox = new ListBox(false); eventSelectionBox = new ListBox(false);
leaderboardSelectionBox = new ListBox(false); leaderboardSelectionBox = new ListBox(false);
localeSelectionBox = new ListBox(false); localeSelectionBox = new ListBox(false);
LocaleInfo currentLocale = LocaleInfo.getCurrentLocale();
int i = 0;
for (String localeName : LocaleInfo.getAvailableLocaleNames()) { for (String localeName : LocaleInfo.getAvailableLocaleNames()) {
if(!localeName.equals("default")) { if(!localeName.equals("default")) {
String displayName = LocaleInfo.getLocaleNativeDisplayName(localeName); String displayName = LocaleInfo.getLocaleNativeDisplayName(localeName);
localeSelectionBox.addItem(displayName); localeSelectionBox.addItem(displayName);
if(currentLocale.getLocaleName().equals(localeName)) {
localeSelectionBox.setSelectedIndex(i);
}
i++;
} }
} }
@@ -155,7 +161,7 @@ public class DesktopStartView extends Composite implements StartView {
private String getSelectedLocale() { private String getSelectedLocale() {
String result = null; String result = null;
int selectedIndex = localeSelectionBox.getSelectedIndex(); int selectedIndex = localeSelectionBox.getSelectedIndex();
if(selectedIndex > 0) { if(selectedIndex >= 0) {
String selectedLocale = localeSelectionBox.getItemText(selectedIndex); String selectedLocale = localeSelectionBox.getItemText(selectedIndex);
for (String localeName : LocaleInfo.getAvailableLocaleNames()) { for (String localeName : LocaleInfo.getAvailableLocaleNames()) {
if(!localeName.equals("default")) { if(!localeName.equals("default")) {