Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #3244 -Camera activity for TestApp
Browse files Browse the repository at this point in the history
  • Loading branch information
bleege committed Dec 10, 2015
1 parent 266b7e4 commit ddc4387
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
<activity
android:name=".BulkMarkerActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/action_add_bulk_markers" />
android:label="@string/activity_add_bulk_markers" />
<activity android:name=".CameraActivity"
android:label="@string/activity_camera"/>
<activity
android:name=".TiltActivity"
android:label="@string/activity_tilt" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.mapbox.mapboxsdk.testapp;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.utils.ApiAccess;
import com.mapbox.mapboxsdk.views.MapView;

public class CameraActivity extends AppCompatActivity {

private MapView mMapView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}

mMapView = (MapView) findViewById(R.id.mapView);
mMapView.setAccessToken(ApiAccess.getToken(this));
mMapView.setStyle(Style.MAPBOX_STREETS);
mMapView.onCreate(savedInstanceState);
}

@Override
protected void onStart() {
super.onStart();
mMapView.onStart();
}

@Override
public void onResume() {
super.onResume();
mMapView.onResume();
}

@Override
public void onPause() {
super.onPause();
mMapView.onPause();
}

@Override
protected void onStop() {
super.onStop();
mMapView.onStop();
}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mMapView.onSaveInstanceState(outState);
}

@Override
protected void onDestroy() {
super.onDestroy();
mMapView.onDestroy();
}

@Override
public void onLowMemory() {
super.onLowMemory();
mMapView.onLowMemory();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ public boolean onNavigationItemSelected(MenuItem menuItem) {
startActivity(new Intent(getApplicationContext(), InfoWindowAdapterActivity.class));
return true;

case R.id.camera:
startActivity(new Intent(getApplicationContext(), CameraActivity.class));

case R.id.action_tilt:
startActivity(new Intent(getApplicationContext(), TiltActivity.class));
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/primary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

<com.mapbox.mapboxsdk.views.MapView
android:id="@+id/cameraMapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_add_24dp"
app:backgroundTint="@android:color/white" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
android:icon="@drawable/ic_flip_to_back_24dp"
android:title="@string/action_tilt" />

<item android:id="@+id/action_camera"
android:checkable="false"
android:title="@string/action_camera"/>

<item
android:id="@+id/action_map_fragment"
android:checkable="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<string name="activity_info_window_concurrent">InfoWindow Activity (Concurrent)</string>
<string name="activity_visible_coordinate_bounds">Visible Coordinate Bounds</string>
<string name="activity_user_tracking_mode">User tracking mode</string>
<string name="activity_add_bulk_markers">Add Markers In Bulk</string>
<string name="activity_camera">Camera</string>
<string name="activity_polyline">Polyline Activity</string>

<string name="navdrawer_menu_title_mainactivity_controls">Main Activity Controls</string>
Expand All @@ -32,6 +34,7 @@
<string name="action_info_window">InfoWindow</string>
<string name="action_info_window_concurrent">InfoWindow (Concurrent)</string>
<string name="action_add_bulk_markers">Add Markers in bulk</string>
<string name="action_camera">Camera</string>
<string name="action_visible_bounds">Set Visible Bounds</string>
<string name="action_visible_bounds_explanation">Center map around 2 markers</string>
<string name="action_remove_polylines">Remove polylines</string>
Expand Down

0 comments on commit ddc4387

Please sign in to comment.