Disable online search without online maps plugin enabled
This commit is contained in:
parent
f13c0145c5
commit
7d7d9409ef
3 changed files with 34 additions and 23 deletions
|
@ -102,7 +102,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:minHeight="48dp"
|
android:minHeight="48dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -64,6 +64,7 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -71,6 +72,7 @@ import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.resources.RegionAddressRepository;
|
import net.osmand.plus.resources.RegionAddressRepository;
|
||||||
import net.osmand.plus.search.QuickSearchHelper.SearchHistoryAPI;
|
import net.osmand.plus.search.QuickSearchHelper.SearchHistoryAPI;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchButtonListItem;
|
import net.osmand.plus.search.listitems.QuickSearchButtonListItem;
|
||||||
|
@ -1080,16 +1082,18 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
for (SearchResult sr : res.getCurrentSearchResults()) {
|
for (SearchResult sr : res.getCurrentSearchResults()) {
|
||||||
rows.add(new QuickSearchListItem(app, sr));
|
rows.add(new QuickSearchListItem(app, sr));
|
||||||
}
|
}
|
||||||
rows.add(new QuickSearchButtonListItem(app, R.drawable.ic_world_globe_dark,
|
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null) {
|
||||||
app.getString(R.string.search_online_address), new OnClickListener() {
|
rows.add(new QuickSearchButtonListItem(app, R.drawable.ic_world_globe_dark,
|
||||||
@Override
|
app.getString(R.string.search_online_address), new OnClickListener() {
|
||||||
public void onClick(View view) {
|
@Override
|
||||||
startOnlinePoiSearch();
|
public void onClick(View view) {
|
||||||
mainSearchFragment.getAdapter().clear();
|
startOnlinePoiSearch();
|
||||||
updateTabbarVisibility(false);
|
mainSearchFragment.getAdapter().clear();
|
||||||
openKeyboard();
|
updateTabbarVisibility(false);
|
||||||
}
|
openKeyboard();
|
||||||
}));
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
rows.add(new QuickSearchButtonListItem(app, R.drawable.ic_action_search_dark,
|
rows.add(new QuickSearchButtonListItem(app, R.drawable.ic_action_search_dark,
|
||||||
app.getString(R.string.custom_search), new OnClickListener() {
|
app.getString(R.string.custom_search), new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,8 +20,10 @@ import net.osmand.access.AccessibilityAssistant;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchHeaderListItem;
|
import net.osmand.plus.search.listitems.QuickSearchHeaderListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchListItem;
|
import net.osmand.plus.search.listitems.QuickSearchListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchListItemType;
|
import net.osmand.plus.search.listitems.QuickSearchListItemType;
|
||||||
|
@ -233,18 +235,21 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
|
||||||
view.findViewById(R.id.empty_search).setVisibility(View.GONE);
|
view.findViewById(R.id.empty_search).setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.more_divider).setVisibility(View.GONE);
|
view.findViewById(R.id.more_divider).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
view.findViewById(R.id.increase_radius_row).setOnClickListener(new View.OnClickListener() {
|
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null) {
|
||||||
@Override
|
view.findViewById(R.id.online_search_row).setVisibility(View.VISIBLE);
|
||||||
public void onClick(View view) {
|
view.findViewById(R.id.increase_radius_row).setOnClickListener(new View.OnClickListener() {
|
||||||
((QuickSearchMoreListItem) listItem).increaseRadiusOnClick();
|
@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) {
|
view.findViewById(R.id.online_search_row).setOnClickListener(new View.OnClickListener() {
|
||||||
((QuickSearchMoreListItem) listItem).onlineSearchOnClick();
|
@Override
|
||||||
}
|
public void onClick(View view) {
|
||||||
});
|
((QuickSearchMoreListItem) listItem).onlineSearchOnClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (type == QuickSearchListItemType.BUTTON) {
|
} else if (type == QuickSearchListItemType.BUTTON) {
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
LayoutInflater inflater = (LayoutInflater) app
|
LayoutInflater inflater = (LayoutInflater) app
|
||||||
|
|
Loading…
Reference in a new issue