update 3.27.10.49
Showing
7 changed files
with
159 additions
and
87 deletions
app/release/app-release.apk
0 → 100644
This file is too large to display.
app/release/output.json
0 → 100644
1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.pashanhoo.landsurvey","split":"","minSdkVersion":"21"}}] | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -14,30 +14,35 @@ import android.widget.TextView; | ... | @@ -14,30 +14,35 @@ import android.widget.TextView; |
14 | 14 | ||
15 | import com.androidnetworking.AndroidNetworking; | 15 | import com.androidnetworking.AndroidNetworking; |
16 | import com.androidnetworking.error.ANError; | 16 | import com.androidnetworking.error.ANError; |
17 | import com.androidnetworking.interfaces.JSONArrayRequestListener; | ||
18 | import com.androidnetworking.interfaces.JSONObjectRequestListener; | 17 | import com.androidnetworking.interfaces.JSONObjectRequestListener; |
19 | import com.arlib.floatingsearchview.FloatingSearchView; | 18 | import com.arlib.floatingsearchview.FloatingSearchView; |
20 | import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; | 19 | import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; |
20 | import com.esri.android.map.GraphicsLayer; | ||
21 | import com.esri.android.map.LocationDisplayManager; | 21 | import com.esri.android.map.LocationDisplayManager; |
22 | import com.esri.android.map.MapView; | 22 | import com.esri.android.map.MapView; |
23 | import com.esri.android.map.event.OnStatusChangedListener; | 23 | import com.esri.android.map.event.OnStatusChangedListener; |
24 | import com.esri.android.map.event.OnZoomListener; | 24 | import com.esri.android.map.event.OnZoomListener; |
25 | import com.esri.android.runtime.ArcGISRuntime; | 25 | import com.esri.android.runtime.ArcGISRuntime; |
26 | import com.esri.core.geometry.Point; | 26 | import com.esri.core.geometry.Point; |
27 | import com.esri.core.map.Graphic; | ||
28 | import com.esri.core.symbol.PictureMarkerSymbol; | ||
27 | import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo; | 29 | import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo; |
28 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuLocalTiledMapServiceLayer; | 30 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuLocalTiledMapServiceLayer; |
29 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceLayer; | 31 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceLayer; |
30 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceType; | 32 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceType; |
31 | import com.pashanhoo.landsurvey.search.DataHelper; | 33 | import com.pashanhoo.landsurvey.search.POISuggestion; |
32 | import com.pashanhoo.landsurvey.utils.AppInfo; | 34 | import com.pashanhoo.landsurvey.utils.AppInfo; |
33 | 35 | ||
34 | import org.json.JSONArray; | 36 | import org.json.JSONArray; |
35 | import org.json.JSONException; | 37 | import org.json.JSONException; |
36 | import org.json.JSONObject; | 38 | import org.json.JSONObject; |
37 | 39 | ||
40 | import java.util.ArrayList; | ||
41 | |||
38 | public class MainActivity extends AppCompatActivity { | 42 | public class MainActivity extends AppCompatActivity { |
39 | 43 | ||
40 | private MapView mapView; | 44 | private MapView mapView; |
45 | private GraphicsLayer graphicsLayer; | ||
41 | private LocationDisplayManager locationDisplayManager; | 46 | private LocationDisplayManager locationDisplayManager; |
42 | private TianDiTuTiledMapServiceLayer t_vec; | 47 | private TianDiTuTiledMapServiceLayer t_vec; |
43 | private TianDiTuTiledMapServiceLayer t_cva; | 48 | private TianDiTuTiledMapServiceLayer t_cva; |
... | @@ -56,8 +61,8 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -56,8 +61,8 @@ public class MainActivity extends AppCompatActivity { |
56 | super.onCreate(savedInstanceState); | 61 | super.onCreate(savedInstanceState); |
57 | setContentView(R.layout.activity_main); | 62 | setContentView(R.layout.activity_main); |
58 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | 63 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); |
59 | mapinfoView = (TextView)findViewById(R.id.mapinfo); | 64 | mapinfoView = (TextView) findViewById(R.id.mapinfo); |
60 | floatingSearchView = (FloatingSearchView)findViewById(R.id.floating_search_view); | 65 | floatingSearchView = (FloatingSearchView) findViewById(R.id.floating_search_view); |
61 | setSupportActionBar(toolbar); | 66 | setSupportActionBar(toolbar); |
62 | //初始化------------------------------------------------------------------- | 67 | //初始化------------------------------------------------------------------- |
63 | AppInfo.Settings(); | 68 | AppInfo.Settings(); |
... | @@ -66,10 +71,10 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -66,10 +71,10 @@ public class MainActivity extends AppCompatActivity { |
66 | zoomin.setOnClickListener(new View.OnClickListener() { | 71 | zoomin.setOnClickListener(new View.OnClickListener() { |
67 | @Override | 72 | @Override |
68 | public void onClick(View view) { | 73 | public void onClick(View view) { |
69 | if(locationDisplayManager!=null){ | 74 | if (locationDisplayManager != null) { |
70 | locationDisplayManager.stop(); | 75 | locationDisplayManager.stop(); |
71 | } | 76 | } |
72 | if(curLevel < 19) { | 77 | if (curLevel < 20) { |
73 | mapView.zoomin(true); | 78 | mapView.zoomin(true); |
74 | } | 79 | } |
75 | } | 80 | } |
... | @@ -78,10 +83,10 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -78,10 +83,10 @@ public class MainActivity extends AppCompatActivity { |
78 | zoomout.setOnClickListener(new View.OnClickListener() { | 83 | zoomout.setOnClickListener(new View.OnClickListener() { |
79 | @Override | 84 | @Override |
80 | public void onClick(View view) { | 85 | public void onClick(View view) { |
81 | if(locationDisplayManager!=null){ | 86 | if (locationDisplayManager != null) { |
82 | locationDisplayManager.stop(); | 87 | locationDisplayManager.stop(); |
83 | } | 88 | } |
84 | if(curLevel > 0) { | 89 | if (curLevel > 0) { |
85 | mapView.zoomout(true); | 90 | mapView.zoomout(true); |
86 | } | 91 | } |
87 | } | 92 | } |
... | @@ -93,16 +98,16 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -93,16 +98,16 @@ public class MainActivity extends AppCompatActivity { |
93 | locationDisplayManager.stop(); | 98 | locationDisplayManager.stop(); |
94 | mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes); | 99 | mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes); |
95 | curLevel = TDTTileinfo.getCurrentLevel(AppInfo.initRes); | 100 | curLevel = TDTTileinfo.getCurrentLevel(AppInfo.initRes); |
96 | mapinfoView.setText("当前地图级别为:"+ String.valueOf(curLevel)); | 101 | mapinfoView.setText("当前地图级别为:" + String.valueOf(curLevel)); |
97 | } | 102 | } |
98 | }); | 103 | }); |
99 | FloatingActionButton gps = (FloatingActionButton) findViewById(R.id.gps); | 104 | FloatingActionButton gps = (FloatingActionButton) findViewById(R.id.gps); |
100 | gps.setOnClickListener(new View.OnClickListener() { | 105 | gps.setOnClickListener(new View.OnClickListener() { |
101 | @Override | 106 | @Override |
102 | public void onClick(View view) { | 107 | public void onClick(View view) { |
103 | if(locationDisplayManager.isStarted()){ | 108 | if (locationDisplayManager.isStarted()) { |
104 | locationDisplayManager.stop(); | 109 | locationDisplayManager.stop(); |
105 | }else{ | 110 | } else { |
106 | locationDisplayManager.start(); | 111 | locationDisplayManager.start(); |
107 | mapView.zoomToResolution(locationDisplayManager.getPoint(), TDTTileinfo.getRes4490()[18]); | 112 | mapView.zoomToResolution(locationDisplayManager.getPoint(), TDTTileinfo.getRes4490()[18]); |
108 | } | 113 | } |
... | @@ -110,7 +115,7 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -110,7 +115,7 @@ public class MainActivity extends AppCompatActivity { |
110 | }); | 115 | }); |
111 | //地图初始化------------------------------------------------------------------- | 116 | //地图初始化------------------------------------------------------------------- |
112 | ArcGISRuntime.setClientId("1eFHW78avlnRUPHm"); | 117 | ArcGISRuntime.setClientId("1eFHW78avlnRUPHm"); |
113 | mapView = (MapView)findViewById(R.id.map); | 118 | mapView = (MapView) findViewById(R.id.map); |
114 | mapView.setEsriLogoVisible(false); | 119 | mapView.setEsriLogoVisible(false); |
115 | mapView.enableWrapAround(false); | 120 | mapView.enableWrapAround(false); |
116 | 121 | ||
... | @@ -130,17 +135,21 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -130,17 +135,21 @@ public class MainActivity extends AppCompatActivity { |
130 | mapView.addLayer(t_cia); | 135 | mapView.addLayer(t_cia); |
131 | mapType = "VEC"; | 136 | mapType = "VEC"; |
132 | 137 | ||
138 | graphicsLayer = new GraphicsLayer(); | ||
139 | mapView.addLayer(graphicsLayer); | ||
140 | |||
133 | mapView.setMaxResolution(TDTTileinfo.getRes4490()[1]); | 141 | mapView.setMaxResolution(TDTTileinfo.getRes4490()[1]); |
134 | mapView.setMinResolution(TDTTileinfo.getRes4490()[18]); | 142 | mapView.setMinResolution(TDTTileinfo.getRes4490()[18]); |
135 | 143 | ||
136 | mapView.setOnStatusChangedListener(new OnStatusChangedListener() { | 144 | mapView.setOnStatusChangedListener(new OnStatusChangedListener() { |
137 | private static final long serialVersionUID = 1L; | 145 | private static final long serialVersionUID = 1L; |
146 | |||
138 | @Override | 147 | @Override |
139 | public void onStatusChanged(Object o, STATUS status) { | 148 | public void onStatusChanged(Object o, STATUS status) { |
140 | if(status == STATUS.INITIALIZED){ | 149 | if (status == STATUS.INITIALIZED) { |
141 | mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes); | 150 | mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes); |
142 | curLevel= TDTTileinfo.getCurrentLevel(AppInfo.initRes); | 151 | curLevel = TDTTileinfo.getCurrentLevel(AppInfo.initRes); |
143 | mapinfoView.setText("当前地图级别为:"+ String.valueOf(curLevel)); | 152 | mapinfoView.setText("当前地图级别为:" + String.valueOf(curLevel)); |
144 | } | 153 | } |
145 | } | 154 | } |
146 | }); | 155 | }); |
... | @@ -152,18 +161,18 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -152,18 +161,18 @@ public class MainActivity extends AppCompatActivity { |
152 | @Override | 161 | @Override |
153 | public void postAction(float v, float v1, double v2) { | 162 | public void postAction(float v, float v1, double v2) { |
154 | curLevel = TDTTileinfo.getCurrentLevel(mapView.getResolution()); | 163 | curLevel = TDTTileinfo.getCurrentLevel(mapView.getResolution()); |
155 | mapinfoView.setText("当前地图级别为:"+ String.valueOf(curLevel)); | 164 | mapinfoView.setText("当前地图级别为:" + String.valueOf(curLevel)); |
156 | // t_local只有8和9级数据 | 165 | // t_local只有8和9级数据 |
157 | if(curLevel > 9 | curLevel <8){ | 166 | if (curLevel > 9 | curLevel < 8) { |
158 | t_local.setVisible(false); | 167 | t_local.setVisible(false); |
159 | }else{ | 168 | } else { |
160 | t_local.setVisible(true); | 169 | t_local.setVisible(true); |
161 | } | 170 | } |
162 | } | 171 | } |
163 | }); | 172 | }); |
164 | 173 | ||
165 | // GPS | 174 | // GPS |
166 | locationDisplayManager = mapView.getLocationDisplayManager(); | 175 | locationDisplayManager = mapView.getLocationDisplayManager(); |
167 | locationDisplayManager.setShowLocation(true); | 176 | locationDisplayManager.setShowLocation(true); |
168 | locationDisplayManager.setAutoPanMode(LocationDisplayManager.AutoPanMode.LOCATION);//设置模式 | 177 | locationDisplayManager.setAutoPanMode(LocationDisplayManager.AutoPanMode.LOCATION);//设置模式 |
169 | locationDisplayManager.setShowPings(true); | 178 | locationDisplayManager.setShowPings(true); |
... | @@ -186,16 +195,28 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -186,16 +195,28 @@ public class MainActivity extends AppCompatActivity { |
186 | } | 195 | } |
187 | }); | 196 | }); |
188 | 197 | ||
198 | // 处理浮动查询条 | ||
189 | floatingSearchView.setOnSearchListener(new FloatingSearchView.OnSearchListener() { | 199 | floatingSearchView.setOnSearchListener(new FloatingSearchView.OnSearchListener() { |
190 | @Override | 200 | @Override |
191 | public void onSuggestionClicked(SearchSuggestion searchSuggestion) { | 201 | public void onSuggestionClicked(SearchSuggestion searchSuggestion) { |
202 | graphicsLayer.removeAll(); | ||
192 | 203 | ||
204 | POISuggestion colorSuggestion = (POISuggestion) searchSuggestion; | ||
205 | Point poipt = new Point(colorSuggestion.getLng(), colorSuggestion.getLat()); | ||
206 | mapView.zoomToResolution(poipt, TDTTileinfo.getRes4490()[18]); | ||
207 | graphicsLayer.addGraphic(new Graphic(poipt, | ||
208 | new PictureMarkerSymbol(getResources().getDrawable(R.mipmap.locator)).setOffsetY(16))); | ||
209 | // floatingSearchView.clearSuggestions(); | ||
210 | curLevel = TDTTileinfo.getCurrentLevel(mapView.getResolution()); | ||
211 | mapinfoView.setText("当前地图级别为:" + String.valueOf(curLevel)); | ||
193 | } | 212 | } |
194 | 213 | ||
195 | @Override | 214 | @Override |
196 | public void onSearchAction(String currentQuery) { | 215 | public void onSearchAction(String currentQuery) { |
197 | if(currentQuery.length() > 3) { | 216 | if (currentQuery.length() > 3) { |
198 | String str = "{\"keyWord\":\""+ currentQuery +"\",\"level\":\"11\",\"mapBound\":\"76.24832,30.1129,156.40458,49.97618\",\"queryType\":\"1\",\"count\":\"10\",\"start\":\"0\",\"queryTerminal\":\"1000\"}"; | 217 | floatingSearchView.clearSuggestions(); |
218 | |||
219 | String str = "{\"keyWord\":\"" + currentQuery + "\",\"level\":\"11\",\"mapBound\":\"76.24832,30.1129,156.40458,49.97618\",\"queryType\":\"1\",\"count\":\"10\",\"start\":\"0\",\"queryTerminal\":\"1000\"}"; | ||
199 | AndroidNetworking.post("http://map.tianditu.com/query.shtml") | 220 | AndroidNetworking.post("http://map.tianditu.com/query.shtml") |
200 | .addBodyParameter("type", "query") | 221 | .addBodyParameter("type", "query") |
201 | .addBodyParameter("postStr", str) | 222 | .addBodyParameter("postStr", str) |
... | @@ -204,15 +225,17 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -204,15 +225,17 @@ public class MainActivity extends AppCompatActivity { |
204 | .getAsJSONObject(new JSONObjectRequestListener() { | 225 | .getAsJSONObject(new JSONObjectRequestListener() { |
205 | @Override | 226 | @Override |
206 | public void onResponse(JSONObject response) { | 227 | public void onResponse(JSONObject response) { |
207 | JSONArray Jarray = null; | 228 | JSONArray Jarray = null; |
208 | try { | 229 | try { |
209 | Jarray = response.getJSONArray("pois"); | 230 | Jarray = response.getJSONArray("pois"); |
210 | for (int i = 0; i < Jarray.length(); i++) | 231 | ArrayList<POISuggestion> poiSuggestions = new ArrayList<POISuggestion>(); |
211 | { | 232 | for (int i = 0; i < Jarray.length(); i++) { |
212 | JSONObject Jasonobject = Jarray.getJSONObject(i); | 233 | JSONObject Jasonobject = Jarray.getJSONObject(i); |
213 | Log.i("b", Jasonobject.getString("name")); | 234 | poiSuggestions.add(new POISuggestion(Jasonobject.getString("name"), |
214 | 235 | Jasonobject.getString("address"), | |
236 | Jasonobject.getString("lonlat"))); | ||
215 | } | 237 | } |
238 | floatingSearchView.swapSuggestions(poiSuggestions); | ||
216 | } catch (JSONException e) { | 239 | } catch (JSONException e) { |
217 | e.printStackTrace(); | 240 | e.printStackTrace(); |
218 | } | 241 | } |
... | @@ -226,25 +249,13 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -226,25 +249,13 @@ public class MainActivity extends AppCompatActivity { |
226 | } | 249 | } |
227 | } | 250 | } |
228 | }); | 251 | }); |
229 | // floatingSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() { | ||
230 | // @Override | ||
231 | // public void onSearchTextChanged(String oldQuery, String newQuery) { | ||
232 | // if (!oldQuery.equals("") && newQuery.equals("")) { | ||
233 | // floatingSearchView.clearSuggestions(); | ||
234 | // } else{ | ||
235 | // if(newQuery.length()>3){ | ||
236 | // | ||
237 | // } | ||
238 | // } | ||
239 | // } | ||
240 | // }); | ||
241 | } | 252 | } |
242 | 253 | ||
243 | @Override | 254 | @Override |
244 | public void onResume() { | 255 | public void onResume() { |
245 | super.onResume(); | 256 | super.onResume(); |
246 | mapView.unpause(); | 257 | mapView.unpause(); |
247 | if(locationDisplayManager!=null){ | 258 | if (locationDisplayManager != null) { |
248 | locationDisplayManager.resume(); | 259 | locationDisplayManager.resume(); |
249 | } | 260 | } |
250 | } | 261 | } |
... | @@ -253,7 +264,7 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -253,7 +264,7 @@ public class MainActivity extends AppCompatActivity { |
253 | public void onPause() { | 264 | public void onPause() { |
254 | super.onPause(); | 265 | super.onPause(); |
255 | mapView.pause(); | 266 | mapView.pause(); |
256 | if(locationDisplayManager!=null){ | 267 | if (locationDisplayManager != null) { |
257 | locationDisplayManager.pause(); | 268 | locationDisplayManager.pause(); |
258 | } | 269 | } |
259 | } | 270 | } |
... | @@ -261,7 +272,7 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -261,7 +272,7 @@ public class MainActivity extends AppCompatActivity { |
261 | @Override | 272 | @Override |
262 | public void onStop() { | 273 | public void onStop() { |
263 | super.onStop(); | 274 | super.onStop(); |
264 | if(locationDisplayManager!=null){ | 275 | if (locationDisplayManager != null) { |
265 | locationDisplayManager.stop(); | 276 | locationDisplayManager.stop(); |
266 | } | 277 | } |
267 | 278 | ||
... | @@ -283,10 +294,10 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -283,10 +294,10 @@ public class MainActivity extends AppCompatActivity { |
283 | 294 | ||
284 | //noinspection SimplifiableIfStatement | 295 | //noinspection SimplifiableIfStatement |
285 | if (id == R.id.action_settings) { | 296 | if (id == R.id.action_settings) { |
286 | if(mapType == "VEC"){ | 297 | if (mapType == "VEC") { |
287 | setLayer("IMG"); | 298 | setLayer("IMG"); |
288 | mapType = "IMG"; | 299 | mapType = "IMG"; |
289 | }else{ | 300 | } else { |
290 | setLayer("VEC"); | 301 | setLayer("VEC"); |
291 | mapType = "VEC"; | 302 | mapType = "VEC"; |
292 | } | 303 | } |
... | @@ -297,8 +308,8 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -297,8 +308,8 @@ public class MainActivity extends AppCompatActivity { |
297 | } | 308 | } |
298 | 309 | ||
299 | // 切换地图形式 | 310 | // 切换地图形式 |
300 | private void setLayer(String type){ | 311 | private void setLayer(String type) { |
301 | switch (type){ | 312 | switch (type) { |
302 | case "VEC": | 313 | case "VEC": |
303 | t_vec.setVisible(true); | 314 | t_vec.setVisible(true); |
304 | t_cva.setVisible(true); | 315 | t_cva.setVisible(true); | ... | ... |
1 | package com.pashanhoo.landsurvey.search; | ||
2 | |||
3 | import android.content.Context; | ||
4 | import android.support.v4.view.AsyncLayoutInflater; | ||
5 | import android.widget.Filter; | ||
6 | |||
7 | import com.arlib.floatingsearchview.FloatingSearchView; | ||
8 | |||
9 | |||
10 | /** | ||
11 | * Created by jiangbotao on 2018/3/27. | ||
12 | */ | ||
13 | |||
14 | public class DataHelper { | ||
15 | |||
16 | public interface OnFindSuggestionsListener { | ||
17 | void onResults(String[] results); | ||
18 | } | ||
19 | |||
20 | public static void findSuggestions(FloatingSearchView.OnQueryChangeListener context, String query, final int limit, final long simulatedDelay, final OnFindSuggestionsListener listener){ | ||
21 | new Filter(){ | ||
22 | |||
23 | @Override | ||
24 | protected FilterResults performFiltering(CharSequence constraint) { | ||
25 | try { | ||
26 | Thread.sleep(simulatedDelay); | ||
27 | } catch (InterruptedException e) { | ||
28 | e.printStackTrace(); | ||
29 | } | ||
30 | FilterResults results = new FilterResults(); | ||
31 | return results; | ||
32 | } | ||
33 | |||
34 | @Override | ||
35 | protected void publishResults(CharSequence charSequence, FilterResults filterResults) { | ||
36 | |||
37 | } | ||
38 | |||
39 | |||
40 | }.filter(query); | ||
41 | } | ||
42 | } |
1 | package com.pashanhoo.landsurvey.search; | ||
2 | |||
3 | import android.annotation.SuppressLint; | ||
4 | import android.os.Parcel; | ||
5 | |||
6 | import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; | ||
7 | |||
8 | /** | ||
9 | * Created by jiangbotao on 2018/3/27. | ||
10 | */ | ||
11 | |||
12 | @SuppressLint("ParcelCreator") | ||
13 | public class POISuggestion implements SearchSuggestion { | ||
14 | |||
15 | private String name; | ||
16 | |||
17 | private String address; | ||
18 | |||
19 | private float lng; | ||
20 | |||
21 | private float lat; | ||
22 | |||
23 | private boolean mIsHistory = false; | ||
24 | |||
25 | public POISuggestion(String suggestion){ | ||
26 | this.name = suggestion.toLowerCase(); | ||
27 | } | ||
28 | |||
29 | public POISuggestion(String name, String address, String lonlat){ | ||
30 | this.name = name; | ||
31 | this.address = address; | ||
32 | String[] position = lonlat.split(" "); | ||
33 | this.lng = Float.parseFloat((position[0])); | ||
34 | this.lat = Float.parseFloat(position[1]); | ||
35 | } | ||
36 | |||
37 | public POISuggestion(Parcel source) { | ||
38 | this.name = source.readString(); | ||
39 | this.mIsHistory = source.readInt() != 0; | ||
40 | } | ||
41 | |||
42 | public void setIsHistory(boolean isHistory) { | ||
43 | this.mIsHistory = isHistory; | ||
44 | } | ||
45 | |||
46 | public boolean getIsHistory() { | ||
47 | return this.mIsHistory; | ||
48 | } | ||
49 | |||
50 | @Override | ||
51 | public String getBody() { | ||
52 | return name; | ||
53 | } | ||
54 | |||
55 | @Override | ||
56 | public int describeContents() { | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | @Override | ||
61 | public void writeToParcel(Parcel parcel, int i) { | ||
62 | parcel.writeString(name); | ||
63 | parcel.writeInt(mIsHistory ? 1 : 0); | ||
64 | } | ||
65 | |||
66 | public static final Creator<POISuggestion> CREATOR = new Creator<POISuggestion>() { | ||
67 | @Override | ||
68 | public POISuggestion createFromParcel(Parcel in) { | ||
69 | return new POISuggestion(in); | ||
70 | } | ||
71 | |||
72 | @Override | ||
73 | public POISuggestion[] newArray(int size) { | ||
74 | return new POISuggestion[size]; | ||
75 | } | ||
76 | }; | ||
77 | |||
78 | public String getAddress() { | ||
79 | return address; | ||
80 | } | ||
81 | |||
82 | public void setAddress(String address) { | ||
83 | this.address = address; | ||
84 | } | ||
85 | |||
86 | public float getLng() { | ||
87 | return lng; | ||
88 | } | ||
89 | |||
90 | public void setLng(long lng) { | ||
91 | this.lng = lng; | ||
92 | } | ||
93 | |||
94 | public float getLat() { | ||
95 | return lat; | ||
96 | } | ||
97 | |||
98 | public void setLat(long lat) { | ||
99 | this.lat = lat; | ||
100 | } | ||
101 | } |
... | @@ -33,6 +33,7 @@ | ... | @@ -33,6 +33,7 @@ |
33 | app:floatingSearch_searchHint="地名地址检索..." | 33 | app:floatingSearch_searchHint="地名地址检索..." |
34 | app:floatingSearch_suggestionsListAnimDuration="250" | 34 | app:floatingSearch_suggestionsListAnimDuration="250" |
35 | app:floatingSearch_showSearchKey="false" | 35 | app:floatingSearch_showSearchKey="false" |
36 | app:floatingSearch_leftActionMode="showSearch" | ||
36 | app:floatingSearch_menu="@menu/menu_main" | 37 | app:floatingSearch_menu="@menu/menu_main" |
37 | app:floatingSearch_close_search_on_keyboard_dismiss="true"/> | 38 | app:floatingSearch_close_search_on_keyboard_dismiss="true"/> |
38 | 39 | ... | ... |
app/src/main/res/mipmap-mdpi/locator.png
0 → 100644
422 Bytes
-
Please register or sign in to post a comment