forked from mapbox/mapbox-gl-native
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mapbox#2018 - Adding basic second activity that displays a map
- Loading branch information
Showing
11 changed files
with
120 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...apboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/SecondMapActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package com.mapbox.mapboxgl.testapp; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.Log; | ||
import com.mapbox.mapboxgl.views.MapView; | ||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
|
||
public class SecondMapActivity extends AppCompatActivity { | ||
|
||
private static final String TAG = "SecondMapActivity"; | ||
|
||
private MapView mMapView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.activity_second); | ||
|
||
mMapView = (MapView) findViewById(R.id.secondMapView); | ||
// Load the access token | ||
try { | ||
BufferedReader reader = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.token))); | ||
String line = reader.readLine(); | ||
mMapView.setAccessToken(line); | ||
} catch (IOException e) { | ||
Log.e(TAG, "Error loading access token from token.txt: " + e.toString()); | ||
} | ||
|
||
mMapView.onCreate(savedInstanceState); | ||
|
||
mMapView.setStyleUrl(getString(R.string.styleURLMapboxStreets)); | ||
} | ||
|
||
/** | ||
* Dispatch onStart() to all fragments. Ensure any created loaders are | ||
* now started. | ||
*/ | ||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
mMapView.onStart(); | ||
} | ||
|
||
@Override | ||
protected void onStop() { | ||
super.onStop(); | ||
mMapView.onStop(); | ||
} | ||
|
||
// Called when our app goes into the background | ||
@Override | ||
public void onPause() { | ||
super.onPause(); | ||
|
||
mMapView.onPause(); | ||
} | ||
|
||
// Called when our app comes into the foreground | ||
@Override | ||
public void onResume() { | ||
super.onResume(); | ||
|
||
mMapView.onResume(); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
mMapView.onDestroy(); | ||
} | ||
|
||
// Called when the system is running low on memory | ||
@Override | ||
public void onLowMemory() { | ||
super.onLowMemory(); | ||
|
||
mMapView.onLowMemory(); | ||
} | ||
} |
Binary file added
BIN
+237 Bytes
...apboxGLAndroidSDKTestApp/src/main/res/drawable-hdpi/ic_looks_two_white_24dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+155 Bytes
...apboxGLAndroidSDKTestApp/src/main/res/drawable-mdpi/ic_looks_two_white_24dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+228 Bytes
...pboxGLAndroidSDKTestApp/src/main/res/drawable-xhdpi/ic_looks_two_white_24dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+315 Bytes
...boxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_looks_two_white_24dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+408 Bytes
...oxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/ic_looks_two_white_24dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_second.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<com.mapbox.mapboxgl.views.MapView | ||
android:id="@+id/secondMapView" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters