Skip to content

Commit

Permalink
Merge pull request #154 from heremaps/esd/41200
Browse files Browse the repository at this point in the history
Update example apps for release 4.12.0.0
  • Loading branch information
maharudraabhishek authored Jul 7, 2022
2 parents d07e4af + 47f7936 commit 24cd54f
Show file tree
Hide file tree
Showing 210 changed files with 1,318 additions and 730 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For an overview of the existing features, please check the _Developer's Guide_ f

> For now, the _Navigate Edition_ is only available upon request. Please contact your HERE representative to receive access including a set of evaluation credentials.
## List of Available Example Apps (Version 4.11.4.0)
## List of Available Example Apps (Version 4.12.0.0)

- **HelloMap**: Shows the classic 'Hello World'.
- **HelloMapKotlin**: Shows the classic 'Hello World' using Kotlin language (Android only).
Expand Down
2 changes: 1 addition & 1 deletion examples/latest/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This folder contains the HERE SDK examples apps for version: 4.11.4.0
This folder contains the HERE SDK examples apps for version: 4.12.0.0

- HERE SDK for Android ([Lite Edition](lite/android/), [Explore Edition](explore/android/), [Navigate Edition](navigate/android/))
- HERE SDK for iOS ([Lite Edition](lite/ios/), [Explore Edition](explore/ios/), [Navigate Edition](navigate/ios/))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<meta-data android:name="com.here.sdk.access_key_secret" android:value="YOUR_ACCESS_KEY_SECRET" />

<activity android:name=".MainActivity"
android:exported="true">
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,27 @@ public void moveToXYButtonClicked(View view) {

@Override
protected void onPause() {
super.onPause();
mapView.onPause();
super.onPause();
}

@Override
protected void onResume() {
super.onResume();
mapView.onResume();
super.onResume();
}

@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();

// Free HERE SDK resources before the application shuts down.
SDKNativeEngine hereSDKEngine = SDKNativeEngine.getSharedInstance();
if (hereSDKEngine != null) {
hereSDKEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations, where a disposed instance is accidentally reused.
SDKNativeEngine.setSharedInstance(null);
}
super.onDestroy();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

<activity
android:name=".MainActivity"
android:exported="true">
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -27,4 +28,4 @@
</activity>
</application>

</manifest>
</manifest>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package com.here.camerakeyframetracks;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
Expand All @@ -30,8 +29,6 @@
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.here.camerakeyframetracks.helper.PermissionsRequestor;
import com.here.camerakeyframetracks.helper.RouteCalculator;
import com.here.sdk.core.GeoCoordinates;
import com.here.sdk.core.engine.SDKNativeEngine;
import com.here.sdk.mapview.MapError;
Expand Down Expand Up @@ -76,9 +73,9 @@ public void permissionsDenied() {
});
}

@SuppressLint("MissingSuperCall")
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
permissionsRequestor.onRequestPermissionsResult(requestCode, grantResults);
}

