d06eca08 by chiangbt

update 3.27

1 parent 6f9a2442
......@@ -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'
......
......@@ -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
......
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);
}
}
......@@ -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"
......