From 8d65ec639749ec25b0f86c84514bd47c0bd208f6 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 11 Sep 2011 17:35:57 +0200 Subject: [PATCH] Fix Issue 621. Inconsistency of Search --- .../activities/search/SearchActivity.java | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java index 40d75b76c4..64b329a1a6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java @@ -33,38 +33,34 @@ public class SearchActivity extends TabActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - } - - @Override - protected void onResume() { - super.onResume(); Intent intent = getIntent(); int tabIndex = 0; - if(intent != null){ + if (intent != null) { tabIndex = intent.getIntExtra(TAB_INDEX_EXTRA, POI_TAB_INDEX); float lat = intent.getFloatExtra(SEARCH_LAT, 0); float lon = intent.getFloatExtra(SEARCH_LON, 0); - if(lat != 0 || lon != 0){ + if (lat != 0 || lon != 0) { searchPoint = new LatLon(lat, lon); } } - - TabHost host = getTabHost(); - // TODO investigate proper intent with lat/lon ? - host.addTab(host.newTabSpec("Search_POI").setIndicator(getString(R.string.poi)).setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$ - - addressSpec = host.newTabSpec("Search_Address").setIndicator(getString(R.string.address)); - setAddressSpecContent(searchPoint); - - host.addTab(addressSpec); - host.addTab(host.newTabSpec("Search_Location").setIndicator(getString(R.string.search_tabs_location)).setContent(createIntent(NavigatePointActivity.class))); //$NON-NLS-1$ + + TabHost host = getTabHost(); + // TODO investigate proper intent with lat/lon ? + host.addTab(host.newTabSpec("Search_POI").setIndicator(getString(R.string.poi)).setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$ + + addressSpec = host.newTabSpec("Search_Address").setIndicator(getString(R.string.address)); + setAddressSpecContent(searchPoint); + + host.addTab(addressSpec); + host.addTab(host.newTabSpec("Search_Location").setIndicator(getString(R.string.search_tabs_location)).setContent(createIntent(NavigatePointActivity.class))); //$NON-NLS-1$ if (searchPoint != null) { host.addTab(host.newTabSpec("Search_Transport").setIndicator(getString(R.string.transport)).setContent(createIntent(SearchTransportActivity.class))); //$NON-NLS-1$ } - host.addTab(host.newTabSpec("Search_History").setIndicator(getString(R.string.history)).setContent(createIntent(SearchHistoryActivity.class))); //$NON-NLS-1$ - host.setCurrentTab(tabIndex); + host.addTab(host.newTabSpec("Search_History").setIndicator(getString(R.string.history)).setContent(createIntent(SearchHistoryActivity.class))); //$NON-NLS-1$ + host.setCurrentTab(tabIndex); } + private Intent createIntent(Class cl){ Intent intent = new Intent(this, cl); if(searchPoint != null){