mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Added support for a title when searching for an address, for example a business name. Also changed snipppets --> snippet in book search.
git-svn-id: https://zxing.googlecode.com/svn/trunk@635 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
0a5cee0307
commit
fd9ecdac96
|
@ -64,7 +64,7 @@
|
|||
<string name="msg_sbc_failed">Sorry, the search encountered a problem.</string>
|
||||
<string name="msg_sbc_no_page_returned">No page returned</string>
|
||||
<string name="msg_sbc_page">Page</string>
|
||||
<string name="msg_sbc_snippet_unavailable">Snippets not available</string>
|
||||
<string name="msg_sbc_snippet_unavailable">Snippet not available</string>
|
||||
<string name="msg_sbc_unknown_page">Unknown page</string>
|
||||
<string name="msg_searching_book">Searching book\u2026</string>
|
||||
<string name="msg_share_barcode">Here\'s the contents of a barcode I scanned</string>
|
||||
|
|
|
@ -100,7 +100,9 @@ public class AddressBookResultHandler extends ResultHandler {
|
|||
addressResult.getTitle());
|
||||
break;
|
||||
case 1:
|
||||
searchMap(addressResult.getAddress());
|
||||
String[] names = addressResult.getNames();
|
||||
String title = names != null ? names[0] : null;
|
||||
searchMap(addressResult.getAddress(), title);
|
||||
break;
|
||||
case 2:
|
||||
dialPhone(addressResult.getPhoneNumbers()[0]);
|
||||
|
|
|
@ -207,8 +207,18 @@ public abstract class ResultHandler {
|
|||
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(geoURI)));
|
||||
}
|
||||
|
||||
public void searchMap(String address) {
|
||||
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(address))));
|
||||
/**
|
||||
* Do a geo search using the address as the query.
|
||||
*
|
||||
* @param address The address to find
|
||||
* @param title An optional title, e.g. the name of the business at this address
|
||||
*/
|
||||
public void searchMap(String address, String title) {
|
||||
String query = address;
|
||||
if (title != null && title.length() > 0) {
|
||||
query = query + " (" + title + ")";
|
||||
}
|
||||
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(query))));
|
||||
}
|
||||
|
||||
public void getDirections(float latitude, float longitude) {
|
||||
|
@ -255,6 +265,8 @@ public abstract class ResultHandler {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: The current Contacts Intent API can only accept one value for each field, so we pick the
|
||||
// first element in the array for names, phone numbers, and emails. It would be great to fix this.
|
||||
private static void putExtra(Intent intent, String key, String[] value) {
|
||||
if (value != null && value.length > 0) {
|
||||
putExtra(intent, key, value[0]);
|
||||
|
|
Loading…
Reference in a new issue