diff options
73 files changed, 979 insertions, 1133 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml index 97d29c7d45..63f739c30c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <color name="white">#FFFFFF</color> + <color name="white">#F9F9F9</color> <color name="black">#000000</color> <color name="gray">#7D7F80</color> <color name="gray_light">#EEEEEE</color> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index 762310d634..5503179eb6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -84,6 +84,7 @@ dependencies { compile "com.android.support:support-v4:${supportLibVersion}" compile "com.android.support:appcompat-v7:${supportLibVersion}" compile "com.android.support:design:${supportLibVersion}" + compile "com.android.support:recyclerview-v7:${supportLibVersion}" // Leak Canary debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1' 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/BulkMarkerActivityTest.java index beb1b1957d..8527c2446d 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/BulkMarkerActivityTest.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.BulkMarkerActivity; +import com.mapbox.mapboxsdk.testapp.activity.BulkMarkerActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CameraActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CameraActivityTest.java index a017ba0532..f8a895237c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CameraActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CameraActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.CameraActivity; +import com.mapbox.mapboxsdk.testapp.activity.CameraActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CoordinateChangeActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CoordinateChangeActivityTest.java index fc7350d5c0..8aa2d48b7e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CoordinateChangeActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/CoordinateChangeActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.CoordinateChangeActivity; +import com.mapbox.mapboxsdk.testapp.activity.CoordinateChangeActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DirectionsActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DirectionsActivityTest.java index 679d8a15e2..5205570f28 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DirectionsActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DirectionsActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.DirectionsActivity; +import com.mapbox.mapboxsdk.testapp.activity.DirectionsActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DoubleMapActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DoubleMapActivityTest.java index 16967ee92f..fc0edc8b54 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DoubleMapActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DoubleMapActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.DoubleMapActivity; +import com.mapbox.mapboxsdk.testapp.activity.DoubleMapActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DynamicMarkerChangeActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DynamicMarkerChangeActivityTest.java index d9284315c4..24f69ccb82 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DynamicMarkerChangeActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/DynamicMarkerChangeActivityTest.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.DynamicMarkerChangeActivity; +import com.mapbox.mapboxsdk.testapp.activity.DynamicMarkerChangeActivity; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.espresso.utils.ViewUtils; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/GeocoderActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/GeocoderActivityTest.java index 816ab70adf..0f7c4d829c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/GeocoderActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/GeocoderActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.GeocoderActivity; +import com.mapbox.mapboxsdk.testapp.activity.GeocoderActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowActivityTest.java index 5617891598..07555110a5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowActivityTest.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.InfoWindowActivity; +import com.mapbox.mapboxsdk.testapp.activity.InfoWindowActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowAdapterActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowAdapterActivityTest.java index 2fe816e0ed..46ba894180 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowAdapterActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowAdapterActivityTest.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.InfoWindowAdapterActivity; +import com.mapbox.mapboxsdk.testapp.activity.InfoWindowAdapterActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowConcurrentActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowConcurrentActivityTest.java index 60531bae81..368227c3bf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowConcurrentActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/InfoWindowConcurrentActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.InfoWindowConcurrentActivity; +import com.mapbox.mapboxsdk.testapp.activity.InfoWindowConcurrentActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/LatLngBoundsActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/LatLngBoundsActivityTest.java index 13839226ba..ebefea3654 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/LatLngBoundsActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/LatLngBoundsActivityTest.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.LatLngBoundsActivity; +import com.mapbox.mapboxsdk.testapp.activity.LatLngBoundsActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityScreenTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityScreenTest.java index d758b1b03b..65042985aa 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityScreenTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityScreenTest.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.MainActivity; +import com.mapbox.mapboxsdk.testapp.FeatureOverviewActivity; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.espresso.utils.DrawerUtils; import com.mapbox.mapboxsdk.testapp.espresso.utils.GestureUtils; @@ -17,17 +17,17 @@ import org.junit.runner.RunWith; import static android.support.test.espresso.matcher.ViewMatchers.withId; /** - * Tests on MainActivity with screenshots + * Tests on FeatureOverviewActivity with screenshots */ @RunWith(AndroidJUnit4.class) @LargeTest public class MainActivityScreenTest extends BaseTest { @Rule - public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>( - MainActivity.class); + public ActivityTestRule<FeatureOverviewActivity> mActivityRule = new ActivityTestRule<>( + FeatureOverviewActivity.class); - private MainActivity mActivity = null; + private FeatureOverviewActivity mActivity = null; @Before public void setActivity() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityTest.java index a3ee33bec6..244a8d2d71 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MainActivityTest.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.MainActivity; +import com.mapbox.mapboxsdk.testapp.FeatureOverviewActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; @@ -24,17 +24,17 @@ import static android.support.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.not; /** - * Tests on MainActivity + * Tests on FeatureOverviewActivity */ @RunWith(AndroidJUnit4.class) @LargeTest public class MainActivityTest extends BaseTest { @Rule - public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>( - MainActivity.class); + public ActivityTestRule<FeatureOverviewActivity> mActivityRule = new ActivityTestRule<>( + FeatureOverviewActivity.class); - private MainActivity mActivity = null; + private FeatureOverviewActivity mActivity = null; @Before public void setActivity() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ManualZoomActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ManualZoomActivityTest.java index aadf8683e8..9c06e63917 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ManualZoomActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ManualZoomActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.ManualZoomActivity; +import com.mapbox.mapboxsdk.testapp.activity.ManualZoomActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapFragmentActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapFragmentActivityTest.java index fc8b2d5d27..86355fa365 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapFragmentActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapFragmentActivityTest.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.MapFragmentActivity; +import com.mapbox.mapboxsdk.testapp.activity.MapFragmentActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapPaddingActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapPaddingActivityTest.java index 77ed07d762..a80d77c462 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapPaddingActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapPaddingActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.MapPaddingActivity; +import com.mapbox.mapboxsdk.testapp.activity.MapPaddingActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapboxMapActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapboxMapActivityTest.java index 085c07cec3..df089656ab 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapboxMapActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MapboxMapActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.MapboxMapActivity; +import com.mapbox.mapboxsdk.testapp.activity.MapboxMapActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MaxMinZoomActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MaxMinZoomActivityTest.java index 2d00df430a..c6a6cd2926 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MaxMinZoomActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MaxMinZoomActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; -import com.mapbox.mapboxsdk.testapp.MaxMinZoomActivity; +import com.mapbox.mapboxsdk.testapp.activity.MaxMinZoomActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MyLocationTrackingModeActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MyLocationTrackingModeActivityTest.java index f8b2ac01d4..8dde6c1b17 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MyLocationTrackingModeActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/MyLocationTrackingModeActivityTest.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.MyLocationTrackingModeActivity; +import com.mapbox.mapboxsdk.testapp.activity.MyLocationTrackingModeActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PolylineActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PolylineActivityTest.java index d541009901..5f4258ac3e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PolylineActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PolylineActivityTest.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.PolylineActivity; +import com.mapbox.mapboxsdk.testapp.activity.PolylineActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PressForMarkerActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PressForMarkerActivityTest.java index a0660c2d52..6acb88ec7a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PressForMarkerActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/PressForMarkerActivityTest.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.PressForMarkerActivity; +import com.mapbox.mapboxsdk.testapp.activity.PressForMarkerActivity; import com.mapbox.mapboxsdk.testapp.R; import org.junit.Before; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ScrollByActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ScrollByActivityTest.java index 2a9de05ef6..43bf815fb9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ScrollByActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/ScrollByActivityTest.java @@ -5,7 +5,7 @@ import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.ScrollByActivity; +import com.mapbox.mapboxsdk.testapp.activity.ScrollByActivity; import org.junit.Rule; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/SupportMapFragmentActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/SupportMapFragmentActivityTest.java index a93ae6e690..dc52ebd4eb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/SupportMapFragmentActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/SupportMapFragmentActivityTest.java @@ -6,7 +6,7 @@ import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.SupportMapFragmentActivity; +import com.mapbox.mapboxsdk.testapp.activity.SupportMapFragmentActivity; import org.junit.Before; import org.junit.Rule; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/TiltActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/TiltActivityTest.java index 8b4dbbf763..d49e033269 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/TiltActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/espresso/TiltActivityTest.java @@ -3,7 +3,7 @@ package com.mapbox.mapboxsdk.testapp.espresso; import android.support.test.rule.ActivityTestRule; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.TiltActivity; +import com.mapbox.mapboxsdk.testapp.activity.TiltActivity; import org.junit.Before; import org.junit.Rule; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/BaseMainActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/BaseMainActivityTest.java index 787a9d8561..0fca07ffb6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/BaseMainActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/BaseMainActivityTest.java @@ -5,20 +5,20 @@ import android.test.ActivityInstrumentationTestCase2; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapUtils; -import com.mapbox.mapboxsdk.testapp.MainActivity; +import com.mapbox.mapboxsdk.testapp.FeatureOverviewActivity; import com.mapbox.mapboxsdk.testapp.R; import com.robotium.solo.Solo; import org.junit.Test; -public abstract class BaseMainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> { +public abstract class BaseMainActivityTest extends ActivityInstrumentationTestCase2<FeatureOverviewActivity> { protected Solo solo; protected MapView mapView; protected MapboxMap mapboxMap; public BaseMainActivityTest() { - super(MainActivity.class); + super(FeatureOverviewActivity.class); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 0d2b78acf8..71823d2bf3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ android:supportsRtl="true" android:theme="@style/AppTheme"> <activity - android:name=".MainActivity" + android:name=".FeatureOverviewActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -24,79 +24,200 @@ </intent-filter> </activity> <activity - android:name=".MapboxMapActivity" - android:label="@string/action_mapboxmap" /> + android:name=".activity.MapboxMapActivity" + android:description="@string/description_mapboxmap" + android:label="@string/activity_mapboxmap"> + <meta-data + android:name="@string/category" + android:value="@string/category_other" /> + </activity> <activity - android:name=".LatLngBoundsActivity" - android:label="@string/activity_visible_coordinate_bounds" /> + android:name=".activity.LatLngBoundsActivity" + android:description="@string/description_visible_bounds" + android:label="@string/activity_visible_coordinate_bounds"> + <meta-data + android:name="@string/category" + android:value="@string/category_other" /> + </activity> <activity - android:name=".InfoWindowAdapterActivity" - android:label="@string/activity_infowindow_adapter" /> + android:name=".activity.InfoWindowAdapterActivity" + android:description="@string/description_info_window_adapter" + android:label="@string/activity_infowindow_adapter"> + <meta-data + android:name="@string/category" + android:value="@string/category_infowindow" /> + </activity> <activity - android:name=".InfoWindowActivity" - android:label="@string/activity_info_window" /> + android:name=".activity.InfoWindowActivity" + android:description="@string/description_info_window" + android:label="@string/activity_info_window"> + <meta-data + android:name="@string/category" + android:value="@string/category_infowindow" /> + </activity> + <activity - android:name=".InfoWindowConcurrentActivity" - android:label="@string/activity_info_window_concurrent" /> + android:name=".activity.InfoWindowConcurrentActivity" + android:description="@string/description_info_window_concurrent" + android:label="@string/activity_info_window_concurrent"> + <meta-data + android:name="@string/category" + android:value="@string/category_infowindow" /> + </activity> <activity - android:name=".BulkMarkerActivity" + android:name=".activity.BulkMarkerActivity" android:configChanges="orientation|keyboardHidden|screenSize" - android:label="@string/activity_add_bulk_markers" /> + android:description="@string/description_add_bulk_markers" + android:label="@string/activity_add_bulk_markers"> + <meta-data + android:name="@string/category" + android:value="@string/category_marker" /> + </activity> <activity - android:name=".CameraActivity" - android:label="@string/activity_camera" /> + android:name=".activity.CameraActivity" + android:description="@string/description_camera" + android:label="@string/activity_camera"> + <meta-data + android:name="@string/category" + android:value="@string/category_camera" /> + </activity> <activity - android:name=".TiltActivity" - android:label="@string/activity_tilt" /> + android:name=".activity.TiltActivity" + android:description="@string/description_tilt" + android:label="@string/activity_tilt"> + <meta-data + android:name="@string/category" + android:value="@string/category_camera" /> + </activity> <activity - android:name=".MapFragmentActivity" - android:label="@string/activity_map_fragment" /> + android:name=".activity.MapFragmentActivity" + android:description="@string/description_map_fragment" + android:label="@string/activity_map_fragment"> + <meta-data + android:name="@string/category" + android:value="@string/category_fragment" /> + </activity> <activity - android:name=".SupportMapFragmentActivity" - android:label="@string/activity_map_fragment_suport" /> + android:name=".activity.SupportMapFragmentActivity" + android:description="@string/description_map_fragment_support" + android:label="@string/activity_map_fragment_suport"> + <meta-data + android:name="@string/category" + android:value="@string/category_fragment" /> + </activity> <activity - android:name=".PressForMarkerActivity" - android:label="@string/activity_press_for_marker" /> + android:name=".activity.PressForMarkerActivity" + android:description="@string/description_press_for_marker" + android:label="@string/activity_press_for_marker"> + <meta-data + android:name="@string/category" + android:value="@string/category_marker" /> + </activity> <activity - android:name=".ManualZoomActivity" - android:label="@string/action_manual_zoom" /> + android:name=".activity.ManualZoomActivity" + android:description="@string/description_manual_zoom" + android:label="@string/activity_manual_zoom"> + <meta-data + android:name="@string/category" + android:value="@string/category_camera" /> + </activity> <activity - android:name=".MaxMinZoomActivity" - android:label="@string/action_minmax_zoom" /> + android:name=".activity.MaxMinZoomActivity" + android:description="@string/description_minmax_zoom" + android:label="@string/activity_minmax_zoom"> + <meta-data + android:name="@string/category" + android:value="@string/category_other" /> + </activity> <activity - android:name=".MyLocationTrackingModeActivity" - android:label="@string/activity_user_tracking_mode" /> + android:name=".activity.MyLocationTrackingModeActivity" + android:description="@string/description_user_location_tracking" + android:label="@string/activity_user_tracking_mode"> + <meta-data + android:name="@string/category" + android:value="@string/category_other" /> + </activity> <activity - android:name=".PolylineActivity" - android:label="@string/activity_polyline" /> + android:name=".activity.PolylineActivity" + android:description="@string/description_polyline" + android:label="@string/activity_polyline"> + <meta-data + android:name="@string/category" + android:value="@string/category_marker" /> + </activity> <activity - android:name=".CoordinateChangeActivity" - android:label="@string/activity_animate_coordinate_change" /> + android:name=".activity.CoordinateChangeActivity" + android:description="@string/description_animate_coordinate_change" + android:label="@string/activity_animate_coordinate_change"> + <meta-data + android:name="@string/category" + android:value="@string/category_camera" /> + </activity> <activity - android:name=".DirectionsActivity" - android:label="@string/activity_directions" /> + android:name=".activity.DirectionsActivity" + android:description="@string/description_directions" + android:label="@string/activity_directions"> + <meta-data + android:name="@string/category" + android:value="@string/category_api" /> + </activity> <activity - android:name=".GeocoderActivity" - android:label="@string/activity_geocoder" /> + android:name=".activity.GeocoderActivity" + android:description="@string/description_geocoder" + android:label="@string/activity_geocoder"> + <meta-data + android:name="@string/category" + android:value="@string/category_api" /> + </activity> <activity - android:name=".DoubleMapActivity" - android:label="@string/activity_double_map" /> + android:name=".activity.DoubleMapActivity" + android:description="@string/description_double_mapview" + android:label="@string/activity_double_map"> + <meta-data + android:name="@string/category" + android:value="@string/category_other" /> + </activity> <activity - android:name=".ScrollByActivity" - android:label="@string/activity_scroll_by" /> + android:name=".activity.ScrollByActivity" + android:description="@string/description_scroll_by" + android:label="@string/activity_scroll_by"> + <meta-data + android:name="@string/category" + android:value="@string/category_camera" /> + </activity> <activity - android:name=".DynamicMarkerChangeActivity" - android:label="@string/activity_dynamic_marker" /> + android:name=".activity.DynamicMarkerChangeActivity" + android:description="@string/description_dynamic_marker" + android:label="@string/activity_dynamic_marker"> + <meta-data + android:name="@string/category" + android:value="@string/category_marker" /> + </activity> <activity - android:name=".MapPaddingActivity" + android:name=".activity.MapPaddingActivity" + android:description="@string/description_map_padding" android:label="@string/activity_map_padding" - android:screenOrientation="portrait" /> + android:screenOrientation="portrait"> + <meta-data + android:name="@string/category" + android:value="@string/category_other" /> + </activity> <activity - android:name=".OfflineActivity" - android:label="@string/activity_offline" /> + android:name=".activity.OfflineActivity" + android:description="@string/description_offline" + android:label="@string/activity_offline"> + <meta-data + android:name="@string/category" + android:value="@string/category_other" /> + </activity> <activity - android:name=".AnimatedMarkerActivity" - android:label="@string/title_activity_animated_marker" /> + android:name=".activity.AnimatedMarkerActivity" + android:description="@string/description_animated_marker" + android:label="@string/activity_animated_marker"> + <meta-data + android:name="@string/category" + android:value="@string/category_marker" /> + </activity> <!-- Configuration Settings --> <meta-data @@ -112,7 +233,6 @@ <service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService" /> - </application> </manifest> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/assets/Roboto-Medium.ttf b/platform/android/MapboxGLAndroidSDKTestApp/src/main/assets/Roboto-Medium.ttf Binary files differnew file mode 100644 index 0000000000..a3c1a1f170 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/assets/Roboto-Medium.ttf diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/assets/Roboto-Regular.ttf b/platform/android/MapboxGLAndroidSDKTestApp/src/main/assets/Roboto-Regular.ttf Binary files differnew file mode 100644 index 0000000000..0e58508a64 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/assets/Roboto-Regular.ttf diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/FeatureOverviewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/FeatureOverviewActivity.java new file mode 100644 index 0000000000..4508097d69 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/FeatureOverviewActivity.java @@ -0,0 +1,154 @@ +package com.mapbox.mapboxsdk.testapp; + +import android.content.ComponentName; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; + +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.View; + +import com.mapbox.mapboxsdk.constants.MapboxConstants; +import com.mapbox.mapboxsdk.testapp.adapter.FeatureAdapter; +import com.mapbox.mapboxsdk.testapp.adapter.FeatureSectionAdapter; +import com.mapbox.mapboxsdk.testapp.model.Feature; +import com.mapbox.mapboxsdk.testapp.utils.ItemClickSupport; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class FeatureOverviewActivity extends AppCompatActivity { + + private static final String KEY_STATE_FEATURES = "featureList"; + + private RecyclerView recyclerView; + private FeatureSectionAdapter sectionAdapter; + private List<Feature> features; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + toolbar.setTitle(getString(R.string.app_name)); + setSupportActionBar(toolbar); + + ActionBar actionBar = getSupportActionBar(); + if(actionBar!=null){ + actionBar.setElevation(getResources().getDimension(R.dimen.toolbar_shadow)); + } + + recyclerView = (RecyclerView) findViewById(R.id.recyclerView); + recyclerView.setLayoutManager(new LinearLayoutManager(this)); + recyclerView.addOnItemTouchListener(new RecyclerView.SimpleOnItemTouchListener()); + recyclerView.setHasFixedSize(true); + + ItemClickSupport.addTo(recyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() { + @Override + public void onItemClicked(RecyclerView recyclerView, int position, View v) { + if (!sectionAdapter.isSectionHeaderPosition(position)) { + Intent intent = new Intent(); + int realPosition = sectionAdapter.getConvertedPosition(position); + intent.setComponent(new ComponentName(getPackageName(), features.get(realPosition).getName())); + startActivity(intent); + } + } + }); + + if (savedInstanceState == null) { + loadFeatures(); + } else { + features = savedInstanceState.getParcelableArrayList(KEY_STATE_FEATURES); + onFeaturesLoaded(features); + } + } + + private void loadFeatures() { + try { + new LoadFeatureTask().execute(getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA)); + } catch (PackageManager.NameNotFoundException e) { + Log.e(MapboxConstants.TAG, "Could not resolve package info", e); + } + } + + private void onFeaturesLoaded(List<Feature> featuresList) { + features = featuresList; + + List<FeatureSectionAdapter.Section> sections = new ArrayList<>(); + String currentCat = ""; + for (int i = 0; i < features.size(); i++) { + String category = features.get(i).getCategory(); + if (!currentCat.equals(category)) { + sections.add(new FeatureSectionAdapter.Section(i, category)); + currentCat = category; + } + } + + FeatureSectionAdapter.Section[] dummy = new FeatureSectionAdapter.Section[sections.size()]; + sectionAdapter = new FeatureSectionAdapter(this, R.layout.section_main_layout, R.id.section_text, new FeatureAdapter(features)); + sectionAdapter.setSections(sections.toArray(dummy)); + recyclerView.setAdapter(sectionAdapter); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putParcelableArrayList(KEY_STATE_FEATURES, (ArrayList<Feature>) features); + } + + private class LoadFeatureTask extends AsyncTask<PackageInfo, Void, List<Feature>> { + + @Override + protected List<Feature> doInBackground(PackageInfo... params) { + List<Feature> features = new ArrayList<>(); + PackageInfo app = params[0]; + + String metaDataKey = getString(R.string.category); + for (ActivityInfo info : app.activities) { + if (!info.name.equals(FeatureOverviewActivity.class.getName())) { + String label = getString(info.labelRes); + String description = getString(info.descriptionRes); + String category = resolveMetaData(info.metaData, metaDataKey); + features.add(new Feature(info.name, label, description, category)); + } + } + + if (!features.isEmpty()) { + Comparator<Feature> comparator = new Comparator<Feature>() { + @Override + public int compare(Feature lhs, Feature rhs) { + return lhs.getCategory().compareToIgnoreCase(rhs.getCategory()); + } + }; + Collections.sort(features, comparator); + } + + return features; + } + + private String resolveMetaData(Bundle bundle, String key) { + String category = null; + if (bundle != null) { + category = bundle.getString(key); + } + return category; + } + + @Override + protected void onPostExecute(List<Feature> features) { + super.onPostExecute(features); + onFeaturesLoaded(features); + } + } +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java deleted file mode 100644 index 45d6d33774..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java +++ /dev/null @@ -1,694 +0,0 @@ -package com.mapbox.mapboxsdk.testapp; - -import android.Manifest; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.graphics.Color; -import android.location.Location; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.design.widget.CoordinatorLayout; -import android.support.design.widget.FloatingActionButton; -import android.support.design.widget.NavigationView; -import android.support.design.widget.Snackbar; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; -import android.support.v4.view.GravityCompat; -import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; -import android.util.Log; -import android.view.MenuItem; -import android.view.View; -import android.widget.TextView; - -import com.mapbox.mapboxsdk.annotations.Icon; -import com.mapbox.mapboxsdk.annotations.IconFactory; -import com.mapbox.mapboxsdk.annotations.Marker; -import com.mapbox.mapboxsdk.annotations.MarkerOptions; -import com.mapbox.mapboxsdk.annotations.PolygonOptions; -import com.mapbox.mapboxsdk.annotations.PolylineOptions; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.constants.MyBearingTracking; -import com.mapbox.mapboxsdk.constants.MyLocationTracking; -import com.mapbox.mapboxsdk.constants.Style; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.layers.CustomLayer; -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.maps.UiSettings; -import com.mapbox.mapboxsdk.testapp.layers.ExampleCustomLayer; -import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil; -import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; - -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; - -public class MainActivity extends AppCompatActivity { - - private static final String TAG = "MainActivity"; - - // - // Static members - // - - // Used for saving instance state - private static final String STATE_IS_ANNOTATIONS_ON = "isAnnotationsOn"; - private static final String STATE_SELECTED_STYLE = "selectedStyle"; - private static final String STATE_MARKER_LIST = "markerList"; - - // Used for permissions requests - private static final int PERMISSIONS_LOCATION = 0; - private static final int PERMISSIONS_TRACKING_MODE_ACTIVITY = 1; - - // Used for info window - private static final DecimalFormat LAT_LON_FORMATTER = new DecimalFormat("#.#####"); - - // - // Instance members - // - - // Used for the UI - private DrawerLayout mDrawerLayout; - private MapView mMapView; - private MapboxMap mMapboxMap; - private TextView mFpsTextView; - private int mSelectedStyle = R.id.actionStyleMapboxStreets; - private NavigationView mNavigationView; - private CoordinatorLayout mCoordinatorLayout; - private boolean mIsShowingCustomLayer; - - // Used for GPS - private FloatingActionButton mLocationFAB; - - // Used for Annotations - private boolean mIsAnnotationsOn = false; - private ArrayList<MarkerOptions> mMarkerList = new ArrayList<>(); - - // - // Lifecycle events - // - - // Called when activity is created - @Override - protected void onCreate(final Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Load the layout - setContentView(R.layout.activity_main); - - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - - final ActionBar ab = getSupportActionBar(); - if (ab != null) { - ab.setHomeAsUpIndicator(R.drawable.ic_menu_24dp); - ab.setDisplayHomeAsUpEnabled(true); - } - - mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); - - mNavigationView = (NavigationView) findViewById(R.id.nav_view); - if (mNavigationView != null) { - setupDrawerContent(mNavigationView); - } - - mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinator_layout); - - mFpsTextView = (TextView) findViewById(R.id.view_fps); - mFpsTextView.setText(""); - - mLocationFAB = (FloatingActionButton) findViewById(R.id.locationFAB); - mLocationFAB.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - // Toggle GPS position updates - if (mMapboxMap != null) { - toggleGps(!mMapboxMap.isMyLocationEnabled()); - } - } - }); - - mMapView = (MapView) findViewById(R.id.mainMapView); - mMapView.setAccessToken(ApiAccess.getToken(this)); - changeMapStyle(mSelectedStyle); - mMapView.onCreate(savedInstanceState); - mMapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap mapboxMap) { - mMapboxMap = mapboxMap; - - mMapboxMap.setOnFpsChangedListener(new MyOnFpsChangedListener()); - - // add location listener to MapboxMap - mapboxMap.setOnMyLocationChangeListener(new MapboxMap.OnMyLocationChangeListener() { - @Override - public void onMyLocationChange(@Nullable Location location) { - String desc = "Loc Chg: "; - boolean noInfo = true; - if (location.hasSpeed()) { - desc += String.format("Spd = %.1f km/h ", location.getSpeed() * 3.6f); - noInfo = false; - } - if (location.hasAltitude()) { - desc += String.format("Alt = %.0f m ", location.getAltitude()); - noInfo = false; - } - if (noInfo) { - desc += "No extra info"; - } - Snackbar.make(mCoordinatorLayout, desc, Snackbar.LENGTH_SHORT).show(); - } - }); - - // Set default UI state - mNavigationView.getMenu().findItem(R.id.action_compass).setChecked(mapboxMap.getUiSettings().isCompassEnabled()); - mNavigationView.getMenu().findItem(R.id.action_debug).setChecked(mapboxMap.isDebugActive()); - mNavigationView.getMenu().findItem(R.id.action_markers).setChecked(mIsAnnotationsOn); - toggleGps(mapboxMap.isMyLocationEnabled()); - - // Listeners - mapboxMap.setOnMapLongClickListener(new MapboxMap.OnMapLongClickListener() { - @Override - public void onMapLongClick(@NonNull LatLng point) { - MarkerOptions marker = new MarkerOptions() - .position(point) - .title("Dropped Pin") - .snippet(LAT_LON_FORMATTER.format(point.getLatitude()) + ", " + - LAT_LON_FORMATTER.format(point.getLongitude())) - .icon(null); - - mMarkerList.add(marker); - mapboxMap.addMarker(marker); - } - }); - - // Restore saved state - if (savedInstanceState != null) { - mIsAnnotationsOn = savedInstanceState.getBoolean(STATE_IS_ANNOTATIONS_ON); - mSelectedStyle = savedInstanceState.getInt(STATE_SELECTED_STYLE); - mMarkerList = savedInstanceState.getParcelableArrayList(STATE_MARKER_LIST); - mapboxMap.addMarkers(mMarkerList); - } - - mMapboxMap.setOnMarkerClickListener(new MapboxMap.OnMarkerClickListener() { - @Override - public boolean onMarkerClick(@NonNull Marker marker) { - Snackbar.make(mCoordinatorLayout, "Marker Click Listener for " + marker.getTitle(), Snackbar.LENGTH_SHORT).show(); - return false; - } - }); - - mMapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - String location = LAT_LON_FORMATTER.format(point.getLatitude()) + ", " + - LAT_LON_FORMATTER.format(point.getLongitude()); - Snackbar.make(mCoordinatorLayout, "Map Click Listener " + location, Snackbar.LENGTH_SHORT).show(); - } - }); - - mMapboxMap.setOnInfoWindowClickListener(new MapboxMap.OnInfoWindowClickListener() { - @Override - public boolean onInfoWindowClick(@NonNull Marker marker) { - Snackbar.make(mCoordinatorLayout, "InfoWindow Click Listener for " + marker.getTitle(), Snackbar.LENGTH_SHORT).show(); - marker.hideInfoWindow(); - return true; - } - }); - - - mMapboxMap.setOnCameraChangeListener(new MapboxMap.OnCameraChangeListener() { - @Override - public void onCameraChange(CameraPosition position) { - Log.v(TAG, "OnCameraChange : " + position); - } - }); - - } - }); - } - - @Override - protected void onStart() { - super.onStart(); - - // We need to recheck permissions in case user revoked them via settings app - if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) - != PackageManager.PERMISSION_GRANTED) || - (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) - != PackageManager.PERMISSION_GRANTED)) { - toggleGps(false); - } - - mMapView.onStart(); - } - - // Called when our app comes into the foreground - @Override - public void onResume() { - super.onResume(); - - mMapView.onResume(); - } - - // Called when our app goes into the background - @Override - public void onPause() { - super.onPause(); - - mMapView.onPause(); - } - - @Override - protected void onStop() { - super.onStop(); - - mMapView.onStop(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - - mMapView.onDestroy(); - } - - // Called when we need to save instance state - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - - mMapView.onSaveInstanceState(outState); - outState.putBoolean(STATE_IS_ANNOTATIONS_ON, mIsAnnotationsOn); - outState.putInt(STATE_SELECTED_STYLE, mSelectedStyle); - outState.putParcelableArrayList(STATE_MARKER_LIST, mMarkerList); - } - - // Called when the system is running low on memory - @Override - public void onLowMemory() { - super.onLowMemory(); - - mMapView.onLowMemory(); - } - - // - // Other events - // - - // Called when pressing action bar items - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - mDrawerLayout.openDrawer(GravityCompat.START); - return true; - default: - return super.onOptionsItemSelected(item); - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { - switch (requestCode) { - case PERMISSIONS_LOCATION: - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - toggleGps(true); - } - break; - - case PERMISSIONS_TRACKING_MODE_ACTIVITY: - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - startActivity(new Intent(getApplicationContext(), MyLocationTrackingModeActivity.class)); - } - break; - } - } - - private void setupDrawerContent(NavigationView navigationView) { - navigationView.setNavigationItemSelectedListener( - new NavigationView.OnNavigationItemSelectedListener() { - @Override - public boolean onNavigationItemSelected(MenuItem menuItem) { - mDrawerLayout.closeDrawers(); - - // Respond To Selection - switch (menuItem.getItemId()) { - - case R.id.action_debug: - // Cycle map debug options - mMapboxMap.cycleDebugOptions(); - toggleFpsCounter(mMapboxMap.isDebugActive()); - return true; - - case R.id.action_markers: - // Toggle markers - toggleAnnotations(!mIsAnnotationsOn); - return true; - - case R.id.action_compass: - // Toggle compass - UiSettings uiSettings = mMapboxMap.getUiSettings(); - uiSettings.setCompassEnabled(!uiSettings.isCompassEnabled()); - return true; - - case R.id.action_mapboxmap: - startActivity(new Intent(getApplicationContext(), MapboxMapActivity.class)); - return true; - - case R.id.action_info_window_adapter: - startActivity(new Intent(getApplicationContext(), InfoWindowAdapterActivity.class)); - return true; - - case R.id.action_camera: - startActivity(new Intent(getApplicationContext(), CameraActivity.class)); - return true; - - case R.id.action_tilt: - startActivity(new Intent(getApplicationContext(), TiltActivity.class)); - return true; - - case R.id.action_map_fragment: - startActivity(new Intent(getApplicationContext(), MapFragmentActivity.class)); - return true; - - case R.id.action_support_map_fragment: - startActivity(new Intent(getApplicationContext(), SupportMapFragmentActivity.class)); - return true; - - case R.id.action_press_for_marker: - startActivity(new Intent(getApplicationContext(), PressForMarkerActivity.class)); - return true; - - case R.id.action_manual_zoom: - startActivity(new Intent(getApplicationContext(), ManualZoomActivity.class)); - return true; - - case R.id.action_minmax_zoom: - startActivity(new Intent(getApplicationContext(), MaxMinZoomActivity.class)); - return true; - - case R.id.action_coordinate_change: - startActivity(new Intent(getApplicationContext(), CoordinateChangeActivity.class)); - return true; - - case R.id.action_bulk_markers: - startActivity(new Intent(getApplicationContext(), BulkMarkerActivity.class)); - return true; - - case R.id.action_info_window: - startActivity(new Intent(getApplicationContext(), InfoWindowActivity.class)); - return true; - - case R.id.action_info_window_concurrent: - startActivity(new Intent(getApplicationContext(), InfoWindowConcurrentActivity.class)); - return true; - - case R.id.action_visible_bounds: - startActivity(new Intent(getApplicationContext(), LatLngBoundsActivity.class)); - return true; - - case R.id.action_user_tracking_mode: - if ((ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) - != PackageManager.PERMISSION_GRANTED) || - (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) - != PackageManager.PERMISSION_GRANTED)) { - ActivityCompat.requestPermissions(MainActivity.this, - new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, - PERMISSIONS_TRACKING_MODE_ACTIVITY); - } else { - startActivity(new Intent(getApplicationContext(), MyLocationTrackingModeActivity.class)); - } - return true; - - case R.id.action_polyline: - startActivity(new Intent(getApplicationContext(), PolylineActivity.class)); - return true; - - case R.id.action_custom_layer: - if (mIsShowingCustomLayer) { - removeCustomLayer(); - } else { - addCustomLayer(); - } - return true; - - case R.id.action_directions: - startActivity(new Intent(getApplicationContext(), DirectionsActivity.class)); - return true; - - case R.id.action_double_mapview: - if ((ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) - != PackageManager.PERMISSION_GRANTED) || - (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) - != PackageManager.PERMISSION_GRANTED)) { - ActivityCompat.requestPermissions(MainActivity.this, - new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, - PERMISSIONS_TRACKING_MODE_ACTIVITY); - } else { - startActivity(new Intent(getApplicationContext(), DoubleMapActivity.class)); - } - return true; - - case R.id.action_geocoder: - startActivity(new Intent(getApplicationContext(), GeocoderActivity.class)); - return true; - - case R.id.action_scroll_by: - startActivity(new Intent(getApplicationContext(), ScrollByActivity.class)); - return true; - - case R.id.action_dynamic_marker: - startActivity(new Intent(getApplicationContext(), DynamicMarkerChangeActivity.class)); - return true; - - case R.id.action_map_padding: - startActivity(new Intent(getApplicationContext(), MapPaddingActivity.class)); - return true; - - case R.id.action_offline: - startActivity(new Intent(getApplicationContext(), OfflineActivity.class)); - return true; - - case R.id.action_animated_marker: - startActivity(new Intent(getApplicationContext(), AnimatedMarkerActivity.class)); - return true; - - default: - return changeMapStyle(menuItem.getItemId()); - } - } - }); - } - - private void toggleFpsCounter(boolean enableFps) { - // Show the FPS counter - if (enableFps) { - mFpsTextView.setVisibility(View.VISIBLE); - mFpsTextView.setText(getResources().getString(R.string.label_fps)); - } else { - mFpsTextView.setVisibility(View.INVISIBLE); - } - } - - private boolean changeMapStyle(int id) { - switch (id) { - case R.id.actionStyleMapboxStreets: - mMapView.setStyleUrl(Style.MAPBOX_STREETS); - mSelectedStyle = id; - return true; - - case R.id.actionStyleEmerald: - mMapView.setStyleUrl(Style.EMERALD); - mSelectedStyle = id; - return true; - - case R.id.actionStyleLight: - mMapView.setStyleUrl(Style.LIGHT); - mSelectedStyle = id; - return true; - - case R.id.actionStyleDark: - mMapView.setStyleUrl(Style.DARK); - mSelectedStyle = id; - return true; - - case R.id.actionStyleSatellite: - mMapView.setStyleUrl(Style.SATELLITE); - mSelectedStyle = id; - return true; - - case R.id.actionStyleSatelliteStreets: - mMapView.setStyleUrl(Style.SATELLITE_STREETS); - mSelectedStyle = id; - return true; - - default: - return false; - } - } - - /** - * Enabled / Disable GPS location updates along with updating the UI - * - * @param enableGps true if GPS is to be enabled, false if GPS is to be disabled - */ - private void toggleGps(boolean enableGps) { - if (enableGps) { - if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) - != PackageManager.PERMISSION_GRANTED) || - (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) - != PackageManager.PERMISSION_GRANTED)) { - ActivityCompat.requestPermissions(this, - new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, - PERMISSIONS_LOCATION); - } else { - mMapboxMap.setOnMyLocationChangeListener(new MapboxMap.OnMyLocationChangeListener() { - @Override - public void onMyLocationChange(@Nullable Location location) { - if (location != null) { - mMapboxMap.setCameraPosition(new CameraPosition.Builder() - .target(new LatLng(location)) - .zoom(16) - .bearing(0) - .tilt(0) - .build()); - mMapboxMap.setOnMyLocationChangeListener(null); - } - } - }); - mMapboxMap.setMyLocationEnabled(true); - - TrackingSettings trackingSettings = mMapboxMap.getTrackingSettings(); - trackingSettings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE); - trackingSettings.setMyBearingTrackingMode(MyBearingTracking.GPS); - - mLocationFAB.setColorFilter(ContextCompat.getColor(this, R.color.primary)); - } - } else { - if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) - == PackageManager.PERMISSION_GRANTED) || - (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) - == PackageManager.PERMISSION_GRANTED)) { - mMapboxMap.setMyLocationEnabled(false); - } - mLocationFAB.setColorFilter(Color.TRANSPARENT); - } - } - - /** - * Enable / Disable Annotations. - * - * @param enableAnnotations True to display, False to hide - */ - private void toggleAnnotations(boolean enableAnnotations) { - if (enableAnnotations) { - if (!mIsAnnotationsOn) { - mIsAnnotationsOn = true; - addMarkers(); - addPolyline(); - addPolygon(); - mMapboxMap.setCameraPosition( - new CameraPosition.Builder() - .target(new LatLng(38.11727, -122.22839)) - .zoom(7) - .bearing(0) - .tilt(0) - .build()); - } - } else { - if (mIsAnnotationsOn) { - mIsAnnotationsOn = false; - removeAnnotations(); - } - } - } - - private void addMarkers() { - List<MarkerOptions> markerOptionsList = new ArrayList<>(); - - final MarkerOptions backLot = generateMarker("Back Lot", "The back lot behind my house", null, 38.649441, -121.369064); - markerOptionsList.add(backLot); - - final Icon dogIcon = IconFactory.getInstance(this).fromAsset("dog-park-24.png"); - final MarkerOptions cheeseRoom = generateMarker("Cheese Room", "The only air conditioned room on the property", dogIcon, 38.531577, -122.010646); - markerOptionsList.add(cheeseRoom); - - mMapboxMap.addMarkers(markerOptionsList); - } - - private MarkerOptions generateMarker(String title, String snippet, Icon icon, double lat, double lng) { - return new MarkerOptions() - .position(new LatLng(lat, lng)) - .title(title) - .icon(icon) - .snippet(snippet); - } - - private void addPolyline() { - try { - String geojsonStr = GeoParseUtil.loadStringFromAssets(this, "small_line.geojson"); - List<LatLng> latLngs = GeoParseUtil.parseGeoJSONCoordinates(geojsonStr); - mMapboxMap.addPolyline(new PolylineOptions() - .add(latLngs.toArray(new LatLng[latLngs.size()])) - .width(2) - .color(Color.RED)); - } catch (Exception e) { - Log.e(TAG, "Error adding Polyline: " + e); - e.printStackTrace(); - } - } - - private void addPolygon() { - try { - String geojsonStr = GeoParseUtil.loadStringFromAssets(this, "small_poly.geojson"); - List<LatLng> latLngs = GeoParseUtil.parseGeoJSONCoordinates(geojsonStr); - List<PolygonOptions> polygonOptions = new ArrayList<>(); - polygonOptions.add(new PolygonOptions() - .add(latLngs.toArray(new LatLng[latLngs.size()])) - .strokeColor(Color.MAGENTA) - .fillColor(Color.BLUE).alpha(0.5f)); - mMapboxMap.addPolygons(polygonOptions).get(0); - } catch (Exception e) { - Log.e(TAG, "Error adding Polygon: " + e); - e.printStackTrace(); - } - } - - private void removeAnnotations() { - mMarkerList.clear(); - mMapboxMap.removeAnnotations(); - } - - private void addCustomLayer() { - mIsShowingCustomLayer = true; - mMapboxMap.addCustomLayer( - new CustomLayer("custom", - ExampleCustomLayer.createContext(), - ExampleCustomLayer.InitializeFunction, - ExampleCustomLayer.RenderFunction, - ExampleCustomLayer.DeinitializeFunction), - null); - } - - private void removeCustomLayer() { - mIsShowingCustomLayer = false; - mMapboxMap.removeCustomLayer("custom"); - } - - // Called when FPS changes - private class MyOnFpsChangedListener implements MapboxMap.OnFpsChangedListener { - - @Override - public void onFpsChanged(double fps) { - mFpsTextView.setText(getResources().getString(R.string.label_fps) + String.format(" %4.2f", fps)); - } - } - -} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/AnimatedMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/AnimatedMarkerActivity.java index a1386d7d19..36abc13fbf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/AnimatedMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/AnimatedMarkerActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.animation.TypeEvaluator; import android.animation.ValueAnimator; @@ -18,6 +18,7 @@ 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.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class AnimatedMarkerActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/BulkMarkerActivity.java index fda5648bef..68a82e523e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/BulkMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/BulkMarkerActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.app.ProgressDialog; import android.content.Context; @@ -21,6 +21,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CameraActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/CameraActivity.java index dd3e4805b4..720c73bf9c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CameraActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/CameraActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -16,6 +16,7 @@ import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CoordinateChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/CoordinateChangeActivity.java index 1270dbc67b..55481a7e38 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CoordinateChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/CoordinateChangeActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -15,6 +15,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.UiSettings; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/DirectionsActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/DirectionsActivity.java index 78ceabe4f2..b126370720 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/DirectionsActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/DirectionsActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.graphics.Color; import android.os.Bundle; @@ -21,6 +21,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/DoubleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/DoubleMapActivity.java index 4452b03ff1..162512efaa 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/DoubleMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/DoubleMapActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -20,6 +20,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.TrackingSettings; import com.mapbox.mapboxsdk.maps.UiSettings; +import com.mapbox.mapboxsdk.testapp.R; public class DoubleMapActivity extends AppCompatActivity { @@ -75,7 +76,7 @@ public class DoubleMapActivity extends AppCompatActivity { TrackingSettings settings = mapboxMap.getTrackingSettings(); settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW); } catch (SecurityException e) { - // permission is handled in MainActivity + // permission is handled in FeatureOverviewActivity getActivity().finish(); } } @@ -100,7 +101,7 @@ public class DoubleMapActivity extends AppCompatActivity { TrackingSettings settings = mapboxMap.getTrackingSettings(); settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW); }catch (SecurityException e){ - // permission is handled in MainActivity + // permission is handled in FeatureOverviewActivity getActivity().finish(); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/DynamicMarkerChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/DynamicMarkerChangeActivity.java index 4a23ce5767..ceade78fc1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/DynamicMarkerChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/DynamicMarkerChangeActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -18,6 +18,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class DynamicMarkerChangeActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/GeocoderActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/GeocoderActivity.java index 585cb89310..96334c62cb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/GeocoderActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/GeocoderActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.graphics.PointF; import android.os.AsyncTask; @@ -26,6 +26,7 @@ import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.Projection; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/InfoWindowActivity.java index e1172c2897..a47bc90f4e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/InfoWindowActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -13,6 +13,7 @@ import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/InfoWindowAdapterActivity.java index 32e1d306d9..4e137bfac0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/InfoWindowAdapterActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.graphics.Color; import android.graphics.PorterDuff; @@ -19,6 +19,7 @@ import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.annotations.CityStateMarker; import com.mapbox.mapboxsdk.testapp.annotations.CityStateMarkerOptions; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowConcurrentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/InfoWindowConcurrentActivity.java index 6ca86a4123..532a33bbc8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowConcurrentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/InfoWindowConcurrentActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -12,6 +12,7 @@ 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.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class InfoWindowConcurrentActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/LatLngBoundsActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/LatLngBoundsActivity.java index 5a9c113502..b9ebfa675c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/LatLngBoundsActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/LatLngBoundsActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -17,6 +17,7 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.UiSettings; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ManualZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/ManualZoomActivity.java index cabbc72dad..02459b00d1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ManualZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/ManualZoomActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.graphics.Point; import android.os.Bundle; @@ -15,6 +15,7 @@ import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.UiSettings; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MapFragmentActivity.java index d2fc7b6713..29ef545c10 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MapFragmentActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.app.FragmentTransaction; import android.os.Bundle; @@ -16,6 +16,7 @@ import com.mapbox.mapboxsdk.maps.MapFragment; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class MapFragmentActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapPaddingActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MapPaddingActivity.java index 59a418543b..f5c2011e5d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapPaddingActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MapPaddingActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -17,6 +17,7 @@ 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.testapp.utils.ApiAccess; public class MapPaddingActivity extends AppCompatActivity { @@ -115,7 +116,7 @@ public class MapPaddingActivity extends AppCompatActivity { trackingSettings.setDismissTrackingOnGesture(false); trackingSettings.setMyLocationTrackingMode(enable ? MyLocationTracking.TRACKING_FOLLOW : MyLocationTracking.TRACKING_NONE); } catch (SecurityException e) { - // permission not granted is handled in MainActivity + // permission not granted is handled in FeatureOverviewActivity finish(); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MapboxMapActivity.java index ddab530106..c6b1545dfe 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MapboxMapActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -14,6 +14,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.constants.Style; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MaxMinZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MaxMinZoomActivity.java index 16dc5d8a71..a7116c0a37 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MaxMinZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MaxMinZoomActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.graphics.Point; import android.os.Bundle; @@ -16,6 +16,7 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.UiSettings; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class MaxMinZoomActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MyLocationTrackingModeActivity.java index a201d2bc96..e15ffda61e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MyLocationTrackingModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/MyLocationTrackingModeActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.location.Location; import android.os.Bundle; @@ -22,6 +22,7 @@ import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.TrackingSettings; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; @@ -72,7 +73,7 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements try { mapboxMap.setMyLocationEnabled(true); } catch (SecurityException e) { - //should not occur, permission was checked in MainActivity + //should not occur, permission was checked in FeatureOverviewActivity Toast.makeText(MyLocationTrackingModeActivity.this, "Location permission is not available", Toast.LENGTH_SHORT).show(); finish(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/OfflineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/OfflineActivity.java index 91c3400bda..d12536a35b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/OfflineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/OfflineActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -26,6 +26,7 @@ import com.mapbox.mapboxsdk.offline.OfflineRegion; import com.mapbox.mapboxsdk.offline.OfflineRegionError; import com.mapbox.mapboxsdk.offline.OfflineRegionStatus; import com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.offline.DownloadRegionDialog; import com.mapbox.mapboxsdk.testapp.offline.ListRegionsDialog; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/PolylineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/PolylineActivity.java index 46f926c619..10d6771dd7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/PolylineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/PolylineActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.graphics.Color; import android.os.Bundle; @@ -16,6 +16,7 @@ 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.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/PressForMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/PressForMarkerActivity.java index ab574d8b55..5aa7423fb3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/PressForMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/PressForMarkerActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.graphics.PointF; import android.os.Bundle; @@ -15,6 +15,7 @@ import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/ScrollByActivity.java index ec68a84412..c506eec3f5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/ScrollByActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -20,6 +20,7 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.UiSettings; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class ScrollByActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/SupportMapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/SupportMapFragmentActivity.java index efd4f52890..336ff9f850 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/SupportMapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/SupportMapFragmentActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -16,6 +16,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.SupportMapFragment; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class SupportMapFragmentActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/TiltActivity.java index b178b24c25..f08f62bb8d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/TiltActivity.java @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp; +package com.mapbox.mapboxsdk.testapp.activity; import android.os.Bundle; import android.support.annotation.NonNull; @@ -12,6 +12,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ApiAccess; public class TiltActivity extends AppCompatActivity { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java new file mode 100644 index 0000000000..16f93e7ae5 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java @@ -0,0 +1,55 @@ +package com.mapbox.mapboxsdk.testapp.adapter; + +import android.graphics.Typeface; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.mapbox.mapboxsdk.testapp.R; +import com.mapbox.mapboxsdk.testapp.model.Feature; +import com.mapbox.mapboxsdk.testapp.utils.FontCache; + +import java.util.List; + +public class FeatureAdapter extends RecyclerView.Adapter<FeatureAdapter.ViewHolder> { + + private List<Feature> features; + + public static class ViewHolder extends RecyclerView.ViewHolder { + + public TextView labelView; + public TextView descriptionView; + + public ViewHolder(View v) { + super(v); + Typeface typeface = FontCache.get("Roboto-Regular.ttf",v.getContext()); + labelView = (TextView) v.findViewById(R.id.nameView); + labelView.setTypeface(typeface); + descriptionView = (TextView) v.findViewById(R.id.descriptionView); + descriptionView.setTypeface(typeface); + } + } + + public FeatureAdapter(List<Feature> features) { + this.features = features; + } + + @Override + public FeatureAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_feature, parent, false); + return new ViewHolder(v); + } + + @Override + public void onBindViewHolder(ViewHolder holder, int position) { + holder.labelView.setText(features.get(position).getLabel()); + holder.descriptionView.setText(features.get(position).getDescription()); + } + + @Override + public int getItemCount() { + return features.size(); + } +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java new file mode 100644 index 0000000000..d86e06ea6d --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java @@ -0,0 +1,178 @@ +package com.mapbox.mapboxsdk.testapp.adapter; + +import android.content.Context; +import android.support.annotation.IdRes; +import android.support.annotation.LayoutRes; +import android.support.annotation.NonNull; +import android.support.v7.widget.RecyclerView; +import android.util.SparseArray; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.mapbox.mapboxsdk.testapp.utils.FontCache; + +import java.util.Arrays; +import java.util.Comparator; + +public class FeatureSectionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { + + private static final int SECTION_TYPE = 0; + + private final Context context; + private final SparseArray<Section> sections; + private final RecyclerView.Adapter adapter; + + @LayoutRes + private final int sectionRes; + + @IdRes + private final int textRes; + + private boolean valid = true; + + public FeatureSectionAdapter(Context ctx, int sectionResourceId, int textResourceId, RecyclerView.Adapter baseAdapter) { + context = ctx; + sectionRes = sectionResourceId; + textRes = textResourceId; + adapter = baseAdapter; + sections = new SparseArray<>(); + adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { + @Override + public void onChanged() { + valid = adapter.getItemCount() > 0; + notifyDataSetChanged(); + } + + @Override + public void onItemRangeChanged(int positionStart, int itemCount) { + valid = adapter.getItemCount() > 0; + notifyItemRangeChanged(positionStart, itemCount); + } + + @Override + public void onItemRangeInserted(int positionStart, int itemCount) { + valid = adapter.getItemCount() > 0; + notifyItemRangeInserted(positionStart, itemCount); + } + + @Override + public void onItemRangeRemoved(int positionStart, int itemCount) { + valid = adapter.getItemCount() > 0; + notifyItemRangeRemoved(positionStart, itemCount); + } + }); + } + + + public static class SectionViewHolder extends RecyclerView.ViewHolder { + + public TextView title; + + public SectionViewHolder(@NonNull View view, @IdRes int textRes) { + super(view); + title = (TextView) view.findViewById(textRes); + title.setTypeface(FontCache.get("Roboto-Medium.ttf", view.getContext())); + } + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int typeView) { + if (typeView == SECTION_TYPE) { + final View view = LayoutInflater.from(context).inflate(sectionRes, parent, false); + return new SectionViewHolder(view, textRes); + } else { + return adapter.onCreateViewHolder(parent, typeView - 1); + } + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder sectionViewHolder, int position) { + if (isSectionHeaderPosition(position)) { + ((SectionViewHolder) sectionViewHolder).title.setText(sections.get(position).title); + } else { + adapter.onBindViewHolder(sectionViewHolder, getConvertedPosition(position)); + } + + } + + @Override + public int getItemViewType(int position) { + return isSectionHeaderPosition(position) + ? SECTION_TYPE + : adapter.getItemViewType(getConvertedPosition(position)) + 1; + } + + + public static class Section { + int firstPosition; + int sectionedPosition; + CharSequence title; + + public Section(int firstPosition, CharSequence title) { + this.firstPosition = firstPosition; + this.title = title; + } + + public CharSequence getTitle() { + return title; + } + } + + + public void setSections(Section[] sections) { + this.sections.clear(); + + Arrays.sort(sections, new Comparator<Section>() { + @Override + public int compare(Section o, Section o1) { + return (o.firstPosition == o1.firstPosition) + ? 0 + : ((o.firstPosition < o1.firstPosition) ? -1 : 1); + } + }); + + int offset = 0; + for (Section section : sections) { + section.sectionedPosition = section.firstPosition + offset; + this.sections.append(section.sectionedPosition, section); + ++offset; + } + + notifyDataSetChanged(); + } + + public int getConvertedPosition(int sectionedPosition) { + if (isSectionHeaderPosition(sectionedPosition)) { + return RecyclerView.NO_POSITION; + } + + int offset = 0; + for (int i = 0; i < sections.size(); i++) { + if (sections.valueAt(i).sectionedPosition > sectionedPosition) { + break; + } + --offset; + } + return sectionedPosition + offset; + } + + public boolean isSectionHeaderPosition(int position) { + return sections.get(position) != null; + } + + + @Override + public long getItemId(int position) { + return isSectionHeaderPosition(position) + ? Integer.MAX_VALUE - sections.indexOfKey(position) + : adapter.getItemId(getConvertedPosition(position)); + } + + @Override + public int getItemCount() { + return (valid ? adapter.getItemCount() + sections.size() : 0); + } + +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/Feature.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/Feature.java new file mode 100644 index 0000000000..32599288db --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/Feature.java @@ -0,0 +1,69 @@ +package com.mapbox.mapboxsdk.testapp.model; + +import android.os.Parcel; +import android.os.Parcelable; + +public class Feature implements Parcelable{ + + private String name; + private String label; + private String description; + private String category; + + public Feature(String name, String label, String description, String category) { + this.name = name; + this.label = label; + this.description = description; + this.category = category; + } + + private Feature(Parcel in) { + name = in.readString(); + label = in.readString(); + description = in.readString(); + category = in.readString(); + } + + public String getName() { + return name; + } + + public String getSimpleName() { + String[] split = name.split("\\."); + return split[split.length - 1]; + } + + public String getLabel() { + return label != null ? label : getSimpleName(); + } + + public String getDescription() { + return description != null ? description : "-"; + } + + public String getCategory() { + return category; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel out, int flags) { + out.writeString(name); + out.writeString(label); + out.writeString(description); + out.writeString(category); + } + + public static final Parcelable.Creator<Feature> CREATOR + = new Parcelable.Creator<Feature>() { + public Feature createFromParcel(Parcel in) { + return new Feature(in); + } + + public Feature[] newArray(int size) { + return new Feature[size]; + } + }; +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java new file mode 100644 index 0000000000..46552fb7ae --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java @@ -0,0 +1,27 @@ +package com.mapbox.mapboxsdk.testapp.utils; + +import android.content.Context; +import android.graphics.Typeface; +import android.util.Log; + +import com.mapbox.mapboxsdk.constants.MapboxConstants; + +import java.util.Hashtable; + +public class FontCache { + + private static Hashtable<String, Typeface> fontCache = new Hashtable<>(); + + public static Typeface get(String name, Context context) { + Typeface tf = fontCache.get(name); + if (tf == null) { + try { + tf = Typeface.createFromAsset(context.getAssets(), name); + fontCache.put(name, tf); + } catch (Exception e) { + Log.e(MapboxConstants.TAG, "Font not found"); + } + } + return tf; + } +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java new file mode 100644 index 0000000000..51e09f3593 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java @@ -0,0 +1,95 @@ +package com.mapbox.mapboxsdk.testapp.utils; + +import android.support.v7.widget.RecyclerView; +import android.view.View; + +import com.mapbox.mapboxsdk.testapp.R; + +public class ItemClickSupport { + private final RecyclerView mRecyclerView; + private OnItemClickListener mOnItemClickListener; + private OnItemLongClickListener mOnItemLongClickListener; + private View.OnClickListener mOnClickListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mOnItemClickListener != null) { + RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v); + mOnItemClickListener.onItemClicked(mRecyclerView, holder.getAdapterPosition(), v); + } + } + }; + private View.OnLongClickListener mOnLongClickListener = new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + if (mOnItemLongClickListener != null) { + RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v); + return mOnItemLongClickListener.onItemLongClicked(mRecyclerView, holder.getAdapterPosition(), v); + } + return false; + } + }; + private RecyclerView.OnChildAttachStateChangeListener mAttachListener + = new RecyclerView.OnChildAttachStateChangeListener() { + @Override + public void onChildViewAttachedToWindow(View view) { + if (mOnItemClickListener != null) { + view.setOnClickListener(mOnClickListener); + } + if (mOnItemLongClickListener != null) { + view.setOnLongClickListener(mOnLongClickListener); + } + } + + @Override + public void onChildViewDetachedFromWindow(View view) { + + } + }; + + private ItemClickSupport(RecyclerView recyclerView) { + mRecyclerView = recyclerView; + mRecyclerView.setTag(R.id.item_click_support, this); + mRecyclerView.addOnChildAttachStateChangeListener(mAttachListener); + } + + public static ItemClickSupport addTo(RecyclerView view) { + ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); + if (support == null) { + support = new ItemClickSupport(view); + } + return support; + } + + public static ItemClickSupport removeFrom(RecyclerView view) { + ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); + if (support != null) { + support.detach(view); + } + return support; + } + + public ItemClickSupport setOnItemClickListener(OnItemClickListener listener) { + mOnItemClickListener = listener; + return this; + } + + public ItemClickSupport setOnItemLongClickListener(OnItemLongClickListener listener) { + mOnItemLongClickListener = listener; + return this; + } + + private void detach(RecyclerView view) { + view.removeOnChildAttachStateChangeListener(mAttachListener); + view.setTag(R.id.item_click_support, null); + } + + public interface OnItemClickListener { + + void onItemClicked(RecyclerView recyclerView, int position, View v); + } + + public interface OnItemLongClickListener { + + boolean onItemLongClicked(RecyclerView recyclerView, int position, View v); + } +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/line_divider.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/line_divider.xml new file mode 100644 index 0000000000..2dc6b4a008 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/line_divider.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + + <size + android:width="1dp" + android:height="1dp" /> + + <solid android:color="@android:color/darker_gray" /> + +</shape>
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml index 0b539daac3..41956385f9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml @@ -1,69 +1,20 @@ <?xml version="1.0" encoding="utf-8"?> - -<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:id="@+id/drawer_layout" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:fitsSystemWindows="true"> + android:orientation="vertical"> - <RelativeLayout + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" 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" /> - - <FrameLayout - android:id="@+id/content_frame" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_below="@+id/toolbar"> - - <android.support.design.widget.CoordinatorLayout - android:id="@+id/coordinator_layout" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.mapbox.mapboxsdk.maps.MapView - android:id="@+id/mainMapView" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - - <TextView - android:id="@+id/view_fps" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:text="@string/label_fps" - android:textAppearance="?android:attr/textAppearanceLarge" /> + android:layout_height="?attr/actionBarSize" + android:background="@color/primary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> - - <android.support.design.widget.FloatingActionButton - android:id="@+id/locationFAB" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end|bottom" - android:layout_margin="@dimen/fab_margin" - android:src="@drawable/ic_gps_fixed_24dp" - app:backgroundTint="@color/white" /> - - </android.support.design.widget.CoordinatorLayout> - - </FrameLayout> - - </RelativeLayout> - - <android.support.design.widget.NavigationView - android:id="@+id/nav_view" - android:layout_width="wrap_content" + <android.support.v7.widget.RecyclerView + android:id="@+id/recyclerView" + android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_gravity="start" - android:fitsSystemWindows="true" - app:menu="@menu/menu_drawer" /> + android:scrollbars="vertical" /> -</android.support.v4.widget.DrawerLayout> +</LinearLayout>
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_fragment.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_fragment.xml index ce516f6a1b..11b755ea28 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_fragment.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_fragment.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - tools:context="com.mapbox.mapboxsdk.testapp.MapFragmentActivity"> + tools:context=".activity.MapFragmentActivity"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_main_feature.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_main_feature.xml new file mode 100644 index 0000000000..93af094e3f --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_main_feature.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="72dp" + android:background="?android:attr/selectableItemBackground" + android:orientation="vertical" + android:paddingLeft="16dp" + android:paddingStart="16dp" + android:paddingTop="16dp"> + + <TextView + android:id="@+id/nameView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:text="Dummy headline" + android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" + android:singleLine="true" + android:textColor="@android:color/black" + android:textSize="16sp" /> + + <TextView + android:id="@+id/descriptionView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:alpha="0.56" + android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" + android:singleLine="true" + android:text="Description is dummy dummy" + android:textColor="@android:color/black" + android:textSize="14sp" /> + +</LinearLayout>
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/section_main_layout.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/section_main_layout.xml new file mode 100644 index 0000000000..8978d4e3eb --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/section_main_layout.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="48dp"> + + <View + android:layout_width="match_parent" + android:layout_height="0.25dp" + android:alpha="0.56" + android:background="@drawable/line_divider" /> + + <TextView + android:id="@+id/section_text" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" + android:alpha="0.54" + android:background="@android:color/transparent" + android:singleLine="true" + android:textColor="@android:color/black" + android:textSize="14sp" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml deleted file mode 100644 index d04996dc95..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml +++ /dev/null @@ -1,221 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - - <item - android:id="@+id/mainActivityMenu" - android:title="@string/navdrawer_menu_title_mainactivity_controls"> - <menu> - <group> - <item - android:id="@+id/action_debug" - android:icon="@drawable/ic_bug_report_24dp" - android:title="@string/action_debug" /> - - <item - android:id="@+id/action_markers" - android:icon="@drawable/ic_place_24dp" - android:title="@string/action_point_annotations" /> - - <item - android:id="@+id/action_compass" - android:icon="@drawable/ic_navigation_24dp" - android:title="@string/action_compass" /> - - <item - android:id="@+id/action_custom_layer" - android:icon="@drawable/ic_now_wallpaper_24dp" - android:title="@string/action_custom_layer" /> - - </group> - </menu> - </item> - - <group android:id="@+id/stylesSeparator" /> - - <item - android:id="@+id/mainActivityStylesMenue" - android:title="@string/navdrawer_menu_title_mainactivity_styles"> - <menu> - <group android:id="@+id/stylesGroup"> - <item - android:id="@+id/actionStyleMapboxStreets" - android:title="@string/styleMapboxStreets" /> - - <item - android:id="@+id/actionStyleEmerald" - android:title="@string/styleEmerald" /> - - <item - android:id="@+id/actionStyleLight" - android:title="@string/styleLight" /> - - <item - android:id="@+id/actionStyleDark" - android:title="@string/styleDark" /> - - <item - android:id="@+id/actionStyleSatellite" - android:title="@string/styleSatellite" /> - - <item - android:id="@+id/actionStyleSatelliteStreets" - android:title="@string/styleSatelliteStreets" /> - - </group> - </menu> - </item> - - <group android:id="@+id/testsSeparator" /> - - <item - android:id="@+id/testsMenu" - android:title="@string/navdrawer_menu_title_individual_tests"> - <menu> - - <item - android:id="@+id/action_offline" - android:checkable="false" - android:icon="@drawable/ic_airplanemode_active_black_24dp" - android:title="@string/action_offline" /> - - <item - android:id="@+id/action_mapboxmap" - android:checkable="false" - android:icon="@drawable/ic_mapboxmap" - android:title="@string/action_mapboxmap" /> - - <item - android:id="@+id/action_tilt" - android:checkable="false" - android:icon="@drawable/ic_tilt" - android:title="@string/action_tilt" /> - - <item - android:id="@+id/action_camera" - android:checkable="false" - android:icon="@drawable/ic_transform_24dp" - android:title="@string/action_camera" /> - - <item - android:id="@+id/action_map_fragment" - android:checkable="false" - android:icon="@drawable/ic_now_widgets_24dp" - android:title="@string/action_map_fragment" /> - - <item - android:id="@+id/action_support_map_fragment" - android:checkable="false" - android:icon="@drawable/ic_now_widgets_24dp" - android:title="@string/action_map_fragment_support" /> - - <item - android:id="@+id/action_info_window" - android:checkable="false" - android:icon="@drawable/ic_flip_to_front_24dp" - android:title="@string/action_info_window" /> - - <item - android:id="@+id/action_info_window_concurrent" - android:checkable="false" - android:icon="@drawable/ic_flip_to_back_24dp" - android:title="@string/action_info_window_concurrent" /> - - <item - android:id="@+id/action_info_window_adapter" - android:checkable="false" - android:icon="@drawable/ic_infowindow_adapter" - android:title="@string/action_info_window_adapter" /> - - <item - android:id="@+id/action_press_for_marker" - android:checkable="false" - android:icon="@drawable/ic_pin_drop_24dp" - android:title="@string/action_press_for_marker" /> - - <item - android:id="@+id/action_manual_zoom" - android:checkable="false" - android:icon="@drawable/ic_filter_center_focus_24dp" - android:title="@string/action_manual_zoom" /> - - <item - android:id="@+id/action_minmax_zoom" - android:checkable="false" - android:icon="@drawable/ic_find_replace_24dp" - android:title="@string/action_minmax_zoom" /> - - <item - android:id="@+id/action_coordinate_change" - android:checkable="false" - android:icon="@drawable/ic_animate_coordinates" - android:title="@string/action_animate_coordinate_change" /> - - <item - android:id="@+id/action_visible_bounds" - android:checkable="false" - android:icon="@drawable/ic_crop_24dp" - android:title="@string/action_visible_bounds" /> - - <item - android:id="@+id/action_bulk_markers" - android:checkable="false" - android:icon="@drawable/ic_blur_on_24dp" - android:title="@string/action_add_bulk_markers" /> - - <item - android:id="@+id/action_user_tracking_mode" - android:checkable="false" - android:icon="@drawable/ic_gps_fixed_24dp" - android:title="@string/activity_user_tracking_mode" /> - - <item - android:id="@+id/action_polyline" - android:checkable="false" - android:icon="@drawable/ic_trending_up_24dp" - android:title="@string/activity_polyline" /> - - <item - android:id="@+id/action_directions" - android:checkable="false" - android:icon="@drawable/ic_directions" - android:title="@string/activity_directions" /> - - <item - android:id="@+id/action_double_mapview" - android:checkable="false" - android:icon="@drawable/ic_dns_24dp" - android:title="@string/action_double_mapview" /> - - <item - android:id="@+id/action_geocoder" - android:checkable="false" - android:icon="@drawable/ic_directions" - android:title="@string/activity_geocoder" /> - - <item - android:id="@+id/action_scroll_by" - android:checkable="false" - android:icon="@drawable/ic_input_24dp" - android:title="@string/activity_scroll_by" /> - - <item - android:id="@+id/action_dynamic_marker" - android:checkable="false" - android:icon="@drawable/ic_dynamic_marker" - android:title="@string/action_dynamic_marker" /> - - <item - android:id="@+id/action_map_padding" - android:checkable="false" - android:icon="@drawable/ic_map_padding" - android:title="@string/action_map_padding" /> - - <item - android:id="@+id/action_animated_marker" - android:checkable="false" - android:icon="@drawable/ic_compare_arrows_black_24dp" - android:title="@string/action_animated_marker" /> - - </menu> - </item> -</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml index ac3b4fc30d..f943e8cedd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml @@ -3,5 +3,5 @@ <color name="primary">#1E8CAB</color> <color name="primaryDark">#166B83</color> <color name="accent">#E55E5E</color> - <color name="white">#FFFFFF</color> + <color name="white">#F9F9F9</color> </resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/dimens.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/dimens.xml index aeda60d478..102a625fc8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/dimens.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/dimens.xml @@ -6,4 +6,5 @@ <dimen name="map_padding_left">96dp</dimen> <dimen name="map_padding_bottom">256dp</dimen> <dimen name="map_padding_right">32dp</dimen> + <dimen name="toolbar_shadow">4dp</dimen> </resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/ids.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/ids.xml new file mode 100644 index 0000000000..1f36e6c015 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/ids.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <item name="mapView" type="id"/> + <item name="item_click_support" type="id" /> +</resources>
\ 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 bd3d6390ee..72e9b7c25f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml @@ -4,23 +4,23 @@ <string name="app_name">Mapbox GL</string> <!-- Test Activities --> - <string name="activity_mapboxmap">MapboxMap</string> - <string name="activity_tilt">Map Tilt</string> - <string name="activity_infowindow_adapter">InfoWindow Adapter</string> + <string name="activity_mapboxmap">MapboxMap Activity</string> + <string name="activity_tilt">Map Tilt Activity</string> + <string name="activity_infowindow_adapter">InfoWindow Adapter Activity</string> <string name="activity_map_fragment_suport">Support Map Fragment Activity</string> <string name="activity_map_fragment">Map Fragment Activity</string> <string name="activity_press_for_marker">Press For Marker Activity</string> <string name="activity_marker_in_bulk">Add Bulk Markers Activity</string> <string name="activity_manual_zoom">Manual Zoom Activity</string> <string name="activity_info_window">InfoWindow Activity</string> - <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_info_window_concurrent">InfoWindow Activity (Concurrent) Activity</string> + <string name="activity_visible_coordinate_bounds">Visible Coordinate Bounds Activity</string> + <string name="activity_user_tracking_mode">User tracking mode Activity</string> + <string name="activity_add_bulk_markers">Add Markers In Bulk Activity</string> + <string name="activity_camera">Camera Activity</string> <string name="activity_polyline">Polyline Activity</string> - <string name="activity_animate_coordinate_change">Animate Coordinate Change</string> - <string name="activity_custom_layer">Custom Layer</string> + <string name="activity_animate_coordinate_change">Animate Coordinate Change Activity</string> + <string name="activity_custom_layer">Custom Layer Activity</string> <string name="activity_directions">Directions Activity</string> <string name="activity_geocoder">Geocoder Activity</string> <string name="activity_double_map">Double Map Activity</string> @@ -28,37 +28,44 @@ <string name="activity_dynamic_marker">Dynamic Marker Activity</string> <string name="activity_map_padding">Map Padding Activity</string> <string name="activity_offline">Offline Map Activity</string> + <string name="activity_minmax_zoom">Min/Max Zoom Activity</string> + <string name="activity_animated_marker">Animated Marker Activity</string> + + <string name="description_user_location_tracking">Tracks the location of the user</string> + <string name="description_custom_layer">Add a custom layer, experimental feature</string> + <string name="description_mapboxmap">Test out MapboxMap interaction</string> + <string name="description_info_window_adapter">Learn how to craete custom InfoWindows</string> + <string name="description_tilt">Showcasing Tilt</string> + <string name="description_map_fragment">Showcase MapFragment</string> + <string name="description_map_fragment_support">Showcase SupportMapFragment</string> + <string name="description_press_for_marker">Add marker on long press</string> + <string name="description_manual_zoom">Different types of zoom in CameraUpdateFactory</string> + <string name="description_minmax_zoom">Configure a max and min zoomlevel</string> + <string name="description_info_window">Example with an InfoWindow</string> + <string name="description_animate_coordinate_change">Animate Coordinate Change</string> + <string name="description_info_window_concurrent">InfoWindow example with multiple open</string> + <string name="description_add_bulk_markers">Example which adds Markers in bulk</string> + <string name="description_camera">Showcase Camera API</string> + <string name="description_visible_bounds">Limit Visible Bounds example</string> + <string name="description_double_mapview">Having 2 MapViews in one location</string> + <string name="description_dynamic_marker">Dynamic Marker example</string> + <string name="description_map_padding">Map Padding example</string> + <string name="description_offline">Offline Map example</string> + <string name="description_animated_marker">Animated Marker example</string> + <string name="description_polyline">Add a polyline example</string> + <string name="description_directions">Example with Directions API</string> + <string name="description_geocoder">Example with Geocoder API</string> + <string name="description_scroll_by">Example to scroll with pixels in x,y direction</string> + + <string name="category_marker">Marker</string> + <string name="category_infowindow">InfoWindow</string> + <string name="category_camera">Camera</string> + <string name="category_fragment">Fragment</string> + <string name="category_api">API</string> + <string name="category_other">Other</string> - <string name="navdrawer_menu_title_mainactivity_controls">Main Activity Controls</string> - <string name="navdrawer_menu_title_mainactivity_styles">Main Activity Styles</string> - <string name="navdrawer_menu_title_individual_tests">Individual Tests</string> - <string name="action_gps">Toggle GPS location</string> - <string name="action_user_location_tracking">User location tracking</string> - <string name="action_compass">Toggle compass</string> - <string name="action_custom_layer">Custom Layer</string> - <string name="action_debug">Cycle map debug options</string> - <string name="action_point_annotations">Toggle point annotations</string> - <string name="action_mapboxmap">MapboxMap</string> - <string name="action_info_window_adapter">InfoWindow Adapter</string> - <string name="action_tilt">Tilt</string> - <string name="action_map_fragment">MapFragment</string> - <string name="action_map_fragment_support">SupportMapFragment</string> - <string name="action_press_for_marker">Press For Marker</string> - <string name="action_manual_zoom">Manual Zoom</string> - <string name="action_minmax_zoom">Min/Max Zoom</string> - <string name="action_info_window">InfoWindow</string> - <string name="action_animate_coordinate_change">Animate Coordinate Change</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> - <string name="action_double_mapview">Double MapView</string> - <string name="action_dynamic_marker">Dynamic Marker</string> - <string name="action_map_padding">Map Padding</string> - <string name="action_offline">Offline Map</string> - <string name="action_animated_marker">Animated Marker</string> <string name="button_camera_move">Move</string> <string name="button_camera_ease">Ease</string> @@ -103,6 +110,7 @@ <string name="scrollby_y_value">Y: %1$d</string> <string name="button_download_region">Download region</string> <string name="button_list_regions">List regions</string> - <string name="title_activity_animated_marker">AnimatedMarkerActivity</string> + + <string name="category">category</string> </resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml index e781e337d6..200665796e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml @@ -7,7 +7,7 @@ <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primaryDark</item> <item name="colorAccent">@color/accent</item> - <item name="android:windowBackground">@android:color/white</item> + <item name="android:windowBackground">@color/white</item> </style> </resources> diff --git a/platform/android/scripts/debug.sh b/platform/android/scripts/debug.sh index b2178db216..881fa3b187 100755 --- a/platform/android/scripts/debug.sh +++ b/platform/android/scripts/debug.sh @@ -31,7 +31,7 @@ if [[ $1 == '--prepare' ]]; then fi adb install -rtdg platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug.apk -adb shell am start -n "com.mapbox.mapboxsdk.testapp/com.mapbox.mapboxsdk.testapp.MainActivity" \ +adb shell am start -n "com.mapbox.mapboxsdk.testapp/com.mapbox.mapboxsdk.testapp.FeatureOverviewActivity" \ -a android.intent.action.MAIN -c android.intent.category.LAUNCHER adb forward tcp:5039 tcp:5039 |