Improved fix to restore the full versionNAme

This commit is contained in:
sonora 2017-06-03 18:40:15 +02:00
parent 35f14f4549
commit 70d70397d5
4 changed files with 8 additions and 10 deletions

View file

@ -2,8 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"
android:versionName="2.7.0"
android:versionCode="270"
package="net.osmand.plus">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

View file

@ -39,10 +39,12 @@ android {
defaultConfig {
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 14
targetSdkVersion 23
versionCode 270
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
multiDexEnabled true
versionName "2.7.0"
versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
//versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName
versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName
}
lintOptions {
@ -187,9 +189,9 @@ def replaceNoTranslate(line) {
// if (line.contains("\"app_version\"") && System.getenv("APK_VERSION")) {
// return line.replaceAll(">[^<]*<", ">" + System.getenv("APK_VERSION") + "<")
// }
if (line.contains("\"app_version_suffix\"") && System.getenv("APK_VERSION_SUFFIX")) {
return line.replaceAll("</", System.getenv("APK_VERSION_SUFFIX") + "</")
}
// if (line.contains("\"app_version_suffix\"") && System.getenv("APK_VERSION_SUFFIX")) {
// return line.replaceAll("</", System.getenv("APK_VERSION_SUFFIX") + "</")
// }
if (line.contains("\"versionFeatures\"") && System.getenv("APP_FEATURES")) {
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_FEATURES") + "<")
}

View file

@ -2,7 +2,7 @@
<resources>
<string name="app_name">OsmAnd~</string>
<string name="app_name_free">OsmAndF~</string>
<string name="app_version_suffix"></string>
<!-- string name="app_version_suffix"></string -->
<!-- Not translatable -->
<string name="full_version_price">€5,99</string>

View file

@ -49,13 +49,11 @@ public class Version {
}
private Version(OsmandApplication ctx) {
// appVersion = ctx.getString(R.string.app_version);
String appVersion = "";
int versionCode = -1;
try {
PackageInfo packageInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
//appVersion = packageInfo.versionName; //already appended in build.gradle: + ctx.getString(R.string.app_version_suffix);
appVersion = packageInfo.versionName + ctx.getString(R.string.app_version_suffix);
appVersion = packageInfo.versionName; //Version suffix ctx.getString(R.string.app_version_suffix) already appended in build.gradle
versionCode = packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();