diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index 2fab929e24..ebf83b4c31 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -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) diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java index 970c438246..2dd4d1aa46 100644 --- a/android/src/com/mapswithme/maps/search/SearchFragment.java +++ b/android/src/com/mapswithme/maps/search/SearchFragment.java @@ -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() { diff --git a/android/src/com/mapswithme/maps/widget/SearchToolbarController.java b/android/src/com/mapswithme/maps/widget/SearchToolbarController.java index 4521a7de6a..9bdb07705d 100644 --- a/android/src/com/mapswithme/maps/widget/SearchToolbarController.java +++ b/android/src/com/mapswithme/maps/widget/SearchToolbarController.java @@ -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); } diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java index 0445bc0be3..e1506001c0 100644 --- a/android/src/com/mapswithme/util/statistics/Statistics.java +++ b/android/src/com/mapswithme/util/statistics/Statistics.java @@ -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()