[android] - zoom to rounded levels
This commit is contained in:
@@ -5,7 +5,9 @@ import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.constants.Style;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
@@ -47,9 +49,21 @@ public class DebugModeActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onMapReady(@NonNull MapboxMap map) {
|
||||
mapboxMap = map;
|
||||
|
||||
mapboxMap.getUiSettings().setZoomControlsEnabled(true);
|
||||
|
||||
// show current zoom level on screen
|
||||
final TextView textView = (TextView) findViewById(R.id.textZoom);
|
||||
mapboxMap.setOnCameraChangeListener(new MapboxMap.OnCameraChangeListener() {
|
||||
@Override
|
||||
public void onCameraChange(CameraPosition position) {
|
||||
textView.setText(String.format(getString(R.string.debug_zoom), position.zoom));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabDebug);
|
||||
fabDebug.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,18 @@
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_uiAttribution="false"
|
||||
app:mapbox_uiCompass="false"
|
||||
app:mapbox_uiLogo="false"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textZoom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabDebug"
|
||||
|
||||
@@ -160,4 +160,5 @@
|
||||
<string name="dynamic_marker_chelsea_snippet">Stamford Bridge</string>
|
||||
<string name="dynamic_marker_arsenal_title">Arsenal</string>
|
||||
<string name="dynamic_marker_arsenal_snippet">Emirates Stadium</string>
|
||||
<string name="debug_zoom">Zoom: %s</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user