diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 8b08579e5bd48974e9a9e05b1f661e19b0f0ac44..970f0aa35cbcab6fef4ca24ef8d8c4fef7bf32ba 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="cz.nic.tablexia.android" + package="cz.nic.tablexia.debug" android:versionCode="1" - android:versionName="1.0" > + android:versionName="IDE-BUILD" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> diff --git a/android/build.gradle b/android/build.gradle index 1385dd61d2e4c176c870e542599d50c00ab481eb..33a9eb92630ff7ba187c15b9596e597f14eabc1c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -17,9 +17,13 @@ android { defaultConfig { versionName version versionCode getVersionCodeFromGit() + applicationId rootProject.applicationIdRelease } buildTypes { + debug { + applicationIdSuffix rootProject.applicationIdDebugSuffix + } release { debuggable false } diff --git a/android/src/cz/nic/tablexia/android/AndroidLauncher.java b/android/src/cz/nic/tablexia/android/AndroidLauncher.java index 5c12bfcf28883ef036ae8a1648b74132b3f6cf6b..5627f27c120a1031f4bd2ed25d0a3c88199ebe9e 100644 --- a/android/src/cz/nic/tablexia/android/AndroidLauncher.java +++ b/android/src/cz/nic/tablexia/android/AndroidLauncher.java @@ -4,13 +4,15 @@ import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; + import cz.nic.tablexia.Tablexia; +import cz.nic.tablexia.debug.BuildConfig; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); - initialize(new Tablexia(BuildConfig.DEBUG, getResources().getConfiguration().locale, BuildConfig.VERSION_NAME), config); + initialize(new Tablexia(BuildConfig.DEBUG, getResources().getConfiguration().locale, BuildConfig.VERSION_NAME, BuildConfig.APPLICATION_ID), config); } } diff --git a/build.gradle b/build.gradle index 49466f902cfc81966f3108d6144f89973c864d17..fd0bc582ea8e4507c0999435400eb8bada27e044 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,10 @@ allprojects { apply plugin: "idea" version = getVersionNameFromGit() + project.extensions.add("applicationIdRelease", "cz.nic.tablexia") + project.extensions.add("applicationIdDebugSuffix", ".debug") + project.extensions.add("applicationIdDebug", applicationIdRelease + applicationIdDebugSuffix) + ext { appName = 'Tablexia' gdxVersion = '1.5.2' diff --git a/core/src/cz/nic/tablexia/Tablexia.java b/core/src/cz/nic/tablexia/Tablexia.java index 05c89208036b7a3e76d8231babea7de743774d4e..b61c0088d31abc8f96dee06d3cdcb6ccf65a200b 100644 --- a/core/src/cz/nic/tablexia/Tablexia.java +++ b/core/src/cz/nic/tablexia/Tablexia.java @@ -31,12 +31,12 @@ public class Tablexia extends TablexiaApplication { private MainMenu mainMenu; private ZipAssetLoader zipAssetLoader; - public Tablexia(boolean debug, Locale systemLocale, String versionName) { - TablexiaSettings.init(debug, systemLocale, versionName); + public Tablexia(boolean debug, Locale systemLocale, String versionName, String applicationId) { + TablexiaSettings.init(debug, systemLocale, versionName, applicationId); } - public Tablexia(String buildTypeKey, Locale systemLocale, String versionName) { - TablexiaSettings.init(buildTypeKey, systemLocale, versionName); + public Tablexia(String buildTypeKey, Locale systemLocale, String versionName, String applicationId) { + TablexiaSettings.init(buildTypeKey, systemLocale, versionName, applicationId); } private void loadingComplete() { diff --git a/core/src/cz/nic/tablexia/TablexiaSettings.java b/core/src/cz/nic/tablexia/TablexiaSettings.java index 071b380e0604d4d1e2c1ba5a4d2b57bf062f785b..d0c83227bbc3d17be73b7aed3ca9ce3400ffe732 100644 --- a/core/src/cz/nic/tablexia/TablexiaSettings.java +++ b/core/src/cz/nic/tablexia/TablexiaSettings.java @@ -13,16 +13,17 @@ import cz.nic.tablexia.util.Log; public class TablexiaSettings { private static final int DEFAULT_SCREEN_WIDTH = 1000; - private static final double MAXIMU_RATIO = 9.0 / 16.0; - private static final int MIN_SCREEN_HEIGHT = (int) (DEFAULT_SCREEN_WIDTH * MAXIMU_RATIO); + private static final double MAXIMUM_RATIO = 9.0 / 16.0; + private static final int MIN_SCREEN_HEIGHT = (int) (DEFAULT_SCREEN_WIDTH * MAXIMUM_RATIO); private static final boolean DEBUG_SHOW_BOUNDING_BOXES = true; - public static final String TABLEXIA_SETTINGS_KEY = "tablexia-"; public static final String LOCALE_KEY = "locale"; + private static final String IDE_BUILD_APPLICATION_ID = "cz.nic.tablexia.debug"; private static final String IDE_BUILD_VERSION_NAME = "IDE-BUILD"; private final BuildType BUILD_TYPE; private final String VERSION_NAME; + private final String APPLICATION_ID; private Preferences preferences; private LocaleDefinition systemLocale; @@ -124,9 +125,10 @@ public class TablexiaSettings { private static TablexiaSettings instance; - private TablexiaSettings(BuildType buildType, Locale systemLocale, String versionName) { + private TablexiaSettings(BuildType buildType, Locale systemLocale, String versionName, String applicationId) { BUILD_TYPE = buildType; VERSION_NAME = versionName == null ? IDE_BUILD_VERSION_NAME : versionName; + APPLICATION_ID = applicationId == null ? IDE_BUILD_APPLICATION_ID : applicationId; this.systemLocale = LocaleDefinition.getLocaleDefinitionForLocale(systemLocale); } @@ -139,29 +141,29 @@ public class TablexiaSettings { return instance; } - public static void init(boolean debug, Locale systemLocale, String versionName) { - TablexiaSettings.init(debug ? BuildType.DEBUG : BuildType.RELEASE, systemLocale, versionName); + public static void init(boolean debug, Locale systemLocale, String versionName, String applicationId) { + TablexiaSettings.init(debug ? BuildType.DEBUG : BuildType.RELEASE, systemLocale, versionName, applicationId); } - public static void init(String buildTypeKey, Locale systemLocale, String versionName) { - TablexiaSettings.init(BuildType.getBuildTypeForKey(buildTypeKey), systemLocale, versionName); + public static void init(String buildTypeKey, Locale systemLocale, String versionName, String applicationId) { + TablexiaSettings.init(BuildType.getBuildTypeForKey(buildTypeKey), systemLocale, versionName, applicationId); } - public static void init(BuildType buildType, Locale systemLocale, String versionName) { + public static void init(BuildType buildType, Locale systemLocale, String versionName, String applicationId) { if (instance != null) { String exceptionMessage = "Tablexia settings already initialized!"; Log.err(TablexiaSettings.class, exceptionMessage); throw new IllegalStateException(exceptionMessage); } - instance = new TablexiaSettings(buildType, systemLocale, versionName); + instance = new TablexiaSettings(buildType, systemLocale, versionName, applicationId); } //////////////////////////// LIBGDX PREFERENCES public void loadPreferences() { - preferences = Gdx.app.getPreferences(TABLEXIA_SETTINGS_KEY + BUILD_TYPE); + preferences = Gdx.app.getPreferences(getApplicationId()); selectedLocale = LocaleDefinition.getLocaleDefinitionForKey(preferences.getString(LOCALE_KEY)); } @@ -176,6 +178,10 @@ public class TablexiaSettings { return VERSION_NAME; } + public String getApplicationId() { + return APPLICATION_ID; + } + public boolean isShowBoundingBoxes() { return isDebug() && DEBUG_SHOW_BOUNDING_BOXES; } @@ -209,8 +215,8 @@ public class TablexiaSettings { return DEFAULT_SCREEN_WIDTH; } - public static double getMaximuRatio() { - return MAXIMU_RATIO; + public static double getMaximumRatio() { + return MAXIMUM_RATIO; } public static int getMinScreenHeight() { diff --git a/desktop/build.gradle b/desktop/build.gradle index 9292ad537f6bdb20f53c179581b289c243d078a6..3bddac4fcaf8618aa1c6d2473524bbc7a59035dc 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -25,6 +25,7 @@ task debugJar(type: Jar) { attributes 'Main-Class': project.mainClassName attributes 'Build-Type': 'debug' attributes 'Version-Name': version + attributes 'Application-Id': rootProject.applicationIdDebug } } @@ -39,6 +40,7 @@ task releaseJar(type: Jar) { attributes 'Main-Class': project.mainClassName attributes 'Build-Type': 'release' attributes 'Version-Name': version + attributes 'Application-Id': rootProject.applicationIdRelease } } diff --git a/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java b/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java index 18304a1875a5c68c5c3f1abfa5629faa045a7d7d..d38766ac1f59721e45ce1af6fe816d0a1849cb0a 100644 --- a/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java +++ b/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java @@ -10,19 +10,21 @@ import cz.nic.tablexia.Tablexia; public class DesktopLauncher { - public static final String BUILD_VARIANT_MANIFEST_ATTRIBUTE = "Build-Type"; - public static final String VERSION_NAME_MANIFEST_ATTRIBUTE = "Version-Name"; + public static final String BUILD_VARIANT_MANIFEST_ATTRIBUTE = "Build-Type"; + public static final String VERSION_NAME_MANIFEST_ATTRIBUTE = "Version-Name"; + public static final String APPLICATION_ID_MANIFEST_ATTRIBUTE = "Application-Id"; public static void main (String[] arg) { String buildType = loadAttributeFromManifest(BUILD_VARIANT_MANIFEST_ATTRIBUTE); String versionName = loadAttributeFromManifest(VERSION_NAME_MANIFEST_ATTRIBUTE); + String applicationId = loadAttributeFromManifest(APPLICATION_ID_MANIFEST_ATTRIBUTE); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.resizable = false; config.width = 1280; config.height = 800; - new LwjglApplication(new Tablexia(buildType, Locale.getDefault(), versionName), config); + new LwjglApplication(new Tablexia(buildType, Locale.getDefault(), versionName, applicationId), config); } private static String loadAttributeFromManifest(String attributeName) { diff --git a/ios/src/cz/nic/tablexia/IOSLauncher.java b/ios/src/cz/nic/tablexia/IOSLauncher.java index b17b2efd8846fac8a63c3a6a96bf1fa1f172c46c..0626c283d6e384472b9ef3267f6020cfdda3ad83 100644 --- a/ios/src/cz/nic/tablexia/IOSLauncher.java +++ b/ios/src/cz/nic/tablexia/IOSLauncher.java @@ -14,7 +14,7 @@ public class IOSLauncher extends IOSApplication.Delegate { @Override protected IOSApplication createApplication() { IOSApplicationConfiguration config = new IOSApplicationConfiguration(); - return new IOSApplication(new Tablexia(null, Locale.getDefault(), null), config); + return new IOSApplication(new Tablexia(null, Locale.getDefault(), null, null), config); } public static void main(String[] argv) {