Commit 80814e17 authored by Matyáš Latner's avatar Matyáš Latner

#653 Workspace clean-up after merge. Fixed copyrights

parent 5b121044
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
......
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.shared.model;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
*
* @author Frantisek Simon <frantisek.simon@nic.cz>
*/
public class Game {
public static final int DEFAULT_GAME_LOCALE = -1;
public static final String DEFAULT_APPLICATION_VERSION_NAME = "UNKNOWN";
public static final int DEFAULT_APPLICATION_VERSION_CODE = -1;
public static final String DEFAULT_MODEL_VERSION_NAME = "UNKNOWN";
public static final int DEFAULT_MODE_VERSION_CODE = -1;
public static final int DEFAULT_BUILD_TYPE = -1;
public static final int DEFAULT_PLATFORM = -1;
public static final int BACK_COMPATIBILITY_321_RANK_SYSTEM_VERSION_CODE = 1;
private static final String DATE_AND_TIME_FORMAT = "d.M.yyyy HH:mm:ss", DATE_FORMAT = "d.M.yyyy";
private long id;
private User user;
private int gameDifficulty;
private int gameNumber;
private int gameLocale;
private Long randomSeed;
private Long startTime;
private Long endTime;
private String applicationVersionName;
private int applicationVersionCode;
private String modelVersionName;
private int modelVersionCode;
private Integer rankSystemVersionCode;
private int buildType;
private int platform;
private String hwSerialNumber;
private List<GameScore> gameScoreMap;
private List<GamePause> gamePauses;
// needed for JSON de/serialization
public Game() {
}
public Game(Long id, User user, int difficulty, int gameNumber, Long random, Long startTime, Long endTime, int gameLocale, String applicationVersionName, Integer applicationVersionCode, String modelVersionName, Integer modelVersionCode, Integer buildType, Integer platform, String hwSerialNumber, Integer rankSystemVersionCode) {
this.id = id;
this.user = user;
this.gameDifficulty = difficulty;
this.gameNumber = gameNumber;
this.gameLocale = gameLocale;
this.randomSeed = random;
this.startTime = startTime;
this.endTime = endTime;
this.applicationVersionName = applicationVersionName == null ? DEFAULT_APPLICATION_VERSION_NAME : applicationVersionName;
this.applicationVersionCode = applicationVersionCode == null ? DEFAULT_APPLICATION_VERSION_CODE : applicationVersionCode;
this.modelVersionName = modelVersionName == null ? DEFAULT_MODEL_VERSION_NAME : modelVersionName;
this.modelVersionCode = modelVersionCode == null ? DEFAULT_MODE_VERSION_CODE : modelVersionCode;
this.buildType = buildType == null ? DEFAULT_BUILD_TYPE : buildType;
this.platform = platform == null ? DEFAULT_PLATFORM : platform;
this.rankSystemVersionCode = rankSystemVersionCode;
this.hwSerialNumber = hwSerialNumber;
gameScoreMap = new ArrayList<GameScore>();
gamePauses = new ArrayList<GamePause>();
}
public long getId() {
return id;
}
public User getUser() {
return user;
}
public int getGameDifficulty() {
return gameDifficulty;
}
public int getGameNumber() {
return gameNumber;
}
public int getGameLocale() {
return gameLocale;
}
public List<GameScore> getGameScoreMap() {
return gameScoreMap;
}
public List<GamePause> getGamePauses() {
return gamePauses;
}
public String getApplicationVersionName() {
return applicationVersionName;
}
public int getApplicationVersionCode() {
return applicationVersionCode;
}
public String getModelVersionName() {
return modelVersionName;
}
public int getModelVersionCode() {
return modelVersionCode;
}
public int getBuildType() {
return buildType;
}
public int getPlatform() {
return platform;
}
public String getHwSerialNumber() {
return hwSerialNumber;
}
public long getRandomSeed() {
return randomSeed;
}
public void setGamePauses(List<GamePause> gamePauses) {
this.gamePauses = gamePauses;
}
public void setGameScoreMap(List<GameScore> gameScoreMap) {
this.gameScoreMap = gameScoreMap;
}
public Long getGameStartTime() {
return startTime != null ? startTime : 0;
}
public String getGameStartDate(boolean dateAndTime) {
if (startTime == null) return "";
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(startTime);
SimpleDateFormat sdf;
if (dateAndTime) {
sdf = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
} else {
sdf = new SimpleDateFormat(DATE_FORMAT);
}
return sdf.format(cal.getTime());
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public Long getStartTime() {
return startTime;
}
public Long getEndTime() {
return endTime;
}
public void setRankSystemVersionCode(Integer rankSystemVersionCode) {
this.rankSystemVersionCode = rankSystemVersionCode;
}
public Integer getRankSystemVersionCode() {
return rankSystemVersionCode;
}
public boolean isStarted() {
return startTime != null;
}
public boolean isFinished() {
return endTime != null;
}
public GameScore getGameScore(String key) {
for (GameScore score : getGameScoreMap()) {
if (score.getKey().equals(key)) {
return score;
}
}
return null;
}
public String getGameScoreValue(String key) {
GameScore score = getGameScore(key);
if (score == null) {
return null;
}
return score.getValue();
}
public String getGameScore(String key, String defaultValue) {
GameScore gameScore = getGameScore(key);
return (gameScore != null && gameScore.getValue() != null) ? gameScore.getValue() : defaultValue;
}
@Override
public String toString() {
String output = "GAME[id: " + id + ", user: " + (user == null ? "unknown" : user.getName()) + ", difficulty: " + gameDifficulty + ", game: " + gameNumber + ", locale: " + gameLocale + ", random: " + randomSeed + ", start: " + startTime + ", end: " + endTime + "]";
output = output + " SCORE: [";
for (GameScore gameScore : gameScoreMap) {
output = output + " " + gameScore.getKey() + " : " + gameScore.getValue();
}
output = output + "]";
return output;
}
}
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.shared.model;
/**
*
* @author Frantisek Simon <frantisek.simon@nic.cz>
*/
public class GamePause {
private long id;
private Long startTime;
private Long endTime;
// needed for JSON de/serialization
public GamePause() {
}
public GamePause(Long id, Long startTime) {
this(id, startTime, null);
}
public GamePause(Long id, Long startTime, Long endTime) {
this.id = id;
this.startTime = startTime;
this.endTime = endTime;
}
public long getId() {
return id;
}
public Long getStartTime() {
return startTime;
}
public Long getEndTime() {
return endTime;
}
public boolean hasStartTime() {
return startTime != null;
}
public boolean hasEndTime() {
return endTime != null;
}
@Override
public String toString() {
return "GAME PAUSE[id: " + id + ", start: " + startTime + ", end: " + endTime + "]";
}
}
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.shared.model;
/**
*
* @author Frantisek Simon <frantisek.simon@nic.cz>
*/
public class GameScore {
private String key;
private String value;
// needed for JSON de/serialization
public GameScore() {
}
public GameScore(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
return String.format("key: %s, value: %s", key, value);
}
}
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.shared.model;
/**
* Created by danilov on 1/27/16.
*/
public class Screen {
private long id;
private long userId;
private String screenName;
private long time;
public Screen() {
}
public Screen(long id, long userId, String screenName, long time) {
this.id = id;
this.userId = userId;
this.screenName= screenName;
this.time = time;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getScreenName() {
return screenName;
}
public void setScreenName(String screenName) {
this.screenName = screenName;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Override
public String toString() {
return "SCREEN[User ID: " + userId + " Screen name: " + screenName+ " Time: " + time + "]";
}
}
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.shared.model;
import java.util.List;
/**
*
* @author Frantisek Simon <frantisek.simon@nic.cz>
*/
public class User {
public enum Gender {
FEMALE(0),
MALE(1);
private int genderId;
Gender(int genderId) {
this.genderId = genderId;
}
public int getGenderId() {
return genderId;
}
public static Gender getGenderForId(int genderId) {
for (Gender gender : Gender.values()) {
if (gender.genderId == genderId) {
return gender;
}
}
return null;
}
}
private Long id;
private String signature;
private int age;
private String name;
private String avatar;
private Gender gender;
private boolean deleted;
private boolean help;
private boolean intro;
private String uuid;
private List<Game> games;
private List<Screen> screens;
private List<UserDifficultySettings> difficultySettings;
// needed for JSON de/serialization
public User() {
}
public User(long id, String name, int age, Gender gender, String avatar, String signature, boolean deleted, boolean help, boolean intro) {
this.id = id;
this.name = name;
this.age = age;
this.gender = gender;
this.signature = signature;
this.avatar = avatar;
this.deleted = deleted;
this.help = help;
this.intro = intro;
}
public Long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public Gender getGender() {
return gender;
}
public void setGender(Gender gender) {
this.gender = gender;
}
public boolean isDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
public boolean isHelp() {
return help;
}
public void setHelp(boolean help) {
this.help = help;
}
public boolean isIntro() {
return intro;
}
public void setIntro(boolean intro) {
this.intro = intro;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public List<Game> getGames() {
return games;
}
public void setGames(List<Game> games) {
this.games = games;
}
public List<Screen> getScreens() { return screens; }
public void setScreens(List<Screen> screens) { this.screens = screens; }
public List<UserDifficultySettings> getDifficultySettings() {
return difficultySettings;
}
public void setDifficultySettings(List<UserDifficultySettings> difficultySettings) {
this.difficultySettings = difficultySettings;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof User)) {
return false;
}
return ((User) obj).getId().equals(getId());
}
@Override
public String toString() {
return "USER[id: " + id + ", name: " + name + ", age: " + age + ", gen: " + gender.name() + ", del: " + deleted + ", help: " + help + ", intro: " + intro + "]";
}
}
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
*
* This program is free software: you can redistribute it and/or modify