Skip to content
Snippets Groups Projects
Commit 96613286 authored by Matyáš Latner's avatar Matyáš Latner
Browse files

TablexiaSetting and TablexiaStorage initialization fix

parent da882f3a
No related merge requests found
......@@ -233,6 +233,7 @@ public class Tablexia extends TablexiaApplication {
public void dispose() {
super.dispose();
TablexiaStorage.getInstance().dispose();
TablexiaSettings.getInstance().dispose();
clearLoadedData();
}
......
......@@ -95,7 +95,7 @@ public class TablexiaSettings {
private final String localeKey;
private final String descriptionKey;
private LocaleDefinition(Locale locale, String localeKey, String descriptionKey) {
LocaleDefinition(Locale locale, String localeKey, String descriptionKey) {
this.locale = locale;
this.localeKey = localeKey;
this.descriptionKey = descriptionKey;
......@@ -157,15 +157,15 @@ public class TablexiaSettings {
return instance;
}
public static void init(boolean debug, Locale systemLocale, String versionName) {
static void init(boolean debug, Locale systemLocale, String versionName) {
TablexiaSettings.init(debug ? BuildType.DEBUG : BuildType.RELEASE, systemLocale, versionName);
}
public static void init(String buildTypeKey, Locale systemLocale, String versionName) {
static void init(String buildTypeKey, Locale systemLocale, String versionName) {
TablexiaSettings.init(BuildType.getBuildTypeForKey(buildTypeKey), systemLocale, versionName);
}
public static void init(BuildType buildType, Locale systemLocale, String versionName) {
static void init(BuildType buildType, Locale systemLocale, String versionName) {
if (instance != null) {
String exceptionMessage = "Tablexia settings already initialized!";
Log.err(TablexiaSettings.class, exceptionMessage);
......@@ -175,6 +175,10 @@ public class TablexiaSettings {
instance = new TablexiaSettings(buildType, systemLocale, versionName);
}
void dispose() {
instance = null;
}
//////////////////////////// LIBGDX PREFERENCES
......
......@@ -55,6 +55,7 @@ public class TablexiaStorage {
} else {
throw new IllegalStateException("Data storage is not initialized or already closed!");
}
instance = null;
}
public static TablexiaStorage getInstance() {
......
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