How to shift HERE Map View to the right when navigating - android

I am making a navigation application using HERE SDK Android. During the middle of navigation, I want to expand an overlayed view on top of my map on the left. This causes some of my navigation views to be cut off. So I want to shift the center of my navigation to the right. That way the route and my arrows will be shifted to the right of the screen where they can be seen.
Is there a way to accomplish this using the HERE android SDK?
I have tried looking at MapSchemes but this does not seem to do what I want.
I think to put it more succinctly I want to shift my center point of the map to the right during navigation.

Have a look at setTransformCenter in the Map class.
That sounds like what you are looking for:
Sets a center coordinate for Map transformations such as zooming.
Transformations performed after calling this method will be based on
this new center coordinate. The transform center may be different than
the Map center. Developer must not use this method and setPadding(int,
int, int, int) at the same time as the only one of them will be taken
into account, depending on the order of invocation.
See https://developer.here.com/documentation/android-starter/api_reference_java/com/here/android/mpa/mapping/Map.html#setTransformCenter-android.graphics.PointF-

Related

Android - custom view and animation

I am experimenting with Views in Android and am trying to create a custom 'widget'. What I want to do is create a portion of a circle with an indicator at 12'o clock. I'd then like to to swipe over the circle and when I do, I'd like to see the indicator move to left or right corresponding to a swipe to the left or the right.
I have looked up a number of sources however I am unsure of how to draw an 'indicator' within the arc. In addtion, what needs to be done to animate the arc ? Can this be achieved without OpenGL ?
I am aware of the circlular progress bar and I believe the problem is quite similar, however I didn't have to add a marker inside the circle.
Here is an image of the screen shot of the View I would like to recreate:
This approach would work,Creating a View with rounded corners and position it to bottom to make it seem like arc

What could be a suitable UI element for map radius?

The android app that I am building contains a map activity. In that activity I need the user to specify a circle around its location.
And the radius of this circle needs to be provided by user. So what could be the best UI element to let the user specify the radius.
Best option that comes to my mind is a seek bar. One sliding it to one end, radius increases and vice versa.
Any thoughts?
A plus and minus button (like google maps has for zooming)
A gesture (2 finger to the edges of the screen for increasing the size e.g.) [no real UI element, but maybe more user-friendly]
A vertical or horizontal slider

Android Map V2 changes UI

Hello,
can anybody give me solution for how to change place of current location default icon (as rounded in above image right corner) from right corner to left corner.?
thanks.
According to this thread, you can reposition the items by using GoogleMap.setPadding(left, top, right, bottom).
Here is the actual statement:
We added GoogleMap.setPadding(left, top, right, bottom), which allows you to indicate parts of the map that may be obscured by other views. Setting padding re-positions the standard map controls, and camera updates will use the padded region.
https://developers.google.com/maps/documentation/android/map#map_padding
If you want to do that, you should hide the default my location button and add your own Button to the layout on the left side, handling onClick to call animateCamera. You cannot reuse default button's drawables this way.
Note: this is not a good idea, because other apps will have this button in the right corner in other apps using maps and may expect it to be there in your app.

Implementing wheel shaped interface navigation tool

I am interested in implementing a user interface navigation control mechanism based on a wheel shaped device (or pie chart shaped or circle shaped) in my Android app.
I would like only half of the wheel to be visible at any time. That is, only the top half of the wheel should be visible since the bottom half should be below the border of the screen. The user can then turn the 'half wheel' to show options hidden by the screen border. The visible top half should then be divided into three parts like a pie chart, so the user can press either one of them to invoke some action. The following pic should explain (it is an example with seven (A-G) options).
http://imgur.com/lNu1F
The rotation itself should not be hard, but I am having a hard time understanding how to position the wheel so that half of it is outside the actual screen. I am thinking that loading the entire wheel (but hiding half of it) is best, since that is that graphics I have and it will also allow a smooth animation when the user swipes to show some other options. How can I make Android show the wheel in this way?
Also. Any comment on how to implement the 'swipe along the wheel shape' would be appreciated.
Thank you.
So for the wheel - you are hving trouble knowing how to position the wheel because you are using XML to align you objects and would like to use something like "Align Object Center To Bottom" which does not exist.
Here is one approach that might work fine: Mask the wheel view.
Is it possible to mask a View in android?
As for swipe the wheel along, I would register the wheel to take touche events, and use only the horizontal componenet of move events to apply to the rotation of the wheel. This setup is common in audio software that uses knobs.
However if you want to have it stick to the users finger in a more realistic fashion, you will need to do the following:
When the user first touches the wheel, calculate the angle from the wheel center to the finger.
Every time the finger moves, check the angle from the wheel center to the finger - and rotate the wheel the amount that the angle has changed from the last touch event.
The formula for getting the angle between two points is this:
Float angleInRadians = Math.atan2(point1.y-point2.y, point1.x-point2.x);

Android Dynamically-Drawn, Clickable Map Overlay?

I'm trying to write an Android app that will allow a user to search for a generic destination (e.g., "gas station") and be presented with up to ~5 nearby locations to choose from. The screen results would display the user location in the center, and possible destination options would be indicated by markers.
The trick is that I don't want to rescale the map from its starting scale, and so some of the possible destinations may not be visible on the screen. I want to dynamically draw a clickable direction indicator (such as an arrow) that emanates from the user location and points to any off-screen destination. If there are multiple off-screen destinations, I'd probably want to scale the arrow lengths to indicate relative distances. If the user clicks on the arrow, they should be "teleported" to the off-screen location.
Any thoughts on how to best implement this? The only information I've found on overlays uses static files (Most overlays seem to be just .PNG files for markers; one example had a route that was drawn from an XML file). I'd need to calculate the arrow based on direction
to the destination (direction the arrow points) and the relative distance to that location (arrow length), so the overlay is something I'd have to come up with at run time.
I think the main challenge is drawing the clickable arrows, but another question that comes to mind is, should I search using the Google Maps API, or is this job more suited to the Google Places API?
Thanks!
I guess we should put the teleportation on hold until the problem of a dynamically-drawn, clickable overlay is solved then!
A dynamically-drawn, clickable overlay is merely a subclass of Overlay. You will override one or both of the draw() methods to render your arrows using the Canvas 2D drawing API. You will override onTap() to be notified of taps on the map, to see if they tapped on an arrow. You add the overlay to the MapView via addOverlays().add().
Most overlays seem to be just .PNG files for markers
Those are usually ItemizedOverlay classes. That's much simpler to implement, particularly if you are one of those developers (like me) who is all thumbs when it comes to Canvas. However, you cannot achieve what you want with an ItemizedOverlay, in all likelihood.
I'd need to calculate the arrow based on direction to the destination (direction the arrow points) and the relative distance to that location (arrow length), so the overlay is something I'd have to come up with at run time.
Correct. You can use a Projection to help convert between pixel space and geo-space (latitude and longitude), if needed.
Note that this all assumes you are trying to use MapActivity and MapView. You are also welcome to use WebView or a plain browser to bring up your own JavaScript-based maps, if you prefer.

Categories

Resources