diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2018-07-04 12:47:08 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-07-05 13:30:50 +0200 |
commit | 32dce870d756063167e000302afb553714f1f0cb (patch) | |
tree | 9624d19e424b6ddddcb0b5030f898c953ab9d317 /platform/android/MapboxGLAndroidSDKTestApp/src/main | |
parent | ec78936e18946e3cad75d23beb03b90fcf0cb915 (diff) | |
download | qtlocation-mapboxgl-32dce870d756063167e000302afb553714f1f0cb.tar.gz |
[android] - create device independent tests for camera position testing
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main')
5 files changed, 107 insertions, 13 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 26ad0ebcfe..a6c0732ee9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -789,6 +789,9 @@ android:name=".activity.espresso.EspressoTestActivity" android:screenOrientation="portrait" /> <activity + android:name=".activity.espresso.DeviceIndependentTestActivity" + android:screenOrientation="portrait" /> + <activity android:name=".activity.style.FillExtrusionStyleTestActivity" android:screenOrientation="portrait" /> <activity diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/DeviceIndependentTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/DeviceIndependentTestActivity.java new file mode 100644 index 0000000000..c1bc079c71 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/DeviceIndependentTestActivity.java @@ -0,0 +1,76 @@ +package com.mapbox.mapboxsdk.testapp.activity.espresso; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import com.mapbox.mapboxsdk.maps.MapView; +import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; + +public class DeviceIndependentTestActivity extends AppCompatActivity implements OnMapReadyCallback { + + public MapView mapView; + protected MapboxMap mapboxMap; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_camera_test); + + // Initialize map as normal + mapView = findViewById(R.id.mapView); + mapView.onCreate(savedInstanceState); + mapView.getMapAsync(this); + } + + @Override + public void onMapReady(MapboxMap map) { + mapboxMap = map; + } + + public MapboxMap getMapboxMap() { + return mapboxMap; + } + + @Override + public void onResume() { + super.onResume(); + mapView.onResume(); + } + + @Override + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + public 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(); + } +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java index ee9f20dceb..7ad9f761ff 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java @@ -19,7 +19,7 @@ public class EspressoTestActivity extends AppCompatActivity implements OnMapRead @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_camera_test); + setContentView(R.layout.activity_espresso_test); // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_test.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_test.xml index 05affaf081..0aa26cf37a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_test.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_test.xml @@ -1,16 +1,16 @@ <?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"> +<FrameLayout + 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"> - <!-- TODO remove zoom #6747--> <com.mapbox.mapboxsdk.maps.MapView - android:id="@id/mapView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_below="@id/toolbar" - app:mapbox_cameraZoom="1"/> + android:layout_gravity="center" + android:id="@id/mapView" + android:layout_width="512px" + android:layout_height="512px" + app:mapbox_pixelRatio="1" + app:mapbox_cameraZoom="1"/> -</RelativeLayout> +</FrameLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_espresso_test.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_espresso_test.xml new file mode 100644 index 0000000000..e4b66c2981 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_espresso_test.xml @@ -0,0 +1,15 @@ +<?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"> + + <com.mapbox.mapboxsdk.maps.MapView + android:id="@id/mapView" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@id/toolbar" + app:mapbox_cameraZoom="1"/> + +</RelativeLayout> |