mirror of
https://github.com/wahyd4/BarcodeScanner.git
synced 2026-08-09 04:55:57 +10:00
minor refactoring ;-)
This commit is contained in:
+141
-149
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
<?xml version="1.0" encoding="UTF-8"?><plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="com.phonegap.plugins.barcodescanner"
|
||||
version="0.5.3">
|
||||
@@ -94,35 +93,34 @@
|
||||
search: (src/android/LibraryProject/(.+?)/[^/]+)$
|
||||
replace: <source-file src="$1" target-dir="$2"/>
|
||||
-->
|
||||
<source-file src="src/android/LibraryProject/res/values/arrays.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/raw/beep.ogg" target-dir="res/raw"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/bookmark_picker_list_item.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/capture.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout-ldpi/capture.xml" target-dir="res/layout-ldpi"/>
|
||||
<source-file src="src/android/LibraryProject/res/menu/capture.xml" target-dir="res/menu"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/colors.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/dimens.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/encode.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout-land/encode.xml" target-dir="res/layout-land"/>
|
||||
<source-file src="src/android/LibraryProject/res/menu/encode.xml" target-dir="res/menu"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/help.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/menu/history.xml" target-dir="res/menu"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/history_list_item.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/ids.xml" target-dir="res/values"/>
|
||||
|
||||
<source-file src="src/android/LibraryProject/res/drawable/launcher_icon.png" target-dir="res/drawable"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable/share_via_barcode.png" target-dir="res/drawable"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable/shopper_icon.png" target-dir="res/drawable"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable-hdpi/launcher_icon.png" target-dir="res/drawable-hdpi"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable-hdpi/shopper_icon.png" target-dir="res/drawable-hdpi"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable-xhdpi/launcher_icon.png" target-dir="res/drawable-xhdpi"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable-xxhdpi/launcher_icon.png" target-dir="res/drawable-xxhdpi"/>
|
||||
<source-file src="src/android/LibraryProject/res/xml/preferences.xml" target-dir="res/xml"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/bookmark_picker_list_item.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/capture.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/encode.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/help.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/history_list_item.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/search_book_contents.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/search_book_contents_header.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/search_book_contents_list_item.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout/share.xml" target-dir="res/layout"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout-land/encode.xml" target-dir="res/layout-land"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout-land/share.xml" target-dir="res/layout-land"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable/share_via_barcode.png" target-dir="res/drawable"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable/shopper_icon.png" target-dir="res/drawable"/>
|
||||
<source-file src="src/android/LibraryProject/res/drawable-hdpi/shopper_icon.png" target-dir="res/drawable-hdpi"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/strings.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/layout-ldpi/capture.xml" target-dir="res/layout-ldpi"/>
|
||||
<source-file src="src/android/LibraryProject/res/menu/capture.xml" target-dir="res/menu"/>
|
||||
<source-file src="src/android/LibraryProject/res/menu/encode.xml" target-dir="res/menu"/>
|
||||
<source-file src="src/android/LibraryProject/res/menu/history.xml" target-dir="res/menu"/>
|
||||
<source-file src="src/android/LibraryProject/res/raw/beep.ogg" target-dir="res/raw"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/arrays.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/colors.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/dimens.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/values/ids.xml" target-dir="res/values"/>
|
||||
<source-file src="src/android/LibraryProject/res/values-ar/strings.xml" target-dir="res/values-ar"/>
|
||||
<source-file src="src/android/LibraryProject/res/values-bg/strings.xml" target-dir="res/values-bg"/>
|
||||
<source-file src="src/android/LibraryProject/res/values-ca/strings.xml" target-dir="res/values-ca"/>
|
||||
@@ -152,135 +150,129 @@
|
||||
<source-file src="src/android/LibraryProject/res/values-tr/strings.xml" target-dir="res/values-tr"/>
|
||||
<source-file src="src/android/LibraryProject/res/values-zh-rCN/strings.xml" target-dir="res/values-zh-rCN"/>
|
||||
<source-file src="src/android/LibraryProject/res/values-zh-rTW/strings.xml" target-dir="res/values-zh-rTW"/>
|
||||
<source-file src="src/android/LibraryProject/res/xml/preferences.xml" target-dir="res/xml"/>
|
||||
|
||||
<!-- What was this for? Wouldn't above merge files anyway? -->
|
||||
<!--
|
||||
<!-- plugman cannot merge - prepare manual merge -->
|
||||
<config-file target="res/values/strings.xml" parent="/resources">
|
||||
<!- - string name="app_name">Barcode Scanner</string - ->
|
||||
<string name="app_picker_name">Applications</string>
|
||||
<string name="bookmark_picker_name">Bookmarks</string>
|
||||
<string name="button_add_calendar">Add to calendar</string>
|
||||
<string name="button_add_contact">Add contact</string>
|
||||
<string name="button_back">Back</string>
|
||||
<string name="button_book_search">Book Search</string>
|
||||
<string name="button_cancel">Cancel</string>
|
||||
<string name="button_clipboard_empty">Clipboard empty</string>
|
||||
<string name="button_custom_product_search">Custom search</string>
|
||||
<string name="button_dial">Dial number</string>
|
||||
<string name="button_done">Done</string>
|
||||
<string name="button_email">Send email</string>
|
||||
<string name="button_get_directions">Get directions</string>
|
||||
<string name="button_google_shopper">Google Shopper</string>
|
||||
<string name="button_mms">Send MMS</string>
|
||||
<string name="button_ok">OK</string>
|
||||
<string name="button_open_browser">Open browser</string>
|
||||
<string name="button_product_search">Product Search</string>
|
||||
<string name="button_read_book">Browse book</string>
|
||||
<string name="button_search_book_contents">Search contents</string>
|
||||
<string name="button_share_app">Application</string>
|
||||
<string name="button_share_bookmark">Bookmark</string>
|
||||
<string name="button_share_by_email">Share via email</string>
|
||||
<string name="button_share_by_sms">Share via SMS</string>
|
||||
<string name="button_share_clipboard">Clipboard</string>
|
||||
<string name="button_share_contact">Contact</string>
|
||||
<string name="button_show_map">Show map</string>
|
||||
<string name="button_sms">Send SMS</string>
|
||||
<string name="button_web_search">Web search</string>
|
||||
<string name="button_wifi">Connect to Network</string>
|
||||
<string name="contents_contact">Contact info</string>
|
||||
<string name="contents_email">Email address</string>
|
||||
<string name="contents_location">Geographic coordinates</string>
|
||||
<string name="contents_phone">Phone number</string>
|
||||
<string name="contents_sms">SMS address</string>
|
||||
<string name="contents_text">Plain text</string>
|
||||
<string name="history_clear_text">Clear history</string>
|
||||
<string name="history_email_title">Barcode Scanner history</string>
|
||||
<string name="history_send">Send history</string>
|
||||
<string name="history_title">History</string>
|
||||
<string name="menu_about">About</string>
|
||||
<string name="menu_help">Help</string>
|
||||
<string name="menu_history">History</string>
|
||||
<!- - string name="menu_settings">Settings</string - ->
|
||||
<string name="menu_share">Share</string>
|
||||
<string name="msg_about">The official Android app of the open source ZXing barcode project.</string>
|
||||
<string name="msg_buggy">This device has known bugs that cause barcode scanning problems. For more information, visit http://code.google.com/p/zxing/wiki/FrequentlyAskedQuestions</string>
|
||||
<string name="msg_bulk_mode_scanned">Bulk mode: barcode scanned and saved</string>
|
||||
<string name="msg_camera_framework_bug">Sorry, the Android camera encountered a problem. You may need to restart the device.</string>
|
||||
<string name="msg_default_contents">Contents</string>
|
||||
<string name="msg_default_format">Format</string>
|
||||
<string name="msg_default_meta">Metadata</string>
|
||||
<string name="msg_default_mms_subject">Hi</string>
|
||||
<string name="msg_default_status">Place a barcode inside the viewfinder rectangle to scan it.</string>
|
||||
<string name="msg_default_time">Time</string>
|
||||
<string name="msg_default_type">Type</string>
|
||||
<string name="msg_encode_barcode_failed">Could not generate the requested barcode.</string>
|
||||
<string name="msg_encode_contents_failed">Could not encode a barcode from the data provided.</string>
|
||||
<string name="msg_google_shopper_missing">Google Shopper is not installed</string>
|
||||
<string name="msg_install_google_shopper">Google Shopper combines barcode scanning with online and local prices, reviews and more without opening the browser. Would you like to try it?</string>
|
||||
<string name="msg_intent_failed">Sorry, the requested application could not be launched. The barcode contents may be invalid.</string>
|
||||
<string name="msg_loading_apps">Loading list of applications\u2026</string>
|
||||
<string name="msg_not_our_results">You are leaving this application. The search results you will see are not related to this application.</string>
|
||||
<string name="msg_redirect">Redirect</string>
|
||||
<string name="msg_sbc_book_not_searchable">Sorry, this book is not searchable.</string>
|
||||
<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_searching_book">Searching book\u2026</string>
|
||||
<string name="msg_sbc_snippet_unavailable">Snippet not available</string>
|
||||
<string name="msg_sbc_unknown_page">Unknown page</string>
|
||||
<string name="msg_share_explanation">You can share data by displaying a barcode on your screen and scanning it with another phone.</string>
|
||||
<string name="msg_share_subject_line">Here are the contents of a barcode I scanned</string>
|
||||
<string name="msg_share_text">Or type some text and press Enter</string>
|
||||
<string name="msg_unmount_usb">Sorry, the SD card is not accessible.</string>
|
||||
<string name="preferences_actions_title">When a barcode is found\u2026</string>
|
||||
<string name="preferences_bulk_mode_summary">Scan and save many barcodes continuously</string>
|
||||
<string name="preferences_bulk_mode_title">Bulk scan mode</string>
|
||||
<string name="preferences_copy_to_clipboard_title">Copy to clipboard</string>
|
||||
<string name="preferences_custom_product_search_summary" formatted="false">Use %s as a placeholder for the product ID, and %f for format</string>
|
||||
<string name="preferences_custom_product_search_title">Custom search URL</string>
|
||||
<string name="preferences_decode_1D_title">1D barcodes</string>
|
||||
<string name="preferences_decode_Data_Matrix_title">Data Matrix</string>
|
||||
<string name="preferences_decode_QR_title">QR Codes</string>
|
||||
<string name="preferences_front_light_summary">Improves scanning in low light on some phones, but may cause glare. Does not work on all phones.</string>
|
||||
<string name="preferences_front_light_title">Use front light</string>
|
||||
<string name="preferences_general_title">General settings</string>
|
||||
<string name="preferences_name">Settings</string>
|
||||
<string name="preferences_play_beep_title">Beep</string>
|
||||
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
|
||||
<string name="preferences_remember_duplicates_title">Remember duplicates</string>
|
||||
<string name="preferences_reverse_image_summary">Enable on devices with a front camera only</string>
|
||||
<string name="preferences_reverse_image_title">Reversed camera image</string>
|
||||
<string name="preferences_result_title">Result settings</string>
|
||||
<string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
|
||||
<string name="preferences_supplemental_summary">Try to retrieve more information about the barcode contents</string>
|
||||
<string name="preferences_supplemental_title">Retrieve more info</string>
|
||||
<string name="preferences_vibrate_title">Vibrate</string>
|
||||
<string name="result_address_book">Found contact info</string>
|
||||
<string name="result_calendar">Found calendar event</string>
|
||||
<string name="result_email_address">Found email address</string>
|
||||
<string name="result_geo">Found geographic coordinates</string>
|
||||
<string name="result_isbn">Found book</string>
|
||||
<string name="result_product">Found product</string>
|
||||
<string name="result_sms">Found SMS address</string>
|
||||
<string name="result_tel">Found phone number</string>
|
||||
<string name="result_text">Found plain text</string>
|
||||
<string name="result_uri">Found URL</string>
|
||||
<string name="result_wifi">Found WLAN Configuration</string>
|
||||
<string name="sbc_name">Google Book Search</string>
|
||||
<string name="share_name">Share via barcode</string>
|
||||
<string name="title_about">Barcode Scanner v</string>
|
||||
<string name="wa_name">WLAN Connection</string>
|
||||
<string name="wifi_changing_network">Changing Network</string>
|
||||
<string name="wifi_connected">Connected</string>
|
||||
<string name="wifi_creating_network">Creating Network</string>
|
||||
<string name="wifi_modifying_network">Modifying Network</string>
|
||||
<string name="wifi_ssid_missing">Network name missing</string>
|
||||
<string name="wifi_type_incorrect">Network type incorrect</string>
|
||||
<string name="wifi_connect_failed">Network connection failed</string>
|
||||
<string name="wifi_ssid_label">Network Name</string>
|
||||
<string name="wifi_type_label">Type</string>
|
||||
<string name="zxing_url">http://code.google.com/p/zxing</string>
|
||||
<string name="app_picker_name">Applications</string>
|
||||
<string name="bookmark_picker_name">Bookmarks</string>
|
||||
<string name="button_add_calendar">Add to calendar</string>
|
||||
<string name="button_add_contact">Add contact</string>
|
||||
<string name="button_back">Back</string>
|
||||
<string name="button_book_search">Book Search</string>
|
||||
<string name="button_cancel">Cancel</string>
|
||||
<string name="button_custom_product_search">Custom search</string>
|
||||
<string name="button_dial">Dial number</string>
|
||||
<string name="button_done">Done</string>
|
||||
<string name="button_email">Send email</string>
|
||||
<string name="button_get_directions">Get directions</string>
|
||||
<string name="button_google_shopper">Shopper</string>
|
||||
<string name="button_mms">Send MMS</string>
|
||||
<string name="button_ok">OK</string>
|
||||
<string name="button_open_browser">Open browser</string>
|
||||
<string name="button_product_search">Product Search</string>
|
||||
<string name="button_search_book_contents">Search contents</string>
|
||||
<string name="button_share_app">Application</string>
|
||||
<string name="button_share_bookmark">Bookmark</string>
|
||||
<string name="button_share_by_email">Share via email</string>
|
||||
<string name="button_share_by_sms">Share via SMS</string>
|
||||
<string name="button_share_clipboard">Clipboard</string>
|
||||
<string name="button_share_contact">Contact</string>
|
||||
<string name="button_show_map">Show map</string>
|
||||
<string name="button_sms">Send SMS</string>
|
||||
<string name="button_web_search">Web search</string>
|
||||
<string name="button_wifi">Connect to Network</string>
|
||||
<string name="contents_contact">Contact info</string>
|
||||
<string name="contents_email">Email address</string>
|
||||
<string name="contents_location">Geographic coordinates</string>
|
||||
<string name="contents_phone">Phone number</string>
|
||||
<string name="contents_sms">SMS address</string>
|
||||
<string name="contents_text">Plain text</string>
|
||||
<string name="history_clear_text">Clear history</string>
|
||||
<string name="history_clear_one_history_text">Clear</string>
|
||||
<string name="history_email_title">Barcode Scanner history</string>
|
||||
<string name="history_empty">Empty</string>
|
||||
<string name="history_empty_detail">No barcode scans have been recorded</string>
|
||||
<string name="history_send">Send history</string>
|
||||
<string name="history_title">History</string>
|
||||
<string name="menu_encode_mecard">Use MECARD</string>
|
||||
<string name="menu_encode_vcard">Use vCard</string>
|
||||
<string name="menu_help">Help</string>
|
||||
<string name="menu_history">History</string>
|
||||
<string name="menu_share">Share</string>
|
||||
<string name="msg_bulk_mode_scanned">Bulk mode: barcode scanned and saved</string>
|
||||
<string name="msg_camera_framework_bug">Sorry, the Android camera encountered a problem. You may need to restart the device.</string>
|
||||
<string name="msg_default_format">Format</string>
|
||||
<string name="msg_default_meta">Metadata</string>
|
||||
<string name="msg_default_mms_subject">Hi</string>
|
||||
<string name="msg_default_status">Place a barcode inside the viewfinder rectangle to scan it.</string>
|
||||
<string name="msg_default_time">Time</string>
|
||||
<string name="msg_default_type">Type</string>
|
||||
<string name="msg_encode_contents_failed">Could not encode a barcode from the data provided.</string>
|
||||
<string name="msg_google_books">Google Books</string>
|
||||
<string name="msg_google_product">Google Product Search</string>
|
||||
<string name="msg_google_shopper_missing">Google Shopper is not installed</string>
|
||||
<string name="msg_install_google_shopper">Google Shopper combines barcode scanning with online and local prices, reviews and more without opening the browser. Would you like to try it?</string>
|
||||
<string name="msg_intent_failed">Sorry, the requested application could not be launched. The barcode contents may be invalid.</string>
|
||||
<string name="msg_redirect">Redirect</string>
|
||||
<string name="msg_sbc_book_not_searchable">Sorry, this book is not searchable.</string>
|
||||
<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_results">Results</string>
|
||||
<string name="msg_sbc_searching_book">Searching book\u2026</string>
|
||||
<string name="msg_sbc_snippet_unavailable">Snippet not available</string>
|
||||
<string name="msg_sbc_unknown_page">Unknown page</string>
|
||||
<string name="msg_share_explanation">You can share data by displaying a barcode on your screen and scanning it with another phone.</string>
|
||||
<string name="msg_share_subject_line">Here are the contents of a barcode I scanned</string>
|
||||
<string name="msg_share_text">Or type some text and press Enter</string>
|
||||
<string name="msg_sure">Are you sure?</string>
|
||||
<string name="msg_unmount_usb">Sorry, the SD card is not accessible.</string>
|
||||
<string name="preferences_actions_title">When a barcode is found\u2026</string>
|
||||
<string name="preferences_auto_focus_title">Use auto focus</string>
|
||||
<string name="preferences_bulk_mode_summary">Scan and save many barcodes continuously</string>
|
||||
<string name="preferences_bulk_mode_title">Bulk scan mode</string>
|
||||
<string name="preferences_copy_to_clipboard_title">Copy to clipboard</string>
|
||||
<string name="preferences_custom_product_search_summary" formatted="false">Substitutions: %s = contents, %f = format, %t = type</string>
|
||||
<string name="preferences_custom_product_search_title">Custom search URL</string>
|
||||
<string name="preferences_decode_1D_title">1D barcodes</string>
|
||||
<string name="preferences_decode_Data_Matrix_title">Data Matrix</string>
|
||||
<string name="preferences_decode_QR_title">QR Codes</string>
|
||||
<string name="preferences_device_bug_workarounds_title">Device Bug Workarounds</string>
|
||||
<string name="preferences_disable_continuous_focus_summary">Use only standard focus mode</string>
|
||||
<string name="preferences_disable_continuous_focus_title">No continuous focus</string>
|
||||
<string name="preferences_disable_exposure_title">No exposure</string>
|
||||
<string name="preferences_front_light_summary">Improves scanning in low light on some phones, but may cause glare. Does not work on all phones.</string>
|
||||
<string name="preferences_front_light_title">Use front light</string>
|
||||
<string name="preferences_general_title">General settings</string>
|
||||
<string name="preferences_name">Settings</string>
|
||||
<string name="preferences_play_beep_title">Beep</string>
|
||||
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
|
||||
<string name="preferences_remember_duplicates_title">Remember duplicates</string>
|
||||
<string name="preferences_result_title">Result settings</string>
|
||||
<string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
|
||||
<string name="preferences_search_country">Search country</string>
|
||||
<string name="preferences_try_bsplus">Try Barcode Scanner+</string>
|
||||
<string name="preferences_try_bsplus_summary">Enhanced with new features and interface</string>
|
||||
<string name="preferences_supplemental_summary">Try to retrieve more information about the barcode contents</string>
|
||||
<string name="preferences_supplemental_title">Retrieve more info</string>
|
||||
<string name="preferences_vibrate_title">Vibrate</string>
|
||||
<string name="result_address_book">Found contact info</string>
|
||||
<string name="result_calendar">Found calendar event</string>
|
||||
<string name="result_email_address">Found email address</string>
|
||||
<string name="result_geo">Found geographic coordinates</string>
|
||||
<string name="result_isbn">Found book</string>
|
||||
<string name="result_product">Found product</string>
|
||||
<string name="result_sms">Found SMS address</string>
|
||||
<string name="result_tel">Found phone number</string>
|
||||
<string name="result_text">Found plain text</string>
|
||||
<string name="result_uri">Found URL</string>
|
||||
<string name="result_wifi">Found WLAN Configuration</string>
|
||||
<string name="sbc_name">Google Book Search</string>
|
||||
<string name="share_name">Share via barcode</string>
|
||||
<string name="wifi_changing_network">Requesting connection to network\u2026</string>
|
||||
<string name="wifi_ssid_label">Network Name</string>
|
||||
<string name="wifi_type_label">Type</string>
|
||||
</config-file>
|
||||
-->
|
||||
</platform>
|
||||
</plugin>
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
class PluginHelper {
|
||||
public $basePath = 'src/android/LibraryProject/';
|
||||
|
||||
private function perror($msg)
|
||||
{
|
||||
file_put_contents('php://stderr', $msg, FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contents of an XML file.
|
||||
*
|
||||
* @param string $xmlFilePath The XML file path relative to $this->basePath.
|
||||
* @param string $parent Parent element from which to get children.
|
||||
* @param array $options
|
||||
* <li>ident - ident chanracters.
|
||||
* <li>ignorePattern - pattern that will be matched to XML.
|
||||
* @return string
|
||||
*/
|
||||
public function getXml($xmlFilePath, $parent, $options=array())
|
||||
{
|
||||
if (!isset($options['indent']))
|
||||
{
|
||||
$options['indent'] = "";
|
||||
}
|
||||
|
||||
$contents = "";
|
||||
$filePath = $this->basePath . $xmlFilePath;
|
||||
if (!file_exists($filePath))
|
||||
{
|
||||
$this->perror("File $filePath does not exist");
|
||||
return $contents;
|
||||
}
|
||||
|
||||
$xml = file_get_contents($this->basePath . $xmlFilePath);
|
||||
$document = new SimpleXMLElement($xml);
|
||||
$els = $document->xpath($parent);
|
||||
if (!empty($els))
|
||||
{
|
||||
$rootNode = $els[0];
|
||||
foreach ($rootNode->children() as $child)
|
||||
{
|
||||
$childContent = $child->asXML();
|
||||
if (isset($options['ignorePattern']) && preg_match($options['ignorePattern'], $childContent))
|
||||
{
|
||||
$this->perror("\nignored $childContent");
|
||||
continue;
|
||||
}
|
||||
$contents .= "\n" . $options['indent'] . $childContent;
|
||||
}
|
||||
$contents = ltrim ($contents) . "\n";
|
||||
return $contents;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->perror("Path $parent not found in $xmlFilePath");
|
||||
return $contents;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate source-file tags to copy all resources from given dir.
|
||||
*
|
||||
* @param type $dir Dir path relative to $this->basePath.
|
||||
* @param array $options
|
||||
* <li>ident - ident chanracters.
|
||||
*/
|
||||
public function sourceFiles($dir, $options=array())
|
||||
{
|
||||
//ob_end_clean();
|
||||
|
||||
if (!isset($options['indent']))
|
||||
{
|
||||
$options['indent'] = "";
|
||||
}
|
||||
$path = $this->basePath . $dir;
|
||||
|
||||
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
|
||||
while($it->valid())
|
||||
{
|
||||
if (!$it->isDot())
|
||||
{
|
||||
$filename = strtr($it->key(), '\\', '/');
|
||||
if (isset($options['ignorePattern']) && preg_match($options['ignorePattern'], $filename))
|
||||
{
|
||||
$this->perror("\nignored $filename");
|
||||
$it->next();
|
||||
continue;
|
||||
}
|
||||
|
||||
$targetDir = preg_replace('#.+LibraryProject/(.+?)/[^/]+$#', '$1', $filename);
|
||||
echo "\n{$options['indent']}<source-file src=\"$filename\" target-dir=\"$targetDir\"/>";
|
||||
}
|
||||
$it->next();
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
//exit;
|
||||
}
|
||||
}
|
||||
|
||||
// init
|
||||
$pluginHelper = new PluginHelper();
|
||||
|
||||
ob_start();
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
?>
|
||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="com.phonegap.plugins.barcodescanner"
|
||||
version="0.5.3">
|
||||
|
||||
<name>BarcodeScanner</name>
|
||||
|
||||
<description>Scans Barcodes.</description>
|
||||
|
||||
<engines>
|
||||
<engine name="cordova" version=">=2.0.0" />
|
||||
</engines>
|
||||
|
||||
<asset src="www/barcodescanner.js" target="barcodescanner.js" />
|
||||
|
||||
<!-- ios -->
|
||||
<platform name="ios">
|
||||
<plugins-plist key="BarcodeScanner" string="CDVBarcodeScanner" />
|
||||
|
||||
<!-- Cordova >= 2.3 -->
|
||||
<config-file target="config.xml" parent="plugins">
|
||||
<plugin name="BarcodeScanner" value="CDVBarcodeScanner"/>
|
||||
</config-file>
|
||||
|
||||
<resource-file src="src/ios/scannerOverlay.xib" />
|
||||
|
||||
<header-file src="src/ios/zxing-all-in-one.h" />
|
||||
|
||||
<source-file src="src/ios/CDVBarcodeScanner.mm" />
|
||||
<source-file src="src/ios/zxing-all-in-one.cpp" />
|
||||
|
||||
<framework src="libiconv.dylib" />
|
||||
<framework src="AVFoundation.framework" />
|
||||
<framework src="AssetsLibrary.framework" />
|
||||
<framework src="CoreVideo.framework" />
|
||||
</platform>
|
||||
|
||||
<!-- android -->
|
||||
<platform name="android">
|
||||
|
||||
<source-file src="src/android/com/phonegap/plugins/barcodescanner/BarcodeScanner.java" target-dir="src/com/phonegap/plugins/barcodescanner" />
|
||||
<!--
|
||||
<source-file src="R.java" target-dir="src/com/google/zxing/client/android" />
|
||||
-->
|
||||
|
||||
<config-file target="res/xml/plugins.xml" parent="/plugins">
|
||||
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
||||
</config-file>
|
||||
|
||||
<config-file target="res/xml/config.xml" parent="plugins">
|
||||
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
||||
</config-file>
|
||||
|
||||
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
||||
<activity
|
||||
android:name="com.google.zxing.client.android.CaptureActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="@string/share_name">
|
||||
<intent-filter>
|
||||
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.google.zxing.client.android.HelpActivity" android:label="@string/share_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</config-file>
|
||||
|
||||
<config-file target="AndroidManifest.xml" parent="/manifest">
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<!-- Not required to allow users to work around this -->
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||
</config-file>
|
||||
|
||||
<source-file src="src/android/com.google.zxing.client.android.captureactivity.jar" target-dir="libs"/>
|
||||
|
||||
<!--
|
||||
LibraryProject/res/*.*
|
||||
search: (src/android/LibraryProject/(.+?)/[^/]+)$
|
||||
replace: <source-file src="$1" target-dir="$2"/>
|
||||
-->
|
||||
<?
|
||||
$pluginHelper->sourceFiles("res", array('indent'=>"\t\t", 'ignorePattern' => '#values/strings.xml#'));
|
||||
?>
|
||||
|
||||
<!-- plugman cannot merge - prepare manual merge -->
|
||||
<config-file target="res/values/strings.xml" parent="/resources">
|
||||
<?=$pluginHelper->getXml('res/values/strings.xml', "/resources", array('ignorePattern' => '/name="(app_name|menu_settings)"/', 'indent' => "\t\t\t"))?>
|
||||
</config-file>
|
||||
</platform>
|
||||
</plugin>
|
||||
<?php
|
||||
$pluginText = ob_get_clean();
|
||||
file_put_contents("plugin.xml", $pluginText);
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
/libs
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.google.zxing;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* R replacement for PhoneGap Build.
|
||||
*
|
||||
* ([^.\w])R\.(\w+)\.(\w+)
|
||||
* $1fakeR("$2", "$3")
|
||||
*
|
||||
* @author Maciej Nux Jaros
|
||||
*/
|
||||
public class FakeR {
|
||||
private Context context;
|
||||
private String packageName;
|
||||
|
||||
public FakeR(Activity activity) {
|
||||
context = activity.getApplicationContext();
|
||||
packageName = context.getPackageName();
|
||||
}
|
||||
|
||||
public FakeR(Context context) {
|
||||
this.context = context;
|
||||
packageName = context.getPackageName();
|
||||
}
|
||||
|
||||
public int getId(String group, String key) {
|
||||
return context.getResources().getIdentifier(key, group, packageName);
|
||||
}
|
||||
|
||||
public static int getId(Context context, String group, String key) {
|
||||
return context.getResources().getIdentifier(key, group, context.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import android.media.MediaPlayer;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -43,7 +44,9 @@ final class BeepManager {
|
||||
private boolean playBeep;
|
||||
private boolean vibrate;
|
||||
|
||||
private static FakeR fakeR;
|
||||
BeepManager(Activity activity) {
|
||||
fakeR = new FakeR(activity);
|
||||
this.activity = activity;
|
||||
this.mediaPlayer = null;
|
||||
updatePrefs();
|
||||
@@ -94,7 +97,7 @@ final class BeepManager {
|
||||
}
|
||||
});
|
||||
|
||||
AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
|
||||
AssetFileDescriptor file = activity.getResources().openRawResourceFd(fakeR.getId("raw", "beep"));
|
||||
try {
|
||||
mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
|
||||
file.close();
|
||||
|
||||
+38
-34
@@ -61,6 +61,7 @@ import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@@ -81,6 +82,7 @@ import java.util.Set;
|
||||
* @author Sean Owen
|
||||
*/
|
||||
public final class CaptureActivity extends Activity implements SurfaceHolder.Callback {
|
||||
private static FakeR fakeR;
|
||||
|
||||
private static final String TAG = CaptureActivity.class.getSimpleName();
|
||||
|
||||
@@ -138,9 +140,11 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
fakeR = new FakeR(this);
|
||||
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setContentView(R.layout.capture);
|
||||
setContentView(fakeR.getId("layout", "capture"));
|
||||
|
||||
hasSurface = false;
|
||||
historyManager = new HistoryManager(this);
|
||||
@@ -148,9 +152,9 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
inactivityTimer = new InactivityTimer(this);
|
||||
beepManager = new BeepManager(this);
|
||||
|
||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||
PreferenceManager.setDefaultValues(this, fakeR.getId("xml", "preferences"), false);
|
||||
|
||||
showHelpOnFirstLaunch();
|
||||
//showHelpOnFirstLaunch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,18 +167,18 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
// off screen.
|
||||
cameraManager = new CameraManager(getApplication());
|
||||
|
||||
viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
|
||||
viewfinderView = (ViewfinderView) findViewById(fakeR.getId("id", "viewfinder_view"));
|
||||
viewfinderView.setCameraManager(cameraManager);
|
||||
|
||||
resultView = findViewById(R.id.result_view);
|
||||
statusView = (TextView) findViewById(R.id.status_view);
|
||||
resultView = findViewById(fakeR.getId("id", "result_view"));
|
||||
statusView = (TextView) findViewById(fakeR.getId("id", "status_view"));
|
||||
|
||||
handler = null;
|
||||
lastResult = null;
|
||||
|
||||
resetStatusView();
|
||||
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(fakeR.getId("id", "preview_view"));
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
if (hasSurface) {
|
||||
// The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
@@ -273,7 +277,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
inactivityTimer.onPause();
|
||||
cameraManager.closeDriver();
|
||||
if (!hasSurface) {
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(fakeR.getId("id", "preview_view"));
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
surfaceHolder.removeCallback(this);
|
||||
}
|
||||
@@ -318,7 +322,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater menuInflater = getMenuInflater();
|
||||
menuInflater.inflate(R.menu.capture, menu);
|
||||
menuInflater.inflate(fakeR.getId("menu", "capture"), menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@@ -327,16 +331,16 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.menu_share) {
|
||||
if (itemId == fakeR.getId("id", "menu_share")) {
|
||||
intent.setClassName(this, ShareActivity.class.getName());
|
||||
startActivity(intent);
|
||||
} else if (itemId == R.id.menu_history) {
|
||||
} else if (itemId == fakeR.getId("id", "menu_history")) {
|
||||
intent.setClassName(this, HistoryActivity.class.getName());
|
||||
startActivityForResult(intent, HISTORY_REQUEST_CODE);
|
||||
} else if (itemId == R.id.menu_settings) {
|
||||
} else if (itemId == fakeR.getId("id", "menu_settings")) {
|
||||
intent.setClassName(this, PreferencesActivity.class.getName());
|
||||
startActivity(intent);
|
||||
} else if (itemId == R.id.menu_help) {
|
||||
} else if (itemId == fakeR.getId("id", "menu_help")) {
|
||||
intent.setClassName(this, HelpActivity.class.getName());
|
||||
startActivity(intent);
|
||||
} else {
|
||||
@@ -367,7 +371,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
savedResultToShow = result;
|
||||
}
|
||||
if (savedResultToShow != null) {
|
||||
Message message = Message.obtain(handler, R.id.decode_succeeded, savedResultToShow);
|
||||
Message message = Message.obtain(handler, fakeR.getId("id", "decode_succeeded"), savedResultToShow);
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
savedResultToShow = null;
|
||||
@@ -429,7 +433,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
case NONE:
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
|
||||
String message = getResources().getString(R.string.msg_bulk_mode_scanned)
|
||||
String message = getResources().getString(fakeR.getId("string", "msg_bulk_mode_scanned"))
|
||||
+ " (" + rawResult.getText() + ')';
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
// Wait a moment or else it will scan the same barcode continuously about 3 times
|
||||
@@ -452,7 +456,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
if (points != null && points.length > 0) {
|
||||
Canvas canvas = new Canvas(barcode);
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(getResources().getColor(R.color.result_points));
|
||||
paint.setColor(getResources().getColor(fakeR.getId("color", "result_points")));
|
||||
if (points.length == 2) {
|
||||
paint.setStrokeWidth(4.0f);
|
||||
drawLine(canvas, paint, points[0], points[1]);
|
||||
@@ -481,28 +485,28 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
viewfinderView.setVisibility(View.GONE);
|
||||
resultView.setVisibility(View.VISIBLE);
|
||||
|
||||
ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
|
||||
ImageView barcodeImageView = (ImageView) findViewById(fakeR.getId("id", "barcode_image_view"));
|
||||
if (barcode == null) {
|
||||
barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
|
||||
R.drawable.launcher_icon));
|
||||
fakeR.getId("drawable", "launcher_icon")));
|
||||
} else {
|
||||
barcodeImageView.setImageBitmap(barcode);
|
||||
}
|
||||
|
||||
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
|
||||
TextView formatTextView = (TextView) findViewById(fakeR.getId("id", "format_text_view"));
|
||||
formatTextView.setText(rawResult.getBarcodeFormat().toString());
|
||||
|
||||
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
|
||||
TextView typeTextView = (TextView) findViewById(fakeR.getId("id", "type_text_view"));
|
||||
typeTextView.setText(resultHandler.getType().toString());
|
||||
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||
String formattedTime = formatter.format(new Date(rawResult.getTimestamp()));
|
||||
TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
|
||||
TextView timeTextView = (TextView) findViewById(fakeR.getId("id", "time_text_view"));
|
||||
timeTextView.setText(formattedTime);
|
||||
|
||||
|
||||
TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
|
||||
View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
|
||||
TextView metaTextView = (TextView) findViewById(fakeR.getId("id", "meta_text_view"));
|
||||
View metaTextViewLabel = findViewById(fakeR.getId("id", "meta_text_view_label"));
|
||||
metaTextView.setVisibility(View.GONE);
|
||||
metaTextViewLabel.setVisibility(View.GONE);
|
||||
Map<ResultMetadataType,Object> metadata = rawResult.getResultMetadata();
|
||||
@@ -521,14 +525,14 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
}
|
||||
|
||||
TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
|
||||
TextView contentsTextView = (TextView) findViewById(fakeR.getId("id", "contents_text_view"));
|
||||
CharSequence displayContents = resultHandler.getDisplayContents();
|
||||
contentsTextView.setText(displayContents);
|
||||
// Crudely scale betweeen 22 and 32 -- bigger font for shorter text
|
||||
int scaledSize = Math.max(22, 32 - displayContents.length() / 4);
|
||||
contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);
|
||||
|
||||
TextView supplementTextView = (TextView) findViewById(R.id.contents_supplement_text_view);
|
||||
TextView supplementTextView = (TextView) findViewById(fakeR.getId("id", "contents_supplement_text_view"));
|
||||
supplementTextView.setText("");
|
||||
supplementTextView.setOnClickListener(null);
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
|
||||
@@ -540,7 +544,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
|
||||
int buttonCount = resultHandler.getButtonCount();
|
||||
ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
|
||||
ViewGroup buttonView = (ViewGroup) findViewById(fakeR.getId("id", "result_button_view"));
|
||||
buttonView.requestFocus();
|
||||
for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
|
||||
TextView button = (TextView) buttonView.getChildAt(x);
|
||||
@@ -625,7 +629,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
}
|
||||
}
|
||||
sendReplyMessage(R.id.return_scan_result, intent, resultDurationMS);
|
||||
sendReplyMessage(fakeR.getId("id", "return_scan_result"), intent, resultDurationMS);
|
||||
|
||||
} else if (source == IntentSource.PRODUCT_SEARCH_LINK) {
|
||||
|
||||
@@ -633,7 +637,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
// TLD as the scan URL.
|
||||
int end = sourceUrl.lastIndexOf("/scan");
|
||||
String replyURL = sourceUrl.substring(0, end) + "?q=" + resultHandler.getDisplayContents() + "&source=zxing";
|
||||
sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS);
|
||||
sendReplyMessage(fakeR.getId("id", "launch_product_query"), replyURL, resultDurationMS);
|
||||
|
||||
} else if (source == IntentSource.ZXING_LINK) {
|
||||
|
||||
@@ -647,7 +651,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
// can't happen; UTF-8 is always supported. Continue, I guess, without encoding
|
||||
}
|
||||
String replyURL = returnUrlTemplate.replace(RETURN_CODE_PLACEHOLDER, codeReplacement);
|
||||
sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS);
|
||||
sendReplyMessage(fakeR.getId("id", "launch_product_query"), replyURL, resultDurationMS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -717,23 +721,23 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
|
||||
private void displayFrameworkBugMessageAndExit() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(getString(R.string.app_name));
|
||||
builder.setMessage(getString(R.string.msg_camera_framework_bug));
|
||||
builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
|
||||
builder.setTitle(getString(fakeR.getId("string", "app_name")));
|
||||
builder.setMessage(getString(fakeR.getId("string", "msg_camera_framework_bug")));
|
||||
builder.setPositiveButton(fakeR.getId("string", "button_ok"), new FinishListener(this));
|
||||
builder.setOnCancelListener(new FinishListener(this));
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public void restartPreviewAfterDelay(long delayMS) {
|
||||
if (handler != null) {
|
||||
handler.sendEmptyMessageDelayed(R.id.restart_preview, delayMS);
|
||||
handler.sendEmptyMessageDelayed(fakeR.getId("id", "restart_preview"), delayMS);
|
||||
}
|
||||
resetStatusView();
|
||||
}
|
||||
|
||||
private void resetStatusView() {
|
||||
resultView.setVisibility(View.GONE);
|
||||
statusView.setText(R.string.msg_default_status);
|
||||
statusView.setText(fakeR.getId("string", "msg_default_status"));
|
||||
statusView.setVisibility(View.VISIBLE);
|
||||
viewfinderView.setVisibility(View.VISIBLE);
|
||||
lastResult = null;
|
||||
|
||||
+14
-10
@@ -32,6 +32,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -55,10 +56,13 @@ public final class CaptureActivityHandler extends Handler {
|
||||
DONE
|
||||
}
|
||||
|
||||
private static FakeR fakeR;
|
||||
|
||||
CaptureActivityHandler(CaptureActivity activity,
|
||||
Collection<BarcodeFormat> decodeFormats,
|
||||
String characterSet,
|
||||
CameraManager cameraManager) {
|
||||
fakeR = new FakeR(activity);
|
||||
this.activity = activity;
|
||||
decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
|
||||
new ViewfinderResultPointCallback(activity.getViewfinderView()));
|
||||
@@ -73,25 +77,25 @@ public final class CaptureActivityHandler extends Handler {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
if (message.what == R.id.restart_preview) {
|
||||
if (message.what == fakeR.getId("id", "restart_preview")) {
|
||||
Log.d(TAG, "Got restart preview message");
|
||||
restartPreviewAndDecode();
|
||||
} else if (message.what == R.id.decode_succeeded) {
|
||||
} else if (message.what == fakeR.getId("id", "decode_succeeded")) {
|
||||
Log.d(TAG, "Got decode succeeded message");
|
||||
state = State.SUCCESS;
|
||||
Bundle bundle = message.getData();
|
||||
Bitmap barcode = bundle == null ? null :
|
||||
(Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);
|
||||
activity.handleDecode((Result) message.obj, barcode);
|
||||
} else if (message.what == R.id.decode_failed) {
|
||||
} else if (message.what == fakeR.getId("id", "decode_failed")) {
|
||||
// We're decoding as fast as possible, so when one decode fails, start another.
|
||||
state = State.PREVIEW;
|
||||
cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
||||
} else if (message.what == R.id.return_scan_result) {
|
||||
cameraManager.requestPreviewFrame(decodeThread.getHandler(), fakeR.getId("id", "decode"));
|
||||
} else if (message.what == fakeR.getId("id", "return_scan_result")) {
|
||||
Log.d(TAG, "Got return scan result message");
|
||||
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
||||
activity.finish();
|
||||
} else if (message.what == R.id.launch_product_query) {
|
||||
} else if (message.what == fakeR.getId("id", "launch_product_query")) {
|
||||
Log.d(TAG, "Got product query message");
|
||||
String url = (String) message.obj;
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
@@ -121,7 +125,7 @@ public final class CaptureActivityHandler extends Handler {
|
||||
public void quitSynchronously() {
|
||||
state = State.DONE;
|
||||
cameraManager.stopPreview();
|
||||
Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
|
||||
Message quit = Message.obtain(decodeThread.getHandler(), fakeR.getId("id", "quit"));
|
||||
quit.sendToTarget();
|
||||
try {
|
||||
// Wait at most half a second; should be enough time, and onPause() will timeout quickly
|
||||
@@ -131,14 +135,14 @@ public final class CaptureActivityHandler extends Handler {
|
||||
}
|
||||
|
||||
// Be absolutely sure we don't send any queued up messages
|
||||
removeMessages(R.id.decode_succeeded);
|
||||
removeMessages(R.id.decode_failed);
|
||||
removeMessages(fakeR.getId("id", "decode_succeeded"));
|
||||
removeMessages(fakeR.getId("id", "decode_failed"));
|
||||
}
|
||||
|
||||
private void restartPreviewAndDecode() {
|
||||
if (state == State.SUCCESS) {
|
||||
state = State.PREVIEW;
|
||||
cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
||||
cameraManager.requestPreviewFrame(decodeThread.getHandler(), fakeR.getId("id", "decode"));
|
||||
activity.drawViewfinder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -42,7 +43,9 @@ final class DecodeHandler extends Handler {
|
||||
private final MultiFormatReader multiFormatReader;
|
||||
private boolean running = true;
|
||||
|
||||
private static FakeR fakeR;
|
||||
DecodeHandler(CaptureActivity activity, Map<DecodeHintType,Object> hints) {
|
||||
fakeR = new FakeR(activity);
|
||||
multiFormatReader = new MultiFormatReader();
|
||||
multiFormatReader.setHints(hints);
|
||||
this.activity = activity;
|
||||
@@ -53,9 +56,9 @@ final class DecodeHandler extends Handler {
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
if (message.what == R.id.decode) {
|
||||
if (message.what == fakeR.getId("id", "decode")) {
|
||||
decode((byte[]) message.obj, message.arg1, message.arg2);
|
||||
} else if (message.what == R.id.quit) {
|
||||
} else if (message.what == fakeR.getId("id", "quit")) {
|
||||
running = false;
|
||||
Looper.myLooper().quit();
|
||||
}
|
||||
@@ -90,7 +93,7 @@ final class DecodeHandler extends Handler {
|
||||
long end = System.currentTimeMillis();
|
||||
Log.d(TAG, "Found barcode in " + (end - start) + " ms");
|
||||
if (handler != null) {
|
||||
Message message = Message.obtain(handler, R.id.decode_succeeded, rawResult);
|
||||
Message message = Message.obtain(handler, fakeR.getId("id", "decode_succeeded"), rawResult);
|
||||
Bundle bundle = new Bundle();
|
||||
Bitmap grayscaleBitmap = toBitmap(source, source.renderCroppedGreyscaleBitmap());
|
||||
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, grayscaleBitmap);
|
||||
@@ -99,7 +102,7 @@ final class DecodeHandler extends Handler {
|
||||
}
|
||||
} else {
|
||||
if (handler != null) {
|
||||
Message message = Message.obtain(handler, R.id.decode_failed);
|
||||
Message message = Message.obtain(handler, fakeR.getId("id", "decode_failed"));
|
||||
message.sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.view.KeyEvent;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
/**
|
||||
* An HTML-based help screen with Back and Done buttons at the bottom.
|
||||
@@ -46,6 +47,8 @@ public final class HelpActivity extends Activity {
|
||||
private WebView webView;
|
||||
private Button backButton;
|
||||
|
||||
private static FakeR fakeR;
|
||||
|
||||
private final Button.OnClickListener backListener = new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -63,9 +66,12 @@ public final class HelpActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.help);
|
||||
|
||||
webView = (WebView)findViewById(R.id.help_contents);
|
||||
fakeR = new FakeR(this);
|
||||
|
||||
setContentView(fakeR.getId("layout", "help"));
|
||||
|
||||
webView = (WebView)findViewById(fakeR.getId("id", "help_contents"));
|
||||
webView.setWebViewClient(new HelpClient());
|
||||
|
||||
// Froyo has a bug with calling onCreate() twice in a row, which causes the What's New page
|
||||
@@ -85,9 +91,9 @@ public final class HelpActivity extends Activity {
|
||||
webView.loadUrl(BASE_URL + DEFAULT_PAGE);
|
||||
}
|
||||
|
||||
backButton = (Button) findViewById(R.id.back_button);
|
||||
backButton = (Button) findViewById(fakeR.getId("id", "back_button"));
|
||||
backButton.setOnClickListener(backListener);
|
||||
View doneButton = findViewById(R.id.done_button);
|
||||
View doneButton = findViewById(fakeR.getId("id", "done_button"));
|
||||
doneButton.setOnClickListener(doneListener);
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -22,6 +22,7 @@ import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -58,10 +59,13 @@ public final class PreferencesActivity extends PreferenceActivity
|
||||
private CheckBoxPreference decodeQR;
|
||||
private CheckBoxPreference decodeDataMatrix;
|
||||
|
||||
private static FakeR fakeR;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
fakeR = new FakeR(this);
|
||||
addPreferencesFromResource(fakeR.getId("xml", "preferences"));
|
||||
|
||||
PreferenceScreen preferences = getPreferenceScreen();
|
||||
preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -56,17 +57,21 @@ public final class ViewfinderView extends View {
|
||||
private List<ResultPoint> possibleResultPoints;
|
||||
private List<ResultPoint> lastPossibleResultPoints;
|
||||
|
||||
private static FakeR fakeR;
|
||||
|
||||
// This constructor is used when the class is built from an XML resource.
|
||||
public ViewfinderView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
fakeR = new FakeR(context);
|
||||
|
||||
// Initialize these once for performance rather than calling them every time in onDraw().
|
||||
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
Resources resources = getResources();
|
||||
maskColor = resources.getColor(R.color.viewfinder_mask);
|
||||
resultColor = resources.getColor(R.color.result_view);
|
||||
laserColor = resources.getColor(R.color.viewfinder_laser);
|
||||
resultPointColor = resources.getColor(R.color.possible_result_points);
|
||||
maskColor = resources.getColor(fakeR.getId("color", "viewfinder_mask"));
|
||||
resultColor = resources.getColor(fakeR.getId("color", "result_view"));
|
||||
laserColor = resources.getColor(fakeR.getId("color", "viewfinder_laser"));
|
||||
resultPointColor = resources.getColor(fakeR.getId("color", "possible_result_points"));
|
||||
scannerAlpha = 0;
|
||||
possibleResultPoints = new ArrayList<ResultPoint>(5);
|
||||
lastPossibleResultPoints = null;
|
||||
|
||||
+21
-16
@@ -30,6 +30,7 @@ import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -96,10 +97,14 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
return isbn;
|
||||
}
|
||||
|
||||
private static FakeR fakeR;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
fakeR = new FakeR(this);
|
||||
|
||||
// Make sure that expired cookies are removed on launch.
|
||||
CookieSyncManager.createInstance(this);
|
||||
CookieManager.getInstance().removeExpiredCookie();
|
||||
@@ -112,13 +117,13 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
|
||||
isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
|
||||
if (LocaleManager.isBookSearchUrl(isbn)) {
|
||||
setTitle(getString(R.string.sbc_name));
|
||||
setTitle(getString(fakeR.getId("string", "sbc_name")));
|
||||
} else {
|
||||
setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
|
||||
setTitle(getString(fakeR.getId("string", "sbc_name")) + ": ISBN " + isbn);
|
||||
}
|
||||
|
||||
setContentView(R.layout.search_book_contents);
|
||||
queryTextView = (EditText) findViewById(R.id.query_text_view);
|
||||
setContentView(fakeR.getId("layout", "search_book_contents"));
|
||||
queryTextView = (EditText) findViewById(fakeR.getId("id", "query_text_view"));
|
||||
|
||||
String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
|
||||
if (initialQuery != null && initialQuery.length() > 0) {
|
||||
@@ -127,12 +132,12 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
}
|
||||
queryTextView.setOnKeyListener(keyListener);
|
||||
|
||||
queryButton = (Button) findViewById(R.id.query_button);
|
||||
queryButton = (Button) findViewById(fakeR.getId("id", "query_button"));
|
||||
queryButton.setOnClickListener(buttonListener);
|
||||
|
||||
resultListView = (ListView) findViewById(R.id.result_list_view);
|
||||
resultListView = (ListView) findViewById(fakeR.getId("id", "result_list_view"));
|
||||
LayoutInflater factory = LayoutInflater.from(this);
|
||||
headerView = (TextView) factory.inflate(R.layout.search_book_contents_header,
|
||||
headerView = (TextView) factory.inflate(fakeR.getId("layout", "search_book_contents_header"),
|
||||
resultListView, false);
|
||||
resultListView.addHeaderView(headerView);
|
||||
}
|
||||
@@ -162,7 +167,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
}
|
||||
networkTask = new NetworkTask();
|
||||
taskExec.execute(networkTask, query, isbn);
|
||||
headerView.setText(R.string.msg_sbc_searching_book);
|
||||
headerView.setText(fakeR.getId("string", "msg_sbc_searching_book"));
|
||||
resultListView.setAdapter(null);
|
||||
queryTextView.setEnabled(false);
|
||||
queryButton.setEnabled(false);
|
||||
@@ -201,7 +206,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
@Override
|
||||
protected void onPostExecute(JSONObject result) {
|
||||
if (result == null) {
|
||||
headerView.setText(R.string.msg_sbc_failed);
|
||||
headerView.setText(fakeR.getId("string", "msg_sbc_failed"));
|
||||
} else {
|
||||
handleSearchResults(result);
|
||||
}
|
||||
@@ -215,7 +220,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
private void handleSearchResults(JSONObject json) {
|
||||
try {
|
||||
int count = json.getInt("number_of_results");
|
||||
headerView.setText(getString(R.string.msg_sbc_results) + " : " + count);
|
||||
headerView.setText(getString(fakeR.getId("string", "msg_sbc_results")) + " : " + count);
|
||||
if (count > 0) {
|
||||
JSONArray results = json.getJSONArray("search_results");
|
||||
SearchBookContentsResult.setQuery(queryTextView.getText().toString());
|
||||
@@ -228,14 +233,14 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
} else {
|
||||
String searchable = json.optString("searchable");
|
||||
if ("false".equals(searchable)) {
|
||||
headerView.setText(R.string.msg_sbc_book_not_searchable);
|
||||
headerView.setText(fakeR.getId("string", "msg_sbc_book_not_searchable"));
|
||||
}
|
||||
resultListView.setAdapter(null);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.w(TAG, "Bad JSON from book search", e);
|
||||
resultListView.setAdapter(null);
|
||||
headerView.setText(R.string.msg_sbc_failed);
|
||||
headerView.setText(fakeR.getId("string", "msg_sbc_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,10 +250,10 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
String pageId = json.getString("page_id");
|
||||
String pageNumber = json.getString("page_number");
|
||||
if (pageNumber.length() > 0) {
|
||||
pageNumber = getString(R.string.msg_sbc_page) + ' ' + pageNumber;
|
||||
pageNumber = getString(fakeR.getId("string", "msg_sbc_page")) + ' ' + pageNumber;
|
||||
} else {
|
||||
// This can happen for text on the jacket, and possibly other reasons.
|
||||
pageNumber = getString(R.string.msg_sbc_unknown_page);
|
||||
pageNumber = getString(fakeR.getId("string", "msg_sbc_unknown_page"));
|
||||
}
|
||||
|
||||
// Remove all HTML tags and encoded characters. Ideally the server would do this.
|
||||
@@ -261,13 +266,13 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
snippet = QUOTE_ENTITY_PATTERN.matcher(snippet).replaceAll("'");
|
||||
snippet = QUOT_ENTITY_PATTERN.matcher(snippet).replaceAll("\"");
|
||||
} else {
|
||||
snippet = '(' + getString(R.string.msg_sbc_snippet_unavailable) + ')';
|
||||
snippet = '(' + getString(fakeR.getId("string", "msg_sbc_snippet_unavailable")) + ')';
|
||||
valid = false;
|
||||
}
|
||||
return new SearchBookContentsResult(pageId, pageNumber, snippet, valid);
|
||||
} catch (JSONException e) {
|
||||
// Never seen in the wild, just being complete.
|
||||
return new SearchBookContentsResult(getString(R.string.msg_sbc_no_page_returned), "", "", false);
|
||||
return new SearchBookContentsResult(getString(fakeR.getId("string", "msg_sbc_no_page_returned")), "", "", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -21,6 +21,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,8 +34,11 @@ import com.google.zxing.client.android.R;
|
||||
*/
|
||||
final class SearchBookContentsAdapter extends ArrayAdapter<SearchBookContentsResult> {
|
||||
|
||||
private static FakeR fakeR;
|
||||
|
||||
SearchBookContentsAdapter(Context context, List<SearchBookContentsResult> items) {
|
||||
super(context, R.layout.search_book_contents_list_item, 0, items);
|
||||
super(context, fakeR.getId("layout", "search_book_contents_list_item"), 0, items);
|
||||
fakeR = new FakeR(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,7 +48,7 @@ final class SearchBookContentsAdapter extends ArrayAdapter<SearchBookContentsRes
|
||||
if (view == null) {
|
||||
LayoutInflater factory = LayoutInflater.from(getContext());
|
||||
listItem = (SearchBookContentsListItem) factory.inflate(
|
||||
R.layout.search_book_contents_list_item, viewGroup, false);
|
||||
fakeR.getId("layout", "search_book_contents_list_item"), viewGroup, false);
|
||||
} else {
|
||||
if (view instanceof SearchBookContentsListItem) {
|
||||
listItem = (SearchBookContentsListItem) view;
|
||||
|
||||
+5
-2
@@ -26,6 +26,7 @@ import android.text.style.StyleSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -38,8 +39,10 @@ public final class SearchBookContentsListItem extends LinearLayout {
|
||||
private TextView pageNumberView;
|
||||
private TextView snippetView;
|
||||
|
||||
private static FakeR fakeR;
|
||||
SearchBookContentsListItem(Context context) {
|
||||
super(context);
|
||||
fakeR = new FakeR(context);
|
||||
}
|
||||
|
||||
public SearchBookContentsListItem(Context context, AttributeSet attrs) {
|
||||
@@ -49,8 +52,8 @@ public final class SearchBookContentsListItem extends LinearLayout {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
pageNumberView = (TextView) findViewById(R.id.page_number_view);
|
||||
snippetView = (TextView) findViewById(R.id.snippet_view);
|
||||
pageNumberView = (TextView) findViewById(fakeR.getId("id", "page_number_view"));
|
||||
snippetView = (TextView) findViewById(fakeR.getId("id", "snippet_view"));
|
||||
}
|
||||
|
||||
public void set(SearchBookContentsResult result) {
|
||||
|
||||
+17
-14
@@ -37,6 +37,7 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -60,16 +61,18 @@ public final class EncodeActivity extends Activity {
|
||||
|
||||
private QRCodeEncoder qrCodeEncoder;
|
||||
|
||||
private static FakeR fakeR;
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
fakeR = new FakeR(this);
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
finish();
|
||||
} else {
|
||||
// String action = intent.getAction();
|
||||
// if (Intents.Encode.ACTION.equals(action) || Intent.ACTION_SEND.equals(action)) {
|
||||
setContentView(R.layout.encode);
|
||||
setContentView(fakeR.getId("layout", "encode"));
|
||||
// } else {
|
||||
// finish();
|
||||
// }
|
||||
@@ -79,10 +82,10 @@ public final class EncodeActivity extends Activity {
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater menuInflater = getMenuInflater();
|
||||
menuInflater.inflate(R.menu.encode, menu);
|
||||
menuInflater.inflate(fakeR.getId("menu", "encode"), menu);
|
||||
boolean useVcard = qrCodeEncoder != null && qrCodeEncoder.isUseVCard();
|
||||
int encodeNameResource = useVcard ? R.string.menu_encode_mecard : R.string.menu_encode_vcard;
|
||||
MenuItem encodeItem = menu.findItem(R.id.menu_encode);
|
||||
int encodeNameResource = useVcard ? fakeR.getId("string", "menu_encode_mecard") : fakeR.getId("string", "menu_encode_vcard");
|
||||
MenuItem encodeItem = menu.findItem(fakeR.getId("id", "menu_encode"));
|
||||
encodeItem.setTitle(encodeNameResource);
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
@@ -95,10 +98,10 @@ public final class EncodeActivity extends Activity {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.menu_share) {
|
||||
if (itemId == fakeR.getId("id", "menu_share")) {
|
||||
share();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_encode) {
|
||||
} else if (itemId == fakeR.getId("id", "menu_encode")) {
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
return false;
|
||||
@@ -140,7 +143,7 @@ public final class EncodeActivity extends Activity {
|
||||
File barcodesRoot = new File(bsRoot, "Barcodes");
|
||||
if (!barcodesRoot.exists() && !barcodesRoot.mkdirs()) {
|
||||
Log.w(TAG, "Couldn't make dir " + barcodesRoot);
|
||||
showErrorMessage(R.string.msg_unmount_usb);
|
||||
showErrorMessage(fakeR.getId("string", "msg_unmount_usb"));
|
||||
return;
|
||||
}
|
||||
File barcodeFile = new File(barcodesRoot, makeBarcodeFileName(contents) + ".png");
|
||||
@@ -151,7 +154,7 @@ public final class EncodeActivity extends Activity {
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 0, fos);
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
Log.w(TAG, "Couldn't access file " + barcodeFile + " due to " + fnfe);
|
||||
showErrorMessage(R.string.msg_unmount_usb);
|
||||
showErrorMessage(fakeR.getId("string", "msg_unmount_usb"));
|
||||
return;
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
@@ -164,7 +167,7 @@ public final class EncodeActivity extends Activity {
|
||||
}
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:"));
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " - " + encoder.getTitle());
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, getString(fakeR.getId("string", "app_name")) + " - " + encoder.getTitle());
|
||||
intent.putExtra(Intent.EXTRA_TEXT, contents);
|
||||
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + barcodeFile.getAbsolutePath()));
|
||||
intent.setType("image/png");
|
||||
@@ -202,15 +205,15 @@ public final class EncodeActivity extends Activity {
|
||||
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
|
||||
if (bitmap == null) {
|
||||
Log.w(TAG, "Could not encode barcode");
|
||||
showErrorMessage(R.string.msg_encode_contents_failed);
|
||||
showErrorMessage(fakeR.getId("string", "msg_encode_contents_failed"));
|
||||
qrCodeEncoder = null;
|
||||
return;
|
||||
}
|
||||
|
||||
ImageView view = (ImageView) findViewById(R.id.image_view);
|
||||
ImageView view = (ImageView) findViewById(fakeR.getId("id", "image_view"));
|
||||
view.setImageBitmap(bitmap);
|
||||
|
||||
TextView contents = (TextView) findViewById(R.id.contents_text_view);
|
||||
TextView contents = (TextView) findViewById(fakeR.getId("id", "contents_text_view"));
|
||||
if (intent.getBooleanExtra(Intents.Encode.SHOW_CONTENTS, true)) {
|
||||
contents.setText(qrCodeEncoder.getDisplayContents());
|
||||
setTitle(qrCodeEncoder.getTitle());
|
||||
@@ -220,7 +223,7 @@ public final class EncodeActivity extends Activity {
|
||||
}
|
||||
} catch (WriterException e) {
|
||||
Log.w(TAG, "Could not encode barcode", e);
|
||||
showErrorMessage(R.string.msg_encode_contents_failed);
|
||||
showErrorMessage(fakeR.getId("string", "msg_encode_contents_failed"));
|
||||
qrCodeEncoder = null;
|
||||
}
|
||||
}
|
||||
@@ -228,7 +231,7 @@ public final class EncodeActivity extends Activity {
|
||||
private void showErrorMessage(int message) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
|
||||
builder.setPositiveButton(fakeR.getId("string", "button_ok"), new FinishListener(this));
|
||||
builder.setOnCancelListener(new FinishListener(this));
|
||||
builder.show();
|
||||
}
|
||||
|
||||
+12
-9
@@ -37,6 +37,7 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -69,7 +70,9 @@ final class QRCodeEncoder {
|
||||
private final int dimension;
|
||||
private final boolean useVCard;
|
||||
|
||||
private static FakeR fakeR;
|
||||
QRCodeEncoder(Activity activity, Intent intent, int dimension, boolean useVCard) throws WriterException {
|
||||
fakeR = new FakeR(activity);
|
||||
this.activity = activity;
|
||||
this.dimension = dimension;
|
||||
this.useVCard = useVCard;
|
||||
@@ -122,7 +125,7 @@ final class QRCodeEncoder {
|
||||
if (data != null && data.length() > 0) {
|
||||
contents = data;
|
||||
displayContents = data;
|
||||
title = activity.getString(R.string.contents_text);
|
||||
title = activity.getString(fakeR.getId("string", "contents_text"));
|
||||
}
|
||||
}
|
||||
return contents != null && contents.length() > 0;
|
||||
@@ -171,7 +174,7 @@ final class QRCodeEncoder {
|
||||
} else {
|
||||
displayContents = contents;
|
||||
}
|
||||
title = activity.getString(R.string.contents_text);
|
||||
title = activity.getString(fakeR.getId("string", "contents_text"));
|
||||
}
|
||||
|
||||
// Handles send intents from the Contacts app, retrieving a contact as a VCARD.
|
||||
@@ -219,28 +222,28 @@ final class QRCodeEncoder {
|
||||
if (data != null && data.length() > 0) {
|
||||
contents = data;
|
||||
displayContents = data;
|
||||
title = activity.getString(R.string.contents_text);
|
||||
title = activity.getString(fakeR.getId("string", "contents_text"));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.EMAIL)) {
|
||||
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
||||
if (data != null) {
|
||||
contents = "mailto:" + data;
|
||||
displayContents = data;
|
||||
title = activity.getString(R.string.contents_email);
|
||||
title = activity.getString(fakeR.getId("string", "contents_email"));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.PHONE)) {
|
||||
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
||||
if (data != null) {
|
||||
contents = "tel:" + data;
|
||||
displayContents = PhoneNumberUtils.formatNumber(data);
|
||||
title = activity.getString(R.string.contents_phone);
|
||||
title = activity.getString(fakeR.getId("string", "contents_phone"));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.SMS)) {
|
||||
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
||||
if (data != null) {
|
||||
contents = "sms:" + data;
|
||||
displayContents = PhoneNumberUtils.formatNumber(data);
|
||||
title = activity.getString(R.string.contents_sms);
|
||||
title = activity.getString(fakeR.getId("string", "contents_sms"));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.CONTACT)) {
|
||||
|
||||
@@ -273,7 +276,7 @@ final class QRCodeEncoder {
|
||||
if (encoded[1].length() > 0) {
|
||||
contents = encoded[0];
|
||||
displayContents = encoded[1];
|
||||
title = activity.getString(R.string.contents_contact);
|
||||
title = activity.getString(fakeR.getId("string", "contents_contact"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -287,7 +290,7 @@ final class QRCodeEncoder {
|
||||
if (latitude != Float.MAX_VALUE && longitude != Float.MAX_VALUE) {
|
||||
contents = "geo:" + latitude + ',' + longitude;
|
||||
displayContents = latitude + "," + longitude;
|
||||
title = activity.getString(R.string.contents_location);
|
||||
title = activity.getString(fakeR.getId("string", "contents_location"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,7 +309,7 @@ final class QRCodeEncoder {
|
||||
if (encoded[1].length() > 0) {
|
||||
contents = encoded[0];
|
||||
displayContents = encoded[1];
|
||||
title = activity.getString(R.string.contents_contact);
|
||||
title = activity.getString(fakeR.getId("string", "contents_contact"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -32,6 +32,7 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import com.google.zxing.FakeR;
|
||||
import com.google.zxing.client.android.CaptureActivity;
|
||||
import com.google.zxing.client.android.Intents;
|
||||
import com.google.zxing.client.android.R;
|
||||
@@ -45,9 +46,11 @@ public final class HistoryActivity extends ListActivity {
|
||||
private HistoryManager historyManager;
|
||||
private HistoryItemAdapter adapter;
|
||||
|
||||
private static FakeR fakeR;
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
fakeR = new FakeR(this);
|
||||
this.historyManager = new HistoryManager(this);
|
||||
adapter = new HistoryItemAdapter(this);
|
||||
setListAdapter(adapter);
|
||||
@@ -88,7 +91,7 @@ public final class HistoryActivity extends ListActivity {
|
||||
ContextMenu.ContextMenuInfo menuInfo) {
|
||||
int position = ((AdapterView.AdapterContextMenuInfo) menuInfo).position;
|
||||
if (position >= adapter.getCount() || adapter.getItem(position).getResult() != null) {
|
||||
menu.add(Menu.NONE, position, position, R.string.history_clear_one_history_text);
|
||||
menu.add(Menu.NONE, position, position, fakeR.getId("string", "history_clear_one_history_text"));
|
||||
} // else it's just that dummy "Empty" message
|
||||
}
|
||||
|
||||
@@ -104,7 +107,7 @@ public final class HistoryActivity extends ListActivity {
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (historyManager.hasHistoryItems()) {
|
||||
MenuInflater menuInflater = getMenuInflater();
|
||||
menuInflater.inflate(R.menu.history, menu);
|
||||
menuInflater.inflate(fakeR.getId("menu", "history"), menu);
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
@@ -112,18 +115,18 @@ public final class HistoryActivity extends ListActivity {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.menu_history_send) {
|
||||
if (itemId == fakeR.getId("id", "menu_history_send")) {
|
||||
CharSequence history = historyManager.buildHistory();
|
||||
Uri historyFile = HistoryManager.saveHistory(history.toString());
|
||||
if (historyFile == null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(R.string.msg_unmount_usb);
|
||||
builder.setPositiveButton(R.string.button_ok, null);
|
||||
builder.setMessage(fakeR.getId("string", "msg_unmount_usb"));
|
||||
builder.setPositiveButton(fakeR.getId("string", "button_ok"), null);
|
||||
builder.show();
|
||||
} else {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:"));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
String subject = getResources().getString(R.string.history_email_title);
|
||||
String subject = getResources().getString(fakeR.getId("string", "history_email_title"));
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, subject);
|
||||
intent.putExtra(Intent.EXTRA_STREAM, historyFile);
|
||||
@@ -134,11 +137,11 @@ public final class HistoryActivity extends ListActivity {
|
||||
Log.w(TAG, anfe.toString());
|
||||
}
|
||||
}
|
||||
} else if (itemId == R.id.menu_history_clear_text) {
|
||||
} else if (itemId == fakeR.getId("id", "menu_history_clear_text")) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(R.string.msg_sure);
|
||||
builder.setMessage(fakeR.getId("string", "msg_sure"));
|
||||
builder.setCancelable(true);
|
||||
builder.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(fakeR.getId("string", "button_ok"), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int i2) {
|
||||
historyManager.clearHistory();
|
||||
@@ -146,7 +149,7 @@ public final class HistoryActivity extends ListActivity {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.button_cancel, null);
|
||||
builder.setNegativeButton(fakeR.getId("string", "button_cancel"), null);
|
||||
builder.show();
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
||||
+9
-6
@@ -24,6 +24,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.R;
|
||||
|
||||
@@ -33,8 +34,10 @@ final class HistoryItemAdapter extends ArrayAdapter<HistoryItem> {
|
||||
|
||||
private final Activity activity;
|
||||
|
||||
private static FakeR fakeR;
|
||||
HistoryItemAdapter(Activity activity) {
|
||||
super(activity, R.layout.history_list_item, new ArrayList<HistoryItem>());
|
||||
super(activity, activity.getApplicationContext().getResources().getIdentifier("history_list_item", "layout", activity.getApplicationContext().getPackageName()), new ArrayList<HistoryItem>());
|
||||
fakeR = new FakeR(activity);
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@@ -45,7 +48,7 @@ final class HistoryItemAdapter extends ArrayAdapter<HistoryItem> {
|
||||
layout = (LinearLayout) view;
|
||||
} else {
|
||||
LayoutInflater factory = LayoutInflater.from(activity);
|
||||
layout = (LinearLayout) factory.inflate(R.layout.history_list_item, viewGroup, false);
|
||||
layout = (LinearLayout) factory.inflate(fakeR.getId("layout", "history_list_item"), viewGroup, false);
|
||||
}
|
||||
|
||||
HistoryItem item = getItem(position);
|
||||
@@ -58,12 +61,12 @@ final class HistoryItemAdapter extends ArrayAdapter<HistoryItem> {
|
||||
detail = item.getDisplayAndDetails();
|
||||
} else {
|
||||
Resources resources = getContext().getResources();
|
||||
title = resources.getString(R.string.history_empty);
|
||||
detail = resources.getString(R.string.history_empty_detail);
|
||||
title = resources.getString(fakeR.getId("string", "history_empty"));
|
||||
detail = resources.getString(fakeR.getId("string", "history_empty_detail"));
|
||||
}
|
||||
|
||||
((TextView) layout.findViewById(R.id.history_title)).setText(title);
|
||||
((TextView) layout.findViewById(R.id.history_detail)).setText(detail);
|
||||
((TextView) layout.findViewById(fakeR.getId("id", "history_title"))).setText(title);
|
||||
((TextView) layout.findViewById(fakeR.getId("id", "history_detail"))).setText(detail);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
+8
-7
@@ -51,12 +51,7 @@ public final class AddressBookResultHandler extends ResultHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static final int[] BUTTON_TEXTS = {
|
||||
R.string.button_add_contact,
|
||||
R.string.button_show_map,
|
||||
R.string.button_dial,
|
||||
R.string.button_email,
|
||||
};
|
||||
private static int[] BUTTON_TEXTS;
|
||||
|
||||
private final boolean[] fields;
|
||||
private int buttonCount;
|
||||
@@ -80,6 +75,12 @@ public final class AddressBookResultHandler extends ResultHandler {
|
||||
|
||||
public AddressBookResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
BUTTON_TEXTS = new int[]{
|
||||
fakeR.getId("string", "button_add_contact"),
|
||||
fakeR.getId("string", "button_show_map"),
|
||||
fakeR.getId("string", "button_dial"),
|
||||
fakeR.getId("string", "button_email"),
|
||||
};
|
||||
AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
|
||||
String[] addresses = addressResult.getAddresses();
|
||||
boolean hasAddress = addresses != null && addresses.length > 0 && addresses[0].length() > 0;
|
||||
@@ -212,6 +213,6 @@ public final class AddressBookResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_address_book;
|
||||
return fakeR.getId("string", "result_address_book");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -38,12 +38,14 @@ public final class CalendarResultHandler extends ResultHandler {
|
||||
|
||||
private static final String TAG = CalendarResultHandler.class.getSimpleName();
|
||||
|
||||
private static final int[] buttons = {
|
||||
R.string.button_add_calendar
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public CalendarResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_add_calendar")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,6 +183,6 @@ public final class CalendarResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_calendar;
|
||||
return fakeR.getId("string", "result_calendar");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -28,13 +28,14 @@ import android.app.Activity;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
*/
|
||||
public final class EmailAddressResultHandler extends ResultHandler {
|
||||
private static final int[] buttons = {
|
||||
R.string.button_email,
|
||||
R.string.button_add_contact
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public EmailAddressResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_email"),
|
||||
fakeR.getId("string", "button_add_contact")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +68,6 @@ public final class EmailAddressResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_email_address;
|
||||
return fakeR.getId("string", "result_email_address");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -28,13 +28,14 @@ import android.app.Activity;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
*/
|
||||
public final class GeoResultHandler extends ResultHandler {
|
||||
private static final int[] buttons = {
|
||||
R.string.button_show_map,
|
||||
R.string.button_get_directions
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public GeoResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_show_map"),
|
||||
fakeR.getId("string", "button_get_directions")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +63,6 @@ public final class GeoResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_geo;
|
||||
return fakeR.getId("string", "result_geo");
|
||||
}
|
||||
}
|
||||
|
||||
+8
-7
@@ -30,15 +30,16 @@ import android.view.View;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
*/
|
||||
public final class ISBNResultHandler extends ResultHandler {
|
||||
private static final int[] buttons = {
|
||||
R.string.button_product_search,
|
||||
R.string.button_book_search,
|
||||
R.string.button_search_book_contents,
|
||||
R.string.button_custom_product_search
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public ISBNResultHandler(Activity activity, ParsedResult result, Result rawResult) {
|
||||
super(activity, result, rawResult);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_product_search"),
|
||||
fakeR.getId("string", "button_book_search"),
|
||||
fakeR.getId("string", "button_search_book_contents"),
|
||||
fakeR.getId("string", "button_custom_product_search")
|
||||
};
|
||||
showGoogleShopperButton(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -79,6 +80,6 @@ public final class ISBNResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_isbn;
|
||||
return fakeR.getId("string", "result_isbn");
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -30,14 +30,15 @@ import android.view.View;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
*/
|
||||
public final class ProductResultHandler extends ResultHandler {
|
||||
private static final int[] buttons = {
|
||||
R.string.button_product_search,
|
||||
R.string.button_web_search,
|
||||
R.string.button_custom_product_search
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public ProductResultHandler(Activity activity, ParsedResult result, Result rawResult) {
|
||||
super(activity, result, rawResult);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_product_search"),
|
||||
fakeR.getId("string", "button_web_search"),
|
||||
fakeR.getId("string", "button_custom_product_search")
|
||||
};
|
||||
showGoogleShopperButton(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -75,6 +76,6 @@ public final class ProductResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_product;
|
||||
return fakeR.getId("string", "result_product");
|
||||
}
|
||||
}
|
||||
|
||||
+19
-14
@@ -40,6 +40,7 @@ import android.preference.PreferenceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
@@ -104,6 +105,8 @@ public abstract class ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
protected static FakeR fakeR;
|
||||
|
||||
ResultHandler(Activity activity, ParsedResult result) {
|
||||
this(activity, result, null);
|
||||
}
|
||||
@@ -114,9 +117,11 @@ public abstract class ResultHandler {
|
||||
this.rawResult = rawResult;
|
||||
this.customProductSearch = parseCustomSearchURL();
|
||||
|
||||
// Make sure the Shopper button is hidden by default. Without this, scanning a product followed
|
||||
fakeR = new FakeR(activity);
|
||||
|
||||
// Make sure the Shopper button is hidden by default. Without this, scanning a product followed
|
||||
// by a QR Code would leave the button on screen among the QR Code actions.
|
||||
View shopperButton = activity.findViewById(R.id.shopper_button);
|
||||
View shopperButton = activity.findViewById(fakeR.getId("id", "shopper_button"));
|
||||
shopperButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -171,7 +176,7 @@ public abstract class ResultHandler {
|
||||
* @param listener The on click listener to install for this button.
|
||||
*/
|
||||
void showGoogleShopperButton(View.OnClickListener listener) {
|
||||
View shopperButton = activity.findViewById(R.id.shopper_button);
|
||||
View shopperButton = activity.findViewById(fakeR.getId("id", "shopper_button"));
|
||||
shopperButton.setVisibility(View.VISIBLE);
|
||||
shopperButton.setOnClickListener(listener);
|
||||
}
|
||||
@@ -307,7 +312,7 @@ public abstract class ResultHandler {
|
||||
}
|
||||
|
||||
final void shareByEmail(String contents) {
|
||||
sendEmailFromUri("mailto:", null, activity.getString(R.string.msg_share_subject_line),
|
||||
sendEmailFromUri("mailto:", null, activity.getString(fakeR.getId("string", "msg_share_subject_line")),
|
||||
contents);
|
||||
}
|
||||
|
||||
@@ -328,7 +333,7 @@ public abstract class ResultHandler {
|
||||
}
|
||||
|
||||
final void shareBySMS(String contents) {
|
||||
sendSMSFromUri("smsto:", activity.getString(R.string.msg_share_subject_line) + ":\n" +
|
||||
sendSMSFromUri("smsto:", activity.getString(fakeR.getId("string", "msg_share_subject_line")) + ":\n" +
|
||||
contents);
|
||||
}
|
||||
|
||||
@@ -352,7 +357,7 @@ public abstract class ResultHandler {
|
||||
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
|
||||
// The Messaging app needs to see a valid subject or else it will treat this an an SMS.
|
||||
if (subject == null || subject.length() == 0) {
|
||||
putExtra(intent, "subject", activity.getString(R.string.msg_default_mms_subject));
|
||||
putExtra(intent, "subject", activity.getString(fakeR.getId("string", "msg_default_mms_subject")));
|
||||
} else {
|
||||
putExtra(intent, "subject", subject);
|
||||
}
|
||||
@@ -451,11 +456,11 @@ public abstract class ResultHandler {
|
||||
} else {
|
||||
// Otherwise offer to install it from Market.
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(R.string.msg_google_shopper_missing);
|
||||
builder.setMessage(R.string.msg_install_google_shopper);
|
||||
builder.setIcon(R.drawable.shopper_icon);
|
||||
builder.setPositiveButton(R.string.button_ok, shopperMarketListener);
|
||||
builder.setNegativeButton(R.string.button_cancel, null);
|
||||
builder.setTitle(fakeR.getId("string", "msg_google_shopper_missing"));
|
||||
builder.setMessage(fakeR.getId("string", "msg_install_google_shopper"));
|
||||
builder.setIcon(fakeR.getId("drawable", "shopper_icon"));
|
||||
builder.setPositiveButton(fakeR.getId("string", "button_ok"), shopperMarketListener);
|
||||
builder.setNegativeButton(fakeR.getId("string", "button_cancel"), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
@@ -482,9 +487,9 @@ public abstract class ResultHandler {
|
||||
rawLaunchIntent(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(R.string.app_name);
|
||||
builder.setMessage(R.string.msg_intent_failed);
|
||||
builder.setPositiveButton(R.string.button_ok, null);
|
||||
builder.setTitle(fakeR.getId("string", "app_name"));
|
||||
builder.setMessage(fakeR.getId("string", "msg_intent_failed"));
|
||||
builder.setPositiveButton(fakeR.getId("string", "button_ok"), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -29,13 +29,14 @@ import android.telephony.PhoneNumberUtils;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
*/
|
||||
public final class SMSResultHandler extends ResultHandler {
|
||||
private static final int[] buttons = {
|
||||
R.string.button_sms,
|
||||
R.string.button_mms
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public SMSResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_sms"),
|
||||
fakeR.getId("string", "button_mms")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,6 +80,6 @@ public final class SMSResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_sms;
|
||||
return fakeR.getId("string", "result_sms");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -29,13 +29,14 @@ import android.telephony.PhoneNumberUtils;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
*/
|
||||
public final class TelResultHandler extends ResultHandler {
|
||||
private static final int[] buttons = {
|
||||
R.string.button_dial,
|
||||
R.string.button_add_contact
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public TelResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_dial"),
|
||||
fakeR.getId("string", "button_add_contact")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,6 +78,6 @@ public final class TelResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_tel;
|
||||
return fakeR.getId("string", "result_tel");
|
||||
}
|
||||
}
|
||||
|
||||
+8
-7
@@ -29,15 +29,16 @@ import android.app.Activity;
|
||||
*/
|
||||
public final class TextResultHandler extends ResultHandler {
|
||||
|
||||
private static final int[] buttons = {
|
||||
R.string.button_web_search,
|
||||
R.string.button_share_by_email,
|
||||
R.string.button_share_by_sms,
|
||||
R.string.button_custom_product_search,
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public TextResultHandler(Activity activity, ParsedResult result, Result rawResult) {
|
||||
super(activity, result, rawResult);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_web_search"),
|
||||
fakeR.getId("string", "button_share_by_email"),
|
||||
fakeR.getId("string", "button_share_by_sms"),
|
||||
fakeR.getId("string", "button_custom_product_search"),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,6 +72,6 @@ public final class TextResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_text;
|
||||
return fakeR.getId("string", "result_text");
|
||||
}
|
||||
}
|
||||
|
||||
+8
-7
@@ -37,15 +37,16 @@ public final class URIResultHandler extends ResultHandler {
|
||||
"otpauth:"
|
||||
};
|
||||
|
||||
private static final int[] buttons = {
|
||||
R.string.button_open_browser,
|
||||
R.string.button_share_by_email,
|
||||
R.string.button_share_by_sms,
|
||||
R.string.button_search_book_contents,
|
||||
};
|
||||
private static int[] buttons;
|
||||
|
||||
public URIResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons = new int[]{
|
||||
fakeR.getId("string", "button_open_browser"),
|
||||
fakeR.getId("string", "button_share_by_email"),
|
||||
fakeR.getId("string", "button_share_by_sms"),
|
||||
fakeR.getId("string", "button_search_book_contents"),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,7 +84,7 @@ public final class URIResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_uri;
|
||||
return fakeR.getId("string", "result_uri");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -53,7 +53,7 @@ public final class WifiResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getButtonText(int index) {
|
||||
return R.string.button_wifi;
|
||||
return fakeR.getId("string", "button_wifi");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +61,7 @@ public final class WifiResultHandler extends ResultHandler {
|
||||
if (index == 0) {
|
||||
WifiParsedResult wifiResult = (WifiParsedResult) getResult();
|
||||
WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
|
||||
Toast.makeText(getActivity(), R.string.wifi_changing_network, Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getActivity(), fakeR.getId("string", "wifi_changing_network"), Toast.LENGTH_LONG).show();
|
||||
taskExec.execute(new WifiConfigManager(wifiManager), wifiResult);
|
||||
parent.restartPreviewAfterDelay(0L);
|
||||
}
|
||||
@@ -72,15 +72,15 @@ public final class WifiResultHandler extends ResultHandler {
|
||||
public CharSequence getDisplayContents() {
|
||||
WifiParsedResult wifiResult = (WifiParsedResult) getResult();
|
||||
StringBuilder contents = new StringBuilder(50);
|
||||
String wifiLabel = parent.getString(R.string.wifi_ssid_label);
|
||||
String wifiLabel = parent.getString(fakeR.getId("string", "wifi_ssid_label"));
|
||||
ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
|
||||
String typeLabel = parent.getString(R.string.wifi_type_label);
|
||||
String typeLabel = parent.getString(fakeR.getId("string", "wifi_type_label"));
|
||||
ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
|
||||
return contents.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_wifi;
|
||||
return fakeR.getId("string", "result_wifi");
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -22,6 +22,7 @@ import java.util.Collection;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.LocaleManager;
|
||||
import com.google.zxing.client.android.R;
|
||||
@@ -45,7 +46,7 @@ final class BookResultInfoRetriever extends SupplementalInfoRetriever {
|
||||
BookResultInfoRetriever(TextView textView, String isbn, HistoryManager historyManager, Context context) {
|
||||
super(textView, historyManager);
|
||||
this.isbn = isbn;
|
||||
this.source = context.getString(R.string.msg_google_books);
|
||||
this.source = context.getString(FakeR.getId(context, "string", "msg_google_books"));
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -19,6 +19,7 @@ package com.google.zxing.client.android.result.supplement;
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.R;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
@@ -43,7 +44,7 @@ final class ProductResultInfoRetriever extends SupplementalInfoRetriever {
|
||||
ProductResultInfoRetriever(TextView textView, String productID, HistoryManager historyManager, Context context) {
|
||||
super(textView, historyManager);
|
||||
this.productID = productID;
|
||||
this.source = context.getString(R.string.msg_google_product);
|
||||
this.source = context.getString(FakeR.getId(context, "string", "msg_google_product"));
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package com.google.zxing.client.android.result.supplement;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
import com.google.zxing.client.android.R;
|
||||
@@ -36,7 +37,7 @@ final class URIResultInfoRetriever extends SupplementalInfoRetriever {
|
||||
|
||||
URIResultInfoRetriever(TextView textView, URIParsedResult result, HistoryManager historyManager, Context context) {
|
||||
super(textView, historyManager);
|
||||
redirectString = context.getString(R.string.msg_redirect);
|
||||
redirectString = context.getString(FakeR.getId(context, "string", "msg_redirect"));
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -26,6 +26,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
/**
|
||||
* A custom adapter designed to fetch bookmarks from a cursor. Before Honeycomb we used
|
||||
@@ -39,7 +40,9 @@ final class BookmarkAdapter extends BaseAdapter {
|
||||
private final Context context;
|
||||
private final Cursor cursor;
|
||||
|
||||
private static FakeR fakeR;
|
||||
BookmarkAdapter(Context context, Cursor cursor) {
|
||||
fakeR = new FakeR(context);
|
||||
this.context = context;
|
||||
this.cursor = cursor;
|
||||
}
|
||||
@@ -67,15 +70,15 @@ final class BookmarkAdapter extends BaseAdapter {
|
||||
layout = (LinearLayout) view;
|
||||
} else {
|
||||
LayoutInflater factory = LayoutInflater.from(context);
|
||||
layout = (LinearLayout) factory.inflate(R.layout.bookmark_picker_list_item, viewGroup, false);
|
||||
layout = (LinearLayout) factory.inflate(fakeR.getId("layout", "bookmark_picker_list_item"), viewGroup, false);
|
||||
}
|
||||
|
||||
if (!cursor.isClosed()) {
|
||||
cursor.moveToPosition(index);
|
||||
String title = cursor.getString(BookmarkPickerActivity.TITLE_COLUMN);
|
||||
((TextView) layout.findViewById(R.id.bookmark_title)).setText(title);
|
||||
((TextView) layout.findViewById(fakeR.getId("id", "bookmark_title"))).setText(title);
|
||||
String url = cursor.getString(BookmarkPickerActivity.URL_COLUMN);
|
||||
((TextView) layout.findViewById(R.id.bookmark_url)).setText(url);
|
||||
((TextView) layout.findViewById(fakeR.getId("id", "bookmark_url"))).setText(url);
|
||||
} // Otherwise... just don't update as the object is shutting down
|
||||
return layout;
|
||||
}
|
||||
|
||||
+10
-6
@@ -36,6 +36,7 @@ import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.FakeR;
|
||||
|
||||
/**
|
||||
* Barcode Scanner can share data like contacts and bookmarks by displaying a QR Code on screen,
|
||||
@@ -53,6 +54,8 @@ public final class ShareActivity extends Activity {
|
||||
|
||||
private Button clipboardButton;
|
||||
|
||||
private static FakeR fakeR;
|
||||
|
||||
private final Button.OnClickListener contactListener = new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -119,14 +122,15 @@ public final class ShareActivity extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.share);
|
||||
fakeR = new FakeR(this);
|
||||
setContentView(fakeR.getId("layout", "share"));
|
||||
|
||||
findViewById(R.id.share_contact_button).setOnClickListener(contactListener);
|
||||
findViewById(R.id.share_bookmark_button).setOnClickListener(bookmarkListener);
|
||||
findViewById(R.id.share_app_button).setOnClickListener(appListener);
|
||||
clipboardButton = (Button) findViewById(R.id.share_clipboard_button);
|
||||
findViewById(fakeR.getId("id", "share_contact_button")).setOnClickListener(contactListener);
|
||||
findViewById(fakeR.getId("id", "share_bookmark_button")).setOnClickListener(bookmarkListener);
|
||||
findViewById(fakeR.getId("id", "share_app_button")).setOnClickListener(appListener);
|
||||
clipboardButton = (Button) findViewById(fakeR.getId("id", "share_clipboard_button"));
|
||||
clipboardButton.setOnClickListener(clipboardListener);
|
||||
findViewById(R.id.share_text_view).setOnKeyListener(textListener);
|
||||
findViewById(fakeR.getId("id", "share_text_view")).setOnKeyListener(textListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
Building Android
|
||||
================
|
||||
|
||||
## Building localy ##
|
||||
|
||||
Steps if you have Netbeans setup for Android or want to do that.
|
||||
|
||||
1. Setup Netbeans for Android development.
|
||||
1. Download and install JDK (be sure to set JAVA_HOME - it will be important for the SDK).
|
||||
2. Download and install Netebeans.
|
||||
3. Download and install Android SDK (do NOT use ADT boundle).
|
||||
4. Download and install NBAndroid: http://www.nbandroid.org/p/installation.html
|
||||
5. Set path of Android SDK in Netbeans (for installation for all users this is: ```c:\Program Files (x86)\Android\android-sdk\```).
|
||||
|
||||
2. Install Phonegap:
|
||||
|
||||
1. Add to Windows PATH Android SDK tools: ```;C:\...[android-sdk]\platform-tools;C:\...[android-sdk]\tools```
|
||||
2. Copy ANT home from Netbeans and add it your PATH too.
|
||||
3. Add Java bin to PATH: ```;%JAVA_HOME%\bin;%ANT_HOME%\bin```
|
||||
|
||||
3. Install cordova command line
|
||||
1. Install node.js.
|
||||
2. Install cordova command line:
|
||||
```
|
||||
npm install -g cordova
|
||||
```
|
||||
|
||||
4. Create and build test project to check command line tools:
|
||||
```
|
||||
cordova create hello com.example.hello "Hello World"
|
||||
cd hello
|
||||
cordova platform add android
|
||||
cordova build
|
||||
```
|
||||
|
||||
5. To open project in Netbeans just use Open Project and in the folder you created the project navigate to platforms\android.
|
||||
|
||||
6. Add the plugin following instructions from this page: https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner
|
||||
|
||||
## Preparing for PhoneGap Build ##
|
||||
|
||||
The process may vary depending on version of Zxing project, but base steps should be the same.
|
||||
|
||||
1. Get latest zxing-android project and create a LibraryProject from that:
|
||||
1. Checked out zxing-android from SVN (http://zxing.googlecode.com/svn/trunk/).
|
||||
2. Overlayed the source from zxing-core.
|
||||
3. Set to library project.
|
||||
4. Change intent names to avoid conflict with ZXing app.
|
||||
5. Remove two lines from AndroidManifest.xml to avoid shortcuts being created.
|
||||
2. Update plugin.xml with any needed resources (you can use ```plugin.xml.generate.php``` to generate some stuff for Android).
|
||||
3. Refactor LibraryProject for usage with PGB:
|
||||
1. Commented out call to showHelpOnFirstLaunch (it will probably not work anyway).
|
||||
2. Replace R class with FakeR class calls (this is needed beacuse R class will be in a different namespace).
|
||||
3. Add FakeR initialization in each class it was added (note that if some classes extened other then you might want to add a protected fakeR variable to their parent - see e.g. ResultHandler class and it's children).
|
||||
4. Build LibraryProject, rename and copy it.
|
||||
|
||||
## Building with plugman ##
|
||||
|
||||
[Plugman](https://github.com/apache/cordova-plugman) is a Node.js tool used by PG Build.
|
||||
|
||||
Workflow for creating and building example project with the plugin:
|
||||
1. Create and build example project:
|
||||
```
|
||||
cordova create hello com.example.hello "Hello World"
|
||||
cd hello
|
||||
cordova platform add android
|
||||
cordova build
|
||||
```
|
||||
2. Copy plugin files to "hello\plugins\barcodescanner\".
|
||||
|
||||
3. Install the plugin (current dir. being "hello"):
|
||||
plugman --plugins_dir plugins --plugin barcodescanner --platform android --project platforms\android
|
||||
|
||||
4. Build & deploy Android project with whatever Android IDE (or ANT + ADK tools).
|
||||
Binary file not shown.
Reference in New Issue
Block a user