forked from organicmaps/organicmaps
[android] Added paid roads stats
This commit is contained in:
parent
0bda46a66d
commit
a098885047
6 changed files with 81 additions and 16 deletions
|
@ -928,6 +928,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
mPlacePageController.close();
|
||||
RoutingOptions.removeOption(roadType);
|
||||
Statistics.INSTANCE.trackSettingsDriveOptionsChangeEvent(Statistics.EventParam.ROUTE);
|
||||
rebuildLastRouteInternal();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ import static com.mapswithme.util.statistics.Statistics.EventName.ROUTING_POINT_
|
|||
public class RoutingController implements TaxiManager.TaxiListener
|
||||
{
|
||||
private static final String TAG = RoutingController.class.getSimpleName();
|
||||
private static final int ERROR_TYPE_IMPOSSIBLE_DEST = 0;
|
||||
private static final int ERROR_TYPE_IMPOSSIBLE_OPTIONS = 1;
|
||||
private static final int ERROR_TYPE_MISSED_MWM = 3;
|
||||
|
||||
private enum State
|
||||
{
|
||||
|
@ -197,6 +200,7 @@ public class RoutingController implements TaxiManager.TaxiListener
|
|||
return;
|
||||
|
||||
mContainsCachedResult = false;
|
||||
Statistics.INSTANCE.trackDriveSettingsStatus();
|
||||
|
||||
if (mLastResultCode == ResultCodesHelper.NO_ERROR || mLastResultCode == ResultCodesHelper.HAS_WARNINGS)
|
||||
{
|
||||
|
@ -214,15 +218,20 @@ public class RoutingController implements TaxiManager.TaxiListener
|
|||
if (ResultCodesHelper.isMoreMapsNeeded(mLastResultCode))
|
||||
{
|
||||
mContainer.onBuildError(mLastResultCode, mLastMissingMaps);
|
||||
Statistics.INSTANCE.trackRoutingBuildError(ERROR_TYPE_MISSED_MWM);
|
||||
return;
|
||||
}
|
||||
|
||||
setBuildState(BuildState.ERROR);
|
||||
mLastBuildProgress = 0;
|
||||
Statistics.INSTANCE.trackRoutingBuildError(ERROR_TYPE_IMPOSSIBLE_DEST);
|
||||
updateProgress();
|
||||
|
||||
if (RoutingOptions.hasAnyOptions())
|
||||
{
|
||||
mContainer.onCalculateRouteError();
|
||||
Statistics.INSTANCE.trackRoutingBuildError(ERROR_TYPE_IMPOSSIBLE_OPTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
private void setState(State newState)
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.widget.Switch;
|
|||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.base.BaseMwmToolbarFragment;
|
||||
import com.mapswithme.maps.routing.RoutingOptions;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -81,27 +82,27 @@ public class DrivingOptionsFragment extends BaseMwmToolbarFragment
|
|||
private void initViews(@NonNull View root)
|
||||
{
|
||||
Switch tollsBtn = root.findViewById(R.id.avoid_tolls_btn);
|
||||
tollsBtn.setChecked(RoutingOptions.hasOption(RoadType.TOLL));
|
||||
tollsBtn.setChecked(RoutingOptions.hasOption(RoadType.Toll));
|
||||
CompoundButton.OnCheckedChangeListener tollBtnListener =
|
||||
new ToggleRoutingOptionListener(RoadType.TOLL);
|
||||
new ToggleRoutingOptionListener(RoadType.Toll);
|
||||
tollsBtn.setOnCheckedChangeListener(tollBtnListener);
|
||||
|
||||
Switch motorwaysBtn = root.findViewById(R.id.avoid_motorways_btn);
|
||||
motorwaysBtn.setChecked(RoutingOptions.hasOption(RoadType.MOTORWAY));
|
||||
motorwaysBtn.setChecked(RoutingOptions.hasOption(RoadType.Motorway));
|
||||
CompoundButton.OnCheckedChangeListener motorwayBtnListener =
|
||||
new ToggleRoutingOptionListener(RoadType.MOTORWAY);
|
||||
new ToggleRoutingOptionListener(RoadType.Motorway);
|
||||
motorwaysBtn.setOnCheckedChangeListener(motorwayBtnListener);
|
||||
|
||||
Switch ferriesBtn = root.findViewById(R.id.avoid_ferries_btn);
|
||||
ferriesBtn.setChecked(RoutingOptions.hasOption(RoadType.FERRY));
|
||||
ferriesBtn.setChecked(RoutingOptions.hasOption(RoadType.Ferry));
|
||||
CompoundButton.OnCheckedChangeListener ferryBtnListener =
|
||||
new ToggleRoutingOptionListener(RoadType.FERRY);
|
||||
new ToggleRoutingOptionListener(RoadType.Ferry);
|
||||
ferriesBtn.setOnCheckedChangeListener(ferryBtnListener);
|
||||
|
||||
Switch dirtyRoadsBtn = root.findViewById(R.id.avoid_dirty_roads_btn);
|
||||
dirtyRoadsBtn.setChecked(RoutingOptions.hasOption(RoadType.DIRTY));
|
||||
dirtyRoadsBtn.setChecked(RoutingOptions.hasOption(RoadType.Dirty));
|
||||
CompoundButton.OnCheckedChangeListener dirtyBtnListener =
|
||||
new ToggleRoutingOptionListener(RoadType.DIRTY);
|
||||
new ToggleRoutingOptionListener(RoadType.Dirty);
|
||||
dirtyRoadsBtn.setOnCheckedChangeListener(dirtyBtnListener);
|
||||
}
|
||||
|
||||
|
@ -122,6 +123,8 @@ public class DrivingOptionsFragment extends BaseMwmToolbarFragment
|
|||
RoutingOptions.addOption(mRoadType);
|
||||
else
|
||||
RoutingOptions.removeOption(mRoadType);
|
||||
|
||||
Statistics.INSTANCE.trackSettingsDriveOptionsChangeEvent(Statistics.EventParam.SETTINGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.mapswithme.maps.settings;
|
|||
|
||||
public enum RoadType
|
||||
{
|
||||
USUAL,
|
||||
TOLL,
|
||||
MOTORWAY,
|
||||
FERRY,
|
||||
DIRTY
|
||||
Usual,
|
||||
Toll,
|
||||
Motorway,
|
||||
Ferry,
|
||||
Dirty
|
||||
}
|
||||
|
|
|
@ -709,17 +709,17 @@ public class PlacePageView extends NestedScrollView
|
|||
|
||||
private void onAvoidUnpavedBtnClicked()
|
||||
{
|
||||
onAvoidBtnClicked(RoadType.DIRTY);
|
||||
onAvoidBtnClicked(RoadType.Dirty);
|
||||
}
|
||||
|
||||
private void onAvoidFerryBtnClicked()
|
||||
{
|
||||
onAvoidBtnClicked(RoadType.FERRY);
|
||||
onAvoidBtnClicked(RoadType.Ferry);
|
||||
}
|
||||
|
||||
private void onAvoidTollBtnClicked()
|
||||
{
|
||||
onAvoidBtnClicked(RoadType.TOLL);
|
||||
onAvoidBtnClicked(RoadType.Toll);
|
||||
}
|
||||
|
||||
private void onAvoidBtnClicked(@NonNull RoadType roadType)
|
||||
|
@ -728,6 +728,9 @@ public class PlacePageView extends NestedScrollView
|
|||
return;
|
||||
|
||||
mRoutingModeListener.toggleRouteSettings(roadType);
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.PP_DRIVING_OPTIONS_ACTION,
|
||||
new Statistics.ParameterBuilder().add(Statistics.EventParam.TYPE,
|
||||
roadType.name()));
|
||||
}
|
||||
|
||||
private void initPlaceDescriptionView()
|
||||
|
|
|
@ -32,6 +32,8 @@ import com.mapswithme.maps.editor.OsmOAuth;
|
|||
import com.mapswithme.maps.location.LocationHelper;
|
||||
import com.mapswithme.maps.purchase.ValidationStatus;
|
||||
import com.mapswithme.maps.routing.RoutePointInfo;
|
||||
import com.mapswithme.maps.routing.RoutingOptions;
|
||||
import com.mapswithme.maps.settings.RoadType;
|
||||
import com.mapswithme.maps.taxi.TaxiInfoError;
|
||||
import com.mapswithme.maps.taxi.TaxiManager;
|
||||
import com.mapswithme.maps.widget.menu.MainMenu;
|
||||
|
@ -216,6 +218,43 @@ public enum Statistics
|
|||
Statistics.ParamValue.SHARING_OPTIONS));
|
||||
}
|
||||
|
||||
public void trackDriveSettingsStatus()
|
||||
{
|
||||
ParameterBuilder status = getRoutingOptionsStatus();
|
||||
trackEvent(Statistics.EventName.SETTINGS_DRIVE_OPTIONS_STATUS,
|
||||
status);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private ParameterBuilder getRoutingOptionsStatus()
|
||||
{
|
||||
boolean hasToll = RoutingOptions.hasOption(RoadType.Toll);
|
||||
boolean hasFerry = RoutingOptions.hasOption(RoadType.Ferry);
|
||||
boolean hasMoto = RoutingOptions.hasOption(RoadType.Ferry);
|
||||
boolean hasDirty = RoutingOptions.hasOption(RoadType.Dirty);
|
||||
|
||||
ParameterBuilder builder = new ParameterBuilder() ;
|
||||
return builder.add(EventParam.TOLL, hasToll ? 1 : 0)
|
||||
.add(EventParam.FERRY, hasFerry ? 1 : 0)
|
||||
.add(EventParam.MOTORWAY, hasMoto ? 1 : 0)
|
||||
.add(EventParam.UNPAVED, hasDirty ? 1 : 0);
|
||||
}
|
||||
|
||||
public void trackRoutingBuildError(int errorType)
|
||||
{
|
||||
Statistics.ParameterBuilder builder = new Statistics.ParameterBuilder();
|
||||
trackEvent(Statistics.EventName.ROUTING_BUILD_ERROR, builder.add(EventParam.ERROR, errorType));
|
||||
}
|
||||
|
||||
public void trackSettingsDriveOptionsChangeEvent(@NonNull String source)
|
||||
{
|
||||
ParameterBuilder parameterBuilder = getRoutingOptionsStatus();
|
||||
parameterBuilder.add(EventParam.FROM, source);
|
||||
|
||||
trackEvent(EventName.SETTINGS_DRIVE_OPTIONS_CHANGE,
|
||||
parameterBuilder);
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({PP_BANNER_STATE_PREVIEW, PP_BANNER_STATE_DETAILS})
|
||||
public @interface BannerState {}
|
||||
|
@ -283,6 +322,10 @@ public enum Statistics
|
|||
private static final String BM_DOWNLOADED_CATALOGUE_ERROR = "Bookmarks_Downloaded_Catalogue_error";
|
||||
public static final String BM_GUIDEDOWNLOADTOAST_SHOWN = "Bookmarks_GuideDownloadToast_shown";
|
||||
public static final String BM_GUIDES_DOWNLOADDIALOGUE_CLICK = "Bookmarks_Guides_DownloadDialogue_click";
|
||||
public static final String SETTINGS_DRIVE_OPTIONS_CHANGE = "Settings_Navigation_DrivingOptions_change";
|
||||
public static final String SETTINGS_DRIVE_OPTIONS_STATUS = "Settings_Navigation_DrivingOptions_status";
|
||||
public static final String ROUTING_BUILD_ERROR = "Routing_build_error";
|
||||
public static final String PP_DRIVING_OPTIONS_ACTION = "Placepage_DrivingOptions_action";
|
||||
|
||||
// search
|
||||
public static final String SEARCH_CAT_CLICKED = "Search. Category clicked";
|
||||
|
@ -451,6 +494,12 @@ public enum Statistics
|
|||
public static final String TRACKS = "tracks";
|
||||
public static final String POINTS = "points";
|
||||
public static final String URL = "url";
|
||||
public static final String TOLL = "toll";
|
||||
public static final String UNPAVED = "unpaved";
|
||||
public static final String FERRY = "ferry";
|
||||
public static final String MOTORWAY = "motorway";
|
||||
public static final String SETTINGS = "settings";
|
||||
public static final String ROUTE = "route";
|
||||
static final String CATEGORY = "category";
|
||||
public static final String TAB = "tab";
|
||||
static final String COUNT = "Count";
|
||||
|
|
Loading…
Add table
Reference in a new issue