diff --git a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java index fb0827d0a9..fcfef74bf8 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java @@ -81,7 +81,6 @@ public class OsmAndAppCustomization { } public Class getDownloadActivity() { - //return DownloadActivity.class; return DownloadActivity.class; } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index 012092e48d..1f4e152c22 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -54,10 +54,14 @@ public class DownloadActivity extends SherlockFragmentActivity { private List localIndexInfos = new ArrayList(); List> fragList = new ArrayList>(); + private String initialFilter = ""; public static final String FILTER_KEY = "filter"; public static final String FILTER_CAT = "filter_cat"; + public static final String TAB_TO_OPEN = "Tab_to_open"; + public static final String DOWNLOAD_TAB = "download"; + @Override protected void onCreate(Bundle savedInstanceState) { @@ -128,9 +132,10 @@ public class DownloadActivity extends SherlockFragmentActivity { setType(downloadTypes.get(0)); if (intent != null && intent.getExtras() != null) { final String filter = intent.getExtras().getString(FILTER_KEY); -// if (filter != null) { -// filterText.setText(filter); -// } + if (filter != null) { + initialFilter = filter; + } + final String filterCat = intent.getExtras().getString(FILTER_CAT); if (filterCat != null) { DownloadActivityType type = DownloadActivityType.getIndexType(filterCat.toLowerCase()); @@ -140,6 +145,13 @@ public class DownloadActivity extends SherlockFragmentActivity { downloadTypes.add(0, type); } } + + String tab = intent.getExtras().get(TAB_TO_OPEN).toString(); + if (tab != null) { + if (tab.equals(DOWNLOAD_TAB)){ + tabHost.setCurrentTab(1); + } + } } if(getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) { @@ -197,6 +209,10 @@ public class DownloadActivity extends SherlockFragmentActivity { return downloadListIndexThread != null ? downloadListIndexThread.getIndexActivatedFileNames() : null; } + public String getInitialFilter() { + return initialFilter; + } + @Override protected void onResume() { super.onResume(); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java index 404dd69629..63195d8e07 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java @@ -84,7 +84,8 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment { }; filterText.addTextChangedListener(textWatcher); - + String filter = ((DownloadActivity)getActivity()).getInitialFilter(); + filterText.setText(filter); return view; } diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java index af24a3f559..8fc0138455 100644 --- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java @@ -89,6 +89,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer { public void onClick(View v) { final Intent intent = new Intent(view.getContext(), view.getApplication().getAppCustomization().getDownloadIndexActivity()); intent.putExtra(DownloadActivity.FILTER_KEY, filter.toString()); + intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB); view.getContext().startActivity(intent); } });