Commit 3d5fb9d9 authored by Matyáš Latner's avatar Matyáš Latner

Victory dialog speed optimization

parent d2836a86
......@@ -30,6 +30,7 @@ android/gen/
*.iml
out/
com_crashlytics_export_strings.xml
captures
## Eclipse
.classpath
......
......@@ -980,7 +980,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
);
List<ITrophyDefinition> received = new ArrayList<ITrophyDefinition>();
for (ITrophyDefinition trophy : allTrophies) {
if ((!hasTrophies.containsKey(trophy) || hasTrophies.get(trophy) == false) && trophy.hasTrophy(getSelectedUser()) == true) {
if ((!hasTrophies.containsKey(trophy) || !hasTrophies.get(trophy)) && trophy.hasTrophy(getSelectedUser())) {
Log.debug(this.getClass(), "has new trophy: " + trophy.getTrophyName());
received.add(trophy);
}
......
......@@ -29,8 +29,10 @@ import cz.nic.tablexia.util.Log;
*/
public class GameDAO {
private static final Object ATOMIC_LOCK = new Object();
private static final AtomicInteger gameScoreSetCounter = new AtomicInteger(0);
private static final Object ATOMIC_LOCK = new Object();
private static final String STRING_ONLY_DIGITS_REGEX = "[0-9]+";
private static final AtomicInteger gameScoreSetCounter = new AtomicInteger(0);
//////////////////////////// Game API
......@@ -172,10 +174,8 @@ public class GameDAO {
}
private static Long prepareLong(String longNumber) {
if (longNumber != null) {
if (new Scanner(longNumber).hasNextLong()) {
return Long.valueOf(longNumber);
}
if (longNumber != null && longNumber.matches(STRING_ONLY_DIGITS_REGEX)) {
return Long.valueOf(longNumber);
}
return null;
}
......
Markdown is supported
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