[android] re-implemented the fps listener api

This commit is contained in:
Ivo van Dongen
2017-09-18 19:00:34 +03:00
committed by Ivo van Dongen
parent bef58c38a8
commit b0c06c764b
8 changed files with 77 additions and 80 deletions

View File

@@ -26,6 +26,7 @@ import com.mapbox.mapboxsdk.style.layers.Property;
import com.mapbox.mapboxsdk.testapp.R;
import java.util.List;
import java.util.Locale;
import timber.log.Timber;
@@ -104,6 +105,17 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa
setupNavigationView(mapboxMap.getLayers());
setupZoomView();
setFpsView();
}
private void setFpsView() {
final TextView fpsView = (TextView) findViewById(R.id.fpsView);
mapboxMap.setOnFpsChangedListener(new MapboxMap.OnFpsChangedListener() {
@Override
public void onFpsChanged(double fps) {
fpsView.setText(String.format(Locale.US,"FPS: %4.2f", fps));
}
});
}
private void setupNavigationView(List<Layer> layerList) {

View File

@@ -35,6 +35,17 @@
app:layout_anchor="@id/bottom_sheet"
app:layout_anchorGravity="bottom|start"/>
<TextView
android:id="@+id/fpsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_margin="8dp"
android:textIsSelectable="true"
android:textSize="14sp"
app:layout_anchor="@id/textZoom"
app:layout_anchorGravity="top"/>
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"