Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-12-10 01:20:17 +01:00
commit 6d0cd1a2e1
10 changed files with 59 additions and 40 deletions

View file

@ -200,6 +200,7 @@ public class BinaryMapRouteReaderAdapter {
int nameTypeRule = -1; int nameTypeRule = -1;
int refTypeRule = -1; int refTypeRule = -1;
int destinationTypeRule = -1; int destinationTypeRule = -1;
int destinationRefTypeRule = -1;
public RouteTypeRule quickGetEncodingRule(int id) { public RouteTypeRule quickGetEncodingRule(int id) {
return routeEncodingRules.get(id); return routeEncodingRules.get(id);
@ -216,6 +217,8 @@ public class BinaryMapRouteReaderAdapter {
refTypeRule = id; refTypeRule = id;
} else if (tags.equals("destination")) { } else if (tags.equals("destination")) {
destinationTypeRule = id; destinationTypeRule = id;
} else if (tags.equals("destination:ref")) {
destinationRefTypeRule = id;
} }
} }

View file

@ -67,6 +67,10 @@ public class RouteDataObject {
public String getRef(){ 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 names.get(region.refTypeRule);
} }
return null; return null;

View file

@ -222,7 +222,7 @@
</activity> </activity>
<activity android:name="net.osmand.plus.development.TestVoiceActivity" /> <activity android:name="net.osmand.plus.development.TestVoiceActivity" />
<activity android:name="net.osmand.plus.download.DownloadActivity" android:label="@string/local_index_descr_title" /> <activity android:name="net.osmand.plus.download.DownloadActivity" android:label="" />
<activity android:name="net.osmand.plus.osmedit.LocalOpenstreetmapActivity" android:label="@string/local_openstreetmap_act_title" /> <activity android:name="net.osmand.plus.osmedit.LocalOpenstreetmapActivity" android:label="@string/local_openstreetmap_act_title" />
<!-- keep android:process on a separate line !! --> <!-- keep android:process on a separate line !! -->

View file

@ -148,5 +148,8 @@ public class OsmAndAppCustomization {
public boolean showNavigationControls() { return true;} public boolean showNavigationControls() { return true;}
public boolean onlyTourDownload() { return false;} public boolean onlyTourDownload() {
return false;
}
} }

View file

@ -97,20 +97,12 @@ public class DownloadActivity extends BaseDownloadActivity {
tabHost.setup(); tabHost.setup();
ViewPager viewPager = (ViewPager) findViewById(R.id.pager); ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
mTabsAdapter = new FavouritesActivity.TabsAdapter(this, tabHost, viewPager, settings, false); mTabsAdapter = new FavouritesActivity.TabsAdapter(this, tabHost, viewPager, settings, false);
if (getMyApplication().getAppCustomization().onlyTourDownload()) { mTabsAdapter.addTab(tabHost.newTabSpec("LOCAL_INDEX").setIndicator(getString(R.string.download_tab_local)),
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); LocalIndexesFragment.class, null);
mTabsAdapter.addTab( mTabsAdapter.addTab(tabHost.newTabSpec("DOWNLOADS")
tabHost.newTabSpec("DOWNLOADS").setIndicator(getString(R.string.download_tab_downloads)), .setIndicator(getString(R.string.download_tab_downloads)), DownloadIndexFragment.class, null);
DownloadIndexFragment.class, null); mTabsAdapter.addTab(tabHost.newTabSpec("UPDATES").setIndicator(getString(R.string.download_tab_updates)),
mTabsAdapter.addTab(tabHost.newTabSpec("UPDATES") UpdatesIndexFragment.class, null);
.setIndicator(getString(R.string.download_tab_updates)), UpdatesIndexFragment.class, null);
}
tabHost.setCurrentTab(currentTab); tabHost.setCurrentTab(currentTab);
} }

View file

@ -41,6 +41,7 @@ import com.actionbarsherlock.view.SubMenu;
public class DownloadIndexFragment extends OsmandExpandableListFragment { public class DownloadIndexFragment extends OsmandExpandableListFragment {
/** menus **/ /** menus **/
private static boolean SHOW_ONLY_RELOAD = true;
public static final int MORE_ID = 10; public static final int MORE_ID = 10;
public static final int RELOAD_ID = 0; public static final int RELOAD_ID = 0;
public static final int SELECT_ALL_ID = 1; public static final int SELECT_ALL_ID = 1;
@ -62,7 +63,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
setListView(listView); 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 // recreation upon rotation is pgetaprevented in manifest file
filterText = (EditText) view.findViewById(R.id.search_box); filterText = (EditText) view.findViewById(R.id.search_box);
@ -151,6 +152,12 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
}); });
if (getMyApplication().getAppCustomization().showDownloadExtraActions()) { if (getMyApplication().getAppCustomization().showDownloadExtraActions()) {
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); 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, RELOAD_ID, 0, R.string.update_downlod_list);
s.add(0, SELECT_ALL_ID, 0, R.string.select_all); s.add(0, SELECT_ALL_ID, 0, R.string.select_all);
@ -161,6 +168,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
} }
} }
}
public String getFilterText() { public String getFilterText() {
return filterText.getText().toString(); return filterText.getText().toString();

View file

@ -85,7 +85,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.local_index, container, false); 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); getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false);
ExpandableListView listView = (ExpandableListView)view.findViewById(android.R.id.list); ExpandableListView listView = (ExpandableListView)view.findViewById(android.R.id.list);
@ -1007,9 +1007,14 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
size += sz; size += sz;
} }
} }
size = size / (1 << 10);
if (size > 0) { if (size > 0) {
t.append(" [").append(size).append(" MB]"); 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()); nameView.setText(t.toString());
if (!group.isBackupedData()) { if (!group.isBackupedData()) {

View file

@ -109,8 +109,12 @@ public class UpdatesIndexFragment extends SherlockListFragment {
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
if (getMyApplication().getAppCustomization().showDownloadExtraActions()) { 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); 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.SELECT_ALL_ID, 0, R.string.select_all);
s.add(0, DownloadIndexFragment.DESELECT_ALL_ID, 0, R.string.deselect_all); s.add(0, DownloadIndexFragment.DESELECT_ALL_ID, 0, R.string.deselect_all);

View file

@ -732,8 +732,4 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
return false; return false;
} }
@Override
public boolean onlyTourDownload() {
return true;
}
} }

View file

@ -379,6 +379,8 @@ public class TourViewActivity extends SherlockFragmentActivity {
public void startDownloadActivity() { public void startDownloadActivity() {
final Intent download = new Intent(this, DownloadActivity.class); final Intent download = new Intent(this, DownloadActivity.class);
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); 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; refreshListAfterDownload = true;
startActivity(download); startActivity(download);
} }
@ -418,6 +420,8 @@ public class TourViewActivity extends SherlockFragmentActivity {
} }
public boolean onlyTourDownload() {
return true;
}
} }