From ac79042caa9581d78d6f1f171a901ff62fdf7357 Mon Sep 17 00:00:00 2001 From: renaud gaudin Date: Fri, 5 Jun 2015 13:29:32 +0200 Subject: [PATCH] Added enforced language capability for custom App --- gen-custom-android-build.py | 4 +++- src/org/kiwix/kiwixmobile/KiwixMobileActivity.java | 9 +++++++++ src/org/kiwix/kiwixmobile/settings/Constants.java | 2 ++ templates/Constants.java | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gen-custom-android-build.py b/gen-custom-android-build.py index 44fda86c8..f18922ced 100755 --- a/gen-custom-android-build.py +++ b/gen-custom-android-build.py @@ -49,7 +49,9 @@ DEFAULT_JSDATA = { 'email': "kelson@kiwix.org", # help page content - 'support_email': "kelson@kiwix.org" + 'support_email': "kelson@kiwix.org", + + 'enforced_lang': None } SIZE_MATRIX = { diff --git a/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java b/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java index 8ab4c786c..32dcdc040 100644 --- a/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java +++ b/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java @@ -1113,6 +1113,15 @@ public class KiwixMobileActivity extends AppCompatActivity Log.d(TAG_KIWIX, "Kiwix Custom App starting for the first time. Check Companion ZIM."); + if (Constants.CUSTOM_APP_ENFORCED_LANG.length() > 0) { + // Custom App recommends to start off a specific language + LanguageUtils.handleLocaleChange(this, Constants.CUSTOM_APP_ENFORCED_LANG); + + this.setResult(1236); + this.finish(); + this.startActivity(new Intent(this, this.getClass())); + } + //Context context = this.getApplicationContext(); String fileName = FileUtils.getExpansionAPKFileName(true); Log.d(TAG_KIWIX, "Looking for: " + fileName + " -- filesize: " diff --git a/src/org/kiwix/kiwixmobile/settings/Constants.java b/src/org/kiwix/kiwixmobile/settings/Constants.java index 5235757af..99b336201 100644 --- a/src/org/kiwix/kiwixmobile/settings/Constants.java +++ b/src/org/kiwix/kiwixmobile/settings/Constants.java @@ -19,4 +19,6 @@ public class Constants { public static final String CUSTOM_APP_EMAIL = "~support_email~"; public static final String CUSTOM_APP_SUPPORT_EMAIL = "~support_email~"; + + public static final String CUSTOM_APP_ENFORCED_LANG = ""; } diff --git a/templates/Constants.java b/templates/Constants.java index 7e6432dbf..c7012a54b 100644 --- a/templates/Constants.java +++ b/templates/Constants.java @@ -10,4 +10,5 @@ public class Constants { public static final String CUSTOM_APP_WEBSITE = "~website~"; public static final String CUSTOM_APP_EMAIL = "~support_email~"; public static final String CUSTOM_APP_SUPPORT_EMAIL = "~support_email~"; + public static final String CUSTOM_APP_ENFORCED_LANG = "~enforced_lang~"; }