How to create a location input bar in ios/Android? - android

Looking for some clue to build a location input bar just above keyboard and user can tap location icon to input a location, similar as what Fb/twitter has on their mobile apps when click new post/tweet.
Are there any existing library that support this? Should I create a customized keyboard with this bar?
Many thanks for any clues!

Assuming you are simply looking to create the bar above the keyboard, inputAccessoryView, a property of both UITextFields and UITextViews, is what you are looking for. This allows you to add a UIToolbar to the top of the keyboard similar to what both Twitter and Facebook do.
You can read further in the Apple documentation here.
A simple implementation of this is as follows -
UIToolbar *locationToolbar = [[UIToolbar alloc] init];
locationToolbar.frame = CGRectMake(320, 384, 320, 53);
// Add location button to UIToolbar as desired
self.textField.inputAccessoryView = locationToolbar;
If you are looking to create a map to select the location from, MKMapView would be a good place to start.

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))

HERE SDK turn-by-turn navigation maneuvers

In the HERE SDK user guide there is a screenshot showing the next maneuver. See:
https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/map-guidance.html
Is this something that is provided by the SDK or is the developer expected to render this manually?
Here is the navigation code I am using:
Route route = list.get(0).getRoute();
map.setMapScheme(Map.Scheme.CARNAV_DAY);
map.getPositionIndicator().setVisible(true);
map.setTilt(45);
map.addMapObject(new MapRoute(route));
manager.setRoute(route);
manager.setTrafficAvoidanceMode(NavigationManager.TrafficAvoidanceMode.DYNAMIC);
manager.setRealisticViewMode(NavigationManager.RealisticViewMode.DAY);
manager.setMap(map);
NavigationManager.Error simError = manager.startNavigation(route);
if(simError != NavigationManager.Error.NONE) {
Log.e(LOG_TAG, "Error" + simError);
}
Maybe a bit late, but for the others who are having the same question,
You can use the HERE Mobile SDK UI Kit (MSDKUI) which provides a highly customizable user interface components that can be used on top of the HERE SDKs.
Here is the repo on Github:
https://github.com/heremaps/msdkui-android
Some things are rendered automatically by the HERE SDK, mainly things that are directly tied to the map rendering (like navigation arrows on the street when doing guidance), but most UI things you have to do on your own since most users want to have their own look&feel and UI.
So, yes the maneuver icons are something you have to provide and render in your UI manually (or the other way around: you have the full freedom to decide how it should look like).

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

Hide / Disable default menu in Chrome Custom Tab

I have implemented new Chrome Custom Tab in android, I am using the following code to open
String url = "http://www.flipkart.com/";
int color = Color.BLUE;
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setToolbarColor(color);
intentBuilder.setShowTitle(true);
CustomTabActivityHelper.openCustomTab(
this, intentBuilder.build(), Uri.parse(url), new WebviewFallback());
I need to secure my URL or not like to show my URL to User, But there is a option Open in Chrome in default menu, By using this link user can open my URL in browser,By how hide the default menu?
At this moment, it's not possible to hide the overflow menu or "Open in Chrome" menu item.
There are no methods for hiding the menu option in Chrome custom tabs
Chrome Custom Tab actually uses Chrome app in user's mobile.
start activity in Chrome app by link, If chrome not installed on the user's mobile, it will use a webView as the default.
In fact, Chrome Custom Tabs is designed to display a web page where the user is sure that the programmer of that software does not have a phishing, Like a bank payment.
Therefore, you must show the options in the toolbar to the user.
This can be hide by using app link assistant.
complete guideline for how to create app link can be found here.
https://developer.android.com/studio/write/app-link-indexing
after successful generation and verification the above header can be hidden.
I have implemented this and result is like
You must add hiding flag before. To disable your URL parameter but it can't hide your site name.
intentBuilder.enableUrlBarHiding();

Android Web Driver - cannot simulate touch actions

I've downloaded the android_webdriver_library.jar via the Eclipse ADT SDK Manager under Extras/Google Web Driver and reference it in my eclipse project.
How do I simulate a touch action like tapping a button for example? I cannot find the TouchActions class which according to the documentation (http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html) is supposed to be the factory class for touch actions.
i don't know Java, but I got this working in Python.
What does your code look like? Can you try the Tutorial , as well as the example below and modify it to use touch?
Example from tutorial below:
WebElement toFlick = driver.findElement(By.id("image"));
// 400 pixels left at normal speed
Action flick = getBuilder(driver).flick(toFlick, 0, -400, FlickAction.SPEED_NORMAL)
.build();
flick.perform();
WebElement secondImage = driver.findElement(“secondImage”);
assertTrue(secondImage.isDisplayed());

Categories

Resources