[android] test app - texture view test activities
This commit is contained in:
@@ -28,8 +28,8 @@ import com.mapbox.mapboxsdk.annotations.Annotation;
|
||||
import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
import com.mapbox.mapboxsdk.constants.Style;
|
||||
import com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer;
|
||||
import com.mapbox.mapboxsdk.maps.renderer.MapRenderer;
|
||||
import com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer;
|
||||
import com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer;
|
||||
import com.mapbox.mapboxsdk.maps.widgets.CompassView;
|
||||
import com.mapbox.mapboxsdk.maps.widgets.MyLocationView;
|
||||
@@ -50,7 +50,6 @@ import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static android.opengl.GLSurfaceView.RENDERMODE_WHEN_DIRTY;
|
||||
import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION;
|
||||
import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_WAIT_IDLE;
|
||||
|
||||
|
||||
@@ -728,6 +728,29 @@
|
||||
android:value="@string/category_maplayout"/>
|
||||
</activity>
|
||||
|
||||
<!-- TextureView -->
|
||||
<activity android:name=".activity.textureview.TextureViewDebugModeActivity"
|
||||
android:description="@string/description_textureview_debug"
|
||||
android:label="@string/activity_textureview_debug">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_textureview"/>
|
||||
</activity>
|
||||
<activity android:name=".activity.textureview.TextureViewResizeActivity"
|
||||
android:description="@string/description_textureview_resize"
|
||||
android:label="@string/activity_textureview_resize">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_textureview"/>
|
||||
</activity>
|
||||
<activity android:name=".activity.textureview.TextureViewAnimationActivity"
|
||||
android:description="@string/description_textureview_animate"
|
||||
android:label="@string/activity_textureview_animate">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_textureview"/>
|
||||
</activity>
|
||||
|
||||
<!-- For Instrumentation tests -->
|
||||
<activity
|
||||
android:name=".activity.style.RuntimeStyleTestActivity"
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.textureview;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Test animating a {@link android.view.TextureView} backed map.
|
||||
*/
|
||||
public class TextureViewAnimationActivity extends AppCompatActivity {
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private Handler handler;
|
||||
private Runnable delayed;
|
||||
|
||||
private static LatLng[] PLACES = {
|
||||
new LatLng(37.7749, -122.4194), // SF
|
||||
new LatLng(38.9072, -77.0369), // DC
|
||||
new LatLng(52.3702, 4.8952), // AMS
|
||||
new LatLng(60.1699, 24.9384), // HEL
|
||||
new LatLng(-13.1639, -74.2236), // AYA
|
||||
new LatLng(52.5200, 13.4050), // BER
|
||||
new LatLng(12.9716, 77.5946), // BAN
|
||||
new LatLng(31.2304, 121.4737) // SHA
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_textureview_animate);
|
||||
handler = new Handler(getMainLooper());
|
||||
setupToolbar();
|
||||
setupMapView(savedInstanceState);
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMapView(Bundle savedInstanceState) {
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.getMapAsync(new OnMapReadyCallback() {
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
TextureViewAnimationActivity.this.mapboxMap = mapboxMap;
|
||||
|
||||
setFpsView(mapboxMap);
|
||||
|
||||
// Animate the map view
|
||||
ObjectAnimator animation = ObjectAnimator.ofFloat(mapView, "rotationY", 0.0f, 360f);
|
||||
animation.setDuration(3600);
|
||||
animation.setRepeatCount(ObjectAnimator.INFINITE);
|
||||
animation.start();
|
||||
|
||||
// Start an animation on the map as well
|
||||
flyTo(mapboxMap, 0, 14);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void flyTo(final MapboxMap mapboxMap, final int place, final double zoom) {
|
||||
mapboxMap.animateCamera(
|
||||
CameraUpdateFactory.newLatLngZoom(PLACES[place], zoom),
|
||||
10000,
|
||||
new MapboxMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
delayed = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
delayed = null;
|
||||
flyTo(mapboxMap, place, zoom);
|
||||
}
|
||||
};
|
||||
handler.postDelayed(delayed, 2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
flyTo(mapboxMap, place == (PLACES.length - 1) ? 0 : place + 1, zoom);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setFpsView(MapboxMap mapboxMap) {
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
if (handler != null && delayed != null) {
|
||||
handler.removeCallbacks(delayed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.textureview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListView;
|
||||
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;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.style.layers.Layer;
|
||||
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;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility;
|
||||
|
||||
/**
|
||||
* Test activity showcasing the different debug modes and allows to cycle between the default map styles.
|
||||
*/
|
||||
public class TextureViewDebugModeActivity extends AppCompatActivity implements OnMapReadyCallback {
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private ActionBarDrawerToggle actionBarDrawerToggle;
|
||||
private int currentStyleIndex = 0;
|
||||
|
||||
private static final String[] STYLES = new String[] {
|
||||
Style.MAPBOX_STREETS,
|
||||
Style.OUTDOORS,
|
||||
Style.LIGHT,
|
||||
Style.DARK,
|
||||
Style.SATELLITE,
|
||||
Style.SATELLITE_STREETS,
|
||||
Style.TRAFFIC_DAY,
|
||||
Style.TRAFFIC_NIGHT
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_textureview_debug_mode);
|
||||
setupToolbar();
|
||||
setupMapView(savedInstanceState);
|
||||
setupDebugChangeView();
|
||||
setupStyleChangeView();
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
|
||||
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
actionBarDrawerToggle = new ActionBarDrawerToggle(this,
|
||||
drawerLayout,
|
||||
R.string.navigation_drawer_open,
|
||||
R.string.navigation_drawer_close
|
||||
);
|
||||
actionBarDrawerToggle.setDrawerIndicatorEnabled(true);
|
||||
actionBarDrawerToggle.syncState();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMapView(Bundle savedInstanceState) {
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
|
||||
@Override
|
||||
public void onMapChanged(int change) {
|
||||
if (change == MapView.DID_FINISH_LOADING_STYLE && mapboxMap != null) {
|
||||
Timber.v("New style loaded with JSON: %s", mapboxMap.getStyleJson());
|
||||
setupNavigationView(mapboxMap.getLayers());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mapView.setTag(true);
|
||||
mapView.setStyleUrl(STYLES[currentStyleIndex]);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapReady(MapboxMap map) {
|
||||
mapboxMap = map;
|
||||
mapboxMap.getUiSettings().setZoomControlsEnabled(true);
|
||||
|
||||
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) {
|
||||
final LayerListAdapter adapter = new LayerListAdapter(this, layerList);
|
||||
ListView listView = (ListView) findViewById(R.id.listView);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Layer clickedLayer = adapter.getItem(position);
|
||||
toggleLayerVisibility(clickedLayer);
|
||||
closeNavigationView();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void toggleLayerVisibility(Layer layer) {
|
||||
boolean isVisible = layer.getVisibility().getValue().equals(Property.VISIBLE);
|
||||
layer.setProperties(
|
||||
visibility(
|
||||
isVisible ? Property.NONE : Property.VISIBLE
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private void closeNavigationView() {
|
||||
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
drawerLayout.closeDrawers();
|
||||
}
|
||||
|
||||
private void setupZoomView() {
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupDebugChangeView() {
|
||||
FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabDebug);
|
||||
fabDebug.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mapboxMap != null) {
|
||||
Timber.d("Debug FAB: isDebug Active? %s", mapboxMap.isDebugActive());
|
||||
mapboxMap.cycleDebugOptions();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupStyleChangeView() {
|
||||
FloatingActionButton fabStyles = (FloatingActionButton) findViewById(R.id.fabStyles);
|
||||
fabStyles.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mapboxMap != null) {
|
||||
currentStyleIndex++;
|
||||
if (currentStyleIndex == STYLES.length) {
|
||||
currentStyleIndex = 0;
|
||||
}
|
||||
mapboxMap.setStyleUrl(STYLES[currentStyleIndex], new MapboxMap.OnStyleLoadedListener() {
|
||||
@Override
|
||||
public void onStyleLoaded(String style) {
|
||||
Timber.d("Style loaded %s", style);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
return actionBarDrawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
private static class LayerListAdapter extends BaseAdapter {
|
||||
|
||||
private LayoutInflater layoutInflater;
|
||||
private List<Layer> layers;
|
||||
|
||||
LayerListAdapter(Context context, List<Layer> layers) {
|
||||
this.layoutInflater = LayoutInflater.from(context);
|
||||
this.layers = layers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return layers.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Layer getItem(int position) {
|
||||
return layers.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Layer layer = layers.get(position);
|
||||
View view = convertView;
|
||||
if (view == null) {
|
||||
view = layoutInflater.inflate(android.R.layout.simple_list_item_2, parent, false);
|
||||
ViewHolder holder = new ViewHolder(
|
||||
(TextView) view.findViewById(android.R.id.text1),
|
||||
(TextView) view.findViewById(android.R.id.text2)
|
||||
);
|
||||
view.setTag(holder);
|
||||
}
|
||||
ViewHolder holder = (ViewHolder) view.getTag();
|
||||
holder.text.setText(layer.getClass().getSimpleName());
|
||||
holder.subText.setText(layer.getId());
|
||||
return view;
|
||||
}
|
||||
|
||||
private static class ViewHolder {
|
||||
final TextView text;
|
||||
final TextView subText;
|
||||
|
||||
ViewHolder(TextView text, TextView subText) {
|
||||
this.text = text;
|
||||
this.subText = subText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.textureview;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
/**
|
||||
* Test resizing a {@link android.view.TextureView} backed map on the fly.
|
||||
*/
|
||||
public class TextureViewResizeActivity extends AppCompatActivity {
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_textureview_resize);
|
||||
setupToolbar();
|
||||
setupMapView(savedInstanceState);
|
||||
setupFab();
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMapView(Bundle savedInstanceState) {
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.getMapAsync(new OnMapReadyCallback() {
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
TextureViewResizeActivity.this.mapboxMap = mapboxMap;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupFab() {
|
||||
FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabResize);
|
||||
fabDebug.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mapView != null) {
|
||||
View parent = findViewById(R.id.coordinator_layout);
|
||||
int width = parent.getWidth() == mapView.getWidth() ? parent.getWidth() / 2 : parent.getWidth();
|
||||
int height = parent.getHeight() == mapView.getHeight() ? parent.getHeight() / 2 : parent.getHeight();
|
||||
mapView.setLayoutParams(new CoordinatorLayout.LayoutParams(width, height));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/mapbox_blue"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_margin="50dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_renderTextureMode="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fpsView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_margin="16dp"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_renderTextureMode="true"
|
||||
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:textIsSelectable="true"
|
||||
android:textSize="14sp"
|
||||
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"
|
||||
android:layout_height="250dp"
|
||||
android:background="@color/white"
|
||||
android:visibility="invisible"
|
||||
app:behavior_hideable="true"
|
||||
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabDebug"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|end"
|
||||
android:layout_marginBottom="82dp"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginRight="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_refresh"
|
||||
app:backgroundTint="@color/accent"
|
||||
app:layout_anchor="@+id/fabStyles"
|
||||
app:layout_anchorGravity="top"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@id/fabStyles"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_layers"
|
||||
app:backgroundTint="@color/primary"
|
||||
app:layout_anchor="@id/bottom_sheet"
|
||||
app:layout_anchorGravity="bottom|end"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</android.support.design.widget.NavigationView>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_renderTextureMode="true"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabResize"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_marginBottom="@dimen/fab_margin"
|
||||
android:layout_marginRight="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_refresh"
|
||||
app:backgroundTint="@color/accent"
|
||||
app:layout_anchorGravity="bottom"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
@@ -14,4 +14,5 @@
|
||||
<string name="category_style">Styling</string>
|
||||
<string name="category_features">Features</string>
|
||||
<string name="category_storage">Storage</string>
|
||||
<string name="category_textureview">Texture View</string>
|
||||
</resources>
|
||||
@@ -64,4 +64,7 @@
|
||||
<string name="description_map_snapshotter_marker">Show how to add a marker to a Snapshot</string>
|
||||
<string name="description_camera_animator">Use Android SDK Animators to animate camera position changes</string>
|
||||
<string name="description_symbol_generator">Use Android SDK Views as symbols</string>
|
||||
<string name="description_textureview_debug">Use TextureView to render the map</string>
|
||||
<string name="description_textureview_resize">Resize a map rendered on a TextureView</string>
|
||||
<string name="description_textureview_animate">Animate a map rendered on a TextureView</string>
|
||||
</resources>
|
||||
@@ -64,4 +64,7 @@
|
||||
<string name="activity_map_snapshotter_marker">Map Snapshot with marker</string>
|
||||
<string name="activity_camera_animator">Animator animation</string>
|
||||
<string name="activity_symbol_generator">SymbolGenerator</string>
|
||||
<string name="activity_textureview_debug">TextureView debug</string>
|
||||
<string name="activity_textureview_resize">TextureView resize</string>
|
||||
<string name="activity_textureview_animate">TextureView animation</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user