Merge branch 'master' into app_profiles_2

This commit is contained in:
madwasp79 2019-05-30 14:11:35 +03:00
commit 6601d23d96
98 changed files with 111 additions and 57 deletions

View file

@ -858,13 +858,13 @@ public class GPXUtilities {
public GPXFile(String title, String lang, String description) {
this.metadata = new Metadata();
if(description != null) {
metadata.extensions.put("desc", description);
metadata.getExtensionsToWrite().put("desc", description);
}
if(lang != null) {
metadata.extensions.put("article_lang", lang);
metadata.getExtensionsToWrite().put("article_lang", lang);
}
if(title != null) {
metadata.extensions.put("article_title", title);
metadata.getExtensionsToWrite().put("article_title", title);
}
}

View file

@ -59,7 +59,9 @@ class TelegramApplication : Application(), OsmandHelperListener {
}
osmandAidlHelper.setUpdatesListener(object : UpdatesListener {
override fun update() {
showLocationHelper.startUpdateMessagesTask()
if (settings.hasAnyChatToShowOnMap()) {
showLocationHelper.startUpdateMessagesTask()
}
}
})
shareLocationHelper = ShareLocationHelper(this)

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View file

@ -3401,7 +3401,7 @@
<string name="poi_payment_contactless_no">Бесконтактная оплата не принимается</string>
<string name="poi_hazard_nuclear">Радиационная опасность</string>
<string name="poi_hazard_erosion">Эрозия</string>
<string name="poi_hazard_avalanche">Опасность лавины</string>
<string name="poi_hazard_avalanche">Опасность схода лавины</string>
<string name="poi_hazard_slippery_road">Скользкая дорога</string>
<string name="poi_hazard_flood">Опасность затопления</string>
<string name="poi_hazard_minefield">Минное поле</string>
@ -3460,4 +3460,12 @@
<string name="poi_climbing_crag_filter">Место для скалолазания</string>
<string name="poi_climbing_crag">Да</string>
<string name="poi_hazard_additional_erosion">Опасность: эрозия</string>
<string name="poi_hazard_additional_rockfall">Опасность: камнепад</string>
<string name="poi_hazard_additional_nuclear">Опасность: радиация</string>
<string name="poi_hazard_additional_flood">Опасность: затопление</string>
<string name="poi_hazard_additional_avalanche">Опасность: сход лавины</string>
<string name="poi_hazard_additional_minefield">Опасность: минное поле</string>
<string name="poi_hazard_additional_contamination">Опасность: заражение</string>
</resources>

View file

@ -3940,4 +3940,11 @@
<string name="poi_rescue_box">Rescue box</string>
<string name="poi_climbing_crag">Yes</string>
<string name="poi_hazard_additional_erosion">Hazard: erosion</string>
<string name="poi_hazard_additional_rockfall">Hazard: rockfall</string>
<string name="poi_hazard_additional_nuclear">Hazard: nuclear</string>
<string name="poi_hazard_additional_flood">Hazard: flood</string>
<string name="poi_hazard_additional_avalanche">Hazard: avalanche</string>
<string name="poi_hazard_additional_minefield">Hazard: minefield</string>
<string name="poi_hazard_additional_contamination">Hazard: contamination</string>
</resources>

View file

@ -48,6 +48,7 @@ import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dialogs.ErrorBottomSheetDialog;
import net.osmand.plus.dialogs.RateUsBottomSheetDialog;
import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.AvoidSpecificRoads;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.inapp.InAppPurchaseHelper;
@ -918,10 +919,9 @@ public class OsmandApplication extends MultiDexApplication {
}
}
public void logEvent(Activity ctx, String event) {
public void logEvent(String event) {
try {
if (Version.isGooglePlayEnabled(this) && !Version.isPaidVersion(this)
&& !osmandSettings.DO_NOT_SEND_ANONYMOUS_APP_USAGE.get()) {
if (osmandSettings.SEND_ANONYMOUS_APP_USAGE_DATA.get()) {
analyticsHelper.addEvent(event);
}
} catch (Exception e) {
@ -929,6 +929,16 @@ public class OsmandApplication extends MultiDexApplication {
}
}
public void logMapDownloadEvent(String event, IndexItem item) {
try {
if (osmandSettings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get()) {
analyticsHelper.addEvent("map_download_" + event + ": " + item.getFileName());
}
} catch (Exception e) {
LOG.error(e);
}
}
public void restartApp(Context ctx) {
AlertDialog.Builder bld = new AlertDialog.Builder(ctx);
bld.setMessage(R.string.restart_is_required);

View file

@ -1036,7 +1036,8 @@ public class OsmandSettings {
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_USE_ANIMATIONS = new BooleanPreference("do_not_use_animations", 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 OsmandPreference<Boolean> SEND_ANONYMOUS_MAP_DOWNLOADS_DATA = new BooleanPreference("send_anonymous_map_downloads_data", false).makeGlobal().cache();
public final OsmandPreference<Boolean> SEND_ANONYMOUS_APP_USAGE_DATA = new BooleanPreference("send_anonymous_app_usage_data", false).makeGlobal().cache();
public final OsmandPreference<Boolean> MAP_EMPTY_STATE_ALLOWED = new BooleanPreference("map_empty_state_allowed", true).makeGlobal().cache();

View file

@ -637,7 +637,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_dashboard_open");
app.logEvent("drawer_dashboard_open");
MapActivity.clearPrevActivityIntent();
mapActivity.closeDrawer();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD, viewCoordinates);
@ -651,7 +651,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_markers_open");
app.logEvent("drawer_markers_open");
MapActivity.clearPrevActivityIntent();
MapMarkersDialogFragment.showInstance(mapActivity);
return true;
@ -664,7 +664,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_myplaces_open");
app.logEvent("drawer_myplaces_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getFavoritesActivity());
newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -679,7 +679,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_search_open");
app.logEvent("drawer_search_open");
mapActivity.showQuickSearch(MapActivity.ShowQuickSearchMode.NEW_IF_EXPIRED, false);
return true;
}
@ -692,7 +692,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_directions_open");
app.logEvent("drawer_directions_open");
MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
if (mapControlsLayer != null) {
mapControlsLayer.doRoute(false);
@ -720,7 +720,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_config_map_open");
app.logEvent("drawer_config_map_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP, viewCoordinates);
return false;
@ -740,7 +740,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_download_maps_open");
app.logEvent("drawer_download_maps_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadActivity());
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -756,7 +756,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_osm_live_open");
app.logEvent("drawer_osm_live_open");
Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(intent);
@ -804,7 +804,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_config_screen_open");
app.logEvent("drawer_config_screen_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, viewCoordinates);
return false;
@ -817,7 +817,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_plugins_open");
app.logEvent("drawer_plugins_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getPluginsActivity());
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -832,7 +832,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_settings_open");
app.logEvent("drawer_settings_open");
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization()
.getSettingsActivity());
settings.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -860,7 +860,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_help_open");
app.logEvent("drawer_help_open");
Intent intent = new Intent(mapActivity, HelpActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(intent);

View file

@ -89,11 +89,11 @@ public class OsmandInAppPurchaseActivity extends AppCompatActivity implements In
if (app.isPlusVersionInApp()) {
InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper();
if (purchaseHelper != null) {
app.logEvent(activity, "in_app_purchase_redirect");
app.logEvent("in_app_purchase_redirect");
purchaseHelper.purchaseFullVersion(activity);
}
} else {
app.logEvent(activity, "paid_version_redirect");
app.logEvent("paid_version_redirect");
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus")));
try {
@ -110,7 +110,7 @@ public class OsmandInAppPurchaseActivity extends AppCompatActivity implements In
if (app != null) {
InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper();
if (purchaseHelper != null) {
app.logEvent(activity, "depth_contours_purchase_redirect");
app.logEvent("depth_contours_purchase_redirect");
purchaseHelper.purchaseDepthContours(activity);
}
}
@ -177,7 +177,7 @@ public class OsmandInAppPurchaseActivity extends AppCompatActivity implements In
@Override
public void onItemPurchased(String sku, boolean active) {
if (purchaseHelper != null && purchaseHelper.getLiveUpdates().containsSku(sku)) {
getMyApplication().logEvent(this, "live_osm_subscription_purchased");
getMyApplication().logEvent("live_osm_subscription_purchased");
if (!active) {
OsmLiveRestartBottomSheetDialogFragment fragment = new OsmLiveRestartBottomSheetDialogFragment();

View file

@ -504,10 +504,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
misc.addPreference(createCheckBoxPreference(settings.MAP_EMPTY_STATE_ALLOWED, R.string.tap_on_map_to_hide_interface, R.string.tap_on_map_to_hide_interface_descr));
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES, R.string.do_not_show_startup_messages, R.string.do_not_show_startup_messages_desc));
misc.addPreference(createCheckBoxPreference(settings.ANIMATE_MY_LOCATION,R.string.animate_my_location, R.string.animate_my_location_desc));
OsmandApplication app = getMyApplication();
if (Version.isGooglePlayEnabled(getMyApplication()) && !Version.isPaidVersion(app)) {
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));
}
}

View file

@ -88,9 +88,9 @@ public class ChoosePlanFreeBannerDialogFragment extends ChoosePlanDialogFragment
if (activity != null) {
OsmandApplication app = getOsmandApplication();
if (app.isPlusVersionInApp()) {
app.logEvent(getActivity(), "in_app_purchase_redirect_from_banner");
app.logEvent("in_app_purchase_redirect_from_banner");
} else {
app.logEvent(getActivity(), "paid_version_redirect_from_banner");
app.logEvent("paid_version_redirect_from_banner");
dismiss();
}
OsmandInAppPurchaseActivity.purchaseFullVersion(activity);

View file

@ -402,7 +402,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
&& isDownlodingPermitted(ctx.getMyApplication().getSettings())) {
collapseBanner();
} else {
ctx.getMyApplication().logEvent(ctx, "click_free_dialog");
ctx.getMyApplication().logEvent("click_free_dialog");
ChoosePlanDialogFragment.showFreeVersionInstance(ctx.getSupportFragmentManager());
}
}

View file

@ -3,7 +3,6 @@ package net.osmand.plus.download;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
@ -35,7 +34,6 @@ import net.osmand.plus.Version;
import net.osmand.plus.base.BasicProgressAsyncTask;
import net.osmand.plus.download.DownloadFileHelper.DownloadFileShowWarning;
import net.osmand.plus.helpers.DatabaseHelper;
import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.util.Algorithms;
@ -264,7 +262,7 @@ public class DownloadIndexesThread {
}
}
if (uiActivity instanceof Activity) {
app.logEvent((Activity) uiActivity, "download_files");
app.logEvent("download_files");
}
for(IndexItem item : items) {
if (!item.equals(currentDownloadingItem) && !indexItemDownloading.contains(item)) {
@ -279,7 +277,8 @@ public class DownloadIndexesThread {
}
public void cancelDownload(IndexItem item) {
if(currentDownloadingItem == item) {
app.logMapDownloadEvent("cancel", item);
if (currentDownloadingItem == item) {
downloadFileHelper.setInterruptDownloading(true);
} else {
indexItemDownloading.remove(item);
@ -291,6 +290,7 @@ public class DownloadIndexesThread {
if (items != null) {
boolean updateProgress = false;
for (IndexItem item : items) {
app.logMapDownloadEvent("cancel", item);
if (currentDownloadingItem == item) {
downloadFileHelper.setInterruptDownloading(true);
} else {
@ -532,9 +532,9 @@ public class DownloadIndexesThread {
}
setTag(item);
boolean result = downloadFile(item, filesToReindex, forceWifi);
checkDownload(item);
success = result || success;
if (result) {
checkDownload(item);
if (DownloadActivityType.isCountedInDownloads(item)) {
downloads.set(downloads.get() + 1);
}
@ -664,6 +664,7 @@ public class DownloadIndexesThread {
LOG.error("Copy exception", e);
}
} else {
app.logMapDownloadEvent("start", item);
res = downloadFileHelper.downloadFile(de, this, filesToReindex, this, forceWifi);
}
return res;
@ -677,6 +678,7 @@ public class DownloadIndexesThread {
}
private void checkDownload(IndexItem item) {
app.logMapDownloadEvent("done", item);
Map<String, String> params = new HashMap<>();
params.put("file_name", item.fileName);
params.put("file_size", item.size);

View file

@ -330,7 +330,7 @@ public class ItemViewHolder {
public void onClick(View v) {
switch (clickAction) {
case ASK_FOR_FULL_VERSION_PURCHASE:
context.getMyApplication().logEvent(context, "in_app_purchase_show_from_wiki_context_menu");
context.getMyApplication().logEvent("in_app_purchase_show_from_wiki_context_menu");
ChoosePlanDialogFragment.showWikipediaInstance(context.getSupportFragmentManager());
break;
case ASK_FOR_DEPTH_CONTOURS_PURCHASE:

View file

@ -261,7 +261,7 @@ public class DiscountHelper {
View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
mapActivity.getMyApplication().logEvent(mapActivity, "motd_click");
mapActivity.getMyApplication().logEvent("motd_click");
mBannerVisible = false;
mapActivity.hideTopToolbar(toolbarController);
openUrl(mapActivity, data.url);
@ -274,7 +274,7 @@ public class DiscountHelper {
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapActivity.getMyApplication().logEvent(mapActivity, "motd_close");
mapActivity.getMyApplication().logEvent("motd_close");
mBannerVisible = false;
mapActivity.hideTopToolbar(toolbarController);
}
@ -303,7 +303,7 @@ public class DiscountHelper {
InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper();
if (purchaseHelper != null) {
if (url.contains(purchaseHelper.getFullVersion().getSku())) {
app.logEvent(mapActivity, "in_app_purchase_redirect");
app.logEvent("in_app_purchase_redirect");
purchaseHelper.purchaseFullVersion(mapActivity);
} else {
for (InAppPurchase p : purchaseHelper.getLiveUpdates().getAllSubscriptions()) {

View file

@ -436,7 +436,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
@Nullable Object object) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && init(latLon, pointDescription, object)) {
mapActivity.getMyApplication().logEvent(mapActivity, "open_context_menu");
mapActivity.getMyApplication().logEvent("open_context_menu");
showInternal();
}
}

View file

@ -252,7 +252,7 @@ public class MapillaryPlugin extends OsmandPlugin {
}
public static boolean installMapillary(Activity activity, OsmandApplication app) {
app.logEvent(activity, "install_mapillary");
app.logEvent("install_mapillary");
boolean success = execInstall(app, Version.getUrlWithUtmRef(app, MAPILLARY_PACKAGE_ID));
if (!success) {
success = execInstall(app, "https://play.google.com/store/apps/details?id=" + MAPILLARY_PACKAGE_ID);

View file

@ -58,7 +58,7 @@ public class FavoritesActivity extends TabActivity {
app.applyTheme(this);
super.onCreate(icicle);
app.logEvent(this, "myplaces_open");
app.logEvent("myplaces_open");
importHelper = new ImportHelper(this, getMyApplication(), null);

View file

@ -1966,7 +1966,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
return false;
}
mapActivity.getMyApplication().logEvent(mapActivity, "search_open");
mapActivity.getMyApplication().logEvent("search_open");
Bundle bundle = new Bundle();
if (object != null) {

View file

@ -24,6 +24,7 @@ import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
import net.osmand.plus.widgets.tools.CropCircleTransformation;
@ -40,6 +41,8 @@ import java.util.concurrent.ConcurrentHashMap;
public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider, MapTextLayer.MapTextProvider<AMapPoint> {
private static final float POINT_IMAGE_VERTICAL_OFFSET = 0.91f;
private static final int POINT_OUTER_COLOR = 0x88555555;
private static final float START_ZOOM = 7;
private static final int SMALL_ICON_SIZE_DP = 20;
@ -58,6 +61,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
private Bitmap smallIconBg;
private Bitmap bigIconBg;
private Bitmap bigIconBgStale;
private Bitmap bigIconBgSelected;
private Bitmap placeholder;
private int smallIconSize;
@ -106,6 +110,8 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
? R.drawable.map_pin_user_location_night : R.drawable.map_pin_user_location_day);
bigIconBgStale = BitmapFactory.decodeResource(res, night
? R.drawable.map_pin_user_stale_location_night : R.drawable.map_pin_user_stale_location_day);
bigIconBgSelected = BitmapFactory.decodeResource(res, night
? R.drawable.map_pin_user_location_selected_night : R.drawable.map_pin_user_location_selected_day);
placeholder = BitmapFactory.decodeResource(res, R.drawable.img_user_picture);
smallIconSize = AndroidUtils.dpToPx(map, SMALL_ICON_SIZE_DP);
@ -130,6 +136,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
String selectedPointId = getSelectedContextMenuPointId();
for (AMapPoint point : aidlLayer.getPoints()) {
ALatLon l = point.getLocation();
if (l != null) {
@ -147,7 +154,8 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
}
}
displayedPoints.add(point);
drawPoint(canvas, x, y, tileBox, point, image);
boolean selected = selectedPointId != null && selectedPointId.equals(point.getId());
drawPoint(canvas, x, y, tileBox, point, image, selected);
}
}
}
@ -158,11 +166,13 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
mapTextLayer.putData(this, displayedPoints);
}
private void drawPoint(Canvas canvas, int x, int y, RotatedTileBox tb, AMapPoint point, Bitmap image) {
private void drawPoint(Canvas canvas, int x, int y, RotatedTileBox tb, AMapPoint point, Bitmap image, boolean selected) {
if (image == null) {
image = placeholder;
}
if (pointsType == PointsType.STANDARD) {
if (selected) {
drawBigIcon(canvas, x, y, image, bigIconBgSelected);
} else if (pointsType == PointsType.STANDARD) {
int radius = getRadiusPoi(tb);
float density = tb.getDensity();
pointInnerCircle.setColor(point.getColor());
@ -175,15 +185,29 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
bitmapPaint.setColorFilter(null);
canvas.drawBitmap(image, null, getDstRect(x, y, smallIconSize / 2), bitmapPaint);
} else if (pointsType == PointsType.BIG_ICON) {
bitmapPaint.setColorFilter(null);
Bitmap bg = isStale(point) ? bigIconBgStale : bigIconBg;
float vOffset = bg.getHeight() * 0.91f;
int imageCenterY = (int) (y - vOffset + bg.getHeight() / 2);
canvas.drawBitmap(bg, x - bg.getWidth() / 2, y - vOffset, bitmapPaint);
canvas.drawBitmap(image, null, getDstRect(x, imageCenterY, bigIconSize / 2), bitmapPaint);
drawBigIcon(canvas, x, y, image, bg);
}
}
private void drawBigIcon(Canvas canvas, int x, int y, Bitmap image, Bitmap bg) {
bitmapPaint.setColorFilter(null);
float vOffset = bg.getHeight() * POINT_IMAGE_VERTICAL_OFFSET;
int imageCenterY = (int) (y - vOffset + bg.getHeight() / 2);
canvas.drawBitmap(bg, x - bg.getWidth() / 2, y - vOffset, bitmapPaint);
canvas.drawBitmap(image, null, getDstRect(x, imageCenterY, bigIconSize / 2), bitmapPaint);
}
private String getSelectedContextMenuPointId() {
MapContextMenu mapContextMenu = map.getContextMenu();
Object object = mapContextMenu.getObject();
if (mapContextMenu.isVisible() && object instanceof AMapPoint) {
AMapPoint aMapPoint = (AMapPoint) object;
return aMapPoint.getId();
}
return null;
}
private void drawColoredBitmap(Canvas canvas, int x, int y, Bitmap bitmap, int color) {
bitmapPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
canvas.drawBitmap(bitmap, x - bitmap.getWidth() / 2, y - bitmap.getHeight() / 2, bitmapPaint);

View file

@ -25,6 +25,7 @@ import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
import net.osmand.NativeLibrary.RenderedObject;
import net.osmand.RenderingContext;
import net.osmand.aidl.maplayer.point.AMapPoint;
import net.osmand.core.android.MapRendererView;
import net.osmand.core.jni.AmenitySymbolsProvider.AmenitySymbolsGroup;
import net.osmand.core.jni.AreaI;
@ -195,6 +196,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings nightMode) {
boolean markerCustomized = false;
if (selectedObject != null) {
TIntArrayList x = null;
TIntArrayList y = null;
@ -206,11 +208,13 @@ public class ContextMenuLayer extends OsmandMapLayer {
RenderedObject r = (RenderedObject) selectedObject;
x = r.getX();
y = r.getY();
} else if (selectedObject instanceof AMapPoint) {
markerCustomized = true;
}
if (x != null && y != null && x.size() > 2) {
double lat = MapUtils.get31LatitudeY(y.get(0));
double lon = MapUtils.get31LongitudeX(x.get(0));
int px,py, prevX, prevY;
int px, py, prevX, prevY;
prevX = (int) box.getPixXFromLatLon(lat, lon);
prevY = (int) box.getPixYFromLatLon(lat, lon);
for (int i = 1; i < x.size(); i++) {
@ -235,7 +239,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
canvas.drawBitmap(pressedBitmap, x - pressedBitmap.getWidth() / 2, y - pressedBitmap.getHeight() / 2, paint);
}
if (mapQuickActionLayer!= null && mapQuickActionLayer.isInMovingMarkerMode())
if (mapQuickActionLayer != null && mapQuickActionLayer.isInMovingMarkerMode())
return;
if (mInChangeMarkerPositionMode) {
@ -248,7 +252,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
canvas.translate(box.getPixWidth() / 2 - contextMarker.getWidth() / 2, box.getPixHeight() / 2 - contextMarker.getHeight());
contextMarker.draw(canvas);
mAddGpxPointBottomSheetHelper.onDraw(box);
} else if (menu.isActive()) {
} else if (menu.isActive() && !markerCustomized) {
LatLon latLon = menu.getLatLon();
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());

View file

@ -703,7 +703,7 @@ public class MapControlsLayer extends OsmandMapLayer {
mapRouteInfoMenu.show();
} else {
touchEvent = 0;
app.logEvent(mapActivity, "start_navigation");
app.logEvent("start_navigation");
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
mapActivity.getMapViewTrackingUtilities().backToLocationImpl(17, true);
app.getSettings().FOLLOW_THE_ROUTE.set(true);