diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 29f336cdfe..d84c45c6dd 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -200,6 +200,7 @@ public class BinaryMapRouteReaderAdapter { int nameTypeRule = -1; int refTypeRule = -1; int destinationTypeRule = -1; + int destinationRefTypeRule = -1; public RouteTypeRule quickGetEncodingRule(int id) { return routeEncodingRules.get(id); @@ -216,6 +217,8 @@ public class BinaryMapRouteReaderAdapter { refTypeRule = id; } else if (tags.equals("destination")) { destinationTypeRule = id; + } else if (tags.equals("destination:ref")) { + destinationRefTypeRule = id; } } diff --git a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java index 5fa380dac9..22f5b11fbe 100644 --- a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java @@ -66,14 +66,18 @@ public class RouteDataObject { } public String getRef(){ - if(names != null ) { + if (names != null) { + String ref = names.get(region.destinationRefTypeRule); + if (ref != null) { + return ref; + } return names.get(region.refTypeRule); } return null; } public String getDestinationName(){ - if(names != null ) { + if(names != null) { return names.get(region.destinationTypeRule); } return null; diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index f80d43f60a..3dbebd7fcd 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -222,7 +222,7 @@ - + diff --git a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java index 2e0ed085ed..ac9c2ce641 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java @@ -148,5 +148,8 @@ public class OsmAndAppCustomization { public boolean showNavigationControls() { return true;} - public boolean onlyTourDownload() { return false;} + public boolean onlyTourDownload() { + return false; + } + } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index 15b36247e9..aca427c9e1 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -97,20 +97,12 @@ public class DownloadActivity extends BaseDownloadActivity { tabHost.setup(); ViewPager viewPager = (ViewPager) findViewById(R.id.pager); mTabsAdapter = new FavouritesActivity.TabsAdapter(this, tabHost, viewPager, settings, false); - if (getMyApplication().getAppCustomization().onlyTourDownload()) { - mTabsAdapter.addTab( - tabHost.newTabSpec("DOWNLOADS").setIndicator(getString(R.string.download_tab_downloads)), - DownloadIndexFragment.class, null); - } else { - mTabsAdapter.addTab( - tabHost.newTabSpec("LOCAL_INDEX").setIndicator(getString(R.string.download_tab_local)), - LocalIndexesFragment.class, null); - mTabsAdapter.addTab( - tabHost.newTabSpec("DOWNLOADS").setIndicator(getString(R.string.download_tab_downloads)), - DownloadIndexFragment.class, null); - mTabsAdapter.addTab(tabHost.newTabSpec("UPDATES") - .setIndicator(getString(R.string.download_tab_updates)), UpdatesIndexFragment.class, null); - } + mTabsAdapter.addTab(tabHost.newTabSpec("LOCAL_INDEX").setIndicator(getString(R.string.download_tab_local)), + LocalIndexesFragment.class, null); + mTabsAdapter.addTab(tabHost.newTabSpec("DOWNLOADS") + .setIndicator(getString(R.string.download_tab_downloads)), DownloadIndexFragment.class, null); + mTabsAdapter.addTab(tabHost.newTabSpec("UPDATES").setIndicator(getString(R.string.download_tab_updates)), + UpdatesIndexFragment.class, null); tabHost.setCurrentTab(currentTab); } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java index 11be097ea1..acfa0f392f 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java @@ -41,6 +41,7 @@ import com.actionbarsherlock.view.SubMenu; public class DownloadIndexFragment extends OsmandExpandableListFragment { /** menus **/ + private static boolean SHOW_ONLY_RELOAD = true; public static final int MORE_ID = 10; public static final int RELOAD_ID = 0; public static final int SELECT_ALL_ID = 1; @@ -62,7 +63,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment { listView.setAdapter(listAdapter); setListView(listView); - getDownloadActivity().getSupportActionBar().setTitle(R.string.local_index_download); +// getDownloadActivity().getSupportActionBar().setTitle(R.string.local_index_download); // recreation upon rotation is pgetaprevented in manifest file filterText = (EditText) view.findViewById(R.id.search_box); @@ -151,14 +152,21 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment { }); if (getMyApplication().getAppCustomization().showDownloadExtraActions()) { - SubMenu s = menu.addSubMenu(0, MORE_ID, 0, R.string.default_buttons_other_actions); - s.add(0, RELOAD_ID, 0, R.string.update_downlod_list); - s.add(0, SELECT_ALL_ID, 0, R.string.select_all); - s.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all); + if (SHOW_ONLY_RELOAD) { + MenuItem item = menu.add(0, RELOAD_ID, 0, R.string.update_downlod_list); + item.setIcon(isLightActionBar() ? R.drawable.ic_action_refresh_light : + R.drawable.ic_action_refresh_dark); + item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + } else { + SubMenu s = menu.addSubMenu(0, MORE_ID, 0, R.string.default_buttons_other_actions); + s.add(0, RELOAD_ID, 0, R.string.update_downlod_list); + s.add(0, SELECT_ALL_ID, 0, R.string.select_all); + s.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all); - s.setIcon(isLightActionBar() ? R.drawable.abs__ic_menu_moreoverflow_holo_light - : R.drawable.abs__ic_menu_moreoverflow_holo_dark); - s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + s.setIcon(isLightActionBar() ? R.drawable.abs__ic_menu_moreoverflow_holo_light + : R.drawable.abs__ic_menu_moreoverflow_holo_dark); + s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + } } } diff --git a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java index 2583245ddb..2b3d939484 100644 --- a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java @@ -85,7 +85,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.local_index, container, false); - getDownloadActivity().getSupportActionBar().setTitle(R.string.local_index_descr_title); +// getDownloadActivity().getSupportActionBar().setTitle(R.string.local_index_descr_title); getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false); ExpandableListView listView = (ExpandableListView)view.findViewById(android.R.id.list); @@ -998,18 +998,23 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { TextView nameView = ((TextView) v.findViewById(R.id.category_name)); List list = data.get(group); int size = 0; - for(int i=0; i 0){ - t.append(" [").append(size).append(" MB]"); + if (size > 0) { + String sz; + if (size > 1 << 20) { + sz = formatGb.format(new Object[] { (float) size / (1 << 20) }); + } else { + sz = formatMb.format(new Object[] { (float) size / (1 << 10) }); + } + t.append(" [").append(sz).append("]"); } nameView.setText(t.toString()); if (!group.isBackupedData()) { diff --git a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java index bd0a07df2e..83fdc6bc5b 100644 --- a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java @@ -50,8 +50,8 @@ public class UpdatesIndexFragment extends SherlockListFragment { } private void createListView(List indexItems) { - if (indexItems.size() == 0){ - indexItems.add(new IndexItem(getString(R.string.everything_up_to_date),"",0,"",0,0, null)); + if (indexItems.size() == 0) { + indexItems.add(new IndexItem(getString(R.string.everything_up_to_date), "", 0, "", 0, 0, null)); } listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, indexItems); listAdapter.sort(new Comparator() { @@ -109,8 +109,12 @@ public class UpdatesIndexFragment extends SherlockListFragment { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); if (getMyApplication().getAppCustomization().showDownloadExtraActions()) { + MenuItem item = menu.add(0, DownloadIndexFragment.RELOAD_ID, 0, R.string.update_downlod_list); + item.setIcon(isLightActionBar() ? R.drawable.ic_action_refresh_light : + R.drawable.ic_action_refresh_dark); + item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + SubMenu s = menu.addSubMenu(0, DownloadIndexFragment.MORE_ID, 0, R.string.default_buttons_other_actions); - s.add(0, DownloadIndexFragment.RELOAD_ID, 0, R.string.update_downlod_list); s.add(0, DownloadIndexFragment.SELECT_ALL_ID, 0, R.string.select_all); s.add(0, DownloadIndexFragment.DESELECT_ALL_ID, 0, R.string.deselect_all); diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java index 910c4e7385..65d60e2284 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java @@ -732,8 +732,4 @@ public class SherpafyCustomization extends OsmAndAppCustomization { return false; } - @Override - public boolean onlyTourDownload() { - return true; - } } diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java b/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java index e2cb2d4f63..24ff77c576 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java @@ -379,6 +379,8 @@ public class TourViewActivity extends SherlockFragmentActivity { public void startDownloadActivity() { final Intent download = new Intent(this, DownloadActivity.class); download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); + download.putExtra(DownloadActivity.SINGLE_TAB, true); + download.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB); refreshListAfterDownload = true; startActivity(download); } @@ -418,6 +420,8 @@ public class TourViewActivity extends SherlockFragmentActivity { } - + public boolean onlyTourDownload() { + return true; + } }