Expand Down Expand Up @@ -107,18 +104,13 @@ public boolean onCreateOptionsMenu(Menu menu) {

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (RouteCalculator.testRoute == null) {
Log.e("MainActivity", "Error: No route for testing ...");
return false;
}

switch (item.getItemId()) {
case R.id.stopToRouteAnimation:
routeAnimationExample.stopRouteAnimation();
return true;
case R.id.startToRouteAnimation:
// An animation that moves the camera to the route without keyframe tracks.
routeAnimationExample.animateToRoute(RouteCalculator.testRoute);
routeAnimationExample.animateToRoute();
return true;
case R.id.startNYCAnimation:
// A camera animation through New York.
Expand All @@ -134,25 +126,27 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) {

@Override
protected void onPause() {
super.onPause();
mapView.onPause();
super.onPause();
}

@Override
protected void onResume() {
super.onResume();
mapView.onResume();
super.onResume();
}

@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();

// Free HERE SDK resources before the application shuts down.
SDKNativeEngine hereSDKEngine = SDKNativeEngine.getSharedInstance();
if (hereSDKEngine != null) {
hereSDKEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations, where a disposed instance is accidentally reused.
SDKNativeEngine.setSharedInstance(null);
}
super.onDestroy();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package com.here.camerakeyframetracks.helper;
package com.here.camerakeyframetracks;

import android.Manifest;
import android.app.Activity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import android.util.Log;

import com.here.camerakeyframetracks.helper.RouteCalculator;
import com.here.sdk.animation.EasingFunction;
import com.here.sdk.core.GeoOrientationUpdate;
import com.here.sdk.core.Point2D;
Expand Down Expand Up @@ -52,16 +51,25 @@ public void stopRouteAnimation() {
mapView.getCamera().cancelAnimations();
}

public void animateToRoute(Route route) {
// Untilt and unrotate the map.
public void animateToRoute() {
if (RouteCalculator.testRoute == null) {
Log.e("RouteAnimationExample", "Error: No route for testing ...");
return;
}

animateToRoute(RouteCalculator.testRoute);
}

private void animateToRoute(Route route) {
// The animation should result in an untilted and unrotated map.
double bearing = 0;
double tilt = 0;
// We want to show the route fitting in the map view without any additional padding.
Point2D origin = new Point2D(0, 0);
Size2D sizeInPixels = new Size2D(mapView.getWidth(), mapView.getHeight());
// We want to show the route fitting in the map view with an additional padding of 50 pixels
Point2D origin = new Point2D(50, 50);
Size2D sizeInPixels = new Size2D(mapView.getWidth() - 100, mapView.getHeight() - 100);
Rectangle2D mapViewport = new Rectangle2D(origin, sizeInPixels);

// Animate to route.
// Animate to the route within a duration of 3 seconds.
MapCameraUpdate update = MapCameraUpdateFactory.lookAt(
route.getBoundingBox(),
new GeoOrientationUpdate(bearing, tilt),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package com.here.camerakeyframetracks.helper;
package com.here.camerakeyframetracks;

import android.util.Log;

Expand All @@ -29,11 +29,9 @@
import com.here.sdk.core.errors.InstantiationErrorException;
import com.here.sdk.mapview.MapPolyline;
import com.here.sdk.mapview.MapView;
import com.here.sdk.routing.CalculateRouteCallback;
import com.here.sdk.routing.CarOptions;
import com.here.sdk.routing.Route;
import com.here.sdk.routing.RoutingEngine;
import com.here.sdk.routing.RoutingError;
import com.here.sdk.routing.Waypoint;

import java.util.ArrayList;
Expand All @@ -60,19 +58,16 @@ public RouteCalculator(MapView mapView) {
}

public void createRoute() {
// A random test route.
// A fixed test route.
Waypoint startWaypoint = new Waypoint(new GeoCoordinates(40.7133, -74.0112));
Waypoint destinationWaypoint = new Waypoint(new GeoCoordinates(40.7203, -74.3122));
List<Waypoint> waypoints = new ArrayList<>(Arrays.asList(startWaypoint, destinationWaypoint));
routingEngine.calculateRoute(waypoints, new CarOptions(), new CalculateRouteCallback() {
@Override
public void onRouteCalculated(@Nullable RoutingError routingError, @Nullable List<Route> routes) {
if (routingError == null) {
testRoute = routes.get(0);
showRouteOnMap(testRoute);
} else {
Log.e("RouteCalculator", "RoutingError: " + routingError.name());
}
routingEngine.calculateRoute(waypoints, new CarOptions(), (routingError, routes) -> {
if (routingError == null) {
testRoute = routes.get(0);
showRouteOnMap(testRoute);
} else {
Log.e("RouteCalculator", "RoutingError: " + routingError.name());
}
});
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<meta-data android:name="com.here.sdk.access_key_secret" android:value="YOUR_ACCESS_KEY_SECRET" />

<activity android:name=".MainActivity"
android:exported="true">
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,27 @@ public void unloadButtonClicked(View view) {

@Override
protected void onPause() {
super.onPause();
mapView.onPause();
super.onPause();
}

@Override
protected void onResume() {
super.onResume();
mapView.onResume();
super.onResume();
}

@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();

// Free HERE SDK resources before the application shuts down.
SDKNativeEngine hereSDKEngine = SDKNativeEngine.getSharedInstance();
if (hereSDKEngine != null) {
hereSDKEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations, where a disposed instance is accidentally reused.
SDKNativeEngine.setSharedInstance(null);
}
super.onDestroy();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<meta-data android:name="com.here.sdk.access_key_secret" android:value="YOUR_ACCESS_KEY_SECRET" />

<activity android:name=".MainActivity"
android:exported="true">
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
Expand Down
Loading

0 comments on commit 24cd54f

Please sign in to comment.