Here-SDK: How to show the default HereWeGo-Positionindicator? - android

How do i show the standard PositionIndicator from the HereWeGo-App in my MapActivity?
This one:
When i use this Code:
mPositioningManager = PositioningManager.getInstance()
mPositioningManager.addListener(
newWeakReference<PositioningManager.OnPositionChangedListener>(MyActivity.this));
if (mPositioningManager.start(PositioningManager.LocationMethod.GPS_NETWORK_INDOOR))
{
mapFragment.getPositionIndicator().setVisible(true);
}
i get this Indicator:
Is there some other way to create the "HereWeGo-Indicator"? As i know if you implement the Indicator iOS you get by default the "HereWeGo-Indicator".

If you want to use image than do like below
Image img_current_location = new Image();
img_current_location.setImageResource(R.drawable.custom_img);
after that set on PositionIndicator.
Map.getPositionIndicator().setMarker(img_current_location);
And if you dont want to use image at all than create compass header. sample example can downloaded from the below link.
https://tcs.ext.here.com/sdk_examples/CustomPositionMarker.zip
some discussion can be found on this post.
It does not fit in your requirement but you can modify it.

Related

Android mapbox v10 - dynamically change the source url

We have a usual source url of something like https://my-source/{x}/{y}/{z}. When the user selects filtering options, we'd like to add these params to the url as something like https://my-source/{x}/{y}/{z}?my-param=true and instantly update the map.
Is this possible to achieve in mapbox?
Turns out this is relatively simple! If a little difficult to find, the code below will update the tile url dynamically:
val source = style.getSourceAs<VectorSource>(CHARGE_POINT_SOURCE_ID)
source?.tiles(listOf(newSourceUrl))

Android/iOS keyboard: stickers API

I was searching for a way to create a custom keyboard to add custom emoji and stickers.
So far I've figured out that emoji are just unicode characters and in order to add custom emoji one should supply a custom font with the dedicated emoji mapped to a predefined unicode character inside the font. This font should be available across users of the app in order for the custom emoji to display correctly.
The question arises when it comes to stickers (those big images available to add for example in Facebook comments). I can't find any useful information on how they work and what is the interface to embed them in the custom keyboard and to paste further to a text. There are apps available on Google Play and AppStore that does it (like "Go Keyboard" app for example)
Can anyone point me in the right direction?
So the question is:
How to embed stickers into a text to share further to 3rd-party apps? My main idea is to understand if there is a common standard or API for stickers (like for emoji)? Or the only way to use stickers is to use/build a custom chat API with a backend server which means only apps that use the same service will reliably decode the shared text to display stickers correctly?
I've been working in an iOS project to prove this concept of using emojis and stickers in chat conversations.
You can check it out in my GitHub repository and contribute if you want (review and improvement are welcome).
What I done was, use the NSTextAttachment to attach an image within an UITextView, using the NSAttributedString object type.
To show a image as an emoji, within in an UITextView:
// initialize object with the content of textView
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithAttributedString:textview.attributedText];
// initialize selected image to be used as emoji
NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
textAttachment.image = [UIImage imageNamed:#"MicheyMouse"];
textAttachment.image = [UIImage imageWithCGImage:textAttachment.image.CGImage scale:25 orientation:UIImageOrientationUp];
NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment];
[attributeString appendAttributedString:attrStringWithImage];
// blank space after the image
NSAttributedString *blank = [[NSAttributedString alloc] initWithString:#" "];
[attributeString appendAttributedString:blank];
textview.attributedText = attributeString;
And if you wanna use the image as a sticker, follow this lines:
NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
textAttachment.image = [UIImage imageNamed:sticker];
textAttachment.image = [UIImage imageWithCGImage:textAttachment.image.CGImage scale:12 orientation:UIImageOrientationUp]; // --> change de scale, to change image size (or create the image in size that you want)
NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment];
cell.textLabel.attributedText = attrStringWithImage
In this example, I attached the image as a sticker directly in a cell (you can do this cell as a chat ballon).
In other words, in the first code lines, I basically showed the image in an UITextView, and in the second I put the image directly in chat lines.
I had to do my own sticker/emoji keyboard and I also made some work to handle the switching between emoji keyboard and typing keyboard.
This is the GitHub repository for the project example: https://github.com/cairano/CIStickerFacilities

Not Getting Thumb with Genres - Universal Music Player

