Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
蒋波涛
/
landsurvey
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9502c15b
authored
2018-03-27 17:40:35 +0800
by
chiangbt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update 3.27
1 parent
d06eca08
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
6 deletions
app/build.gradle
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
app/src/main/res/layout/activity_main.xml
app/build.gradle
View file @
9502c15
...
...
@@ -27,6 +27,7 @@ dependencies {
compile
'com.esri.arcgis.android:arcgis-android:10.2.9'
compile
'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
compile
'com.github.arimorty:floatingsearchview:2.1.1'
compile
'com.amitshekhar.android:android-networking:0.2.0'
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
//noinspection GradleCompatible
...
...
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
View file @
9502c15
...
...
@@ -12,7 +12,12 @@ import android.view.Menu;
import
android.view.MenuItem
;
import
android.widget.TextView
;
import
com.androidnetworking.AndroidNetworking
;
import
com.androidnetworking.error.ANError
;
import
com.androidnetworking.interfaces.JSONArrayRequestListener
;
import
com.androidnetworking.interfaces.JSONObjectRequestListener
;
import
com.arlib.floatingsearchview.FloatingSearchView
;
import
com.arlib.floatingsearchview.suggestions.model.SearchSuggestion
;
import
com.esri.android.map.LocationDisplayManager
;
import
com.esri.android.map.MapView
;
import
com.esri.android.map.event.OnStatusChangedListener
;
...
...
@@ -26,6 +31,10 @@ import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceType;
import
com.pashanhoo.landsurvey.search.DataHelper
;
import
com.pashanhoo.landsurvey.utils.AppInfo
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
public
class
MainActivity
extends
AppCompatActivity
{
private
MapView
mapView
;
...
...
@@ -177,16 +186,58 @@ public class MainActivity extends AppCompatActivity {
}
});
floatingSearchView
.
setOnQueryChangeListener
(
new
FloatingSearchView
.
OnQueryChangeListener
()
{
floatingSearchView
.
setOnSearchListener
(
new
FloatingSearchView
.
OnSearchListener
()
{
@Override
public
void
onSuggestionClicked
(
SearchSuggestion
searchSuggestion
)
{
}
@Override
public
void
onSearchAction
(
String
currentQuery
)
{
if
(
currentQuery
.
length
()
>
3
)
{
String
str
=
"{\"keyWord\":\""
+
currentQuery
+
"\",\"level\":\"11\",\"mapBound\":\"76.24832,30.1129,156.40458,49.97618\",\"queryType\":\"1\",\"count\":\"10\",\"start\":\"0\",\"queryTerminal\":\"1000\"}"
;
AndroidNetworking
.
post
(
"http://map.tianditu.com/query.shtml"
)
.
addBodyParameter
(
"type"
,
"query"
)
.
addBodyParameter
(
"postStr"
,
str
)
.
setTag
(
"test"
)
.
build
()
.
getAsJSONObject
(
new
JSONObjectRequestListener
()
{
@Override
public
void
onResponse
(
JSONObject
response
)
{
JSONArray
Jarray
=
null
;
try
{
Jarray
=
response
.
getJSONArray
(
"pois"
);
for
(
int
i
=
0
;
i
<
Jarray
.
length
();
i
++)
{
JSONObject
Jasonobject
=
Jarray
.
getJSONObject
(
i
);
Log
.
i
(
"b"
,
Jasonobject
.
getString
(
"name"
));
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onSearchTextChanged
(
String
oldQuery
,
String
newQuery
)
{
if
(!
oldQuery
.
equals
(
""
)
&&
newQuery
.
equals
(
""
))
{
floatingSearchView
.
clearSuggestions
();
}
else
{
public
void
onError
(
ANError
anError
)
{
}
});
}
}
});
// floatingSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
// @Override
// public void onSearchTextChanged(String oldQuery, String newQuery) {
// if (!oldQuery.equals("") && newQuery.equals("")) {
// floatingSearchView.clearSuggestions();
// } else{
// if(newQuery.length()>3){
//
// }
// }
// }
// });
}
@Override
...
...
app/src/main/res/layout/activity_main.xml
View file @
9502c15
...
...
@@ -29,10 +29,10 @@
android:layout_height=
"match_parent"
android:layout_marginTop=
"70dp"
android:layout_marginLeft=
"16dp"
android:layout_marginBottom=
"16dp"
app:floatingSearch_searchHint=
"地名地址检索..."
app:floatingSearch_suggestionsListAnimDuration=
"250"
app:floatingSearch_showSearchKey=
"false"
app:floatingSearch_leftActionMode=
"showHamburger"
app:floatingSearch_menu=
"@menu/menu_main"
app:floatingSearch_close_search_on_keyboard_dismiss=
"true"
/>
...
...
Please
register
or
sign in
to post a comment