diff --git a/android/res/drawable-hdpi/ic_fab_view_on_map.webp b/android/res/drawable-hdpi/ic_fab_view_on_map.webp
deleted file mode 100644
index e28be46090..0000000000
Binary files a/android/res/drawable-hdpi/ic_fab_view_on_map.webp and /dev/null differ
diff --git a/android/res/drawable-hdpi/ic_fab_view_on_map_night.webp b/android/res/drawable-hdpi/ic_fab_view_on_map_night.webp
deleted file mode 100644
index ffce902faa..0000000000
Binary files a/android/res/drawable-hdpi/ic_fab_view_on_map_night.webp and /dev/null differ
diff --git a/android/res/drawable-mdpi/ic_fab_view_on_map.webp b/android/res/drawable-mdpi/ic_fab_view_on_map.webp
deleted file mode 100644
index bc9d88cafb..0000000000
Binary files a/android/res/drawable-mdpi/ic_fab_view_on_map.webp and /dev/null differ
diff --git a/android/res/drawable-mdpi/ic_fab_view_on_map_night.webp b/android/res/drawable-mdpi/ic_fab_view_on_map_night.webp
deleted file mode 100644
index a877be4c76..0000000000
Binary files a/android/res/drawable-mdpi/ic_fab_view_on_map_night.webp and /dev/null differ
diff --git a/android/res/drawable-xhdpi/ic_fab_view_on_map.webp b/android/res/drawable-xhdpi/ic_fab_view_on_map.webp
deleted file mode 100644
index e96aa7093e..0000000000
Binary files a/android/res/drawable-xhdpi/ic_fab_view_on_map.webp and /dev/null differ
diff --git a/android/res/drawable-xhdpi/ic_fab_view_on_map_night.webp b/android/res/drawable-xhdpi/ic_fab_view_on_map_night.webp
deleted file mode 100644
index 49f75bcf70..0000000000
Binary files a/android/res/drawable-xhdpi/ic_fab_view_on_map_night.webp and /dev/null differ
diff --git a/android/res/drawable-xxhdpi/ic_fab_view_on_map.webp b/android/res/drawable-xxhdpi/ic_fab_view_on_map.webp
deleted file mode 100644
index e39ed1b5a6..0000000000
Binary files a/android/res/drawable-xxhdpi/ic_fab_view_on_map.webp and /dev/null differ
diff --git a/android/res/drawable-xxhdpi/ic_fab_view_on_map_night.webp b/android/res/drawable-xxhdpi/ic_fab_view_on_map_night.webp
deleted file mode 100644
index 3faf6a5320..0000000000
Binary files a/android/res/drawable-xxhdpi/ic_fab_view_on_map_night.webp and /dev/null differ
diff --git a/android/res/drawable-xxxhdpi/ic_fab_view_on_map.webp b/android/res/drawable-xxxhdpi/ic_fab_view_on_map.webp
deleted file mode 100644
index 346de4304f..0000000000
Binary files a/android/res/drawable-xxxhdpi/ic_fab_view_on_map.webp and /dev/null differ
diff --git a/android/res/drawable-xxxhdpi/ic_fab_view_on_map_night.webp b/android/res/drawable-xxxhdpi/ic_fab_view_on_map_night.webp
deleted file mode 100644
index 32bc250404..0000000000
Binary files a/android/res/drawable-xxxhdpi/ic_fab_view_on_map_night.webp and /dev/null differ
diff --git a/android/res/drawable/ic_show_on_map_fab.xml b/android/res/drawable/ic_show_on_map_fab.xml
new file mode 100644
index 0000000000..ffd9dd90c5
--- /dev/null
+++ b/android/res/drawable/ic_show_on_map_fab.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/android/res/drawable/ic_show_on_map_fab_night.xml b/android/res/drawable/ic_show_on_map_fab_night.xml
new file mode 100644
index 0000000000..d1274d89bd
--- /dev/null
+++ b/android/res/drawable/ic_show_on_map_fab_night.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/android/res/layout/activity_map.xml b/android/res/layout/activity_map.xml
index d4905cc45b..58e34a4b54 100644
--- a/android/res/layout/activity_map.xml
+++ b/android/res/layout/activity_map.xml
@@ -34,6 +34,7 @@
layout="@layout/toolbar_with_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
android:visibility="gone"
tools:visibility="visible" />
@@ -67,11 +68,6 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
-
-
diff --git a/android/res/layout/fragment_bookmark_list.xml b/android/res/layout/fragment_bookmark_list.xml
index ffabb861cf..e94f00a8f0 100644
--- a/android/res/layout/fragment_bookmark_list.xml
+++ b/android/res/layout/fragment_bookmark_list.xml
@@ -3,50 +3,47 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapsme="http://schemas.android.com/apk/app"
xmlns:tools="http://schemas.android.com/tools"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
+
+
+
+
-
-
-
-
+ android:layout_gravity="bottom|end"
+ android:layout_margin="@dimen/margin_base"/>
+
+
+
+
diff --git a/android/res/layout/fragment_search.xml b/android/res/layout/fragment_search.xml
index 8f8029c26f..376764bdd1 100644
--- a/android/res/layout/fragment_search.xml
+++ b/android/res/layout/fragment_search.xml
@@ -24,7 +24,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"/>
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/android/res/layout/search_filter_panel.xml b/android/res/layout/search_filter_panel.xml
deleted file mode 100644
index be13bb6198..0000000000
--- a/android/res/layout/search_filter_panel.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
diff --git a/android/res/layout/show_on_map_fab.xml b/android/res/layout/show_on_map_fab.xml
new file mode 100644
index 0000000000..0fa03dbe86
--- /dev/null
+++ b/android/res/layout/show_on_map_fab.xml
@@ -0,0 +1,12 @@
+
+
diff --git a/android/res/menu/menu_bookmark_catalog.xml b/android/res/menu/menu_bookmark_catalog.xml
deleted file mode 100644
index 7f50ae60af..0000000000
--- a/android/res/menu/menu_bookmark_catalog.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
diff --git a/android/res/values/themes-attrs.xml b/android/res/values/themes-attrs.xml
index abe467d2a1..a0ce332a0e 100644
--- a/android/res/values/themes-attrs.xml
+++ b/android/res/values/themes-attrs.xml
@@ -51,7 +51,7 @@
-
+
diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml
index 0d7d79573a..a934cfc62e 100644
--- a/android/res/values/themes-base.xml
+++ b/android/res/values/themes-base.xml
@@ -82,7 +82,7 @@
- @style/MwmTheme.Navigation
- @drawable/ic_fab_add
- - @drawable/ic_fab_view_on_map
+ - @drawable/ic_show_on_map_fab
- @color/routing_button_tint
- ?statusBar
@@ -261,7 +261,7 @@
- @style/MwmTheme.Navigation.Night
- @drawable/ic_fab_add_night
- - @drawable/ic_fab_view_on_map_night
+ - @drawable/ic_show_on_map_fab_night
- @color/routing_button_tint
- ?statusBar
diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java
index 45b01199a1..4a3ca222bc 100644
--- a/android/src/com/mapswithme/maps/MwmActivity.java
+++ b/android/src/com/mapswithme/maps/MwmActivity.java
@@ -11,7 +11,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
-import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
@@ -38,7 +37,6 @@ import com.mapswithme.maps.base.CustomNavigateUpListener;
import com.mapswithme.maps.base.NoConnectionListener;
import com.mapswithme.maps.base.OnBackPressListener;
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
-import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
import com.mapswithme.maps.bookmarks.data.BookmarkInfo;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.maps.bookmarks.data.MapObject;
@@ -79,7 +77,6 @@ import com.mapswithme.maps.routing.RoutingPlanInplaceController;
import com.mapswithme.maps.search.FloatingSearchToolbarController;
import com.mapswithme.maps.search.SearchActivity;
import com.mapswithme.maps.search.SearchEngine;
-import com.mapswithme.maps.search.SearchFilterController;
import com.mapswithme.maps.search.SearchFragment;
import com.mapswithme.maps.settings.DrivingOptionsActivity;
import com.mapswithme.maps.settings.RoadType;
@@ -197,8 +194,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
@SuppressWarnings("NullableProblems")
@NonNull
private MapLayerCompositeController mToggleMapLayerController;
- @Nullable
- private SearchFilterController mFilterController;
private boolean mIsTabletLayout;
private boolean mIsFullscreen;
@@ -224,9 +219,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
@SuppressWarnings("NullableProblems")
@NonNull
private MenuController mMainMenuController;
- @SuppressWarnings("NotNullFieldNotInitialized")
- @NonNull
- private Toolbar mBookmarkCategoryToolbar;
+
public interface LeftAnimationTrackListener
{
@@ -326,14 +319,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
BookmarkCategoriesActivity.start(this);
}
- private void showTabletSearch(@Nullable Intent data, @NonNull String query)
- {
- if (mFilterController == null || data == null)
- return;
-
- showSearch(query);
- }
-
public void showSearch(String query)
{
if (mIsTabletLayout)
@@ -440,11 +425,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
.addOnGlobalLayoutListener(new ToolbarLayoutChangeListener());
mSearchController.setVisibilityListener(this);
- mBookmarkCategoryToolbar = findViewById(R.id.bookmark_category_toolbar);
- mBookmarkCategoryToolbar.inflateMenu(R.menu.menu_bookmark_catalog);
- mBookmarkCategoryToolbar.setOnMenuItemClickListener(this::onBookmarkToolbarMenuClicked);
- UiUtils.extendViewWithStatusBar(mBookmarkCategoryToolbar);
-
boolean isLaunchByDeepLink = getIntent().getBooleanExtra(EXTRA_LAUNCH_BY_DEEP_LINK, false);
initViews(isLaunchByDeepLink);
@@ -463,16 +443,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
}
- private boolean onBookmarkToolbarMenuClicked(@NonNull MenuItem item)
- {
- if (item.getItemId() == R.id.close)
- {
- closeBookmarkCategoryToolbar();
- return true;
- }
- return false;
- }
-
@Override
public void onNoConnectionError()
{
@@ -500,24 +470,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
initMainMenu();
initOnmapDownloader();
initPositionChooser();
- initFilterViews();
- }
-
- private void initFilterViews()
- {
- View frame = findViewById(R.id.filter_frame);
- if (frame != null)
- {
- mFilterController = new SearchFilterController(frame, new SearchFilterController
- .DefaultFilterListener()
- {
- @Override
- public void onShowOnMapClick()
- {
- showSearch(mSearchController.getQuery());
- }
- }, R.string.search_in_table);
- }
}
private void initPositionChooser()
@@ -552,7 +504,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
// Do not show the search tool bar if we are planning or navigating
if (!RoutingController.get().isNavigating() && !RoutingController.get().isPlanning())
{
- mSearchController.show();
+ showSearchToolbar();
}
}
else
@@ -561,6 +513,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
}
+ private void showSearchToolbar()
+ {
+ mSearchController.show();
+ }
+
public void showPositionChooser(boolean isBusiness, boolean applyPosition)
{
closeFloatingToolbarsAndPanels(false);
@@ -749,19 +706,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
return false;
}
- /**
- * @return False if the bookmark category toolbar was already closed, true otherwise
- */
- private boolean closeBookmarkCategoryToolbar()
- {
- if (UiUtils.isVisible(mBookmarkCategoryToolbar))
- {
- hideBookmarkCategoryToolbar();
- return true;
- }
- return false;
- }
-
private void closeFloatingToolbarsAndPanels(boolean clearSearchText)
{
closeFloatingPanels();
@@ -776,7 +720,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
private void closeFloatingToolbars(boolean clearSearchText, boolean stopSearch)
{
- closeBookmarkCategoryToolbar();
closePositionChooser();
closeSearchToolbar(clearSearchText, stopSearch);
}
@@ -1137,7 +1080,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
RoutingController routingController = RoutingController.get();
if (!closeMenu() && !closePlacePage() && !closeSearchToolbar(true, true) &&
- !closeBookmarkCategoryToolbar() && !closeSidePanel() && !closePositionChooser() &&
+ !closeSidePanel() && !closePositionChooser() &&
!routingController.resetToPlanningStateIfNavigating() && !routingController.cancel())
{
try
@@ -1268,9 +1211,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
|| RoutingController.get().isPlanning())
return;
- if (UiUtils.isVisible(mBookmarkCategoryToolbar))
- return;
-
mIsFullscreen = isFullscreen;
final BaseMenu menu = getCurrentMenu();
@@ -1466,12 +1406,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
return false;
}
- if (UiUtils.isVisible(mBookmarkCategoryToolbar))
- {
- showLineFrame(false);
- return false;
- }
-
hideRoutingActionFrame();
showLineFrame(true);
return true;
@@ -1658,17 +1592,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (mNavAnimationController == null)
return;
- adjustCompassAndTraffic(visible ? calcFloatingViewsOffset()
- : UiUtils.getStatusBarHeight(getApplicationContext()));
- int toolbarHeight = mSearchController.getToolbar().getHeight();
- setNavButtonsTopLimit(visible ? toolbarHeight : 0);
- if (mFilterController != null)
- {
- boolean show = visible && !TextUtils.isEmpty(SearchEngine.INSTANCE.getQuery())
- && !RoutingController.get().isNavigating();
- mFilterController.show(show);
- mMainMenu.show(!show);
- }
+ boolean show = visible && !TextUtils.isEmpty(SearchEngine.INSTANCE.getQuery())
+ && !RoutingController.get().isNavigating();
+ mMainMenu.show(!show);
}
private int calcFloatingViewsOffset()
@@ -1690,11 +1616,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
refreshFade();
if (mOnmapDownloader != null)
mOnmapDownloader.updateState(false);
- if (show)
- {
- if (mFilterController != null)
- mFilterController.show(false);
- }
}
@Override
@@ -2021,6 +1942,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
@Override
public void onSearchQueryClick(@Nullable String query)
{
+ closeFloatingToolbarsAndPanels(true);
showSearch(query);
}
@@ -2069,7 +1991,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
Track track = BookmarkManager.INSTANCE.getTrack(trackId);
Objects.requireNonNull(track);
- setupBookmarkCategoryToolbar(track.getCategoryId());
Framework.nativeShowTrackRect(trackId);
}
@@ -2077,43 +1998,14 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
BookmarkInfo info = BookmarkManager.INSTANCE.getBookmarkInfo(bookmarkId);
Objects.requireNonNull(info);
- setupBookmarkCategoryToolbar(info.getCategoryId());
BookmarkManager.INSTANCE.showBookmarkOnMap(bookmarkId);
}
public void showBookmarkCategoryOnMap(long categoryId)
{
- setupBookmarkCategoryToolbar(categoryId);
BookmarkManager.INSTANCE.showBookmarkCategoryOnMap(categoryId);
}
- private void setupBookmarkCategoryToolbar(long categoryId)
- {
- final BookmarkCategory category = BookmarkManager.INSTANCE.getCategoryById(categoryId);
- mBookmarkCategoryToolbar.setTitle(category.getName());
- UiUtils.setupNavigationIcon(mBookmarkCategoryToolbar, v -> {
- BookmarkCategoriesActivity.start(MwmActivity.this, category);
- closePlacePage();
- closeBookmarkCategoryToolbar();
- });
-
- showBookmarkCategoryToolbar();
- }
-
- private void showBookmarkCategoryToolbar()
- {
- UiUtils.show(mBookmarkCategoryToolbar);
- adjustCompassAndTraffic(mBookmarkCategoryToolbar.getHeight());
- adjustMenuLineFrameVisibility();
- }
-
- private void hideBookmarkCategoryToolbar()
- {
- UiUtils.hide(mBookmarkCategoryToolbar);
- adjustCompassAndTraffic(UiUtils.getStatusBarHeight(MwmActivity.this));
- adjustMenuLineFrameVisibility();
- }
-
private class CurrentPositionClickListener implements OnClickListener
{
@Override
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
index ec649ab565..d5380d2113 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
@@ -249,7 +249,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
{
final Intent i = makeMwmActivityIntent();
@@ -802,7 +802,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
- {
- if (mFilterListener != null)
- mFilterListener.onShowOnMapClick();
- });
- }
-
- public static class DefaultFilterListener implements FilterListener
- {
- @Override
- public void onShowOnMapClick()
- {
- }
- }
-}
diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java
index aa26bfae53..9529aed4dc 100644
--- a/android/src/com/mapswithme/maps/search/SearchFragment.java
+++ b/android/src/com/mapswithme/maps/search/SearchFragment.java
@@ -14,6 +14,7 @@ import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -21,6 +22,8 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmActivity;
@@ -72,7 +75,7 @@ public class SearchFragment extends BaseMwmFragment
{
public ToolbarController(View root)
{
- super(root, SearchFragment.this.getActivity());
+ super(root, SearchFragment.this.requireActivity());
}
@Override
@@ -144,13 +147,9 @@ public class SearchFragment extends BaseMwmFragment
}
}
- private View mTabFrame;
private View mResultsFrame;
private PlaceholderView mResultsPlaceholder;
- private RecyclerView mResults;
- private AppBarLayout mAppBarLayout;
- @Nullable
- private SearchFilterController mFilterController;
+ private FloatingActionButton mShowOnMapFab;
private SearchToolbarController mToolbarController;
@@ -162,7 +161,7 @@ public class SearchFragment extends BaseMwmFragment
private final RecyclerView.OnScrollListener mRecyclerListener = new RecyclerView.OnScrollListener()
{
@Override
- public void onScrollStateChanged(RecyclerView recyclerView, int newState)
+ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState)
{
if (newState == RecyclerView.SCROLL_STATE_DRAGGING)
mToolbarController.deactivate();
@@ -188,19 +187,6 @@ public class SearchFragment extends BaseMwmFragment
}
};
- private final AppBarLayout.OnOffsetChangedListener mOffsetListener =
- new AppBarLayout.OnOffsetChangedListener() {
- @Override
- public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset)
- {
- if (mFilterController == null)
- return;
-
- boolean show = !(Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange());
- mFilterController.showDivider(show);
- }
- };
-
private static boolean doShowDownloadSuggest()
{
return (MapManager.nativeGetDownloadedCount() == 0 && !MapManager.nativeIsDownloading());
@@ -214,7 +200,7 @@ public class SearchFragment extends BaseMwmFragment
if (fragment == null || fragment.isDetached() || fragment.isRemoving())
{
- fragment = Fragment.instantiate(getActivity(), fragmentName, null);
+ fragment = Fragment.instantiate(requireActivity(), fragmentName, null);
fm.beginTransaction()
.add(R.id.download_suggest_frame, fragment, fragmentName)
.commit();
@@ -237,15 +223,14 @@ public class SearchFragment extends BaseMwmFragment
private void updateFrames()
{
final boolean hasQuery = mToolbarController.hasQuery();
- UiUtils.showIf(hasQuery, mResultsFrame);
Toolbar toolbar = mToolbarController.getToolbar();
AppBarLayout.LayoutParams lp = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
lp.setScrollFlags(hasQuery ? AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS
| AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL : 0);
toolbar.setLayoutParams(lp);
- if (mFilterController != null)
- mFilterController.show(hasQuery);
+ UiUtils.showIf(hasQuery, mResultsFrame);
+ UiUtils.showIf(hasQuery, mShowOnMapFab);
if (hasQuery)
hideDownloadSuggest();
else if (doShowDownloadSuggest())
@@ -261,8 +246,6 @@ public class SearchFragment extends BaseMwmFragment
&& mToolbarController.hasQuery();
UiUtils.showIf(show, mResultsPlaceholder);
- if (mFilterController != null)
- mFilterController.showPopulateButton(!isTabletSearch());
}
@Override
@@ -280,8 +263,7 @@ public class SearchFragment extends BaseMwmFragment
readArguments();
ViewGroup root = (ViewGroup) view;
- mAppBarLayout = root.findViewById(R.id.app_bar);
- mTabFrame = root.findViewById(R.id.tab_frame);
+ View mTabFrame = root.findViewById(R.id.tab_frame);
ViewPager pager = mTabFrame.findViewById(R.id.pages);
mToolbarController = new ToolbarController(view);
@@ -289,20 +271,10 @@ public class SearchFragment extends BaseMwmFragment
final TabAdapter tabAdapter = new TabAdapter(getChildFragmentManager(), pager, tabLayout);
mResultsFrame = root.findViewById(R.id.results_frame);
- mResults = mResultsFrame.findViewById(R.id.recycler);
+ RecyclerView mResults = mResultsFrame.findViewById(R.id.recycler);
setRecyclerScrollListener(mResults);
mResultsPlaceholder = mResultsFrame.findViewById(R.id.placeholder);
mResultsPlaceholder.setContent(R.string.search_not_found, R.string.search_not_found_query);
- mFilterController = new SearchFilterController(root.findViewById(R.id.filter_frame),
- new SearchFilterController.DefaultFilterListener()
- {
- @Override
- public void onShowOnMapClick()
- {
- showAllResultsOnMap();
- }
-
- }, R.string.search_show_on_map);
mSearchAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver()
{
@@ -312,6 +284,8 @@ public class SearchFragment extends BaseMwmFragment
updateResultsPlaceholder();
}
});
+ mShowOnMapFab = root.findViewById(R.id.show_on_map_fab);
+ mShowOnMapFab.setOnClickListener(v -> showAllResultsOnMap());
mResults.setLayoutManager(new LinearLayoutManager(view.getContext()));
mResults.setAdapter(mSearchAdapter);
@@ -347,7 +321,6 @@ public class SearchFragment extends BaseMwmFragment
{
super.onResume();
LocationHelper.INSTANCE.addListener(mLocationListener);
- mAppBarLayout.addOnOffsetChangedListener(mOffsetListener);
}
@Override
@@ -355,7 +328,6 @@ public class SearchFragment extends BaseMwmFragment
{
LocationHelper.INSTANCE.removeListener(mLocationListener);
super.onPause();
- mAppBarLayout.removeOnOffsetChangedListener(mOffsetListener);
}
@Override
@@ -434,7 +406,7 @@ public class SearchFragment extends BaseMwmFragment
{
SearchResult.Description description = result.description;
String subtitle = description != null
- ? Utils.getLocalizedFeatureType(getContext(), description.featureType)
+ ? Utils.getLocalizedFeatureType(requireContext(), description.featureType)
: "";
String title = TextUtils.isEmpty(result.name) ? subtitle : "";
@@ -562,9 +534,6 @@ public class SearchFragment extends BaseMwmFragment
{
super.onActivityResult(requestCode, resultCode, data);
mToolbarController.onActivityResult(requestCode, resultCode, data);
-
- if (resultCode != Activity.RESULT_OK)
- return;
}
@Override
@@ -593,8 +562,9 @@ public class SearchFragment extends BaseMwmFragment
private void closeSearch()
{
- getActivity().finish();
- getActivity().overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
+ final Activity activity = requireActivity();
+ activity.finish();
+ activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
public void setRecyclerScrollListener(RecyclerView recycler)
diff --git a/android/src/com/mapswithme/maps/widget/SearchToolbarController.java b/android/src/com/mapswithme/maps/widget/SearchToolbarController.java
index efd047af31..dbf67ea8ba 100644
--- a/android/src/com/mapswithme/maps/widget/SearchToolbarController.java
+++ b/android/src/com/mapswithme/maps/widget/SearchToolbarController.java
@@ -20,7 +20,7 @@ import com.mapswithme.util.StringUtils;
import com.mapswithme.util.UiUtils;
public class SearchToolbarController extends ToolbarController
- implements View.OnClickListener
+ implements View.OnClickListener, View.OnFocusChangeListener
{
private static final int REQUEST_VOICE_RECOGNITION = 0xCA11;
@Nullable
@@ -62,7 +62,7 @@ public class SearchToolbarController extends ToolbarController
mSearchContainer = getToolbar().findViewById(R.id.search_container);
mBack = mSearchContainer.findViewById(R.id.back);
mQuery = mSearchContainer.findViewById(R.id.query);
- mQuery.setOnClickListener(this);
+ mQuery.setOnFocusChangeListener(this);
mQuery.addTextChangedListener(mTextWatcher);
mQuery.setOnEditorActionListener(
(v, actionId, event) ->
@@ -185,15 +185,18 @@ public class SearchToolbarController extends ToolbarController
UiUtils.showIf(show, mProgress);
}
+ @Override
+ public void onFocusChange(View view, boolean b)
+ {
+ if (view.getId()== R.id.query && b)
+ onQueryClick(getQuery());
+ }
+
@Override
public void onClick(View v)
{
switch (v.getId())
{
- case R.id.query:
- onQueryClick(getQuery());
- break;
-
case R.id.clear:
onClearClick();
break;