diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java index 32085f4d0d..04b6d916e4 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java @@ -182,7 +182,7 @@ public class BinaryMapAddressReaderAdapter { } } codedIS.popLimit(oldLimit); - if(resultMatcher != null && resultMatcher.isCancelled()){ + if (resultMatcher != null && resultMatcher.isCancelled()) { codedIS.skipRawBytes(codedIS.getBytesUntilLimit()); } break; @@ -233,7 +233,7 @@ public class BinaryMapAddressReaderAdapter { int y = 0; City c = null; LinkedList additionalTags = null; - while(true){ + while (true) { int t = codedIS.readTag(); int tag = WireFormat.getTagFieldNumber(t); switch (tag) { @@ -263,7 +263,7 @@ public class BinaryMapAddressReaderAdapter { case OsmandOdb.CityIndex.ATTRIBUTETAGIDS_FIELD_NUMBER : int tgid = codedIS.readUInt32(); if(additionalTags == null) { - additionalTags = new LinkedList(); + additionalTags = new LinkedList<>(); } if(additionalTagsTable != null && tgid < additionalTagsTable.size()) { additionalTags.add(additionalTagsTable.get(tgid)); @@ -577,15 +577,15 @@ public class BinaryMapAddressReaderAdapter { do { int st = codedIS.readTag(); stag = WireFormat.getTagFieldNumber(st); - if(stag == AddressNameIndexData.ATOM_FIELD_NUMBER) { + if (stag == AddressNameIndexData.ATOM_FIELD_NUMBER) { int slen = codedIS.readRawVarint32(); int soldLim = codedIS.pushLimit(slen); readAddressNameData(req, refs, fp); codedIS.popLimit(soldLim); - } else if(stag != 0){ + } else if (stag != 0){ skipUnknownField(st); } - } while(stag != 0); + } while (stag != 0); codedIS.popLimit(oldLim); if (req.isCancelled()) { @@ -659,8 +659,8 @@ public class BinaryMapAddressReaderAdapter { private void readAddressNameData(SearchRequest req, TIntArrayList[] refs, int fp) throws IOException { TIntArrayList toAdd = null; - while(true){ - if(req.isCancelled()){ + while (true) { + if (req.isCancelled()){ return; } int t = codedIS.readTag(); @@ -675,12 +675,12 @@ public class BinaryMapAddressReaderAdapter { codedIS.readString(); break; case AddressNameIndexDataAtom.SHIFTTOCITYINDEX_FIELD_NUMBER : - if(toAdd != null) { + if (toAdd != null) { toAdd.add(fp - codedIS.readInt32()); } break; case AddressNameIndexDataAtom.SHIFTTOINDEX_FIELD_NUMBER : - if(toAdd != null) { + if (toAdd != null) { toAdd.add(fp - codedIS.readInt32()); } break; diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java index eccd66ccfd..de331b4e3d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java @@ -176,7 +176,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity }); selectAddress = getIntent() != null && getIntent().hasExtra(SELECT_ADDRESS); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); - if(initializeTask != null){ + if (initializeTask != null){ initializeTask.execute(); } } @@ -286,8 +286,8 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity protected void addObjectToInitialList(T initial){ initialListToFilter.add(initial); - if(!namesFilter.active){ - if(filterObject(initial, currentFilter)) { + if (!namesFilter.active) { + if (filterObject(initial, currentFilter)) { Message msg = uiHandler.obtainMessage(MESSAGE_ADD_ENTITY, initial); msg.sendToTarget(); } @@ -335,7 +335,6 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity return matches; } - @Override protected void onResume() { super.onResume(); @@ -394,7 +393,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity @Override public void handleMessage(Message msg) { String currentFilter = SearchByNameAbstractActivity.this.currentFilter; - if (msg.what == MESSAGE_CLEAR_LIST){ + if (msg.what == MESSAGE_CLEAR_LIST) { minimalIndex = Integer.MAX_VALUE; minimalText = null; getListAdapter().clear(); @@ -457,7 +456,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity protected FilterResults performFiltering(CharSequence constraint) { isCancelled = false; String query = constraint.toString(); - if(query.equals(newFilter)){ + if (query.equals(newFilter)) { active = true; startTime = System.currentTimeMillis(); uiHandler.sendEmptyMessage(MESSAGE_CLEAR_LIST); @@ -466,7 +465,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity filterLoop(query, list); active = false; } - if(!isCancelled){ + if (!isCancelled) { return new FilterResults(); } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreetByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreetByNameActivity.java index 0bf4522de9..1583ee54f2 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreetByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreetByNameActivity.java @@ -127,9 +127,9 @@ public class SearchStreetByNameActivity extends SearchByNameAbstractActivity list) { if(searchWithCity == -1){ filter(query, list); - } else if(searchWithCity == 0){ + } else if (searchWithCity == 0) { for (Street obj : list) { - if(namesFilter.isCancelled){ + if (namesFilter.isCancelled) { break; } if(filterObject(obj, query)){ @@ -143,7 +143,7 @@ public class SearchStreetByNameActivity extends SearchByNameAbstractActivity