From: Keith Packard Date: Sun, 7 Oct 2018 17:01:30 +0000 (-0700) Subject: altosui/altosdroid: Disable offline map type selections X-Git-Tag: 1.8.7~3^2~11 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=5c957107ee5917d865eb866319f86cf8c109f212 altosui/altosdroid: Disable offline map type selections Our server only supports hybrid maps for now. If that changes, we can re-add this support easily enough. Signed-off-by: Keith Packard --- diff --git a/altosdroid/res/layout/map_preload.xml b/altosdroid/res/layout/map_preload.xml index 321e5ee3..4e60df2d 100644 --- a/altosdroid/res/layout/map_preload.xml +++ b/altosdroid/res/layout/map_preload.xml @@ -62,6 +62,7 @@ android:layout_height="wrap_content" android:text="@string/preload_types" /> + known_sites_adapter; +/* private CheckBox hybrid; private CheckBox satellite; private CheckBox roadmap; private CheckBox terrain; +*/ private Spinner known_sites_spinner; private Spinner min_zoom; @@ -196,17 +198,22 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe return r; } +/* private int bit(CheckBox box, int value) { if (box.isChecked()) return 1 << value; return 0; } +*/ private int types() { +/* return (bit(hybrid, AltosMap.maptype_hybrid) | bit(satellite, AltosMap.maptype_satellite) | bit(roadmap, AltosMap.maptype_roadmap) | bit(terrain, AltosMap.maptype_terrain)); +*/ + return 1 << AltosMap.maptype_hybrid; } private void load() { @@ -318,12 +325,14 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe latitude = (EditText) findViewById(R.id.preload_latitude); longitude = (EditText) findViewById(R.id.preload_longitude); +/* hybrid = (CheckBox) findViewById(R.id.preload_hybrid); satellite = (CheckBox) findViewById(R.id.preload_satellite); roadmap = (CheckBox) findViewById(R.id.preload_roadmap); terrain = (CheckBox) findViewById(R.id.preload_terrain); hybrid.setChecked(true); +*/ min_zoom = (Spinner) findViewById(R.id.preload_min_zoom); add_numbers(min_zoom, diff --git a/altoslib/AltosMap.java b/altoslib/AltosMap.java index e183e933..9e5f578d 100644 --- a/altoslib/AltosMap.java +++ b/altoslib/AltosMap.java @@ -211,12 +211,14 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener { } public boolean set_maptype(int maptype) { +/* if (maptype != this.maptype) { this.maptype = maptype; tiles.clear(); repaint(); return true; } +*/ return false; } @@ -350,7 +352,7 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener { public void set_load_params(int new_zoom, int new_type, double lat, double lon, int radius, AltosMapTileListener listener) { if (AltosMap.min_zoom <= new_zoom && new_zoom <= AltosMap.max_zoom) zoom = new_zoom; - maptype = new_type; +/* maptype = new_type; */ load_centre = new AltosLatLon(lat, lon); load_radius = radius; load_listener = listener; diff --git a/altoslib/AltosMapLoader.java b/altoslib/AltosMapLoader.java index 727dfbcb..4047907d 100644 --- a/altoslib/AltosMapLoader.java +++ b/altoslib/AltosMapLoader.java @@ -214,7 +214,10 @@ public class AltosMapLoader extends Thread implements AltosMapStoreListener { this.min_z = min_z; this.max_z = max_z; this.radius = radius; +/* this.all_types = all_types; +*/ + this.all_types = 1 << AltosMap.maptype_hybrid; this.scale = scale; this.abort = false; start(); diff --git a/altosuilib/AltosUIMap.java b/altosuilib/AltosUIMap.java index 3fb33d4a..7f114e37 100644 --- a/altosuilib/AltosUIMap.java +++ b/altosuilib/AltosUIMap.java @@ -386,8 +386,10 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM JLabel zoom_label; public void set_maptype(int type) { +/* map.set_maptype(type); maptype_combo.setSelectedIndex(type); +*/ } /* AltosUIMapPreload functions */ @@ -433,7 +435,9 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM /* internal layout bits */ private GridBagLayout layout = new GridBagLayout(); +/* JComboBox maptype_combo; +*/ MapView view; @@ -522,6 +526,7 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM c.weighty = 0; add(zoom_out, c); +/* maptype_combo = new JComboBox(map.maptype_labels); maptype_combo.setEditable(false); @@ -540,7 +545,7 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM c.weightx = 0; c.weighty = 0; add(maptype_combo, c); - +*/ map = new AltosMap(this); } } diff --git a/altosuilib/AltosUIMapPreload.java b/altosuilib/AltosUIMapPreload.java index 36b32c85..ffd974ac 100644 --- a/altosuilib/AltosUIMapPreload.java +++ b/altosuilib/AltosUIMapPreload.java @@ -144,7 +144,9 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I JToggleButton load_button; JButton close_button; +/* JCheckBox[] maptypes = new JCheckBox[AltosMap.maptype_terrain - AltosMap.maptype_hybrid + 1]; +*/ JComboBox min_zoom; JComboBox max_zoom; @@ -215,11 +217,14 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I private int all_types() { +/* int all_types = 0; for (int t = AltosMap.maptype_hybrid; t <= AltosMap.maptype_terrain; t++) if (maptypes[t].isSelected()) all_types |= (1 << t); return all_types; +*/ + return 1 << AltosMap.maptype_hybrid; } void center_map(double latitude, double longitude) { @@ -485,6 +490,7 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I pane.add(close_button, c); +/* JLabel types_label = new JLabel("Map Types"); c.gridx = 2; c.gridwidth = 2; @@ -501,6 +507,7 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I c.gridy = (type & 1) + 3; pane.add(maptypes[type], c); } +*/ JLabel min_zoom_label = new JLabel("Minimum Zoom"); c.gridx = 4;