Select specific tab for search activity
This commit is contained in:
parent
085fa4d9b7
commit
9611c7f261
3 changed files with 17 additions and 8 deletions
|
@ -1009,6 +1009,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
// dlg.showDialog();
|
// dlg.showDialog();
|
||||||
Intent newIntent = new Intent(MapActivity.this, SearchActivity.class);
|
Intent newIntent = new Intent(MapActivity.this, SearchActivity.class);
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
newIntent.putExtra(SearchActivity.TAB_INDEX_EXTRA, SearchActivity.LOCATION_TAB_INDEX);
|
||||||
startActivity(newIntent);
|
startActivity(newIntent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.map_mute:
|
case R.id.map_mute:
|
||||||
|
|
|
@ -14,7 +14,6 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package net.osmand.plus.activities.search;
|
package net.osmand.plus.activities.search;
|
||||||
|
|
||||||
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.NavigatePointActivity;
|
import net.osmand.plus.activities.NavigatePointActivity;
|
||||||
import android.app.TabActivity;
|
import android.app.TabActivity;
|
||||||
|
@ -13,20 +11,30 @@ import android.widget.TabHost;
|
||||||
import android.widget.TabHost.TabSpec;
|
import android.widget.TabHost.TabSpec;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Maxim Frolov
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SearchActivity extends TabActivity {
|
public class SearchActivity extends TabActivity {
|
||||||
|
public static final int POI_TAB_INDEX = 0;
|
||||||
|
public static final int ADDRESS_TAB_INDEX = 1;
|
||||||
|
public static final int LOCATION_TAB_INDEX = 2;
|
||||||
|
public static final int TRANSPORT_TAB_INDEX = 3;
|
||||||
|
public static final int HISTORY_TAB_INDEX = 4;
|
||||||
|
public static final String TAB_INDEX_EXTRA = "TAB_INDEX_EXTRA";
|
||||||
|
|
||||||
Button searchPOIButton;
|
Button searchPOIButton;
|
||||||
private TabSpec addressSpec;
|
private TabSpec addressSpec;
|
||||||
|
|
||||||
private static boolean searchOnLine = false;
|
private static boolean searchOnLine = false;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
// LatLon latLon = null;
|
||||||
|
int tabIndex = 0;
|
||||||
|
if(intent != null){
|
||||||
|
tabIndex = intent.getIntExtra(TAB_INDEX_EXTRA, POI_TAB_INDEX);
|
||||||
|
}
|
||||||
|
|
||||||
TabHost host = getTabHost();
|
TabHost host = getTabHost();
|
||||||
host.addTab(host.newTabSpec("Search_POI").setIndicator(getString(R.string.poi)).setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$
|
host.addTab(host.newTabSpec("Search_POI").setIndicator(getString(R.string.poi)).setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -37,6 +45,7 @@ public class SearchActivity extends TabActivity {
|
||||||
host.addTab(host.newTabSpec("Search_Location").setIndicator(getString(R.string.search_tabs_location)).setContent(new Intent(this, NavigatePointActivity.class))); //$NON-NLS-1$
|
host.addTab(host.newTabSpec("Search_Location").setIndicator(getString(R.string.search_tabs_location)).setContent(new Intent(this, NavigatePointActivity.class))); //$NON-NLS-1$
|
||||||
// host.addTab(host.newTabSpec("Search_Transport").setIndicator(getString(R.string.transport)).setContent(new Intent(this, SearchTransportActivity.class))); //$NON-NLS-1$
|
// host.addTab(host.newTabSpec("Search_Transport").setIndicator(getString(R.string.transport)).setContent(new Intent(this, SearchTransportActivity.class))); //$NON-NLS-1$
|
||||||
host.addTab(host.newTabSpec("Search_History").setIndicator(getString(R.string.history)).setContent(new Intent(this, SearchHistoryActivity.class))); //$NON-NLS-1$
|
host.addTab(host.newTabSpec("Search_History").setIndicator(getString(R.string.history)).setContent(new Intent(this, SearchHistoryActivity.class))); //$NON-NLS-1$
|
||||||
|
host.setCurrentTab(tabIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startSearchAddressOffline(){
|
public void startSearchAddressOffline(){
|
||||||
|
|
Loading…
Reference in a new issue