Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-02-05 00:29:40 +01:00
commit d427b0b7a1
6 changed files with 29 additions and 84 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -17,14 +17,7 @@ import java.util.TimeZone;
import java.util.TreeSet;
import net.osmand.IndexConstants;
import net.osmand.binary.BinaryIndexPart;
import net.osmand.binary.BinaryMapAddressReaderAdapter.AddressRegion;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.binary.BinaryMapIndexReader.MapIndex;
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
import net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
import net.osmand.plus.OsmandApplication;
@ -34,7 +27,6 @@ import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.download.LocalIndexesFragment.LoadLocalIndexTask;
import net.osmand.plus.voice.MediaCommandPlayerImpl;
import net.osmand.plus.voice.TTSCommandPlayerImpl;
import net.osmand.util.MapUtils;
import android.content.Context;
import android.os.Build;
@ -88,9 +80,6 @@ public class LocalIndexHelper {
}
String descr = "";
descr += app.getString(R.string.local_index_tile_data_name, template.getName());
descr += "\n" + app.getString(R.string.local_index_tile_data_minzoom, template.getMinimumZoomSupported());
descr += "\n" + app.getString(R.string.local_index_tile_data_maxzoom, template.getMaximumZoomSupported());
descr += "\n" + app.getString(R.string.local_index_tile_data_downloadable, template.couldBeDownloadedFromInternet());
if(template.getExpirationTimeMinutes() >= 0) {
descr += "\n" + app.getString(R.string.local_index_tile_data_expire, template.getExpirationTimeMinutes());
}
@ -203,63 +192,13 @@ public class LocalIndexHelper {
private MessageFormat format = new MessageFormat("\t {0}, {1} NE \n\t {2}, {3} NE", Locale.US);
private String formatLatLonBox(int left, int right, int top, int bottom) {
double l = MapUtils.get31LongitudeX(left);
double r = MapUtils.get31LongitudeX(right);
double t = MapUtils.get31LatitudeY(top);
double b = MapUtils.get31LatitudeY(bottom);
return format.format(new Object[] { l, t, r, b });
}
private String formatLatLonBox(double l, double r, double t, double b) {
return format.format(new Object[] { l, t, r, b });
}
private void updateObfFileInformation(LocalIndexInfo info, File mapFile) {
try {
RandomAccessFile mf = new RandomAccessFile(mapFile, "r");
BinaryMapIndexReader reader = new BinaryMapIndexReader(mf);
info.setNotSupported(reader.getVersion() != IndexConstants.BINARY_MAP_VERSION);
List<BinaryIndexPart> indexes = reader.getIndexes();
StringBuilder builder = new StringBuilder();
for(BinaryIndexPart part : indexes){
if(part instanceof MapIndex){
MapIndex mi = ((MapIndex) part);
builder.append(app.getString(R.string.local_index_map_data)).append(": ").
append(mi.getName()).append("\n");
if(mi.getRoots().size() > 0){
MapRoot mapRoot = mi.getRoots().get(0);
String box = formatLatLonBox(mapRoot.getLeft(), mapRoot.getRight(), mapRoot.getTop(), mapRoot.getBottom());
builder.append(box).append("\n");
}
} else if(part instanceof PoiRegion){
PoiRegion mi = ((PoiRegion) part);
builder.append(app.getString(R.string.local_index_poi_data)).append(": ").
append(mi.getName()).append("\n");
String box = formatLatLonBox(mi.getLeftLongitude(), mi.getRightLongitude(),
mi.getTopLatitude(), mi.getBottomLatitude());
builder.append(box).append("\n");
} else if(part instanceof RouteRegion){
RouteRegion mi = ((RouteRegion) part);
builder.append(app.getString(R.string.local_index_routing_data)).append(": ").
append(mi.getName()).append("\n");
String box = formatLatLonBox(mi.getLeftLongitude(), mi.getRightLongitude(),
mi.getTopLatitude(), mi.getBottomLatitude());
builder.append(box).append("\n");
} else if(part instanceof TransportIndex){
TransportIndex mi = ((TransportIndex) part);
int sh = (31 - BinaryMapIndexReader.TRANSPORT_STOP_ZOOM);
builder.append(app.getString(R.string.local_index_transport_data)).append(": ").
append(mi.getName()).append("\n");
String box = formatLatLonBox(mi.getLeft() << sh, mi.getRight() << sh, mi.getTop() << sh, mi.getBottom() << sh);
builder.append(box).append("\n");
} else if(part instanceof AddressRegion){
AddressRegion mi = ((AddressRegion) part);
builder.append(app.getString(R.string.local_index_address_data)).append(": ").
append(mi.getName()).append("\n");
}
}
builder.append(getInstalledDate(reader.getDateCreated(), null));
info.setDescription(builder.toString());
reader.close();

View file

@ -122,15 +122,18 @@ public class DashPluginsFragment extends DashBaseFragment {
private void inflatePluginView(LayoutInflater inflater, ViewGroup container,
OsmandPlugin plugin) {
boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
boolean hasSettings = (plugin.getSettingsActivity() != null);
View view = inflater.inflate(R.layout.dash_plugin_item, container, false);
view.setTag(plugin);
if (isEnabled && hasSettings) {
view.setOnClickListener(pluginSettingsListener);
} else {
view.setOnClickListener(pluginDetailsListener);
}
// To discuss: too much confusing and not consistent
// boolean hasSettings = (plugin.getSettingsActivity() != null);
// if (isEnabled && hasSettings) {
// view.setOnClickListener(pluginSettingsListener);
// } else {
// view.setOnClickListener(pluginDetailsListener);
// }
view.setOnClickListener(pluginDetailsListener);
TextView nameView = (TextView)view.findViewById(R.id.plugin_name);
nameView.setText(plugin.getName());

View file

@ -13,10 +13,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.view.ActionMode;
import android.view.*;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
@ -42,8 +38,19 @@ import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StatFs;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.view.ActionMode;
import android.text.method.LinkMovementMethod;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
@ -504,27 +511,24 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
optionsMenuAdapter.item(R.string.local_index_mi_reload)
.icon(R.drawable.ic_action_refresh_dark)
.listen(listener).position(1).reg();
optionsMenuAdapter.item(R.string.local_index_mi_backup)
.icon(R.drawable.ic_action_undo_dark)
.listen(listener).position(2).reg();
optionsMenuAdapter.item(R.string.local_index_mi_restore)
.icon(R.drawable.ic_action_redo_dark)
.listen(listener).position(3).reg();
optionsMenuAdapter.item(R.string.local_index_mi_delete)
.icon(R.drawable.ic_action_delete_dark)
.listen(listener).position(2).reg();
optionsMenuAdapter.item(R.string.local_index_mi_backup)
.listen(listener).position(3).reg();
optionsMenuAdapter.item(R.string.local_index_mi_restore)
.listen(listener).position(4).reg();
OsmandPlugin.onOptionsMenuActivity(getDownloadActivity(), null, optionsMenuAdapter);
// doesn't work correctly
//int max = getResources().getInteger(R.integer.abs__max_action_buttons);
int max = 4;
int max = 3;
SubMenu split = null;
for (int j = 0; j < optionsMenuAdapter.length(); j++) {
MenuItem item;
if (j + 1 >= max && optionsMenuAdapter.length() > max) {
if (split == null) {
split = menu.addSubMenu(0, 1, j + 1, R.string.default_buttons_other_actions);
// split.setIcon(isLightActionBar() ? R.drawable.abs__ic_menu_moreoverflow_holo_light
// : R.drawable.abs__ic_menu_moreoverflow_holo_dark);
split.setIcon(isLightActionBar() ? R.drawable.ic_overflow_menu_light : R.drawable.ic_overflow_menu_dark );
split.getItem();
MenuItemCompat.setShowAsAction(split.getItem(),MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
}

View file

@ -109,12 +109,11 @@ public class UpdatesIndexFragment extends ListFragment {
MenuItem item = menu.add(0, DownloadIndexFragment.RELOAD_ID, 0, R.string.update_downlod_list);
item.setIcon(R.drawable.ic_action_refresh_dark);
MenuItemCompat.setShowAsAction(item, MenuItemCompat.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, -1);
s.setIcon(isLightActionBar() ? R.drawable.ic_overflow_menu_light
: R.drawable.ic_overflow_menu_dark);
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.setIcon(isLightActionBar() ? R.drawable.abs__ic_menu_moreoverflow_holo_light
// : R.drawable.abs__ic_menu_moreoverflow_holo_dark);
MenuItemCompat.setShowAsAction(s.getItem(), MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
}