summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/IdleZoomListener.java
blob: 80f17ab58ec0cd3b1695fab01499e66dd1dcac92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.mapbox.mapboxsdk.testapp.utils;

import android.content.Context;
import android.widget.TextView;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;

public class IdleZoomListener implements MapboxMap.OnCameraIdleListener {

  private MapboxMap mapboxMap;
  private TextView textView;

  public IdleZoomListener(MapboxMap mapboxMap, TextView textView) {
    this.mapboxMap = mapboxMap;
    this.textView = textView;
  }

  @Override
  public void onCameraIdle() {
    Context context = textView.getContext();
    CameraPosition position = mapboxMap.getCameraPosition();
    textView.setText(String.format(context.getString(R.string.debug_zoom), position.zoom));
  }
}