[android] - remove overlay SurfaceView examples (#7278)

This commit is contained in:
Tobrun
2016-12-06 19:40:40 +01:00
committed by GitHub
parent 077d685656
commit e706ede0b4
5 changed files with 1 additions and 298 deletions

View File

@@ -317,14 +317,6 @@
android:name="@string/category"
android:value="@string/category_fragment" />
</activity>
<activity
android:name=".activity.maplayout.VideoViewActivity"
android:description="@string/description_video_view"
android:label="@string/activity_video_view">
<meta-data
android:name="@string/category"
android:value="@string/category_maplayout" />
</activity>
<activity
android:name=".activity.maplayout.SimpleMapActivity"
android:description="@string/description_simple_map"
@@ -396,14 +388,6 @@
android:name="@string/category"
android:value="@string/category_imagegenerator" />
</activity>
<activity
android:name=".activity.maplayout.SurfaceViewMediaControlActivity"
android:description="@string/description_surfaceview_mediacontrols"
android:label="@string/activity_surfaceview_overlay">
<meta-data
android:name="@string/category"
android:value="@string/category_maplayout" />
</activity>
<!-- Features -->
<activity

View File

@@ -1,163 +0,0 @@
package com.mapbox.mapboxsdk.testapp.activity.maplayout;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.widget.FrameLayout;
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 javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
public class SurfaceViewMediaControlActivity extends AppCompatActivity implements OnMapReadyCallback {
private MapView mapView;
private MapboxMap mapboxMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_surfaceview_mediacontrols);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
// add another SurfaceView to the Layout
FrameLayout container = (FrameLayout) findViewById(R.id.container);
GLSurfaceView mediaControlSurfaceView = new ClearGLSurfaceView(this);
mediaControlSurfaceView.setZOrderMediaOverlay(true);
container.addView(mediaControlSurfaceView);
}
@Override
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
}
@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();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_padding, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
class ClearGLSurfaceView extends GLSurfaceView {
private ClearRenderer renderer;
public ClearGLSurfaceView(Context context) {
super(context);
renderer = new ClearRenderer();
setRenderer(renderer);
}
public boolean onTouchEvent(final MotionEvent event) {
queueEvent(new Runnable() {
public void run() {
renderer.setColor(event.getRawX() / getWidth(),
event.getRawY() / getHeight(), 1.0f);
}
});
return true;
}
}
class ClearRenderer implements GLSurfaceView.Renderer {
private float red;
private float green;
private float blue;
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
// Do nothing special.
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
}
public void onDrawFrame(GL10 gl) {
gl.glClearColor(red, green, blue, 1.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
}
public void setColor(float red, float green, float blue) {
this.red = red;
this.green = green;
this.blue = blue;
}
}
}

View File

@@ -1,114 +0,0 @@
package com.mapbox.mapboxsdk.testapp.activity.maplayout;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.VideoView;
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 static android.media.MediaPlayer.OnPreparedListener;
public class VideoViewActivity extends AppCompatActivity {
private MapView mapView;
private MapboxMap mapboxMap;
private VideoView videoView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_view);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
// Setup the video
videoView = (VideoView) findViewById(R.id.video_view);
videoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sea_waves));
videoView.start();
// Used to repeat the video.
videoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.setLooping(true);
}
});
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
VideoViewActivity.this.mapboxMap = mapboxMap;
}
});
}
@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
public void onLowMemory() {
super.onLowMemory();
mapView.onLowMemory();
}
@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mapView.onSaveInstanceState(outState);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}

View File

@@ -62,7 +62,6 @@
<string name="activity_geojson_clustering">GeoJson Clustering</string>
<string name="activity_geojson_realtime">Add live realtime data</string>
<string name="activity_print">Print a map</string>
<string name="activity_surfaceview_overlay">SurfaceView MediaOverlay</string>
<string name="activity_query_rendered_feature_properties">Query feature properties</string>
<string name="activity_query_rendered_features_box_count">Count features in box</string>
<string name="activity_query_rendered_features_box_symbol_count">Count symbols in box</string>
@@ -71,7 +70,6 @@
<string name="activity_symbol_layer">Symbols</string>
<string name="activity_add_sprite">Add Custom Sprite</string>
<string name="activity_navigation_drawer">Android SDK View integration</string>
<string name="activity_video_view">Video View</string>
<string name="activity_simple_map">Simple Map</string>
<string name="activity_map_in_dialog">Dialog with map</string>
<string name="activity_marker_view_rectangle">Marker views in rectangle</string>
@@ -122,13 +120,11 @@
<string name="description_geojson_realtime">Use realtime GeoJSON data streams to move a symbol on your map</string>
<string name="description_print">Shows how to print a map</string>
<string name="description_navigation_drawer">Test animation of Android SDK View components</string>
<string name="description_surfaceview_mediacontrols">Test overlaying SurfaceView</string>
<string name="description_query_rendered_feature_properties_point">Query rendered feature properties on click</string>
<string name="description_query_rendered_features_box_count">Count all rendered features in box</string>
<string name="description_query_rendered_features_box_symbol_count">Count all rendered symbols in box</string>
<string name="description_query_rendered_features_box_highlight">Hightligh buildings in box</string>
<string name="description_car_driving">MyLocationView follow map update example</string>
<string name="description_video_view">Android video view on top of the map view</string>
<string name="description_simple_map">Shows a simple map</string>
<string name="description_add_remove_markers">Based on zoom level</string>
<string name="description_style_file">Use a local file as the style</string>