[android] #3276 - only update thumb Icon when needed, disabled background task for now, added view pool counter

This commit is contained in:
Tobrun
2016-05-10 16:41:34 +02:00
parent bdff43ba95
commit 8e57b455c5
4 changed files with 48 additions and 23 deletions

View File

@@ -74,6 +74,7 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
});
final View fab = findViewById(R.id.fab);
final TextView viewCountView = (TextView) findViewById(R.id.countView);
if (fab != null) {
fab.setOnClickListener(new View.OnClickListener() {
@Override
@@ -81,6 +82,22 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
if (mMapboxMap != null) {
fab.animate().alpha(0).start();
mMapboxMap.setMarkerViewAdapter(new TextAdapter(BulkMarkerActivity.this));
mMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
public void onMapChanged(@MapView.MapChange int change) {
if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) {
if (mMapboxMap.getMarkerViewAdapter() != null) {
viewCountView.setText("ViewCache size " + (mMapView.getChildCount()-5));
}
}
}
});
mMapboxMap.setOnMarkerViewClickListener(new MapboxMap.OnMarkerViewClickListener() {
@Override
public void onMarkerClick(@NonNull Marker marker, @NonNull View view) {
mMapboxMap.selectMarker(marker);
}
});
}
}
});

View File

@@ -28,6 +28,13 @@
app:style_url="@string/style_mapbox_streets"
app:zoom="10" />
<TextView
android:id="@+id/countView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:padding="16dp"
android:textSize="20sp"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"