summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2016-04-04 11:03:14 +0200
committerBrad Leege <bleege@gmail.com>2016-04-05 11:51:08 -0500
commit63780d07f3af392338ae88f53fea726195c9c7ff (patch)
tree7e08a980685d3b7f221e18394fbe99a6b7c73838 /platform/android
parentcda5884aa0fd9b637276b1cb5aebcbffbcdaab29 (diff)
downloadqtlocation-mapboxgl-63780d07f3af392338ae88f53fea726195c9c7ff.tar.gz
[android] #4365 - make dismiss on gesture configurable, renamed activity to match UI in test app, cleanup
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java3
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/AddMarkerActivityTest.java (renamed from platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/BulkMarkerActivityTest.java)12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddMarkerActivity.java (renamed from platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java)4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/other/MyLocationTrackingModeActivity.java17
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml14
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml13
8 files changed, 57 insertions, 28 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java
index 90147929e9..de715f5c81 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java
@@ -126,6 +126,9 @@ public class TrackingSettings {
uiSettings.setScrollGesturesEnabled(false);
uiSettings.setRotateGesturesEnabled((myBearingTrackingMode == MyBearingTracking.NONE));
}
+ }else{
+ uiSettings.setScrollGesturesEnabled(true);
+ uiSettings.setRotateGesturesEnabled(true);
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/BulkMarkerActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/AddMarkerActivityTest.java
index b85fe41243..0a29b5fa47 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/BulkMarkerActivityTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/AddMarkerActivityTest.java
@@ -4,7 +4,7 @@ import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
-import com.mapbox.mapboxsdk.testapp.activity.annotation.BulkMarkerActivity;
+import com.mapbox.mapboxsdk.testapp.activity.annotation.AddMarkerActivity;
import com.mapbox.mapboxsdk.testapp.R;
import org.junit.Before;
@@ -13,17 +13,17 @@ import org.junit.Test;
import org.junit.runner.RunWith;
/**
- * Tests on BulkMarkerActivity
+ * Tests on AddMarkerActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
-public class BulkMarkerActivityTest extends BaseTest {
+public class AddMarkerActivityTest extends BaseTest {
@Rule
- public ActivityTestRule<BulkMarkerActivity> mActivityRule = new ActivityTestRule<>(
- BulkMarkerActivity.class);
+ public ActivityTestRule<AddMarkerActivity> mActivityRule = new ActivityTestRule<>(
+ AddMarkerActivity.class);
- private BulkMarkerActivity mActivity = null;
+ private AddMarkerActivity mActivity = null;
@Before
public void setActivity() {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
index 685a9d2615..40979fde5e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
@@ -41,7 +41,7 @@
android:value="@string/category_infowindow" />
</activity>
<activity
- android:name=".activity.annotation.BulkMarkerActivity"
+ android:name=".activity.annotation.AddMarkerActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:description="@string/description_add_bulk_markers"
android:label="@string/activity_add_bulk_markers">
@@ -58,6 +58,14 @@
android:value="@string/category_annotation" />
</activity>
<activity
+ android:name=".activity.annotation.DynamicMarkerChangeActivity"
+ android:description="@string/description_dynamic_marker"
+ android:label="@string/activity_dynamic_marker">
+ <meta-data
+ android:name="@string/category"
+ android:value="@string/category_annotation" />
+ </activity>
+ <activity
android:name=".activity.camera.CameraAnimationTypeActivity"
android:description="@string/description_camera_animation_types"
android:label="@string/activity_camera_animation_types">
@@ -163,14 +171,6 @@
android:value="@string/category_camera" />
</activity>
<activity
- android:name=".activity.annotation.DynamicMarkerChangeActivity"
- android:description="@string/description_dynamic_marker"
- android:label="@string/activity_dynamic_marker">
- <meta-data
- android:name="@string/category"
- android:value="@string/category_annotation" />
- </activity>
- <activity
android:name=".activity.other.MapPaddingActivity"
android:description="@string/description_map_padding"
android:label="@string/activity_map_padding"
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddMarkerActivity.java
index 7288d63719..628f969509 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddMarkerActivity.java
@@ -30,7 +30,7 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
-public class BulkMarkerActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
+public class AddMarkerActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private MapboxMap mMapboxMap;
private MapView mMapView;
@@ -63,7 +63,7 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter(spinnerAdapter);
- spinner.setOnItemSelectedListener(BulkMarkerActivity.this);
+ spinner.setOnItemSelectedListener(AddMarkerActivity.this);
}
}
});
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/other/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/other/MyLocationTrackingModeActivity.java
index 5309fe1baf..4d67b27c96 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/other/MyLocationTrackingModeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/other/MyLocationTrackingModeActivity.java
@@ -8,6 +8,7 @@ import android.support.design.widget.Snackbar;
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.View;
import android.widget.AdapterView;
@@ -16,14 +17,14 @@ import android.widget.Spinner;
import android.widget.Toast;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.constants.MyBearingTracking;
import com.mapbox.mapboxsdk.constants.MyLocationTracking;
import com.mapbox.mapboxsdk.geometry.LatLng;
+import com.mapbox.mapboxsdk.maps.MapView;
+import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.maps.TrackingSettings;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.maps.MapView;
public class MyLocationTrackingModeActivity extends AppCompatActivity implements MapboxMap.OnMyLocationChangeListener, AdapterView.OnItemSelectedListener {
@@ -200,11 +201,23 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
}
@Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.menu_tracking, menu);
+ return true;
+ }
+
+ @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
+ case R.id.action_toggle_dismissible_tracking:
+ boolean state = !item.isChecked();
+ mMapboxMap.getTrackingSettings().setDismissTrackingOnGesture(state);
+ Toast.makeText(this, "Dismiss tracking mode on gesture = " + state, Toast.LENGTH_SHORT).show();
+ item.setChecked(state);
+ return true;
default:
return super.onOptionsItemSelected(item);
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml
index 9341648639..5a5fb5f604 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml
@@ -21,12 +21,11 @@
app:center_longitude="-0.11968"
app:zoom="15" />
-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
android:layout_alignParentBottom="true"
+ android:orientation="horizontal"
android:weightSum="3">
<Button
@@ -51,5 +50,4 @@
android:text="@string/button_camera_animate" />
</LinearLayout>
-
</RelativeLayout>
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml
new file mode 100644
index 0000000000..25c77fcc2b
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <group android:checkableBehavior="all">
+ <item
+ android:id="@+id/action_toggle_dismissible_tracking"
+ android:checkable="true"
+ android:checked="true"
+ android:title="@string/menuitem_title_tracking_mode_dismiss_on_gesture"
+ app:showAsAction="never" />
+ </group>
+
+</menu> \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
index 4510db4148..5ceabacff2 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
@@ -67,13 +67,14 @@
<string name="description_snapshot">Example to make a snapshot of the map</string>
<string name="menuitem_title_concurrent_infowindow">Concurrent Open InfoWindows</string>r
+ <string name="menuitem_title_tracking_mode_dismiss_on_gesture">Dismiss on Gesture</string>r
<string name="category">category</string>
<string name="category_annotation">Annotation</string>
<string name="category_infowindow">InfoWindow</string>
<string name="category_camera">Camera</string>
<string name="category_fragment">Fragment</string>
- <string name="category_api">Mapbox Android Services</string>
+ <string name="category_api">API</string>
<string name="category_other">Other</string>
<string name="action_visible_bounds_explanation">Center map around 2 markers</string>
@@ -106,14 +107,14 @@
</string-array>
<string-array name="user_tracking_mode">
- <item>Disable tracking</item>
- <item>Follow tracking mode</item>
+ <item>Disabled</item>
+ <item>Follow tracking</item>
</string-array>
<string-array name="user_bearing_mode">
- <item>Disable bearing</item>
- <item>GPS mode</item>
- <item>Compass mode</item>
+ <item>Disabled</item>
+ <item>GPS bearing</item>
+ <item>Compass bearing</item>
<!--<item>Combined mode</item>-->
</string-array>