Fix small issues
This commit is contained in:
parent
2bb1d40f41
commit
0d407b9026
5 changed files with 28 additions and 22 deletions
|
@ -105,7 +105,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
searchPOILevel.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
return searchMore();
|
||||
return search();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -159,7 +159,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
return tb;
|
||||
}
|
||||
|
||||
private boolean searchMore() {
|
||||
private boolean search() {
|
||||
String query = searchFilter.getText().toString().trim();
|
||||
if (query.length() < 2 && isNameSearch()) {
|
||||
AccessibleToast.makeText(SearchPOIActivity.this, R.string.poi_namefinder_query_empty, Toast.LENGTH_LONG)
|
||||
|
@ -171,6 +171,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
filter.setFilterByName(query);
|
||||
runNewSearchQuery(location, NEW_SEARCH_INIT);
|
||||
} else {
|
||||
filter.setFilterByName(query);
|
||||
runNewSearchQuery(location, SEARCH_FURTHER);
|
||||
}
|
||||
return true;
|
||||
|
@ -243,6 +244,11 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
runNewSearchQuery(location, NEW_SEARCH_INIT);
|
||||
}
|
||||
updateButtonState();
|
||||
if (filter != null) {
|
||||
String text = filter.getFilterByName() != null ? filter.getFilterByName() : "";
|
||||
searchFilter.setText(text);
|
||||
searchFilterLayout.setVisibility(text.length() > 0 || isNameSearch() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (filter != null) {
|
||||
if (searchNearBy) {
|
||||
app.getLocationProvider().addLocationListener(this);
|
||||
|
@ -251,15 +257,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
}
|
||||
updateLocation(location);
|
||||
}
|
||||
if (isNameSearch()) {
|
||||
searchFilterLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if(searchFilterLayout.getVisibility() == View.VISIBLE) {
|
||||
searchFilter.requestFocus();
|
||||
}
|
||||
if(filter != null) {
|
||||
searchFilter.setText(filter.getFilterByName() != null ? filter.getFilterByName() : "");
|
||||
}
|
||||
|
||||
// Freeze the direction arrows (reference is constant north) when Accessibility mode = ON, so screen can be read
|
||||
// aloud without continuous updates
|
||||
if (!app.accessibilityEnabled()) {
|
||||
|
@ -272,10 +270,12 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
private void changeFilter(CharSequence s) {
|
||||
// if (!isNameSearch() ) {
|
||||
amenityAdapter.getFilter().filter(s);
|
||||
if (filter != null && !isNameSearch()) {
|
||||
String cfilter = filter.getFilterByName() == null ? "" :
|
||||
filter.getFilterByName().toLowerCase();
|
||||
if(!isNameSearch() && !s.toString().toLowerCase().startsWith(cfilter)) {
|
||||
filter.setFilterByName(s.toString());
|
||||
runNewSearchQuery(location, SEARCH_AGAIN);
|
||||
}
|
||||
|
||||
updateButtonState();
|
||||
}
|
||||
|
||||
|
@ -298,8 +298,8 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
boolean enabled = taskAlreadyFinished && location != null &&
|
||||
filter != null && filter.isSearchFurtherAvailable();
|
||||
if(isNameSearch() && !Algorithms.objectEquals(searchFilter.getText().toString(), filter.getFilterByName())) {
|
||||
searchPOILevel.setEnabled(true);
|
||||
searchPOILevel.setTitle(R.string.search_button);
|
||||
enabled = true;
|
||||
title = R.string.search_button;
|
||||
}
|
||||
searchPOILevel.setEnabled(enabled);
|
||||
searchPOILevel.setTitle(title);
|
||||
|
@ -470,7 +470,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
// getSherlock().setProgressBarIndeterminateVisibility(true);
|
||||
setSupportProgressBarIndeterminateVisibility(true);
|
||||
if (searchPOILevel != null) {
|
||||
searchPOILevel.setEnabled(false);
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(List<Amenity> result) {
|
||||
// getSherlock().setProgressBarIndeterminateVisibility(false);
|
||||
setSupportProgressBarIndeterminateVisibility(false);
|
||||
currentSearchTask = null;
|
||||
updateButtonState();
|
||||
if (isNameSearch()) {
|
||||
|
|
|
@ -190,7 +190,10 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
|||
}
|
||||
showFilterActivity(model.getFilterId());
|
||||
} else {
|
||||
showFilterActivity(PoiLegacyFilter.STD_PREFIX + ((AbstractPoiType) item).getKeyName());
|
||||
PoiLegacyFilter custom = getApp().getPoiFilters().getCustomPOIFilter();
|
||||
custom.setFilterByName(null);
|
||||
custom.updateTypesToAccept(((AbstractPoiType) item));
|
||||
showFilterActivity(custom.getFilterId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,8 @@ public class PoiFiltersHelper {
|
|||
|
||||
public void reloadAllPoiFilters() {
|
||||
cacheTopStandardFilters = null;
|
||||
showAllPOIFilter = null;
|
||||
getShowAllPOIFilter();
|
||||
getTopDefinedPoiFilters();
|
||||
}
|
||||
|
||||
|
|
|
@ -312,6 +312,11 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateTypesToAccept(AbstractPoiType pt) {
|
||||
acceptedTypes.clear();
|
||||
pt.putTypes(acceptedTypes);
|
||||
}
|
||||
|
||||
|
||||
public Map<PoiCategory, LinkedHashSet<String>> getAcceptedTypes(){
|
||||
return new LinkedHashMap<PoiCategory, LinkedHashSet<String>>(acceptedTypes);
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.osmand.data.LatLon;
|
|||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
|
@ -198,7 +197,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
data.queryNewData(tileBox);
|
||||
objects = data.getResults();
|
||||
if (objects != null) {
|
||||
MapPoiTypes poiTypes = view.getApplication().getPoiTypes();
|
||||
int r = getRadiusPoi(tileBox);
|
||||
for (Amenity o : objects) {
|
||||
int x = (int) tileBox.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation()
|
||||
|
@ -214,8 +212,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
id = st.getKeyName();
|
||||
} else if (RenderingIcons.containsIcon(st.getOsmTag() + "_" + st.getOsmValue())) {
|
||||
id = st.getOsmTag() + "_" + st.getOsmValue();
|
||||
} else if (RenderingIcons.containsIcon(st.getOsmValue())) {
|
||||
id = st.getOsmValue();
|
||||
}
|
||||
}
|
||||
if (id != null) {
|
||||
|
|
Loading…
Reference in a new issue