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
d06eca08
authored
2018-03-27 15:29:26 +0800
by
chiangbt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update 3.27
1 parent
6f9a2442
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
0 deletions
app/build.gradle
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
app/src/main/java/com/pashanhoo/landsurvey/search/DataHelper.java
app/src/main/res/layout/activity_main.xml
app/build.gradle
View file @
d06eca0
...
...
@@ -26,8 +26,10 @@ android {
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'
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
//noinspection GradleCompatible
implementation
'com.android.support:appcompat-v7:26.1.0'
implementation
'com.android.support.constraint:constraint-layout:1.0.2'
implementation
'com.android.support:design:26.1.0'
...
...
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
View file @
d06eca0
...
...
@@ -12,6 +12,7 @@ import android.view.Menu;
import
android.view.MenuItem
;
import
android.widget.TextView
;
import
com.arlib.floatingsearchview.FloatingSearchView
;
import
com.esri.android.map.LocationDisplayManager
;
import
com.esri.android.map.MapView
;
import
com.esri.android.map.event.OnStatusChangedListener
;
...
...
@@ -22,6 +23,7 @@ import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo;
import
com.pashanhoo.landsurvey.layers.tianditu.TianDiTuLocalTiledMapServiceLayer
;
import
com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceLayer
;
import
com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceType
;
import
com.pashanhoo.landsurvey.search.DataHelper
;
import
com.pashanhoo.landsurvey.utils.AppInfo
;
public
class
MainActivity
extends
AppCompatActivity
{
...
...
@@ -37,6 +39,7 @@ public class MainActivity extends AppCompatActivity {
private
String
mapType
;
private
TextView
mapinfoView
;
private
FloatingSearchView
floatingSearchView
;
private
int
curLevel
=
0
;
@Override
...
...
@@ -45,6 +48,7 @@ public class MainActivity extends AppCompatActivity {
setContentView
(
R
.
layout
.
activity_main
);
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar
);
mapinfoView
=
(
TextView
)
findViewById
(
R
.
id
.
mapinfo
);
floatingSearchView
=
(
FloatingSearchView
)
findViewById
(
R
.
id
.
floating_search_view
);
setSupportActionBar
(
toolbar
);
//初始化-------------------------------------------------------------------
AppInfo
.
Settings
();
...
...
@@ -173,6 +177,16 @@ public class MainActivity extends AppCompatActivity {
}
});
floatingSearchView
.
setOnQueryChangeListener
(
new
FloatingSearchView
.
OnQueryChangeListener
()
{
@Override
public
void
onSearchTextChanged
(
String
oldQuery
,
String
newQuery
)
{
if
(!
oldQuery
.
equals
(
""
)
&&
newQuery
.
equals
(
""
))
{
floatingSearchView
.
clearSuggestions
();
}
else
{
}
}
});
}
@Override
...
...
app/src/main/java/com/pashanhoo/landsurvey/search/DataHelper.java
0 → 100644
View file @
d06eca0
package
com
.
pashanhoo
.
landsurvey
.
search
;
import
android.content.Context
;
import
android.support.v4.view.AsyncLayoutInflater
;
import
android.widget.Filter
;
import
com.arlib.floatingsearchview.FloatingSearchView
;
/**
* Created by jiangbotao on 2018/3/27.
*/
public
class
DataHelper
{
public
interface
OnFindSuggestionsListener
{
void
onResults
(
String
[]
results
);
}
public
static
void
findSuggestions
(
FloatingSearchView
.
OnQueryChangeListener
context
,
String
query
,
final
int
limit
,
final
long
simulatedDelay
,
final
OnFindSuggestionsListener
listener
){
new
Filter
(){
@Override
protected
FilterResults
performFiltering
(
CharSequence
constraint
)
{
try
{
Thread
.
sleep
(
simulatedDelay
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
FilterResults
results
=
new
FilterResults
();
return
results
;
}
@Override
protected
void
publishResults
(
CharSequence
charSequence
,
FilterResults
filterResults
)
{
}
}.
filter
(
query
);
}
}
app/src/main/res/layout/activity_main.xml
View file @
d06eca0
...
...
@@ -22,6 +22,20 @@
</android.support.design.widget.AppBarLayout>
<include
layout=
"@layout/content_main"
/>
<com.arlib.floatingsearchview.FloatingSearchView
android:id=
"@+id/floating_search_view"
android:layout_width=
"300dp"
android:layout_height=
"match_parent"
android:layout_marginTop=
"70dp"
android:layout_marginLeft=
"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"
/>
<android.support.v7.widget.LinearLayoutCompat
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
...
...
Please
register
or
sign in
to post a comment