Add version features
This commit is contained in:
parent
65580ff610
commit
7a4d41f3f3
4 changed files with 54 additions and 25 deletions
|
@ -128,6 +128,14 @@
|
|||
<exclude name="**/*.java" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<if>
|
||||
<condition>
|
||||
<isset property="versionFeatures" />
|
||||
</condition>
|
||||
<then>
|
||||
<replaceregexp file="res/values/no_translate.xml" match='versionFeatures">(.*)<' replace='versionFeatures">${versionFeatures}<' byline="true" />
|
||||
</then>
|
||||
</if>
|
||||
<if>
|
||||
<condition>
|
||||
<isset property="net.osmand" />
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
<string name="ga_api_key">UA-28342846-2</string>
|
||||
<string name="ga_dispatchPeriod">10</string>
|
||||
<string name="ga_debug">true</string>
|
||||
|
||||
<string name="versionFeatures">+play_market +gps_status -parking_plugin</string>
|
||||
</resources>
|
|
@ -12,6 +12,19 @@ public class Version {
|
|||
private final String appName;
|
||||
private final static String FREE_VERSION_NAME = "net.osmand";
|
||||
|
||||
|
||||
public static boolean isGpsStatusEnabled(Context ctx) {
|
||||
return ctx.getString(R.string.versionFeatures).contains("+gps_status");
|
||||
}
|
||||
|
||||
public static boolean isGooglePlayEnabled(Context ctx) {
|
||||
return ctx.getString(R.string.versionFeatures).contains("+play_market");
|
||||
}
|
||||
|
||||
public static boolean isParkingPluginInlined(Context ctx) {
|
||||
return ctx.getString(R.string.versionFeatures).contains("+parking_plugin");
|
||||
}
|
||||
|
||||
private Version(Context ctx) {
|
||||
appVersion = ctx.getString(R.string.app_version);
|
||||
appName = ctx.getString(R.string.app_name);
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.FavouritePoint;
|
|||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.LogUtil;
|
||||
import net.osmand.Version;
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
|
@ -972,16 +973,20 @@ public class MapActivityActions implements DialogProvider {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.show_gps_status, R.string.show_gps_status, android.R.drawable.ic_menu_compass, new OnOptionsMenuClick() {
|
||||
if (Version.isGpsStatusEnabled(mapActivity)) {
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.show_gps_status, R.string.show_gps_status,
|
||||
android.R.drawable.ic_menu_compass, new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
startGpsStatusIntent();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.show_point_options, R.string.show_point_options, new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
|
@ -1015,6 +1020,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
if (resolved != null) {
|
||||
mapActivity.startActivity(intent);
|
||||
} else {
|
||||
if (Version.isGooglePlayEnabled(mapActivity)) {
|
||||
AlertDialog.Builder builder = new AccessibleAlertBuilder(mapActivity);
|
||||
builder.setMessage(getString(R.string.gps_status_app_not_found));
|
||||
builder.setPositiveButton(getString(R.string.default_buttons_yes), new DialogInterface.OnClickListener() {
|
||||
|
@ -1027,9 +1033,11 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(
|
||||
getString(R.string.default_buttons_no), null);
|
||||
builder.setNegativeButton(getString(R.string.default_buttons_no), null);
|
||||
builder.show();
|
||||
} else {
|
||||
Toast.makeText(mapActivity, R.string.gps_status_app_not_found, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue