More proper support for geo: URLs in Android

git-svn-id: https://zxing.googlecode.com/svn/trunk@301 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-03-19 20:18:28 +00:00
parent b0f43f0991
commit 76757bdcd4
4 changed files with 14 additions and 11 deletions

View file

@ -20,7 +20,7 @@
<string name="button_ok">OK</string> <string name="button_ok">OK</string>
<string name="button_yes">Yes</string> <string name="button_yes">Yes</string>
<string name="menu_about">About...</string> <string name="menu_about">About...</string>
<string name="msg_about">ZXing Barcode Reader v0.4\nhttp://code.google.com/p/zxing</string> <string name="msg_about">ZXing Barcode Reader v0.6\nhttp://code.google.com/p/zxing</string>
<string name="msg_no_barcode_detected">Sorry, no barcode was found.</string> <string name="msg_no_barcode_detected">Sorry, no barcode was found.</string>
<string name="title_about">About</string> <string name="title_about">About</string>
<string name="title_barcode_detected">Barcode Detected</string> <string name="title_barcode_detected">Barcode Detected</string>
@ -30,5 +30,6 @@
<string name="title_add_contact">Add Contact?</string> <string name="title_add_contact">Add Contact?</string>
<string name="title_compose_email">Compose E-mail?</string> <string name="title_compose_email">Compose E-mail?</string>
<string name="title_lookup_barcode">Look Up Barcode Online?</string> <string name="title_lookup_barcode">Look Up Barcode Online?</string>
<string name="title_dial">Dial Number?</string> <string name="title_dial">Dial Number?</string>
<string name="title_view_maps">View In Google Maps?</string>
</resources> </resources>

View file

@ -207,6 +207,8 @@ public final class BarcodeReaderCaptureActivity extends Activity {
return R.string.title_lookup_barcode; return R.string.title_lookup_barcode;
} else if (type.equals(ParsedReaderResultType.TEL)) { } else if (type.equals(ParsedReaderResultType.TEL)) {
return R.string.title_dial; return R.string.title_dial;
} else if (type.equals(ParsedReaderResultType.GEO)) {
return R.string.title_view_maps;
} else { } else {
return R.string.title_barcode_detected; return R.string.title_barcode_detected;
} }

View file

@ -26,6 +26,7 @@ import com.google.zxing.client.result.AddressBookDoCoMoParsedResult;
import com.google.zxing.client.result.BookmarkDoCoMoParsedResult; import com.google.zxing.client.result.BookmarkDoCoMoParsedResult;
import com.google.zxing.client.result.EmailAddressParsedResult; import com.google.zxing.client.result.EmailAddressParsedResult;
import com.google.zxing.client.result.EmailDoCoMoParsedResult; import com.google.zxing.client.result.EmailDoCoMoParsedResult;
import com.google.zxing.client.result.GeoParsedResult;
import com.google.zxing.client.result.ParsedReaderResult; import com.google.zxing.client.result.ParsedReaderResult;
import com.google.zxing.client.result.ParsedReaderResultType; import com.google.zxing.client.result.ParsedReaderResultType;
import com.google.zxing.client.result.TelParsedResult; import com.google.zxing.client.result.TelParsedResult;
@ -102,15 +103,12 @@ final class ResultHandler extends Handler {
intent = new Intent(Intent.DIAL_ACTION, new ContentURI("tel:" + telResult.getNumber())); intent = new Intent(Intent.DIAL_ACTION, new ContentURI("tel:" + telResult.getNumber()));
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
} }
//} else if (type.equals(ParsedReaderResultType.GEO)) { } else if (type.equals(ParsedReaderResultType.GEO)) {
// GeoParsedResult geoResult = (GeoParsedResult) result; GeoParsedResult geoResult = (GeoParsedResult) result;
// try { try {
// intent = new Intent(Intent.VIEW_ACTION, new ContentURI(geoResult.getGoogleMapsURI())); intent = new Intent(Intent.VIEW_ACTION, new ContentURI(geoResult.getGeoURI()));
// // or can we send the raw geo: URI to Android? maybe it'll open Maps? } catch (URISyntaxException e) {
// // or just open a MapView }
// } catch (URISyntaxException e) {
// return;
// }
} else if (type.equals(ParsedReaderResultType.UPC)) { } else if (type.equals(ParsedReaderResultType.UPC)) {
UPCParsedResult upcResult = (UPCParsedResult) result; UPCParsedResult upcResult = (UPCParsedResult) result;
try { try {

View file

@ -115,6 +115,7 @@ public final class GeoParsedResult extends ParsedReaderResult {
* by this instance, and sets the zoom level in a way that roughly reflects the * by this instance, and sets the zoom level in a way that roughly reflects the
* altitude, if specified * altitude, if specified
*/ */
/*
public String getGoogleMapsURI() { public String getGoogleMapsURI() {
StringBuffer result = new StringBuffer(50); StringBuffer result = new StringBuffer(50);
result.append("http://maps.google.com/?ll="); result.append("http://maps.google.com/?ll=");
@ -139,5 +140,6 @@ public final class GeoParsedResult extends ParsedReaderResult {
} }
return result.toString(); return result.toString();
} }
*/
} }