forked from upstream-mirrors/OpenTracks
Automatic versioning (versionName and versionCode) using GIT.
This commit is contained in:
@@ -19,8 +19,11 @@ public class AboutActivity extends AbstractActivity {
|
||||
TextView textDescription = findViewById(R.id.about_text_description);
|
||||
textDescription.setText(getString(R.string.about_description));
|
||||
|
||||
TextView textVersion = findViewById(R.id.about_text_version);
|
||||
textVersion.setText(getString(R.string.about_version, SystemUtils.getAppVersion(this)));
|
||||
TextView textVersionName = findViewById(R.id.about_text_version_name);
|
||||
textVersionName.setText(getString(R.string.about_version_name, SystemUtils.getAppVersionName(this)));
|
||||
|
||||
TextView textVersionCode = findViewById(R.id.about_text_version_code);
|
||||
textVersionCode.setText(getString(R.string.about_version_code, SystemUtils.getAppVersionCode(this)));
|
||||
|
||||
TextView textURL = findViewById(R.id.about_app_url);
|
||||
textURL.setText(getString(R.string.about_url, getString(R.string.app_web_url)));
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.net.Uri;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
import de.dennisguse.opentracks.content.Waypoint.WaypointType;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -38,7 +39,7 @@ public interface ContentProviderUtils {
|
||||
* The authority (the first part of the URI) for the app's content
|
||||
* provider.
|
||||
*/
|
||||
String AUTHORITY = "de.dennisguse.opentracks";
|
||||
String AUTHORITY = BuildConfig.APPLICATION_ID;
|
||||
/**
|
||||
* The default {@link LocationFactory} which creates a location each time.
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,8 @@ import android.content.Context;
|
||||
import android.content.SearchRecentSuggestionsProvider;
|
||||
import android.provider.SearchRecentSuggestions;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
|
||||
/**
|
||||
* Content provider for search suggestions.
|
||||
*
|
||||
@@ -26,7 +28,7 @@ import android.provider.SearchRecentSuggestions;
|
||||
*/
|
||||
public class SearchEngineProvider extends SearchRecentSuggestionsProvider {
|
||||
|
||||
private static final String AUTHORITY = "de.dennisguse.opentracks.search";
|
||||
private static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".search";
|
||||
private static final int MODE = DATABASE_MODE_QUERIES;
|
||||
|
||||
public SearchEngineProvider() {
|
||||
|
||||
@@ -19,6 +19,8 @@ package de.dennisguse.opentracks.content;
|
||||
import android.net.Uri;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
|
||||
/**
|
||||
* Constants for the track points table.
|
||||
*
|
||||
@@ -27,7 +29,7 @@ import android.provider.BaseColumns;
|
||||
public interface TrackPointsColumns extends BaseColumns {
|
||||
|
||||
String TABLE_NAME = "trackpoints";
|
||||
Uri CONTENT_URI = Uri.parse("content://de.dennisguse.opentracks/trackpoints");
|
||||
Uri CONTENT_URI = Uri.parse("content://" + BuildConfig.APPLICATION_ID + "/trackpoints");
|
||||
String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.de.dennisguse.trackpoint";
|
||||
String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.de.dennisguse.trackpoint";
|
||||
String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
@@ -19,6 +19,8 @@ package de.dennisguse.opentracks.content;
|
||||
import android.net.Uri;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
|
||||
/**
|
||||
* Constants for the tracks table.
|
||||
*
|
||||
@@ -31,7 +33,7 @@ public interface TracksColumns extends BaseColumns {
|
||||
/**
|
||||
* Tracks provider uri.
|
||||
*/
|
||||
Uri CONTENT_URI = Uri.parse("content://de.dennisguse.opentracks/tracks");
|
||||
Uri CONTENT_URI = Uri.parse("content://" + BuildConfig.APPLICATION_ID + "/tracks");
|
||||
|
||||
/**
|
||||
* Track content type.
|
||||
|
||||
@@ -19,6 +19,8 @@ package de.dennisguse.opentracks.content;
|
||||
import android.net.Uri;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
|
||||
/**
|
||||
* Constants for waypoints table.
|
||||
*
|
||||
@@ -27,7 +29,7 @@ import android.provider.BaseColumns;
|
||||
public interface WaypointsColumns extends BaseColumns {
|
||||
|
||||
String TABLE_NAME = "waypoints";
|
||||
Uri CONTENT_URI = Uri.parse("content://de.dennisguse.opentracks/waypoints");
|
||||
Uri CONTENT_URI = Uri.parse("content://" + BuildConfig.APPLICATION_ID + "/waypoints");
|
||||
String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.de.dennisguse.waypoint";
|
||||
String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.de.dennisguse.waypoint";
|
||||
String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
@@ -22,6 +22,8 @@ import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
|
||||
/**
|
||||
* Utilities for dealing with files.
|
||||
*
|
||||
@@ -32,7 +34,7 @@ public class FileUtils {
|
||||
/**
|
||||
* Used to transfer picture from the camera.
|
||||
*/
|
||||
public static final String FILEPROVIDER = "de.dennisguse.opentracks.fileprovider";
|
||||
public static final String FILEPROVIDER = BuildConfig.APPLICATION_ID + ".fileprovider";
|
||||
/**
|
||||
* The play tracks directory in the app's cache directory.
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,8 @@ import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.util.Log;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
|
||||
/**
|
||||
* Utility class for accessing basic Android functionality.
|
||||
*
|
||||
@@ -42,10 +44,9 @@ public class SystemUtils {
|
||||
*
|
||||
* @return the version, or an empty string in case of failure.
|
||||
*/
|
||||
public static String getAppVersion(Context context) {
|
||||
public static String getAppVersionName(Context context) {
|
||||
try {
|
||||
PackageInfo pi = context.getPackageManager()
|
||||
.getPackageInfo("de.dennisguse.opentracks", PackageManager.GET_META_DATA);
|
||||
PackageInfo pi = context.getPackageManager().getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_META_DATA);
|
||||
return pi.versionName;
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.w(TAG, "Failed to get version info.", e);
|
||||
@@ -53,6 +54,16 @@ public class SystemUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static Long getAppVersionCode(Context context) {
|
||||
try {
|
||||
PackageInfo pi = context.getPackageManager().getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_META_DATA);
|
||||
return pi.getLongVersionCode();
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.w(TAG, "Failed to get version info.", e);
|
||||
return -1L;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquire a wake lock if not already acquired.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user