Added two settings and motd event
This commit is contained in:
parent
2f1317e4f5
commit
ae7da416b9
6 changed files with 26 additions and 6 deletions
|
@ -9,6 +9,10 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="do_not_send_anonymous_app_usage">Do not send anonymous app usage</string>
|
||||
<string name="do_not_send_anonymous_app_usage_desc">It sends general information about screen used during session. We do not collect any geolocation or user input related data.</string>
|
||||
<string name="do_not_show_startup_messages">Do not show messages at startup</string>
|
||||
<string name="do_not_show_startup_messages_desc">It displays app discounts & special local events messages</string>
|
||||
<string name="parking_options">Parking options</string>
|
||||
<string name="full_version_thanks">Thank you for purchasing full version of OsmAnd!</string>
|
||||
<string name="routing_attr_relief_smoothness_factor_hills_name">Hills</string>
|
||||
|
|
|
@ -793,7 +793,10 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
|
||||
public void logEvent(Activity ctx, String event) {
|
||||
try {
|
||||
if(Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
if (Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)
|
||||
&& !osmandSettings.DO_NOT_SEND_ANONYMOUS_APP_USAGE.get()
|
||||
&& !osmandSettings.FULL_VERSION_PURCHASED.get()
|
||||
&& !osmandSettings.LIVE_UPDATES_PURCHASED.get()) {
|
||||
Class<?> cl = Class.forName("com.google.firebase.analytics.FirebaseAnalytics");
|
||||
Method mm = cl.getMethod("getInstance", Context.class);
|
||||
Object inst = mm.invoke(null, ctx == null ? this : ctx);
|
||||
|
@ -807,7 +810,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
|
||||
public void initRemoteConfig() {
|
||||
try {
|
||||
if(Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
if (Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
Class<?> cl = Class.forName("com.google.firebase.remoteconfig.FirebaseRemoteConfig");
|
||||
Method mm = cl.getMethod("getInstance");
|
||||
Object inst = mm.invoke(null);
|
||||
|
@ -837,7 +840,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
|
||||
public void activateFetchedRemoteParams() {
|
||||
try {
|
||||
if(Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
if (Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
Class<?> cl = Class.forName("com.google.firebase.remoteconfig.FirebaseRemoteConfig");
|
||||
Method mm = cl.getMethod("getInstance");
|
||||
Object inst = mm.invoke(null);
|
||||
|
@ -851,7 +854,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
|
||||
public boolean getRemoteBoolean(String key, boolean defaultValue) {
|
||||
try {
|
||||
if(Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
if (Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
Class<?> cl = Class.forName("com.google.firebase.remoteconfig.FirebaseRemoteConfig");
|
||||
Method mm = cl.getMethod("getInstance");
|
||||
Object inst = mm.invoke(null);
|
||||
|
|
|
@ -871,6 +871,9 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeGlobal().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> DO_NOT_SHOW_STARTUP_MESSAGES = new BooleanPreference("do_not_show_startup_messages", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> DO_NOT_SEND_ANONYMOUS_APP_USAGE = new BooleanPreference("do_not_send_anonymous_app_usage", false).makeGlobal().cache();
|
||||
|
||||
|
||||
public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeProfile().cache();
|
||||
|
||||
|
|
|
@ -436,7 +436,11 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
|
|||
OsmandSettings.OSMAND_LIGHT_THEME});
|
||||
|
||||
misc.addPreference(createCheckBoxPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS, R.string.use_kalman_filter_compass, R.string.use_kalman_filter_compass_descr));
|
||||
|
||||
if (Version.isGooglePlayEnabled(getMyApplication()) && Version.isFreeVersion(getMyApplication())
|
||||
&& !settings.FULL_VERSION_PURCHASED.get() && !settings.LIVE_UPDATES_PURCHASED.get()) {
|
||||
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SEND_ANONYMOUS_APP_USAGE, R.string.do_not_send_anonymous_app_usage, R.string.do_not_send_anonymous_app_usage_desc));
|
||||
}
|
||||
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES, R.string.do_not_show_startup_messages, R.string.do_not_show_startup_messages_desc));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class XMasDialogFragment extends DialogFragment {
|
|||
private static boolean XmasDialogWasProcessed = false;
|
||||
|
||||
public static boolean shouldShowXmasDialog(OsmandApplication app) {
|
||||
if (XmasDialogWasProcessed) {
|
||||
if (XmasDialogWasProcessed || app.getSettings().DO_NOT_SHOW_STARTUP_MESSAGES.get()) {
|
||||
return false;
|
||||
}
|
||||
int numberOfStarts = app.getAppInitializer().getNumberOfStarts();
|
||||
|
|
|
@ -40,6 +40,9 @@ public class DiscountHelper {
|
|||
|
||||
|
||||
public static void checkAndDisplay(final MapActivity mapActivity) {
|
||||
if (mapActivity.getMyApplication().getSettings().DO_NOT_SHOW_STARTUP_MESSAGES.get()) {
|
||||
return;
|
||||
}
|
||||
if (mBannerVisible) {
|
||||
showDiscountBanner(mapActivity, mTitle, mDescription, mIcon, mUrl);
|
||||
}
|
||||
|
@ -161,6 +164,7 @@ public class DiscountHelper {
|
|||
toolbarController.setOnBackButtonClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mapActivity.getMyApplication().logEvent(mapActivity, "motd_click");
|
||||
mBannerVisible = false;
|
||||
openUrl(mapActivity, url);
|
||||
}
|
||||
|
@ -168,6 +172,7 @@ public class DiscountHelper {
|
|||
toolbarController.setOnTitleClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mapActivity.getMyApplication().logEvent(mapActivity, "motd_click");
|
||||
mBannerVisible = false;
|
||||
openUrl(mapActivity, url);
|
||||
}
|
||||
|
@ -176,6 +181,7 @@ public class DiscountHelper {
|
|||
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mapActivity.getMyApplication().logEvent(mapActivity, "motd_close");
|
||||
mBannerVisible = false;
|
||||
mapActivity.hideTopToolbar(toolbarController);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue