[android] Implemented tracking the quick filter open event

This commit is contained in:
alexzatsepin 2020-08-24 20:05:22 +03:00 committed by Maksim Andrianov
parent 7df2aa7f56
commit 744d0c2995
4 changed files with 30 additions and 2 deletions

View file

@ -1484,6 +1484,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (MapFragment.nativeIsEngineCreated())
LocationHelper.INSTANCE.attach(this);
mPlacePageController.onActivityStarted(this);
mSearchController.attach(this);
MwmApplication.backgroundTracker(getActivity()).addListener(this);
}
@ -1500,6 +1501,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
MwmApplication.backgroundTracker(getActivity()).removeListener(this);
IsolinesManager.from(getApplicationContext()).detach();
GuidesManager.from(getApplicationContext()).detach();
mSearchController.detach();
}
private void onGuidesStateChanged(@NonNull GuidesState state)

View file

@ -417,6 +417,13 @@ public class SearchFragment extends BaseMwmFragment
mFilterController.onSaveState(outState);
}
@Override
public void onStart()
{
super.onStart();
mToolbarController.attach(requireActivity());
}
public void onResume()
{
super.onResume();
@ -434,6 +441,13 @@ public class SearchFragment extends BaseMwmFragment
mAppBarLayout.removeOnOffsetChangedListener(mOffsetListener);
}
@Override
public void onStop()
{
super.onStop();
mToolbarController.detach();
}
@Override
public void onDestroy()
{

View file

@ -32,6 +32,7 @@ import com.mapswithme.util.InputUtils;
import com.mapswithme.util.StringUtils;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.statistics.AlohaHelper;
import com.mapswithme.util.statistics.Statistics;
import java.util.ArrayList;
import java.util.List;
@ -199,8 +200,8 @@ public class SearchToolbarController extends ToolbarController
if (mChooseDatesChip == null)
return;
mChooseDatesChip.setText(FilterUtils.makeDateRangeHeader(requireActivity(), checkinMillis,
checkoutMillis));
mChooseDatesChip.setText(FilterUtils.makeDateRangeHeader(mChooseDatesChip.getContext(),
checkinMillis, checkoutMillis));
mChosenDates = new Pair<>(checkinMillis, checkoutMillis);
}
@ -349,6 +350,9 @@ public class SearchToolbarController extends ToolbarController
if (mFilterContainer == null)
return;
if (getActivity() != null && UiUtils.isHidden(mFilterContainer) && show)
Statistics.INSTANCE.trackQuickFilterOpen(Statistics.EventParam.HOTEL);
UiUtils.showIf(show, mFilterContainer);
}

View file

@ -101,6 +101,7 @@ import static com.mapswithme.util.statistics.Statistics.EventName.ROUTING_PLAN_T
import static com.mapswithme.util.statistics.Statistics.EventName.ROUTING_ROUTE_FINISH;
import static com.mapswithme.util.statistics.Statistics.EventName.ROUTING_ROUTE_START;
import static com.mapswithme.util.statistics.Statistics.EventName.SEARCH_FILTER_CLICK;
import static com.mapswithme.util.statistics.Statistics.EventName.SEARCH_QUICKFILTER_OPEN;
import static com.mapswithme.util.statistics.Statistics.EventName.TIPS_TRICKS_CLOSE;
import static com.mapswithme.util.statistics.Statistics.EventName.TOOLBAR_CLICK;
import static com.mapswithme.util.statistics.Statistics.EventName.TOOLBAR_MENU_CLICK;
@ -449,6 +450,7 @@ public enum Statistics
public static final String SEARCH_FILTER_CANCEL = "Search_Filter_Cancel";
public static final String SEARCH_FILTER_RESET = "Search_Filter_Reset";
public static final String SEARCH_FILTER_APPLY = "Search_Filter_Apply";
public static final String SEARCH_QUICKFILTER_OPEN = "Search_QuickFilter_Open";
static final String SEARCH_CAT_CLICKED = "Search. Category clicked";
static final String SEARCH_TAB_SELECTED = "Search_Tab_selected";
static final String SEARCH_FILTER_CLICK = "Search_Filter_Click";
@ -1596,6 +1598,12 @@ public enum Statistics
return type == 0 ? BACKUP : RESTORE;
}
public void trackQuickFilterOpen(@NonNull String category)
{
trackEvent(SEARCH_QUICKFILTER_OPEN, params().add(CATEGORY, category)
.add(NETWORK, getConnectionState()).get());
}
public void trackFilterEvent(@NonNull String event, @NonNull String category)
{
trackEvent(event, params()