From 0dd72f7a3166ae7bb4d7fd0850799a87176cc9e0 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 5 Feb 2015 00:29:22 +0100 Subject: [PATCH] Small changes --- .../drawable-hdpi/ic_overflow_menu_dark.png | Bin 1160 -> 2878 bytes .../drawable-hdpi/ic_overflow_menu_light.png | Bin 1160 -> 1160 bytes .../plus/activities/LocalIndexHelper.java | 61 ------------------ .../plus/dashboard/DashPluginsFragment.java | 15 +++-- .../plus/download/LocalIndexesFragment.java | 30 +++++---- .../plus/download/UpdatesIndexFragment.java | 7 +- 6 files changed, 29 insertions(+), 84 deletions(-) diff --git a/OsmAnd/res/drawable-hdpi/ic_overflow_menu_dark.png b/OsmAnd/res/drawable-hdpi/ic_overflow_menu_dark.png index 5365202e5a5f8ad176a96b0538ee67fc0ce64aea..64b766683e1eb53acdd5884c891c3e3fc0fad3ee 100644 GIT binary patch delta 2872 zcmV-83&-?`3BDGPBYz4nX+uL$Nkc;*aB^>EX>4Tx07%E3mUmQC*A|D*y?1({%`nm# zdXp|Nfb=dP9RyJrW(F9_0K*JTY>22pL=h1IMUbF?0i&TvtcYSED5zi$NDxqBFp8+C zWJcCXe0h2A<>mLsz2Dkr?{oLrd!Mx~03=TzE-wX^0w9?u;C}~tIMY{!N6@kT00ww~ z0j2;jS?Q_1LGHmoBri7?db-F7{EOZU0Z9D5W$5Wor-T1b(yUaz0078e#O7>HI!na) zB2LN_q>Ak`BBsV9iWx?UnJ-FE#BySeTjZsmeHPhK%H0=h0sk8Wyh&7ga7GLtw0fuTQ>mB{3?=`JbBsZ3rr0E=h- zEE#ca>7pWAnp#_08k!lIeo?6Zy7)IG?(HJI3i#YJh=11ihwZQYQtAL;%!+EW>knJZ zegHbQ0w8z)51Zy803=0yYrpZud1&H!i5Cb`ZH$dGGc%329F~!|pug*XI{XcN@jWB) zcE6X0?#hW}3X=qMaot!cNhv};Jw27l;?NEMJjDMv@UQb&8pw&|@HsqDM5t)WxV$(~ zyLoJ`fP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t&hw9jt_jMT(%bbgu_e!&Hn@T z{9U-;(|_{H*H5p1{AazCPcQ4YZ|nn0$Bv)bwdvLC=$D%dUtL=eHunnO-Z`9rzuq*{ Oe?w__%>H5M^trc_mw5;P diff --git a/OsmAnd/res/drawable-hdpi/ic_overflow_menu_light.png b/OsmAnd/res/drawable-hdpi/ic_overflow_menu_light.png index 7f52c4689d9493cc18aff3d8f7f05a765d491292..5365202e5a5f8ad176a96b0538ee67fc0ce64aea 100644 GIT binary patch delta 178 zcmV;j08Rgh35W@>WdZ>;lV$=t0W`Cs0x$st6F1g{lhy+te;&b6Y(T0Lh~uC_3xT*| z$J%AT2E;)?&;i5+Nc=(|24&mgfr_#?EMoDai5dwkCQ^)UX{a3PsYED$K2&VL90bZu z`A|GsFpfHi8~`e*`+@i^6!$^J1}ssJmeivq^=L^wS}=|}XtbmrEvZLKY7znC=y1%a ggNB=f00ImE6r8&%b1nAqcK`qY07*qoM6N<$f^4`(zyJUM delta 178 zcmV;j08Rgh35W@>WdZ>)lV$=t0Wh07*qoM6N<$f~96fqW}N^ diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java index e47d2b468b..2b009dab4c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java @@ -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 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(); diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java index 340e61e052..4a70f62129 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java @@ -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()); diff --git a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java index ca91efaaf0..631b9175c2 100644 --- a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java @@ -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); } diff --git a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java index 4dde72ed20..80a96ea24a 100644 --- a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java @@ -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); } }