[Quick search] show on the map button customization

This commit is contained in:
Alexey Kulish 2016-07-25 10:31:11 +03:00
parent 49ef49a919
commit 8d2426a873
2 changed files with 9 additions and 0 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="show_something_on_map">Show %1$s on the map</string>
<string name="release_2_4">
\u2022 New very powerful free text search. \n\n
\u2022 Much improved audio over Bluetooth.\n\n

View file

@ -62,6 +62,7 @@ import net.osmand.search.core.SearchCoreFactory.SearchBaseAPI;
import net.osmand.search.core.SearchPhrase;
import net.osmand.search.core.SearchResult;
import net.osmand.search.core.SearchSettings;
import net.osmand.search.core.SearchWord;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
@ -260,6 +261,12 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
String newText = searchUICore.getPhrase().getTextWithoutLastWord();
searchEditText.setText(newText);
searchEditText.setSelection(newText.length());
SearchWord word = searchUICore.getPhrase().getLastSelectedWord();
if (word != null && word.getResult() != null) {
buttonToolbarText.setText(app.getString(R.string.show_something_on_map, word.getResult().localeName).toUpperCase());
} else {
buttonToolbarText.setText(app.getString(R.string.show_on_map).toUpperCase());
}
}
}
});
@ -659,6 +666,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
searchQuery = txt;
searchEditText.setText(txt);
searchEditText.setSelection(txt.length());
buttonToolbarText.setText(getMyApplication().getString(R.string.show_something_on_map, sr.localeName).toUpperCase());
runCoreSearch(txt);
}