update 3.27
Showing
4 changed files
with
72 additions
and
0 deletions
... | @@ -26,8 +26,10 @@ android { | ... | @@ -26,8 +26,10 @@ android { |
26 | dependencies { | 26 | dependencies { |
27 | compile 'com.esri.arcgis.android:arcgis-android:10.2.9' | 27 | compile 'com.esri.arcgis.android:arcgis-android:10.2.9' |
28 | compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar' | 28 | compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar' |
29 | compile 'com.github.arimorty:floatingsearchview:2.1.1' | ||
29 | 30 | ||
30 | implementation fileTree(dir: 'libs', include: ['*.jar']) | 31 | implementation fileTree(dir: 'libs', include: ['*.jar']) |
32 | //noinspection GradleCompatible | ||
31 | implementation 'com.android.support:appcompat-v7:26.1.0' | 33 | implementation 'com.android.support:appcompat-v7:26.1.0' |
32 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' | 34 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' |
33 | implementation 'com.android.support:design:26.1.0' | 35 | implementation 'com.android.support:design:26.1.0' | ... | ... |
... | @@ -12,6 +12,7 @@ import android.view.Menu; | ... | @@ -12,6 +12,7 @@ import android.view.Menu; |
12 | import android.view.MenuItem; | 12 | import android.view.MenuItem; |
13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
14 | 14 | ||
15 | import com.arlib.floatingsearchview.FloatingSearchView; | ||
15 | import com.esri.android.map.LocationDisplayManager; | 16 | import com.esri.android.map.LocationDisplayManager; |
16 | import com.esri.android.map.MapView; | 17 | import com.esri.android.map.MapView; |
17 | import com.esri.android.map.event.OnStatusChangedListener; | 18 | import com.esri.android.map.event.OnStatusChangedListener; |
... | @@ -22,6 +23,7 @@ import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo; | ... | @@ -22,6 +23,7 @@ import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo; |
22 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuLocalTiledMapServiceLayer; | 23 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuLocalTiledMapServiceLayer; |
23 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceLayer; | 24 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceLayer; |
24 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceType; | 25 | import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceType; |
26 | import com.pashanhoo.landsurvey.search.DataHelper; | ||
25 | import com.pashanhoo.landsurvey.utils.AppInfo; | 27 | import com.pashanhoo.landsurvey.utils.AppInfo; |
26 | 28 | ||
27 | public class MainActivity extends AppCompatActivity { | 29 | public class MainActivity extends AppCompatActivity { |
... | @@ -37,6 +39,7 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -37,6 +39,7 @@ public class MainActivity extends AppCompatActivity { |
37 | 39 | ||
38 | private String mapType; | 40 | private String mapType; |
39 | private TextView mapinfoView; | 41 | private TextView mapinfoView; |
42 | private FloatingSearchView floatingSearchView; | ||
40 | private int curLevel = 0; | 43 | private int curLevel = 0; |
41 | 44 | ||
42 | @Override | 45 | @Override |
... | @@ -45,6 +48,7 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -45,6 +48,7 @@ public class MainActivity extends AppCompatActivity { |
45 | setContentView(R.layout.activity_main); | 48 | setContentView(R.layout.activity_main); |
46 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | 49 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); |
47 | mapinfoView = (TextView)findViewById(R.id.mapinfo); | 50 | mapinfoView = (TextView)findViewById(R.id.mapinfo); |
51 | floatingSearchView = (FloatingSearchView)findViewById(R.id.floating_search_view); | ||
48 | setSupportActionBar(toolbar); | 52 | setSupportActionBar(toolbar); |
49 | //初始化------------------------------------------------------------------- | 53 | //初始化------------------------------------------------------------------- |
50 | AppInfo.Settings(); | 54 | AppInfo.Settings(); |
... | @@ -173,6 +177,16 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -173,6 +177,16 @@ public class MainActivity extends AppCompatActivity { |
173 | } | 177 | } |
174 | }); | 178 | }); |
175 | 179 | ||
180 | floatingSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() { | ||
181 | @Override | ||
182 | public void onSearchTextChanged(String oldQuery, String newQuery) { | ||
183 | if (!oldQuery.equals("") && newQuery.equals("")) { | ||
184 | floatingSearchView.clearSuggestions(); | ||
185 | } else{ | ||
186 | |||
187 | } | ||
188 | } | ||
189 | }); | ||
176 | } | 190 | } |
177 | 191 | ||
178 | @Override | 192 | @Override | ... | ... |
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 | } |
... | @@ -22,6 +22,20 @@ | ... | @@ -22,6 +22,20 @@ |
22 | </android.support.design.widget.AppBarLayout> | 22 | </android.support.design.widget.AppBarLayout> |
23 | 23 | ||
24 | <include layout="@layout/content_main" /> | 24 | <include layout="@layout/content_main" /> |
25 | |||
26 | <com.arlib.floatingsearchview.FloatingSearchView | ||
27 | android:id="@+id/floating_search_view" | ||
28 | android:layout_width="300dp" | ||
29 | android:layout_height="match_parent" | ||
30 | android:layout_marginTop="70dp" | ||
31 | android:layout_marginLeft="16dp" | ||
32 | app:floatingSearch_searchHint="地名地址检索..." | ||
33 | app:floatingSearch_suggestionsListAnimDuration="250" | ||
34 | app:floatingSearch_showSearchKey="false" | ||
35 | app:floatingSearch_leftActionMode="showHamburger" | ||
36 | app:floatingSearch_menu="@menu/menu_main" | ||
37 | app:floatingSearch_close_search_on_keyboard_dismiss="true"/> | ||
38 | |||
25 | <android.support.v7.widget.LinearLayoutCompat | 39 | <android.support.v7.widget.LinearLayoutCompat |
26 | android:layout_width="wrap_content" | 40 | android:layout_width="wrap_content" |
27 | android:layout_height="match_parent" | 41 | android:layout_height="match_parent" | ... | ... |
-
Please register or sign in to post a comment