This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] #3627 - Adding Content Offset to TestApp
- Loading branch information
Showing
7 changed files
with
132 additions
and
0 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
90 changes: 90 additions & 0 deletions
90
...GLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ContentOffsetActivity.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,90 @@ | ||
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 android.view.MenuItem; | ||
import com.mapbox.mapboxsdk.constants.Style; | ||
import com.mapbox.mapboxsdk.utils.ApiAccess; | ||
import com.mapbox.mapboxsdk.views.MapView; | ||
|
||
public class ContentOffsetActivity extends AppCompatActivity { | ||
|
||
private static final String TAG = "ContentOffsetActivity"; | ||
|
||
private MapView mMapView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_content_offset); | ||
|
||
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.contentOffsetMapView); | ||
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(); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { | ||
case android.R.id.home: | ||
onBackPressed(); | ||
return true; | ||
default: | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_aspect_ratio_24dp.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,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FFFFFF" | ||
android:pathData="M19,12h-2v3h-3v2h5v-5zM7,9h3V7H5v5h2V9zm14,-6H3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2zm0,16.01H3V4.99h18v14.02z"/> | ||
</vector> |
20 changes: 20 additions & 0 deletions
20
platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_content_offset.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,20 @@ | ||
<?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"> | ||
|
||
<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/contentOffsetMapView" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_below="@+id/toolbar"/> | ||
|
||
</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