I am using UMP example provided by Google, I have not made any change in my code, even I have not tried anything out of the box, I just imported your project into my work-space and checked it on my device, and found that I am not getting Thumb with Genres (Songs by genre) and List of Genres...
Whereas I supposed to get Thumb from our JSON, here is what I have tried (but no success) -
holder.mImageView.setImageBitmap(description.getIconBitmap());
UPDATE # 1 AS PER SUGGESTED BY #NageshSusarla here
holder.mTitleView.setText(description.getTitle());
holder.mDescriptionView.setText(description.getSubtitle());
AlbumArtCache cache = AlbumArtCache.getInstance();
Bitmap art = cache.getIconImage(url);
if (art == null) {
cache.fetch(url, new AlbumArtCache.FetchListener() {
#Override
public void onFetched(String artUrl, Bitmap bitmap, Bitmap icon) {
if (artUrl.equals(url)) {
holder.mImageView.setImageBitmap(icon);
}
}
});
} else {
holder.mImageView.setImageBitmap(bitmap);
}
holder.mImageView.setImageBitmap(description.getIconBitmap());
and getting Cannot resolve symbol 'url'
The icon bitmap may not have been set. It's best to use the AlbumartCache to fetch the icon and then set it on the imageView. The url to be passed to AlbumArtCache.getInstance().fetch(url,..) is description.getIconUri().toString()
The reason you may not be seeing it in uAmp is because of the tint being applied to it. You can remove the tint from media_list_item.xml to try out the changes.
Aside: This is indeed by design and the icon is only shown at the bottom when a user selects the item to be played.
This is by design. To keep the navigation cleaner, we decided to not
show the MediaItem icon on the local browsing UI. Other browsing UI's
may show it, like Android Auto and Android Wear.
I think you should check it in issues of android-UniversalMusicPlayer. Take a look at comment given by mangini here.
If you want to change uAmp to show the MediaDescription.getIconUri,
set the holder.mImageView at this.

How can I change the ordering of Crop Effect given by Aviary for Android

I am using Aviary version 3.1.1 to provide effects for photos in android. But I want user to directly jump to Crop screen in Aviary. I don't want to remove any of them but just chage their ordering. Please refer to the pic below:
Also inside the Crop page I want to remove all the other options except Square. Please refer to the image below:
I have looked in SO for this too but cannot find any related Docs in Aviary or SO. Please help me to resolve this doc with some links.
Thanks in Advance.
This issue was resolved later by me. I have used Aviary library "Aviary-Android-SDK-3.2.0" (However this has no relation to my answer and I have used this as it was the latest at that time)
1) For the first point, while calling FeatherActivity.class from your code, please do this:
String[] tools = new String[] { "CROP", "ENHANCE", "EFFECTS",
"BORDERS", "STICKERS", "TILT_SHIFT", "ADJUST",
"BRIGHTNESS", "CONTRAST", "SATURATION", "COLORTEMP",
"SHARPNESS", "COLOR_SPLASH", "DRAWING", "TEXT",
"RED_EYE", "WHITEN", "BLEMISH", "MEME", };
Intent newIntent = new Intent(this, FeatherActivity.class);
newIntent.setData(Uri.parse(data.getData().toString()));
newIntent.putExtra(Constants.EXTRA_TOOLS_LIST, tools);
// extra-api-key-secret
newIntent.putExtra(Constants.EXTRA_IN_API_KEY_SECRET,
Constant.AVIARY_API_KEY_SECRET);
startActivityForResult(newIntent, AVIARY);
Hence for that issue, we need to exceptionally pass all the variables we want and in that exact order, we will see that in our app, as suggested by cjwirth here.
2) Now for the second point, we need to edit aviary_config.xml of Aviary SDK. The aviary_config.xml file contains all the customizable behaviors of the SDK, like the colors to show inside the text tool or the drawing tool, the sizes of the brush tools, the custom crop ratios for the crop tool, the default font used in the meme tool, etc. You could also look for that here in official Aviary site.
Just change the past as:
<string-array name="aviary_crop_labels">
<item>#string/feather_square</item>
</string-array>
or any options you want from the given.

using WebView to view map and set marker (pin) on android

I'm making an app on android, using webview to load google map (using this url for my webview: http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html).
but i can't put a marker on that webview, can't somebody tell me how?
http://maps.google.com/maps?saddr=37.423156,-122.084917
The above simply shows the directions screen with missing destination field. If you want the pin to show on a simple map screen do this instead:
http://www.google.com/maps?q=37.423156,-122.084917
Clearly lots of ways to skin a cat - but I am loving the Google Static Maps API.
It generates a standard image (of desired size) and you can add points/lines/polygons all from a URL.
Whilst I haven't checked the terms, it is clearly possible to cache/store the result.
Documentation: http://code.google.com/apis/maps/documentation/staticmaps/
Example: http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false
http://maps.google.com/maps?saddr=NJ
load URL like this pass address where you want to put the pin

Categories

Resources