Android indoor map work in progress...
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.ninepatch:IndoorMapView:Tag'
}
The library requires Android API Level 14+.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<indoormaps.ninepatch.com.library.IndoorMapsView
android:id="@+id/indorMaps"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
public class MainActivity extends AppCompatActivity {
private IndoorMapsView indoorMapsView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
indoorMapsView = (IndoorMapsView) findViewById(R.id.indorMaps);
indoorMapsView.getIndoorViewListener().setOnMapViewInizializate(new OnMapViewInizializate() {
@Override
public void onMapLoading() {
}
@Override
public void onMapinizializate() {
indoorMapsView.init("mappa2.png", ZOOM.LEVEL4); //image from assets or put link
indoorMapsView.setBackgroundColorRes(R.color.colorPrimary);
}
});
}
}
Marker marker = new Marker(MainActivity.this);
marker.setId(1);
marker.setLat(36.8271);
marker.setLon(32.9731);
marker.setName(getString(R.string.marker_name));
marker.setImageLink("pointer.png");//from assets or put link
//set Marker Style
Style style = new Style(MainActivity.this);
style.setLabelColor(R.color.colorAccent);
style.setLabelPx(22);
style.setShowLabel(true);
marker.setStyle(style);
indoorMapsView.addMarker(marker);
indoorMapsView.removeMarker(marker.getId());
// OR
indoorMapsView.removeMarker(marker);
indoorMapsView.getIndoorViewListener().setOnMarkerTapListener(new OnMarkerTapListener() {
@Override
public void onMarkerTap(Marker marker) {
}
});
indoorMapsView.getIndoorViewListener().setOnTapListener(new OnTapListener() {
@Override
public void onTap(double lat, double lon) {
}
});
indoorMapsView.setCenter(lat, lng);
ANIMATION type: PAN, FLY ,SPIRAL
center map to point or marker whit animation
indoorMapsView.goToAnimate(marker, ANIMATION.PAN);