Merge pull request #938 from Bars107/master
Fixed issue with wrong tab opened when loading downloads from map. Fixed...
This commit is contained in:
commit
0595382a19
4 changed files with 22 additions and 5 deletions
|
@ -81,7 +81,6 @@ public class OsmAndAppCustomization {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends Activity> getDownloadActivity() {
|
public Class<? extends Activity> getDownloadActivity() {
|
||||||
//return DownloadActivity.class;
|
|
||||||
return DownloadActivity.class;
|
return DownloadActivity.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,14 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
private List<LocalIndexInfo> localIndexInfos = new ArrayList<LocalIndexInfo>();
|
private List<LocalIndexInfo> localIndexInfos = new ArrayList<LocalIndexInfo>();
|
||||||
List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
||||||
|
|
||||||
|
private String initialFilter = "";
|
||||||
|
|
||||||
public static final String FILTER_KEY = "filter";
|
public static final String FILTER_KEY = "filter";
|
||||||
public static final String FILTER_CAT = "filter_cat";
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -128,9 +132,10 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
setType(downloadTypes.get(0));
|
setType(downloadTypes.get(0));
|
||||||
if (intent != null && intent.getExtras() != null) {
|
if (intent != null && intent.getExtras() != null) {
|
||||||
final String filter = intent.getExtras().getString(FILTER_KEY);
|
final String filter = intent.getExtras().getString(FILTER_KEY);
|
||||||
// if (filter != null) {
|
if (filter != null) {
|
||||||
// filterText.setText(filter);
|
initialFilter = filter;
|
||||||
// }
|
}
|
||||||
|
|
||||||
final String filterCat = intent.getExtras().getString(FILTER_CAT);
|
final String filterCat = intent.getExtras().getString(FILTER_CAT);
|
||||||
if (filterCat != null) {
|
if (filterCat != null) {
|
||||||
DownloadActivityType type = DownloadActivityType.getIndexType(filterCat.toLowerCase());
|
DownloadActivityType type = DownloadActivityType.getIndexType(filterCat.toLowerCase());
|
||||||
|
@ -140,6 +145,13 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
downloadTypes.add(0, type);
|
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()) {
|
if(getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) {
|
||||||
|
@ -197,6 +209,10 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
return downloadListIndexThread != null ? downloadListIndexThread.getIndexActivatedFileNames() : null;
|
return downloadListIndexThread != null ? downloadListIndexThread.getIndexActivatedFileNames() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getInitialFilter() {
|
||||||
|
return initialFilter;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
|
@ -84,7 +84,8 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
};
|
};
|
||||||
filterText.addTextChangedListener(textWatcher);
|
filterText.addTextChangedListener(textWatcher);
|
||||||
|
String filter = ((DownloadActivity)getActivity()).getInitialFilter();
|
||||||
|
filterText.setText(filter);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final Intent intent = new Intent(view.getContext(), view.getApplication().getAppCustomization().getDownloadIndexActivity());
|
final Intent intent = new Intent(view.getContext(), view.getApplication().getAppCustomization().getDownloadIndexActivity());
|
||||||
intent.putExtra(DownloadActivity.FILTER_KEY, filter.toString());
|
intent.putExtra(DownloadActivity.FILTER_KEY, filter.toString());
|
||||||
|
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
||||||
view.getContext().startActivity(intent);
|
view.getContext().startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue