From 7d7d9409ef5bab4b85f220888e265e7d66950fdf Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 25 Oct 2017 17:52:58 +0300 Subject: [PATCH] Disable online search without online maps plugin enabled --- OsmAnd/res/layout/search_more_list_item.xml | 4 ++- .../search/QuickSearchDialogFragment.java | 24 ++++++++------- .../plus/search/QuickSearchListAdapter.java | 29 +++++++++++-------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/OsmAnd/res/layout/search_more_list_item.xml b/OsmAnd/res/layout/search_more_list_item.xml index 216c558aef..faa6e33c0c 100644 --- a/OsmAnd/res/layout/search_more_list_item.xml +++ b/OsmAnd/res/layout/search_more_list_item.xml @@ -102,7 +102,9 @@ android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" android:minHeight="48dp" - android:orientation="vertical"> + android:orientation="vertical" + android:visibility="gone" + tools:visibility="visible"> { view.findViewById(R.id.empty_search).setVisibility(View.GONE); view.findViewById(R.id.more_divider).setVisibility(View.GONE); } - view.findViewById(R.id.increase_radius_row).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - ((QuickSearchMoreListItem) listItem).increaseRadiusOnClick(); - } - }); - view.findViewById(R.id.online_search_row).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - ((QuickSearchMoreListItem) listItem).onlineSearchOnClick(); - } - }); + if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null) { + view.findViewById(R.id.online_search_row).setVisibility(View.VISIBLE); + view.findViewById(R.id.increase_radius_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + ((QuickSearchMoreListItem) listItem).increaseRadiusOnClick(); + } + }); + view.findViewById(R.id.online_search_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + ((QuickSearchMoreListItem) listItem).onlineSearchOnClick(); + } + }); + } } else if (type == QuickSearchListItemType.BUTTON) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) app