mirror of
https://github.com/wahyd4/BarcodeScanner.git
synced 2026-08-09 04:55:57 +10:00
[android] Modified zxing client to access resources from main package
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
.DS_Store
|
||||
bin/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-12
|
||||
android.library=true
|
||||
@@ -0,0 +1,6 @@
|
||||
/** Automatically generated file. DO NOT MODIFY */
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = true;
|
||||
}
|
||||
@@ -11,226 +11,226 @@ public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class color {
|
||||
public static final int contents_text=0x7f060000;
|
||||
public static final int encode_view=0x7f060001;
|
||||
public static final int help_button_view=0x7f060002;
|
||||
public static final int help_view=0x7f060003;
|
||||
public static final int possible_result_points=0x7f060004;
|
||||
public static final int result_image_border=0x7f060005;
|
||||
public static final int result_minor_text=0x7f060006;
|
||||
public static final int result_points=0x7f060007;
|
||||
public static final int result_text=0x7f060008;
|
||||
public static final int result_view=0x7f060009;
|
||||
public static final int sbc_header_text=0x7f06000a;
|
||||
public static final int sbc_header_view=0x7f06000b;
|
||||
public static final int sbc_layout_view=0x7f06000d;
|
||||
public static final int sbc_list_item=0x7f06000c;
|
||||
public static final int sbc_page_number_text=0x7f06000e;
|
||||
public static final int sbc_snippet_text=0x7f06000f;
|
||||
public static final int share_text=0x7f060010;
|
||||
public static final int status_text=0x7f060012;
|
||||
public static final int status_view=0x7f060011;
|
||||
public static final int transparent=0x7f060013;
|
||||
public static final int viewfinder_frame=0x7f060014;
|
||||
public static final int viewfinder_laser=0x7f060015;
|
||||
public static final int viewfinder_mask=0x7f060016;
|
||||
public static int contents_text=0x7f060000;
|
||||
public static int encode_view=0x7f060001;
|
||||
public static int help_button_view=0x7f060002;
|
||||
public static int help_view=0x7f060003;
|
||||
public static int possible_result_points=0x7f060004;
|
||||
public static int result_image_border=0x7f060005;
|
||||
public static int result_minor_text=0x7f060006;
|
||||
public static int result_points=0x7f060007;
|
||||
public static int result_text=0x7f060008;
|
||||
public static int result_view=0x7f060009;
|
||||
public static int sbc_header_text=0x7f06000a;
|
||||
public static int sbc_header_view=0x7f06000b;
|
||||
public static int sbc_layout_view=0x7f06000d;
|
||||
public static int sbc_list_item=0x7f06000c;
|
||||
public static int sbc_page_number_text=0x7f06000e;
|
||||
public static int sbc_snippet_text=0x7f06000f;
|
||||
public static int share_text=0x7f060010;
|
||||
public static int status_text=0x7f060012;
|
||||
public static int status_view=0x7f060011;
|
||||
public static int transparent=0x7f060013;
|
||||
public static int viewfinder_frame=0x7f060014;
|
||||
public static int viewfinder_laser=0x7f060015;
|
||||
public static int viewfinder_mask=0x7f060016;
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int launcher_icon=0x7f020000;
|
||||
public static final int share_via_barcode=0x7f020001;
|
||||
public static final int shopper_icon=0x7f020002;
|
||||
public static int launcher_icon=0x7f020000;
|
||||
public static int share_via_barcode=0x7f020001;
|
||||
public static int shopper_icon=0x7f020002;
|
||||
}
|
||||
public static final class id {
|
||||
/** Messages IDs
|
||||
*/
|
||||
public static final int auto_focus=0x7f070000;
|
||||
public static final int back_button=0x7f070020;
|
||||
public static final int barcode_image_view=0x7f07000f;
|
||||
public static final int bookmark_title=0x7f07000a;
|
||||
public static final int bookmark_url=0x7f07000b;
|
||||
public static final int contents_supplement_text_view=0x7f070019;
|
||||
public static final int contents_text_view=0x7f070018;
|
||||
public static final int decode=0x7f070001;
|
||||
public static final int decode_failed=0x7f070002;
|
||||
public static final int decode_succeeded=0x7f070003;
|
||||
public static final int done_button=0x7f070021;
|
||||
public static final int encode_view=0x7f07001d;
|
||||
public static final int format_text_view=0x7f070011;
|
||||
public static final int format_text_view_label=0x7f070010;
|
||||
public static final int help_contents=0x7f07001f;
|
||||
public static final int image_view=0x7f07001e;
|
||||
public static final int launch_product_query=0x7f070004;
|
||||
public static final int meta_text_view=0x7f070017;
|
||||
public static final int meta_text_view_label=0x7f070016;
|
||||
public static final int networkStatus=0x7f070022;
|
||||
public static final int page_number_view=0x7f070026;
|
||||
public static final int preview_view=0x7f07000c;
|
||||
public static final int query_button=0x7f070024;
|
||||
public static final int query_text_view=0x7f070023;
|
||||
public static final int quit=0x7f070005;
|
||||
public static final int restart_preview=0x7f070006;
|
||||
public static final int result_button_view=0x7f07001a;
|
||||
public static final int result_list_view=0x7f070025;
|
||||
public static final int result_view=0x7f07000e;
|
||||
public static final int return_scan_result=0x7f070007;
|
||||
public static final int search_book_contents_failed=0x7f070008;
|
||||
public static final int search_book_contents_succeeded=0x7f070009;
|
||||
public static final int share_app_button=0x7f070028;
|
||||
public static final int share_bookmark_button=0x7f070029;
|
||||
public static final int share_clipboard_button=0x7f07002b;
|
||||
public static final int share_contact_button=0x7f07002a;
|
||||
public static final int share_text_view=0x7f07002c;
|
||||
public static final int shopper_button=0x7f07001b;
|
||||
public static final int snippet_view=0x7f070027;
|
||||
public static final int status_view=0x7f07001c;
|
||||
public static final int time_text_view=0x7f070015;
|
||||
public static final int time_text_view_label=0x7f070014;
|
||||
public static final int type_text_view=0x7f070013;
|
||||
public static final int type_text_view_label=0x7f070012;
|
||||
public static final int viewfinder_view=0x7f07000d;
|
||||
public static int auto_focus=0x7f070000;
|
||||
public static int back_button=0x7f070020;
|
||||
public static int barcode_image_view=0x7f07000f;
|
||||
public static int bookmark_title=0x7f07000a;
|
||||
public static int bookmark_url=0x7f07000b;
|
||||
public static int contents_supplement_text_view=0x7f070019;
|
||||
public static int contents_text_view=0x7f070018;
|
||||
public static int decode=0x7f070001;
|
||||
public static int decode_failed=0x7f070002;
|
||||
public static int decode_succeeded=0x7f070003;
|
||||
public static int done_button=0x7f070021;
|
||||
public static int encode_view=0x7f07001d;
|
||||
public static int format_text_view=0x7f070011;
|
||||
public static int format_text_view_label=0x7f070010;
|
||||
public static int help_contents=0x7f07001f;
|
||||
public static int image_view=0x7f07001e;
|
||||
public static int launch_product_query=0x7f070004;
|
||||
public static int meta_text_view=0x7f070017;
|
||||
public static int meta_text_view_label=0x7f070016;
|
||||
public static int networkStatus=0x7f070022;
|
||||
public static int page_number_view=0x7f070026;
|
||||
public static int preview_view=0x7f07000c;
|
||||
public static int query_button=0x7f070024;
|
||||
public static int query_text_view=0x7f070023;
|
||||
public static int quit=0x7f070005;
|
||||
public static int restart_preview=0x7f070006;
|
||||
public static int result_button_view=0x7f07001a;
|
||||
public static int result_list_view=0x7f070025;
|
||||
public static int result_view=0x7f07000e;
|
||||
public static int return_scan_result=0x7f070007;
|
||||
public static int search_book_contents_failed=0x7f070008;
|
||||
public static int search_book_contents_succeeded=0x7f070009;
|
||||
public static int share_app_button=0x7f070028;
|
||||
public static int share_bookmark_button=0x7f070029;
|
||||
public static int share_clipboard_button=0x7f07002b;
|
||||
public static int share_contact_button=0x7f07002a;
|
||||
public static int share_text_view=0x7f07002c;
|
||||
public static int shopper_button=0x7f07001b;
|
||||
public static int snippet_view=0x7f070027;
|
||||
public static int status_view=0x7f07001c;
|
||||
public static int time_text_view=0x7f070015;
|
||||
public static int time_text_view_label=0x7f070014;
|
||||
public static int type_text_view=0x7f070013;
|
||||
public static int type_text_view_label=0x7f070012;
|
||||
public static int viewfinder_view=0x7f07000d;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int bookmark_picker_list_item=0x7f030000;
|
||||
public static final int capture=0x7f030001;
|
||||
public static final int encode=0x7f030002;
|
||||
public static final int help=0x7f030003;
|
||||
public static final int network=0x7f030004;
|
||||
public static final int search_book_contents=0x7f030005;
|
||||
public static final int search_book_contents_header=0x7f030006;
|
||||
public static final int search_book_contents_list_item=0x7f030007;
|
||||
public static final int share=0x7f030008;
|
||||
public static int bookmark_picker_list_item=0x7f030000;
|
||||
public static int capture=0x7f030001;
|
||||
public static int encode=0x7f030002;
|
||||
public static int help=0x7f030003;
|
||||
public static int network=0x7f030004;
|
||||
public static int search_book_contents=0x7f030005;
|
||||
public static int search_book_contents_header=0x7f030006;
|
||||
public static int search_book_contents_list_item=0x7f030007;
|
||||
public static int share=0x7f030008;
|
||||
}
|
||||
public static final class raw {
|
||||
public static final int beep=0x7f050000;
|
||||
public static int beep=0x7f050000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f080000;
|
||||
public static final int app_picker_name=0x7f080001;
|
||||
public static final int bookmark_picker_name=0x7f080002;
|
||||
public static final int button_add_calendar=0x7f080003;
|
||||
public static final int button_add_contact=0x7f080004;
|
||||
public static final int button_back=0x7f080005;
|
||||
public static final int button_book_search=0x7f080006;
|
||||
public static final int button_cancel=0x7f080007;
|
||||
public static final int button_clipboard_empty=0x7f080008;
|
||||
public static final int button_custom_product_search=0x7f080009;
|
||||
public static final int button_dial=0x7f08000a;
|
||||
public static final int button_done=0x7f08000b;
|
||||
public static final int button_email=0x7f08000c;
|
||||
public static final int button_get_directions=0x7f08000d;
|
||||
public static final int button_google_shopper=0x7f08000e;
|
||||
public static final int button_mms=0x7f08000f;
|
||||
public static final int button_ok=0x7f080010;
|
||||
public static final int button_open_browser=0x7f080011;
|
||||
public static final int button_product_search=0x7f080012;
|
||||
public static final int button_read_book=0x7f080013;
|
||||
public static final int button_search_book_contents=0x7f080014;
|
||||
public static final int button_share_app=0x7f080015;
|
||||
public static final int button_share_bookmark=0x7f080016;
|
||||
public static final int button_share_by_email=0x7f080017;
|
||||
public static final int button_share_by_sms=0x7f080018;
|
||||
public static final int button_share_clipboard=0x7f080019;
|
||||
public static final int button_share_contact=0x7f08001a;
|
||||
public static final int button_show_map=0x7f08001b;
|
||||
public static final int button_sms=0x7f08001c;
|
||||
public static final int button_web_search=0x7f08001d;
|
||||
public static final int button_wifi=0x7f08001e;
|
||||
public static final int contents_contact=0x7f08001f;
|
||||
public static final int contents_email=0x7f080020;
|
||||
public static final int contents_location=0x7f080021;
|
||||
public static final int contents_phone=0x7f080022;
|
||||
public static final int contents_sms=0x7f080023;
|
||||
public static final int contents_text=0x7f080024;
|
||||
public static final int history_clear_text=0x7f080025;
|
||||
public static final int history_email_title=0x7f080026;
|
||||
public static final int history_send=0x7f080027;
|
||||
public static final int history_title=0x7f080028;
|
||||
public static final int menu_about=0x7f080029;
|
||||
public static final int menu_help=0x7f08002a;
|
||||
public static final int menu_history=0x7f08002b;
|
||||
public static final int menu_settings=0x7f08002c;
|
||||
public static final int menu_share=0x7f08002d;
|
||||
public static final int msg_about=0x7f08002e;
|
||||
public static final int msg_buggy=0x7f08002f;
|
||||
public static final int msg_bulk_mode_scanned=0x7f080030;
|
||||
public static final int msg_camera_framework_bug=0x7f080031;
|
||||
public static final int msg_default_contents=0x7f080032;
|
||||
public static final int msg_default_format=0x7f080033;
|
||||
public static final int msg_default_meta=0x7f080034;
|
||||
public static final int msg_default_mms_subject=0x7f080035;
|
||||
public static final int msg_default_status=0x7f080036;
|
||||
public static final int msg_default_time=0x7f080037;
|
||||
public static final int msg_default_type=0x7f080038;
|
||||
public static final int msg_encode_barcode_failed=0x7f080039;
|
||||
public static final int msg_encode_contents_failed=0x7f08003a;
|
||||
public static final int msg_google_shopper_missing=0x7f08003b;
|
||||
public static final int msg_install_google_shopper=0x7f08003c;
|
||||
public static final int msg_intent_failed=0x7f08003d;
|
||||
public static final int msg_loading_apps=0x7f08003e;
|
||||
public static final int msg_not_our_results=0x7f08003f;
|
||||
public static final int msg_redirect=0x7f080040;
|
||||
public static final int msg_sbc_book_not_searchable=0x7f080041;
|
||||
public static final int msg_sbc_failed=0x7f080042;
|
||||
public static final int msg_sbc_no_page_returned=0x7f080043;
|
||||
public static final int msg_sbc_page=0x7f080044;
|
||||
public static final int msg_sbc_searching_book=0x7f080045;
|
||||
public static final int msg_sbc_snippet_unavailable=0x7f080046;
|
||||
public static final int msg_sbc_unknown_page=0x7f080047;
|
||||
public static final int msg_share_explanation=0x7f080048;
|
||||
public static final int msg_share_subject_line=0x7f080049;
|
||||
public static final int msg_share_text=0x7f08004a;
|
||||
public static final int msg_unmount_usb=0x7f08004b;
|
||||
public static final int preferences_actions_title=0x7f08004c;
|
||||
public static final int preferences_bulk_mode_summary=0x7f08004d;
|
||||
public static final int preferences_bulk_mode_title=0x7f08004e;
|
||||
public static final int preferences_copy_to_clipboard_title=0x7f08004f;
|
||||
public static final int preferences_custom_product_search_summary=0x7f080050;
|
||||
public static final int preferences_custom_product_search_title=0x7f080051;
|
||||
public static final int preferences_decode_1D_title=0x7f080052;
|
||||
public static final int preferences_decode_Data_Matrix_title=0x7f080053;
|
||||
public static final int preferences_decode_QR_title=0x7f080054;
|
||||
public static final int preferences_front_light_summary=0x7f080055;
|
||||
public static final int preferences_front_light_title=0x7f080056;
|
||||
public static final int preferences_general_title=0x7f080057;
|
||||
public static final int preferences_name=0x7f080058;
|
||||
public static final int preferences_play_beep_title=0x7f080059;
|
||||
public static final int preferences_remember_duplicates_summary=0x7f08005a;
|
||||
public static final int preferences_remember_duplicates_title=0x7f08005b;
|
||||
public static final int preferences_result_title=0x7f08005e;
|
||||
public static final int preferences_reverse_image_summary=0x7f08005c;
|
||||
public static final int preferences_reverse_image_title=0x7f08005d;
|
||||
public static final int preferences_scanning_title=0x7f08005f;
|
||||
public static final int preferences_supplemental_summary=0x7f080060;
|
||||
public static final int preferences_supplemental_title=0x7f080061;
|
||||
public static final int preferences_vibrate_title=0x7f080062;
|
||||
public static final int result_address_book=0x7f080063;
|
||||
public static final int result_calendar=0x7f080064;
|
||||
public static final int result_email_address=0x7f080065;
|
||||
public static final int result_geo=0x7f080066;
|
||||
public static final int result_isbn=0x7f080067;
|
||||
public static final int result_product=0x7f080068;
|
||||
public static final int result_sms=0x7f080069;
|
||||
public static final int result_tel=0x7f08006a;
|
||||
public static final int result_text=0x7f08006b;
|
||||
public static final int result_uri=0x7f08006c;
|
||||
public static final int result_wifi=0x7f08006d;
|
||||
public static final int sbc_name=0x7f08006e;
|
||||
public static final int share_name=0x7f08006f;
|
||||
public static final int title_about=0x7f080070;
|
||||
public static final int wa_name=0x7f080071;
|
||||
public static final int wifi_changing_network=0x7f080072;
|
||||
public static final int wifi_connect_failed=0x7f080078;
|
||||
public static final int wifi_connected=0x7f080073;
|
||||
public static final int wifi_creating_network=0x7f080074;
|
||||
public static final int wifi_modifying_network=0x7f080075;
|
||||
public static final int wifi_ssid_label=0x7f080079;
|
||||
public static final int wifi_ssid_missing=0x7f080076;
|
||||
public static final int wifi_type_incorrect=0x7f080077;
|
||||
public static final int wifi_type_label=0x7f08007a;
|
||||
public static final int zxing_url=0x7f08007b;
|
||||
public static int app_name=0x7f080000;
|
||||
public static int app_picker_name=0x7f080001;
|
||||
public static int bookmark_picker_name=0x7f080002;
|
||||
public static int button_add_calendar=0x7f080003;
|
||||
public static int button_add_contact=0x7f080004;
|
||||
public static int button_back=0x7f080005;
|
||||
public static int button_book_search=0x7f080006;
|
||||
public static int button_cancel=0x7f080007;
|
||||
public static int button_clipboard_empty=0x7f080008;
|
||||
public static int button_custom_product_search=0x7f080009;
|
||||
public static int button_dial=0x7f08000a;
|
||||
public static int button_done=0x7f08000b;
|
||||
public static int button_email=0x7f08000c;
|
||||
public static int button_get_directions=0x7f08000d;
|
||||
public static int button_google_shopper=0x7f08000e;
|
||||
public static int button_mms=0x7f08000f;
|
||||
public static int button_ok=0x7f080010;
|
||||
public static int button_open_browser=0x7f080011;
|
||||
public static int button_product_search=0x7f080012;
|
||||
public static int button_read_book=0x7f080013;
|
||||
public static int button_search_book_contents=0x7f080014;
|
||||
public static int button_share_app=0x7f080015;
|
||||
public static int button_share_bookmark=0x7f080016;
|
||||
public static int button_share_by_email=0x7f080017;
|
||||
public static int button_share_by_sms=0x7f080018;
|
||||
public static int button_share_clipboard=0x7f080019;
|
||||
public static int button_share_contact=0x7f08001a;
|
||||
public static int button_show_map=0x7f08001b;
|
||||
public static int button_sms=0x7f08001c;
|
||||
public static int button_web_search=0x7f08001d;
|
||||
public static int button_wifi=0x7f08001e;
|
||||
public static int contents_contact=0x7f08001f;
|
||||
public static int contents_email=0x7f080020;
|
||||
public static int contents_location=0x7f080021;
|
||||
public static int contents_phone=0x7f080022;
|
||||
public static int contents_sms=0x7f080023;
|
||||
public static int contents_text=0x7f080024;
|
||||
public static int history_clear_text=0x7f080025;
|
||||
public static int history_email_title=0x7f080026;
|
||||
public static int history_send=0x7f080027;
|
||||
public static int history_title=0x7f080028;
|
||||
public static int menu_about=0x7f080029;
|
||||
public static int menu_help=0x7f08002a;
|
||||
public static int menu_history=0x7f08002b;
|
||||
public static int menu_settings=0x7f08002c;
|
||||
public static int menu_share=0x7f08002d;
|
||||
public static int msg_about=0x7f08002e;
|
||||
public static int msg_buggy=0x7f08002f;
|
||||
public static int msg_bulk_mode_scanned=0x7f080030;
|
||||
public static int msg_camera_framework_bug=0x7f080031;
|
||||
public static int msg_default_contents=0x7f080032;
|
||||
public static int msg_default_format=0x7f080033;
|
||||
public static int msg_default_meta=0x7f080034;
|
||||
public static int msg_default_mms_subject=0x7f080035;
|
||||
public static int msg_default_status=0x7f080036;
|
||||
public static int msg_default_time=0x7f080037;
|
||||
public static int msg_default_type=0x7f080038;
|
||||
public static int msg_encode_barcode_failed=0x7f080039;
|
||||
public static int msg_encode_contents_failed=0x7f08003a;
|
||||
public static int msg_google_shopper_missing=0x7f08003b;
|
||||
public static int msg_install_google_shopper=0x7f08003c;
|
||||
public static int msg_intent_failed=0x7f08003d;
|
||||
public static int msg_loading_apps=0x7f08003e;
|
||||
public static int msg_not_our_results=0x7f08003f;
|
||||
public static int msg_redirect=0x7f080040;
|
||||
public static int msg_sbc_book_not_searchable=0x7f080041;
|
||||
public static int msg_sbc_failed=0x7f080042;
|
||||
public static int msg_sbc_no_page_returned=0x7f080043;
|
||||
public static int msg_sbc_page=0x7f080044;
|
||||
public static int msg_sbc_searching_book=0x7f080045;
|
||||
public static int msg_sbc_snippet_unavailable=0x7f080046;
|
||||
public static int msg_sbc_unknown_page=0x7f080047;
|
||||
public static int msg_share_explanation=0x7f080048;
|
||||
public static int msg_share_subject_line=0x7f080049;
|
||||
public static int msg_share_text=0x7f08004a;
|
||||
public static int msg_unmount_usb=0x7f08004b;
|
||||
public static int preferences_actions_title=0x7f08004c;
|
||||
public static int preferences_bulk_mode_summary=0x7f08004d;
|
||||
public static int preferences_bulk_mode_title=0x7f08004e;
|
||||
public static int preferences_copy_to_clipboard_title=0x7f08004f;
|
||||
public static int preferences_custom_product_search_summary=0x7f080050;
|
||||
public static int preferences_custom_product_search_title=0x7f080051;
|
||||
public static int preferences_decode_1D_title=0x7f080052;
|
||||
public static int preferences_decode_Data_Matrix_title=0x7f080053;
|
||||
public static int preferences_decode_QR_title=0x7f080054;
|
||||
public static int preferences_front_light_summary=0x7f080055;
|
||||
public static int preferences_front_light_title=0x7f080056;
|
||||
public static int preferences_general_title=0x7f080057;
|
||||
public static int preferences_name=0x7f080058;
|
||||
public static int preferences_play_beep_title=0x7f080059;
|
||||
public static int preferences_remember_duplicates_summary=0x7f08005a;
|
||||
public static int preferences_remember_duplicates_title=0x7f08005b;
|
||||
public static int preferences_result_title=0x7f08005e;
|
||||
public static int preferences_reverse_image_summary=0x7f08005c;
|
||||
public static int preferences_reverse_image_title=0x7f08005d;
|
||||
public static int preferences_scanning_title=0x7f08005f;
|
||||
public static int preferences_supplemental_summary=0x7f080060;
|
||||
public static int preferences_supplemental_title=0x7f080061;
|
||||
public static int preferences_vibrate_title=0x7f080062;
|
||||
public static int result_address_book=0x7f080063;
|
||||
public static int result_calendar=0x7f080064;
|
||||
public static int result_email_address=0x7f080065;
|
||||
public static int result_geo=0x7f080066;
|
||||
public static int result_isbn=0x7f080067;
|
||||
public static int result_product=0x7f080068;
|
||||
public static int result_sms=0x7f080069;
|
||||
public static int result_tel=0x7f08006a;
|
||||
public static int result_text=0x7f08006b;
|
||||
public static int result_uri=0x7f08006c;
|
||||
public static int result_wifi=0x7f08006d;
|
||||
public static int sbc_name=0x7f08006e;
|
||||
public static int share_name=0x7f08006f;
|
||||
public static int title_about=0x7f080070;
|
||||
public static int wa_name=0x7f080071;
|
||||
public static int wifi_changing_network=0x7f080072;
|
||||
public static int wifi_connect_failed=0x7f080078;
|
||||
public static int wifi_connected=0x7f080073;
|
||||
public static int wifi_creating_network=0x7f080074;
|
||||
public static int wifi_modifying_network=0x7f080075;
|
||||
public static int wifi_ssid_label=0x7f080079;
|
||||
public static int wifi_ssid_missing=0x7f080076;
|
||||
public static int wifi_type_incorrect=0x7f080077;
|
||||
public static int wifi_type_label=0x7f08007a;
|
||||
public static int zxing_url=0x7f08007b;
|
||||
}
|
||||
public static final class xml {
|
||||
public static final int preferences=0x7f040000;
|
||||
public static int preferences=0x7f040000;
|
||||
}
|
||||
public static final class styleable {
|
||||
/** Attributes that can be used with a ViewfinderView.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
android.library=true
|
||||
# Project target.
|
||||
target=android-16
|
||||
@@ -93,7 +93,7 @@ public final class BeepManager {
|
||||
}
|
||||
});
|
||||
|
||||
AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
|
||||
AssetFileDescriptor file = activity.getResources().openRawResourceFd(activity.getApplicationContext().getResources().getIdentifier("beep", "raw", activity.getApplicationContext().getPackageName()));
|
||||
try {
|
||||
mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
|
||||
file.close();
|
||||
|
||||
+54
-44
@@ -30,6 +30,7 @@ import com.google.zxing.client.android.share.ShareActivity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -128,11 +129,13 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
private HistoryManager historyManager;
|
||||
private InactivityTimer inactivityTimer;
|
||||
private BeepManager beepManager;
|
||||
private Context context;
|
||||
private String pkgName;
|
||||
|
||||
private final DialogInterface.OnClickListener aboutListener =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.zxing_url)));
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(getIdentifier("string", "zxing_url"))));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
startActivity(intent);
|
||||
}
|
||||
@@ -149,15 +152,18 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
|
||||
context = getApplicationContext();
|
||||
pkgName = context.getPackageName();
|
||||
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setContentView(R.layout.capture);
|
||||
setContentView(getIdentifier("layout", "capture"));
|
||||
|
||||
CameraManager.init(getApplication());
|
||||
viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
|
||||
resultView = findViewById(R.id.result_view);
|
||||
statusView = (TextView) findViewById(R.id.status_view);
|
||||
viewfinderView = (ViewfinderView) findViewById(getIdentifier("id", "viewfinder_view"));
|
||||
resultView = findViewById(getIdentifier("id", "result_view"));
|
||||
statusView = (TextView) findViewById(getIdentifier("id", "status_view"));
|
||||
handler = null;
|
||||
lastResult = null;
|
||||
hasSurface = false;
|
||||
@@ -168,13 +174,17 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
|
||||
// showHelpOnFirstLaunch();
|
||||
}
|
||||
|
||||
private int getIdentifier(String type, String name) {
|
||||
return context.getResources().getIdentifier(name, type, pkgName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
resetStatusView();
|
||||
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(getIdentifier("id", "preview_view"));
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
if (hasSurface) {
|
||||
// The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
@@ -263,7 +273,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
} else if ((source == Source.NONE || source == Source.ZXING_LINK) && lastResult != null) {
|
||||
resetStatusView();
|
||||
if (handler != null) {
|
||||
handler.sendEmptyMessage(R.id.restart_preview);
|
||||
handler.sendEmptyMessage(getIdentifier("id", "restart_preview"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -277,16 +287,16 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
menu.add(0, SHARE_ID, 0, R.string.menu_share)
|
||||
.setIcon(android.R.drawable.ic_menu_share);
|
||||
menu.add(0, HISTORY_ID, 0, R.string.menu_history)
|
||||
.setIcon(android.R.drawable.ic_menu_recent_history);
|
||||
menu.add(0, SETTINGS_ID, 0, R.string.menu_settings)
|
||||
.setIcon(android.R.drawable.ic_menu_preferences);
|
||||
menu.add(0, HELP_ID, 0, R.string.menu_help)
|
||||
.setIcon(android.R.drawable.ic_menu_help);
|
||||
menu.add(0, ABOUT_ID, 0, R.string.menu_about)
|
||||
.setIcon(android.R.drawable.ic_menu_info_details);
|
||||
menu.add(0, SHARE_ID, 0, getIdentifier("string", "menu_share"))
|
||||
.setIcon(getIdentifier("drawable", "ic_menu_share"));
|
||||
menu.add(0, HISTORY_ID, 0, getIdentifier("string", "menu_history"))
|
||||
.setIcon(getIdentifier("drawable", "ic_menu_recent_history"));
|
||||
menu.add(0, SETTINGS_ID, 0, getIdentifier("string", "menu_settings"))
|
||||
.setIcon(getIdentifier("drawable", "ic_menu_preferences"));
|
||||
menu.add(0, HELP_ID, 0, getIdentifier("string", "menu_help"))
|
||||
.setIcon(getIdentifier("drawable", "ic_menu_help"));
|
||||
menu.add(0, ABOUT_ID, 0, getIdentifier("string", "menu_about"))
|
||||
.setIcon(getIdentifier("drawable", "ic_menu_info_details"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -329,11 +339,11 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
case ABOUT_ID:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(getString(R.string.title_about) + versionName);
|
||||
builder.setMessage(getString(R.string.msg_about) + "\n\n" + getString(R.string.zxing_url));
|
||||
builder.setIcon(R.drawable.launcher_icon);
|
||||
builder.setPositiveButton(R.string.button_open_browser, aboutListener);
|
||||
builder.setNegativeButton(R.string.button_cancel, null);
|
||||
builder.setTitle(getString(getIdentifier("string", "title_about")) + versionName);
|
||||
builder.setMessage(getString(getIdentifier("string", "msg_about")) + "\n\n" + getString(getIdentifier("string", "zxing_url")));
|
||||
builder.setIcon(getIdentifier("drawable", "launcher_icon"));
|
||||
builder.setPositiveButton(getIdentifier("string", "button_open_browser"), aboutListener);
|
||||
builder.setNegativeButton(getIdentifier("string", "button_cancel"), null);
|
||||
builder.show();
|
||||
break;
|
||||
}
|
||||
@@ -388,10 +398,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
case NONE:
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
|
||||
Toast.makeText(this, R.string.msg_bulk_mode_scanned, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, getIdentifier("string", "msg_bulk_mode_scanned"), Toast.LENGTH_SHORT).show();
|
||||
// Wait a moment or else it will scan the same barcode continuously about 3 times
|
||||
if (handler != null) {
|
||||
handler.sendEmptyMessageDelayed(R.id.restart_preview, BULK_MODE_SCAN_DELAY_MS);
|
||||
handler.sendEmptyMessageDelayed(getIdentifier("id", "restart_preview"), BULK_MODE_SCAN_DELAY_MS);
|
||||
}
|
||||
resetStatusView();
|
||||
} else {
|
||||
@@ -413,13 +423,13 @@ 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_image_border));
|
||||
paint.setColor(getResources().getColor(getIdentifier("color", "result_image_border")));
|
||||
paint.setStrokeWidth(3.0f);
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
Rect border = new Rect(2, 2, barcode.getWidth() - 2, barcode.getHeight() - 2);
|
||||
canvas.drawRect(border, paint);
|
||||
|
||||
paint.setColor(getResources().getColor(R.color.result_points));
|
||||
paint.setColor(getResources().getColor(getIdentifier("color", "result_points")));
|
||||
if (points.length == 2) {
|
||||
paint.setStrokeWidth(4.0f);
|
||||
drawLine(canvas, paint, points[0], points[1]);
|
||||
@@ -448,28 +458,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(getIdentifier("id", "barcode_image_view"));
|
||||
if (barcode == null) {
|
||||
barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
|
||||
R.drawable.launcher_icon));
|
||||
getIdentifier("drawable", "launcher_icon")));
|
||||
} else {
|
||||
barcodeImageView.setImageBitmap(barcode);
|
||||
}
|
||||
|
||||
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
|
||||
TextView formatTextView = (TextView) findViewById(getIdentifier("id", "format_text_view"));
|
||||
formatTextView.setText(rawResult.getBarcodeFormat().toString());
|
||||
|
||||
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
|
||||
TextView typeTextView = (TextView) findViewById(getIdentifier("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(getIdentifier("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(getIdentifier("id", "meta_text_view"));
|
||||
View metaTextViewLabel = findViewById(getIdentifier("id", "meta_text_view_label"));
|
||||
metaTextView.setVisibility(View.GONE);
|
||||
metaTextViewLabel.setVisibility(View.GONE);
|
||||
Map<ResultMetadataType,Object> metadata =
|
||||
@@ -489,14 +499,14 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
}
|
||||
|
||||
TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
|
||||
TextView contentsTextView = (TextView) findViewById(getIdentifier("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(getIdentifier("id", "contents_supplement_text_view"));
|
||||
supplementTextView.setText("");
|
||||
supplementTextView.setOnClickListener(null);
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
|
||||
@@ -506,7 +516,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(getIdentifier("id", "result_button_view"));
|
||||
buttonView.requestFocus();
|
||||
for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
|
||||
TextView button = (TextView) buttonView.getChildAt(x);
|
||||
@@ -550,13 +560,13 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
if (rawBytes != null && rawBytes.length > 0) {
|
||||
intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
|
||||
}
|
||||
Message message = Message.obtain(handler, R.id.return_scan_result);
|
||||
Message message = Message.obtain(handler, getIdentifier("id", "return_scan_result"));
|
||||
message.obj = intent;
|
||||
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);
|
||||
} else if (source == Source.PRODUCT_SEARCH_LINK) {
|
||||
// Reformulate the URL which triggered us into a query, so that the request goes to the same
|
||||
// TLD as the scan URL.
|
||||
Message message = Message.obtain(handler, R.id.launch_product_query);
|
||||
Message message = Message.obtain(handler, getIdentifier("id", "launch_product_query"));
|
||||
int end = sourceUrl.lastIndexOf("/scan");
|
||||
message.obj = sourceUrl.substring(0, end) + "?q=" +
|
||||
resultHandler.getDisplayContents().toString() + "&source=zxing";
|
||||
@@ -564,7 +574,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
} else if (source == Source.ZXING_LINK) {
|
||||
// Replace each occurrence of RETURN_CODE_PLACEHOLDER in the returnUrlTemplate
|
||||
// with the scanned code. This allows both queries and REST-style URLs to work.
|
||||
Message message = Message.obtain(handler, R.id.launch_product_query);
|
||||
Message message = Message.obtain(handler, getIdentifier("id", "launch_product_query"));
|
||||
message.obj = returnUrlTemplate.replace(RETURN_CODE_PLACEHOLDER,
|
||||
resultHandler.getDisplayContents().toString());
|
||||
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);
|
||||
@@ -621,16 +631,16 @@ 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(getIdentifier("string", "app_name")));
|
||||
builder.setMessage(getString(getIdentifier("string", "msg_camera_framework_bug")));
|
||||
builder.setPositiveButton(getIdentifier("string", "button_ok"), new FinishListener(this));
|
||||
builder.setOnCancelListener(new FinishListener(this));
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private void resetStatusView() {
|
||||
resultView.setVisibility(View.GONE);
|
||||
statusView.setText(R.string.msg_default_status);
|
||||
statusView.setText(getIdentifier("string", "msg_default_status"));
|
||||
statusView.setVisibility(View.VISIBLE);
|
||||
viewfinderView.setVisibility(View.VISIBLE);
|
||||
lastResult = null;
|
||||
|
||||
+13
-13
@@ -65,32 +65,32 @@ public final class CaptureActivityHandler extends Handler {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
if (message.what == R.id.auto_focus) {
|
||||
if (message.what == activity.getApplicationContext().getResources().getIdentifier("auto_focus", "id", activity.getApplicationContext().getPackageName())) {
|
||||
//Log.d(TAG, "Got auto-focus message");
|
||||
// When one auto focus pass finishes, start another. This is the closest thing to
|
||||
// continuous AF. It does seem to hunt a bit, but I'm not sure what else to do.
|
||||
if (state == State.PREVIEW) {
|
||||
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
|
||||
CameraManager.get().requestAutoFocus(this, activity.getApplicationContext().getResources().getIdentifier("auto_focus", "id", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
} else if (message.what == R.id.restart_preview) {
|
||||
} else if (message.what == activity.getApplicationContext().getResources().getIdentifier("restart_preview", "id", activity.getApplicationContext().getPackageName())) {
|
||||
Log.d(TAG, "Got restart preview message");
|
||||
restartPreviewAndDecode();
|
||||
} else if (message.what == R.id.decode_succeeded) {
|
||||
} else if (message.what == activity.getApplicationContext().getResources().getIdentifier("decode_succeeded", "id", activity.getApplicationContext().getPackageName())) {
|
||||
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 == activity.getApplicationContext().getResources().getIdentifier("decode_failed", "id", activity.getApplicationContext().getPackageName())) {
|
||||
// We're decoding as fast as possible, so when one decode fails, start another.
|
||||
state = State.PREVIEW;
|
||||
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
||||
} else if (message.what == R.id.return_scan_result) {
|
||||
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), activity.getApplicationContext().getResources().getIdentifier("decode", "id", activity.getApplicationContext().getPackageName()));
|
||||
} else if (message.what == activity.getApplicationContext().getResources().getIdentifier("return_scan_result", "id", activity.getApplicationContext().getPackageName())) {
|
||||
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 == activity.getApplicationContext().getResources().getIdentifier("launch_product_query", "id", activity.getApplicationContext().getPackageName())) {
|
||||
Log.d(TAG, "Got product query message");
|
||||
String url = (String) message.obj;
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
@@ -102,7 +102,7 @@ public final class CaptureActivityHandler extends Handler {
|
||||
public void quitSynchronously() {
|
||||
state = State.DONE;
|
||||
CameraManager.get().stopPreview();
|
||||
Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
|
||||
Message quit = Message.obtain(decodeThread.getHandler(), activity.getApplicationContext().getResources().getIdentifier("quit", "id", activity.getApplicationContext().getPackageName()));
|
||||
quit.sendToTarget();
|
||||
try {
|
||||
decodeThread.join();
|
||||
@@ -111,15 +111,15 @@ 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(activity.getApplicationContext().getResources().getIdentifier("decode_succeeded", "id", activity.getApplicationContext().getPackageName()));
|
||||
removeMessages(activity.getApplicationContext().getResources().getIdentifier("decode_failed", "id", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
|
||||
private void restartPreviewAndDecode() {
|
||||
if (state == State.SUCCESS) {
|
||||
state = State.PREVIEW;
|
||||
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
||||
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
|
||||
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), activity.getApplicationContext().getResources().getIdentifier("decode", "id", activity.getApplicationContext().getPackageName()));
|
||||
CameraManager.get().requestAutoFocus(this, activity.getApplicationContext().getResources().getIdentifier("auto_focus", "id", activity.getApplicationContext().getPackageName()));
|
||||
activity.drawViewfinder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ final class DecodeHandler extends Handler {
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
if (message.what == R.id.decode) {
|
||||
if (message.what == activity.getApplicationContext().getResources().getIdentifier("decode", "id", activity.getApplicationContext().getPackageName())) {
|
||||
decode((byte[]) message.obj, message.arg1, message.arg2);
|
||||
} else if (message.what == R.id.quit) {
|
||||
} else if (message.what == activity.getApplicationContext().getResources().getIdentifier("quit", "id", activity.getApplicationContext().getPackageName())) {
|
||||
running = false;
|
||||
Looper.myLooper().quit();
|
||||
}
|
||||
@@ -84,13 +84,13 @@ final class DecodeHandler extends Handler {
|
||||
// Don't log the barcode contents for security.
|
||||
long end = System.currentTimeMillis();
|
||||
Log.d(TAG, "Found barcode in " + (end - start) + " ms");
|
||||
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult);
|
||||
Message message = Message.obtain(activity.getHandler(), activity.getApplicationContext().getResources().getIdentifier("decode_succeeded", "id", activity.getApplicationContext().getPackageName()), rawResult);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
|
||||
message.setData(bundle);
|
||||
message.sendToTarget();
|
||||
} else {
|
||||
Message message = Message.obtain(activity.getHandler(), R.id.decode_failed);
|
||||
Message message = Message.obtain(activity.getHandler(), activity.getApplicationContext().getResources().getIdentifier("decode_failed", "id", activity.getApplicationContext().getPackageName()));
|
||||
message.sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,9 +86,9 @@ public final class HelpActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.help);
|
||||
setContentView(getApplicationContext().getResources().getIdentifier("help", "layout", getApplicationContext().getPackageName()));
|
||||
|
||||
webView = (WebView)findViewById(R.id.help_contents);
|
||||
webView = (WebView)findViewById(getApplicationContext().getResources().getIdentifier("help_contents", "id", getApplicationContext().getPackageName()));
|
||||
webView.setWebViewClient(new HelpClient());
|
||||
|
||||
// Froyo has a bug with calling onCreate() twice in a row, which causes the What's New page
|
||||
@@ -108,9 +108,9 @@ public final class HelpActivity extends Activity {
|
||||
webView.loadUrl(BASE_URL + DEFAULT_PAGE);
|
||||
}
|
||||
|
||||
backButton = (Button) findViewById(R.id.back_button);
|
||||
backButton = (Button) findViewById(getApplicationContext().getResources().getIdentifier("back_button", "id", getApplicationContext().getPackageName()));
|
||||
backButton.setOnClickListener(backListener);
|
||||
View doneButton = findViewById(R.id.done_button);
|
||||
View doneButton = findViewById(getApplicationContext().getResources().getIdentifier("done_button", "id", getApplicationContext().getPackageName()));
|
||||
doneButton.setOnClickListener(doneListener);
|
||||
|
||||
if (!initialized) {
|
||||
@@ -126,9 +126,9 @@ public final class HelpActivity extends Activity {
|
||||
for (String buggyModelSubstring : BUGGY_MODEL_SUBSTRINGS) {
|
||||
if (model.contains(buggyModelSubstring)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(R.string.msg_buggy);
|
||||
builder.setPositiveButton(R.string.button_ok, groupsListener);
|
||||
builder.setNegativeButton(R.string.button_cancel, null);
|
||||
builder.setMessage(getApplicationContext().getResources().getIdentifier("msg_buggy", "string", getApplicationContext().getPackageName()));
|
||||
builder.setPositiveButton(getApplicationContext().getResources().getIdentifier("button_ok", "string", getApplicationContext().getPackageName()), groupsListener);
|
||||
builder.setNegativeButton(getApplicationContext().getResources().getIdentifier("button_cancel", "string", getApplicationContext().getPackageName()), null);
|
||||
builder.show();
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public final class PreferencesActivity extends PreferenceActivity
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
addPreferencesFromResource(getApplicationContext().getResources().getIdentifier("preferences", "xml", getApplicationContext().getPackageName()));
|
||||
|
||||
PreferenceScreen preferences = getPreferenceScreen();
|
||||
preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
@@ -62,11 +62,13 @@ public final class ViewfinderView extends View {
|
||||
// Initialize these once for performance rather than calling them every time in onDraw().
|
||||
paint = new Paint();
|
||||
Resources resources = getResources();
|
||||
maskColor = resources.getColor(R.color.viewfinder_mask);
|
||||
resultColor = resources.getColor(R.color.result_view);
|
||||
frameColor = resources.getColor(R.color.viewfinder_frame);
|
||||
laserColor = resources.getColor(R.color.viewfinder_laser);
|
||||
resultPointColor = resources.getColor(R.color.possible_result_points);
|
||||
Resources appRes = context.getResources();
|
||||
String pkgName = context.getPackageName();
|
||||
maskColor = resources.getColor(appRes.getIdentifier("viewfinder_mask", "color", pkgName));
|
||||
resultColor = resources.getColor(appRes.getIdentifier("result_view", "color", pkgName));
|
||||
frameColor = resources.getColor(appRes.getIdentifier("viewfinder_frame", "color", pkgName));
|
||||
laserColor = resources.getColor(appRes.getIdentifier("viewfinder_laser", "color", pkgName));
|
||||
resultPointColor = resources.getColor(appRes.getIdentifier("possible_result_points", "color", pkgName));
|
||||
scannerAlpha = 0;
|
||||
possibleResultPoints = new ArrayList<ResultPoint>(5);
|
||||
lastPossibleResultPoints = null;
|
||||
|
||||
+31
-20
@@ -17,6 +17,7 @@
|
||||
package com.google.zxing.client.android.book;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -74,16 +75,18 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
private Button queryButton;
|
||||
private ListView resultListView;
|
||||
private TextView headerView;
|
||||
private static Context context;
|
||||
private static String pkgName;
|
||||
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
if (message.what == R.id.search_book_contents_succeeded) {
|
||||
if (message.what == getIdentifier("id", "search_book_contents_succeeded")) {
|
||||
handleSearchResults((JSONObject) message.obj);
|
||||
resetForNewQuery();
|
||||
} else if (message.what == R.id.search_book_contents_failed) {
|
||||
} else if (message.what == getIdentifier("id", "search_book_contents_failed")) {
|
||||
resetForNewQuery();
|
||||
headerView.setText(R.string.msg_sbc_failed);
|
||||
headerView.setText(getIdentifier("string", "msg_sbc_failed"));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -108,9 +111,17 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
return isbn;
|
||||
}
|
||||
|
||||
|
||||
private static int getIdentifier(String type, String name) {
|
||||
return context.getResources().getIdentifier(name, type, pkgName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
context = getApplicationContext();
|
||||
pkgName = context.getPackageName();
|
||||
|
||||
// Make sure that expired cookies are removed on launch.
|
||||
CookieSyncManager.createInstance(this);
|
||||
@@ -124,13 +135,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(getIdentifier("string", "sbc_name")));
|
||||
} else {
|
||||
setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
|
||||
setTitle(getString(getIdentifier("string", "sbc_name")) + ": ISBN " + isbn);
|
||||
}
|
||||
|
||||
setContentView(R.layout.search_book_contents);
|
||||
queryTextView = (EditText) findViewById(R.id.query_text_view);
|
||||
setContentView(getIdentifier("layout", "search_book_contents"));
|
||||
queryTextView = (EditText) findViewById(getIdentifier("id", "query_text_view"));
|
||||
|
||||
String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
|
||||
if (initialQuery != null && initialQuery.length() > 0) {
|
||||
@@ -139,12 +150,12 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
}
|
||||
queryTextView.setOnKeyListener(keyListener);
|
||||
|
||||
queryButton = (Button) findViewById(R.id.query_button);
|
||||
queryButton = (Button) findViewById(getIdentifier("id", "query_button"));
|
||||
queryButton.setOnClickListener(buttonListener);
|
||||
|
||||
resultListView = (ListView) findViewById(R.id.result_list_view);
|
||||
resultListView = (ListView) findViewById(getIdentifier("id", "result_list_view"));
|
||||
LayoutInflater factory = LayoutInflater.from(this);
|
||||
headerView = (TextView) factory.inflate(R.layout.search_book_contents_header,
|
||||
headerView = (TextView) factory.inflate(getIdentifier("layout", "search_book_contents_header"),
|
||||
resultListView, false);
|
||||
resultListView.addHeaderView(headerView);
|
||||
}
|
||||
@@ -168,7 +179,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
if (query != null && query.length() > 0) {
|
||||
networkThread = new NetworkThread(isbn, query, handler);
|
||||
networkThread.start();
|
||||
headerView.setText(R.string.msg_sbc_searching_book);
|
||||
headerView.setText(getIdentifier("string", "msg_sbc_searching_book"));
|
||||
resultListView.setAdapter(null);
|
||||
queryTextView.setEnabled(false);
|
||||
queryButton.setEnabled(false);
|
||||
@@ -194,14 +205,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(getIdentifier("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(getIdentifier("string", "msg_sbc_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,10 +222,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(getIdentifier("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(getIdentifier("string", "msg_sbc_unknown_page"));
|
||||
}
|
||||
|
||||
// Remove all HTML tags and encoded characters. Ideally the server would do this.
|
||||
@@ -227,13 +238,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(getIdentifier("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(getIdentifier("string", "msg_sbc_no_page_returned")), "", "", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,17 +288,17 @@ public final class SearchBookContentsActivity extends Activity {
|
||||
JSONObject json = new JSONObject(jsonHolder.toString(getEncoding(entity)));
|
||||
jsonHolder.close();
|
||||
|
||||
Message message = Message.obtain(handler, R.id.search_book_contents_succeeded);
|
||||
Message message = Message.obtain(handler, getIdentifier("id", "search_book_contents_succeeded"));
|
||||
message.obj = json;
|
||||
message.sendToTarget();
|
||||
} else {
|
||||
Log.w(TAG, "HTTP returned " + response.getStatusLine().getStatusCode() + " for " + uri);
|
||||
Message message = Message.obtain(handler, R.id.search_book_contents_failed);
|
||||
Message message = Message.obtain(handler, getIdentifier("id", "search_book_contents_failed"));
|
||||
message.sendToTarget();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error accessing book search", e);
|
||||
Message message = Message.obtain(handler, R.id.search_book_contents_failed);
|
||||
Message message = Message.obtain(handler, getIdentifier("id", "search_book_contents_failed"));
|
||||
message.sendToTarget();
|
||||
} finally {
|
||||
if (client != null) {
|
||||
|
||||
+4
-4
@@ -24,8 +24,6 @@ import android.widget.ArrayAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.zxing.client.android.R;
|
||||
|
||||
/**
|
||||
* Manufactures list items which represent SBC results.
|
||||
*
|
||||
@@ -33,8 +31,10 @@ import com.google.zxing.client.android.R;
|
||||
*/
|
||||
final class SearchBookContentsAdapter extends ArrayAdapter<SearchBookContentsResult> {
|
||||
|
||||
private Context context;
|
||||
SearchBookContentsAdapter(Context context, List<SearchBookContentsResult> items) {
|
||||
super(context, R.layout.search_book_contents_list_item, 0, items);
|
||||
super(context, context.getResources().getIdentifier("search_book_contents_list_item", "layout", context.getPackageName()), 0, items);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,7 +44,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);
|
||||
context.getResources().getIdentifier("search_book_contents_list_item", "layout", context.getPackageName()), viewGroup, false);
|
||||
} else {
|
||||
if (view instanceof SearchBookContentsListItem) {
|
||||
listItem = (SearchBookContentsListItem) view;
|
||||
|
||||
+5
-2
@@ -35,20 +35,23 @@ import android.widget.TextView;
|
||||
public final class SearchBookContentsListItem extends LinearLayout {
|
||||
private TextView pageNumberView;
|
||||
private TextView snippetView;
|
||||
private Context context;
|
||||
|
||||
SearchBookContentsListItem(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public SearchBookContentsListItem(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
pageNumberView = (TextView) findViewById(R.id.page_number_view);
|
||||
snippetView = (TextView) findViewById(R.id.snippet_view);
|
||||
pageNumberView = (TextView) findViewById(context.getResources().getIdentifier("page_number_view", "id", context.getPackageName()));
|
||||
snippetView = (TextView) findViewById(context.getResources().getIdentifier("snippet_view", "id", context.getPackageName()));
|
||||
}
|
||||
|
||||
public void set(SearchBookContentsResult result) {
|
||||
|
||||
+14
-11
@@ -25,6 +25,7 @@ import com.google.zxing.client.android.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
@@ -54,16 +55,18 @@ public final class EncodeActivity extends Activity {
|
||||
private static final int MAX_BARCODE_FILENAME_LENGTH = 24;
|
||||
|
||||
private QRCodeEncoder qrCodeEncoder;
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
context = getApplicationContext();
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
String action = intent.getAction();
|
||||
if (action.equals(Intents.Encode.ACTION) || action.equals(Intent.ACTION_SEND)) {
|
||||
setContentView(R.layout.encode);
|
||||
setContentView(context.getResources().getIdentifier("encode", "layout", context.getPackageName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +76,7 @@ public final class EncodeActivity extends Activity {
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
menu.add(0, Menu.FIRST, 0, R.string.menu_share).setIcon(android.R.drawable.ic_menu_share);
|
||||
menu.add(0, Menu.FIRST, 0, context.getResources().getIdentifier("menu_share", "string", context.getPackageName())).setIcon(context.getResources().getIdentifier("ic_menu_share", "drawable", context.getPackageName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,7 +100,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(context.getResources().getIdentifier("msg_unmount_usb", "string", context.getPackageName()));
|
||||
return true;
|
||||
}
|
||||
File barcodeFile = new File(barcodesRoot, makeBarcodeFileName(contents) + ".png");
|
||||
@@ -108,7 +111,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(context.getResources().getIdentifier("msg_unmount_usb", "string", context.getPackageName()));
|
||||
return true;
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
@@ -121,7 +124,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) + " - " +
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, getString(context.getResources().getIdentifier("app_name", "string", context.getPackageName())) + " - " +
|
||||
qrCodeEncoder.getTitle());
|
||||
intent.putExtra(Intent.EXTRA_TEXT, qrCodeEncoder.getContents());
|
||||
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + barcodeFile.getAbsolutePath()));
|
||||
@@ -159,19 +162,19 @@ public final class EncodeActivity extends Activity {
|
||||
Intent intent = getIntent();
|
||||
try {
|
||||
qrCodeEncoder = new QRCodeEncoder(this, intent, smallerDimension);
|
||||
setTitle(getString(R.string.app_name) + " - " + qrCodeEncoder.getTitle());
|
||||
setTitle(getString(context.getResources().getIdentifier("app_name", "string", context.getPackageName())) + " - " + qrCodeEncoder.getTitle());
|
||||
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
|
||||
ImageView view = (ImageView) findViewById(R.id.image_view);
|
||||
ImageView view = (ImageView) findViewById(context.getResources().getIdentifier("image_view", "id", context.getPackageName()));
|
||||
view.setImageBitmap(bitmap);
|
||||
TextView contents = (TextView) findViewById(R.id.contents_text_view);
|
||||
TextView contents = (TextView) findViewById(context.getResources().getIdentifier("contents_text_view", "id", context.getPackageName()));
|
||||
contents.setText(qrCodeEncoder.getDisplayContents());
|
||||
} catch (WriterException e) {
|
||||
Log.e(TAG, "Could not encode barcode", e);
|
||||
showErrorMessage(R.string.msg_encode_contents_failed);
|
||||
showErrorMessage(context.getResources().getIdentifier("msg_encode_contents_failed", "string", context.getPackageName()));
|
||||
qrCodeEncoder = null;
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(TAG, "Could not encode barcode", e);
|
||||
showErrorMessage(R.string.msg_encode_contents_failed);
|
||||
showErrorMessage(context.getResources().getIdentifier("msg_encode_contents_failed", "string", context.getPackageName()));
|
||||
qrCodeEncoder = null;
|
||||
}
|
||||
}
|
||||
@@ -179,7 +182,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(context.getResources().getIdentifier("button_ok", "string", context.getPackageName()), new FinishListener(this));
|
||||
builder.setOnCancelListener(new FinishListener(this));
|
||||
builder.show();
|
||||
}
|
||||
|
||||
+9
-9
@@ -117,7 +117,7 @@ final class QRCodeEncoder {
|
||||
if (data != null && data.length() > 0) {
|
||||
contents = data;
|
||||
displayContents = data;
|
||||
title = activity.getString(R.string.contents_text);
|
||||
title = activity.getString(activity.getApplicationContext().getResources().getIdentifier("contents_text", "string", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
}
|
||||
return contents != null && contents.length() > 0;
|
||||
@@ -154,7 +154,7 @@ final class QRCodeEncoder {
|
||||
} else {
|
||||
displayContents = contents;
|
||||
}
|
||||
title = activity.getString(R.string.contents_text);
|
||||
title = activity.getString(activity.getApplicationContext().getResources().getIdentifier("contents_text", "string", activity.getApplicationContext().getPackageName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -206,28 +206,28 @@ final class QRCodeEncoder {
|
||||
if (data != null && data.length() > 0) {
|
||||
contents = data;
|
||||
displayContents = data;
|
||||
title = activity.getString(R.string.contents_text);
|
||||
title = activity.getString(activity.getApplicationContext().getResources().getIdentifier("contents_text", "string", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.EMAIL)) {
|
||||
String data = trim(intent.getStringExtra(Intents.Encode.DATA));
|
||||
if (data != null) {
|
||||
contents = "mailto:" + data;
|
||||
displayContents = data;
|
||||
title = activity.getString(R.string.contents_email);
|
||||
title = activity.getString(activity.getApplicationContext().getResources().getIdentifier("contents_email", "string", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.PHONE)) {
|
||||
String data = 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(activity.getApplicationContext().getResources().getIdentifier("contents_phone", "string", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.SMS)) {
|
||||
String data = 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(activity.getApplicationContext().getResources().getIdentifier("contents_sms", "string", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
} else if (type.equals(Contents.Type.CONTACT)) {
|
||||
Bundle bundle = intent.getBundleExtra(Intents.Encode.DATA);
|
||||
@@ -264,7 +264,7 @@ final class QRCodeEncoder {
|
||||
newContents.append(';');
|
||||
contents = newContents.toString();
|
||||
displayContents = newDisplayContents.toString();
|
||||
title = activity.getString(R.string.contents_contact);
|
||||
title = activity.getString(activity.getApplicationContext().getResources().getIdentifier("contents_contact", "string", activity.getApplicationContext().getPackageName()));
|
||||
} else {
|
||||
contents = null;
|
||||
displayContents = null;
|
||||
@@ -279,7 +279,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(activity.getApplicationContext().getResources().getIdentifier("contents_location", "string", activity.getApplicationContext().getPackageName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,7 +337,7 @@ final class QRCodeEncoder {
|
||||
newContents.append(';');
|
||||
contents = newContents.toString();
|
||||
displayContents = newDisplayContents.toString();
|
||||
title = activity.getString(R.string.contents_contact);
|
||||
title = activity.getString(activity.getApplicationContext().getResources().getIdentifier("contents_contact", "string", activity.getApplicationContext().getPackageName()));
|
||||
return true;
|
||||
} else {
|
||||
contents = null;
|
||||
|
||||
+4
-4
@@ -53,14 +53,14 @@ final class HistoryClickListener implements DialogInterface.OnClickListener {
|
||||
Uri historyFile = HistoryManager.saveHistory(history.toString());
|
||||
if (historyFile == null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setMessage(R.string.msg_unmount_usb);
|
||||
builder.setPositiveButton(R.string.button_ok, null);
|
||||
builder.setMessage(activity.getApplicationContext().getResources().getIdentifier("msg_unmount_usb", "string", activity.getApplicationContext().getPackageName()));
|
||||
builder.setPositiveButton(activity.getApplicationContext().getResources().getIdentifier("button_ok", "string", activity.getApplicationContext().getPackageName()), null);
|
||||
builder.show();
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:"));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
String subject = activity.getResources().getString(R.string.history_email_title);
|
||||
String subject = activity.getResources().getString(activity.getApplicationContext().getResources().getIdentifier("history_email_title", "string", activity.getApplicationContext().getPackageName()));
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, subject);
|
||||
intent.putExtra(Intent.EXTRA_STREAM, historyFile);
|
||||
@@ -72,7 +72,7 @@ final class HistoryClickListener implements DialogInterface.OnClickListener {
|
||||
} else {
|
||||
// Display a single history entry.
|
||||
Result result = items.get(i);
|
||||
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, result);
|
||||
Message message = Message.obtain(activity.getHandler(), activity.getApplicationContext().getResources().getIdentifier("decode_succeeded", "id", activity.getApplicationContext().getPackageName()), result);
|
||||
message.sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -111,11 +111,11 @@ public final class HistoryManager {
|
||||
}
|
||||
|
||||
Resources res = activity.getResources();
|
||||
dialogItems.add(res.getString(R.string.history_send));
|
||||
dialogItems.add(res.getString(R.string.history_clear_text));
|
||||
dialogItems.add(res.getString(activity.getApplicationContext().getResources().getIdentifier("history_send", "string", activity.getApplicationContext().getPackageName())));
|
||||
dialogItems.add(res.getString(activity.getApplicationContext().getResources().getIdentifier("history_clear_text", "string", activity.getApplicationContext().getPackageName())));
|
||||
DialogInterface.OnClickListener clickListener = new HistoryClickListener(this, activity, items);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(R.string.history_title);
|
||||
builder.setTitle(activity.getApplicationContext().getResources().getIdentifier("history_title", "string", activity.getApplicationContext().getPackageName()));
|
||||
builder.setItems(dialogItems.toArray(new String[dialogItems.size()]), clickListener);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
+5
-5
@@ -99,13 +99,13 @@ public final class AddressBookResultHandler extends ResultHandler {
|
||||
int action = mapIndexToAction(index);
|
||||
switch (action) {
|
||||
case 0:
|
||||
return R.string.button_add_contact;
|
||||
return getIdentifier("string", "button_add_contact");
|
||||
case 1:
|
||||
return R.string.button_show_map;
|
||||
return getIdentifier("string", "button_show_map");
|
||||
case 2:
|
||||
return R.string.button_dial;
|
||||
return getIdentifier("string", "button_dial");
|
||||
case 3:
|
||||
return R.string.button_email;
|
||||
return getIdentifier("string", "button_email");
|
||||
default:
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
@@ -201,6 +201,6 @@ public final class AddressBookResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_address_book;
|
||||
return getIdentifier("string", "result_address_book");
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -39,12 +39,11 @@ public final class CalendarResultHandler extends ResultHandler {
|
||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
|
||||
private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
|
||||
|
||||
private static final int[] buttons = {
|
||||
R.string.button_add_calendar
|
||||
};
|
||||
private static final int[] buttons = new int[1];
|
||||
|
||||
public CalendarResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons[0] = getIdentifier("string", "button_add_calendar");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,6 +114,6 @@ public final class CalendarResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_calendar;
|
||||
return getIdentifier("string", "result_calendar");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -28,13 +28,12 @@ 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 final int[] buttons = new int[2];
|
||||
|
||||
public EmailAddressResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons[0] = getIdentifier("string", "button_email");
|
||||
buttons[1] = getIdentifier("string", "button_add_contact");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +66,6 @@ public final class EmailAddressResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_email_address;
|
||||
return getIdentifier("string", "result_email_address");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -28,13 +28,12 @@ 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 final int[] buttons = new int[2];
|
||||
|
||||
public GeoResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons[0] = getIdentifier("string", "button_show_map");
|
||||
buttons[1] = getIdentifier("string", "button_get_directions");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +61,6 @@ public final class GeoResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_geo;
|
||||
return getIdentifier("string", "result_geo");
|
||||
}
|
||||
}
|
||||
|
||||
+8
-7
@@ -32,15 +32,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 final int[] buttons = new int[4];
|
||||
|
||||
public ISBNResultHandler(Activity activity, ParsedResult result, Result rawResult) {
|
||||
super(activity, result, rawResult);
|
||||
|
||||
buttons[0] = getIdentifier("string", "button_product_search");
|
||||
buttons[1] = getIdentifier("string", "button_book_search");
|
||||
buttons[2] = getIdentifier("string", "button_search_book_contents");
|
||||
buttons[3] = getIdentifier("string", "button_custom_product_search");
|
||||
|
||||
showGoogleShopperButton(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
ISBNParsedResult isbnResult = (ISBNParsedResult) getResult();
|
||||
@@ -84,6 +85,6 @@ public final class ISBNResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_isbn;
|
||||
return getIdentifier("string", "result_isbn");
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -32,14 +32,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 final int[] buttons = new int[3];
|
||||
|
||||
public ProductResultHandler(Activity activity, ParsedResult result, Result rawResult) {
|
||||
super(activity, result, rawResult);
|
||||
|
||||
buttons[0] = getIdentifier("string", "button_product_search");
|
||||
buttons[1] = getIdentifier("string", "button_web_search");
|
||||
buttons[2] = getIdentifier("string", "button_custom_product_search");
|
||||
|
||||
showGoogleShopperButton(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
ProductParsedResult productResult = (ProductParsedResult) getResult();
|
||||
@@ -80,6 +81,6 @@ public final class ProductResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_product;
|
||||
return getIdentifier("string", "result_product");
|
||||
}
|
||||
}
|
||||
|
||||
+24
-15
@@ -33,6 +33,7 @@ import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.SearchManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -87,6 +88,8 @@ public abstract class ResultHandler {
|
||||
private final Activity activity;
|
||||
private final Result rawResult;
|
||||
private final String customProductSearch;
|
||||
private static Context context;
|
||||
private static String pkgName;
|
||||
|
||||
private final DialogInterface.OnClickListener shopperMarketListener =
|
||||
new DialogInterface.OnClickListener() {
|
||||
@@ -105,12 +108,18 @@ public abstract class ResultHandler {
|
||||
this.activity = activity;
|
||||
this.rawResult = rawResult;
|
||||
this.customProductSearch = parseCustomSearchURL();
|
||||
ResultHandler.context = this.activity.getApplicationContext();
|
||||
ResultHandler.pkgName = context.getPackageName();
|
||||
|
||||
// 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(getIdentifier("id", "shopper_button"));
|
||||
shopperButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
protected int getIdentifier(String type, String name) {
|
||||
return context.getResources().getIdentifier(name, type, pkgName);
|
||||
}
|
||||
|
||||
public ParsedResult getResult() {
|
||||
return result;
|
||||
@@ -159,7 +168,7 @@ public abstract class ResultHandler {
|
||||
* @param listener The on click listener to install for this button.
|
||||
*/
|
||||
protected void showGoogleShopperButton(View.OnClickListener listener) {
|
||||
View shopperButton = activity.findViewById(R.id.shopper_button);
|
||||
View shopperButton = activity.findViewById(getIdentifier("id", "shopper_button"));
|
||||
shopperButton.setVisibility(View.VISIBLE);
|
||||
shopperButton.setOnClickListener(listener);
|
||||
}
|
||||
@@ -276,7 +285,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(getIdentifier("string", "msg_share_subject_line")),
|
||||
contents);
|
||||
}
|
||||
|
||||
@@ -297,7 +306,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(getIdentifier("string", "msg_share_subject_line")) + ":\n" +
|
||||
contents);
|
||||
}
|
||||
|
||||
@@ -321,7 +330,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(getIdentifier("string", "msg_default_mms_subject")));
|
||||
} else {
|
||||
putExtra(intent, "subject", subject);
|
||||
}
|
||||
@@ -411,11 +420,11 @@ public abstract class ResultHandler {
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// 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(getIdentifier("string", "msg_google_shopper_missing"));
|
||||
builder.setMessage(getIdentifier("string", "msg_install_google_shopper"));
|
||||
builder.setIcon(getIdentifier("drawable", "shopper_icon"));
|
||||
builder.setPositiveButton(getIdentifier("string", "button_ok"), shopperMarketListener);
|
||||
builder.setNegativeButton(getIdentifier("string", "button_cancel"), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
@@ -428,9 +437,9 @@ public abstract class ResultHandler {
|
||||
activity.startActivity(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(getIdentifier("string", "app_name"));
|
||||
builder.setMessage(getIdentifier("string", "msg_intent_failed"));
|
||||
builder.setPositiveButton(getIdentifier("string", "button_ok"), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
@@ -451,8 +460,8 @@ public abstract class ResultHandler {
|
||||
// note the user has seen it
|
||||
prefs.edit().putBoolean(PreferencesActivity.KEY_NOT_OUR_RESULTS_SHOWN, true).commit();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setMessage(R.string.msg_not_our_results);
|
||||
builder.setPositiveButton(R.string.button_ok, proceedListener);
|
||||
builder.setMessage(getIdentifier("string", "msg_not_our_results"));
|
||||
builder.setPositiveButton(getIdentifier("string", "button_ok"), proceedListener);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -29,13 +29,13 @@ 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 final int[] buttons = new int[2];
|
||||
|
||||
public SMSResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
|
||||
buttons[0] = getIdentifier("string", "button_sms");
|
||||
buttons[1] = getIdentifier("string", "button_mms");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,6 +79,6 @@ public final class SMSResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_sms;
|
||||
return getIdentifier("string", "result_sms");
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -29,13 +29,13 @@ 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 final int[] buttons = new int[2];
|
||||
|
||||
public TelResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
|
||||
buttons[0] = getIdentifier("string", "button_dial");
|
||||
buttons[1] = getIdentifier("string", "button_add_contact");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,6 +73,6 @@ public final class TelResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_tel;
|
||||
return getIdentifier("string", "result_tel");
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -29,15 +29,15 @@ 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 final int[] buttons = new int[4];
|
||||
|
||||
public TextResultHandler(Activity activity, ParsedResult result, Result rawResult) {
|
||||
super(activity, result, rawResult);
|
||||
|
||||
buttons[0] = getIdentifier("string", "button_web_search");
|
||||
buttons[1] = getIdentifier("string", "button_share_by_email");
|
||||
buttons[2] = getIdentifier("string", "button_share_by_sms");
|
||||
buttons[3] = getIdentifier("string", "button_custom_product_search");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,6 +71,6 @@ public final class TextResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_text;
|
||||
return getIdentifier("string", "result_text");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -35,15 +35,14 @@ 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 final int[] buttons = new int[4];
|
||||
|
||||
public URIResultHandler(Activity activity, ParsedResult result) {
|
||||
super(activity, result);
|
||||
buttons[0] = getIdentifier("string", "button_open_browser");
|
||||
buttons[1] = getIdentifier("string", "button_share_by_email");
|
||||
buttons[2] = getIdentifier("string", "button_share_by_sms");
|
||||
buttons[3] = getIdentifier("string", "button_search_book_contents");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,7 +80,7 @@ public final class URIResultHandler extends ResultHandler {
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_uri;
|
||||
return getIdentifier("string", "result_uri");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-4
@@ -44,7 +44,7 @@ public final class WifiResultHandler extends ResultHandler {
|
||||
@Override
|
||||
public int getButtonText(int index) {
|
||||
if (index == 0) {
|
||||
return R.string.button_wifi;
|
||||
return getIdentifier("string", "button_wifi");
|
||||
}
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
@@ -63,15 +63,15 @@ public final class WifiResultHandler extends ResultHandler {
|
||||
public CharSequence getDisplayContents() {
|
||||
WifiParsedResult wifiResult = (WifiParsedResult) getResult();
|
||||
StringBuffer contents = new StringBuffer(50);
|
||||
String wifiLabel = parent.getString(R.string.wifi_ssid_label);
|
||||
String wifiLabel = parent.getString(getIdentifier("string", "wifi_ssid_label"));
|
||||
ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
|
||||
String typeLabel = parent.getString(R.string.wifi_type_label);
|
||||
String typeLabel = parent.getString(getIdentifier("string", "wifi_type_label"));
|
||||
ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
|
||||
return contents.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayTitle() {
|
||||
return R.string.result_wifi;
|
||||
return getIdentifier("string", "result_wifi");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -45,7 +45,7 @@ final class URIResultInfoRetriever extends SupplementalInfoRetriever {
|
||||
URIResultInfoRetriever(TextView textView, URIParsedResult result, Handler handler,
|
||||
Context context) {
|
||||
super(textView, handler, context);
|
||||
redirectString = context.getString(R.string.msg_redirect);
|
||||
redirectString = context.getString(context.getResources().getIdentifier("msg_redirect", "string", context.getPackageName()));
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -61,16 +61,16 @@ final class BookmarkAdapter extends BaseAdapter {
|
||||
LinearLayout layout;
|
||||
if (view == null || !(view instanceof LinearLayout)) {
|
||||
LayoutInflater factory = LayoutInflater.from(context);
|
||||
layout = (LinearLayout) factory.inflate(R.layout.bookmark_picker_list_item, viewGroup, false);
|
||||
layout = (LinearLayout) factory.inflate(context.getResources().getIdentifier("bookmark_picker_list_item", "layout", context.getPackageName()), viewGroup, false);
|
||||
} else {
|
||||
layout = (LinearLayout) view;
|
||||
}
|
||||
|
||||
cursor.moveToPosition(index);
|
||||
String title = cursor.getString(BookmarkPickerActivity.TITLE_COLUMN);
|
||||
((TextView) layout.findViewById(R.id.bookmark_title)).setText(title);
|
||||
((TextView) layout.findViewById(context.getResources().getIdentifier("bookmark_title", "id", context.getPackageName()))).setText(title);
|
||||
String url = cursor.getString(BookmarkPickerActivity.URL_COLUMN);
|
||||
((TextView) layout.findViewById(R.id.bookmark_url)).setText(url);
|
||||
((TextView) layout.findViewById(context.getResources().getIdentifier("bookmark_url", "id", context.getPackageName()))).setText(url);
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ final class LoadPackagesAsyncTask extends AsyncTask<List<String[]>, Void, List<S
|
||||
labels.add(result[0]);
|
||||
}
|
||||
ListAdapter listAdapter = new ArrayAdapter<String>(activity,
|
||||
android.R.layout.simple_list_item_1, labels);
|
||||
activity.getApplicationContext().getResources().getIdentifier("simple_list_item_1", "layout", activity.getApplicationContext().getPackageName()), labels);
|
||||
activity.setListAdapter(listAdapter);
|
||||
}
|
||||
|
||||
|
||||
+11
-8
@@ -24,6 +24,7 @@ import com.google.zxing.client.android.R;
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@@ -131,14 +132,16 @@ public final class ShareActivity extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.share);
|
||||
Resources res = getApplicationContext().getResources();
|
||||
String pkgName = getApplicationContext().getPackageName();
|
||||
setContentView(res.getIdentifier("share", "layout", pkgName));
|
||||
|
||||
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(res.getIdentifier("share_contact_button", "id", pkgName)).setOnClickListener(contactListener);
|
||||
findViewById(res.getIdentifier("share_bookmark_button", "id", pkgName)).setOnClickListener(bookmarkListener);
|
||||
findViewById(res.getIdentifier("share_app_button", "id", pkgName)).setOnClickListener(appListener);
|
||||
clipboardButton = (Button) findViewById(res.getIdentifier("share_clipboard_button", "id", pkgName));
|
||||
clipboardButton.setOnClickListener(clipboardListener);
|
||||
findViewById(R.id.share_text_view).setOnKeyListener(textListener);
|
||||
findViewById(res.getIdentifier("share_text_view", "id", pkgName)).setOnKeyListener(textListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,10 +151,10 @@ public final class ShareActivity extends Activity {
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
if (clipboard.hasText()) {
|
||||
clipboardButton.setEnabled(true);
|
||||
clipboardButton.setText(R.string.button_share_clipboard);
|
||||
clipboardButton.setText(getApplicationContext().getResources().getIdentifier("button_share_clipboard", "string", getApplicationContext().getPackageName()));
|
||||
} else {
|
||||
clipboardButton.setEnabled(false);
|
||||
clipboardButton.setText(R.string.button_clipboard_empty);
|
||||
clipboardButton.setText(getApplicationContext().getResources().getIdentifier("button_clipboard_empty", "string", getApplicationContext().getPackageName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
|
||||
@@ -50,9 +51,11 @@ final class Killer implements Runnable {
|
||||
parent.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parent);
|
||||
builder.setTitle(R.string.app_name);
|
||||
builder.setMessage(R.string.msg_intent_failed);
|
||||
builder.setPositiveButton(R.string.button_ok, null);
|
||||
Resources res = parent.getApplicationContext().getResources();
|
||||
String pkgName = parent.getApplicationContext().getPackageName();
|
||||
builder.setTitle(res.getIdentifier("app_name", "string", pkgName));
|
||||
builder.setMessage(res.getIdentifier("msg_intent_failed", "string", pkgName));
|
||||
builder.setPositiveButton(res.getIdentifier("button_ok", "string", pkgName), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
+13
-9
@@ -58,7 +58,7 @@ public final class WifiActivity extends Activity {
|
||||
Log.d(TAG, "Encountered another error. Errorcount = " + errorCount);
|
||||
if (errorCount > MAX_ERROR_COUNT){
|
||||
errorCount = 0;
|
||||
doError(R.string.wifi_connect_failed);
|
||||
doError(getIdentifier("string", "wifi_connect_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ public final class WifiActivity extends Activity {
|
||||
private int changeNetwork(NetworkSetting setting) {
|
||||
// If the SSID is empty, throw an error and return
|
||||
if (setting.getSsid() == null || setting.getSsid().length() == 0) {
|
||||
return doError(R.string.wifi_ssid_missing);
|
||||
return doError(getIdentifier("wifi_ssid_missing", "string"));
|
||||
}
|
||||
// If the network type is invalid
|
||||
if (setting.getNetworkType() == NetworkType.NETWORK_INVALID){
|
||||
return doError(R.string.wifi_type_incorrect);
|
||||
return doError(getIdentifier("wifi_type_incorrect", "string"));
|
||||
}
|
||||
|
||||
// If the password is empty, this is an unencrypted network
|
||||
@@ -105,7 +105,7 @@ public final class WifiActivity extends Activity {
|
||||
}
|
||||
|
||||
private WifiConfiguration changeNetworkCommon(NetworkSetting input){
|
||||
statusView.setText(R.string.wifi_creating_network);
|
||||
statusView.setText(getIdentifier("wifi_creating_network", "string"));
|
||||
Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid() + "\nType: " +
|
||||
input.getNetworkType());
|
||||
WifiConfiguration config = new WifiConfiguration();
|
||||
@@ -123,7 +123,7 @@ public final class WifiActivity extends Activity {
|
||||
}
|
||||
|
||||
private int requestNetworkChange(WifiConfiguration config){
|
||||
statusView.setText(R.string.wifi_changing_network);
|
||||
statusView.setText(getIdentifier("wifi_changing_network", "string"));
|
||||
return updateNetwork(config, false);
|
||||
}
|
||||
|
||||
@@ -207,8 +207,8 @@ public final class WifiActivity extends Activity {
|
||||
String ssid = intent.getStringExtra(Intents.WifiConnect.SSID);
|
||||
String password = intent.getStringExtra(Intents.WifiConnect.PASSWORD);
|
||||
String networkType = intent.getStringExtra(Intents.WifiConnect.TYPE);
|
||||
setContentView(R.layout.network);
|
||||
statusView = (TextView) findViewById(R.id.networkStatus);
|
||||
setContentView(getIdentifier("network", "layout"));
|
||||
statusView = (TextView) findViewById(getIdentifier("id", "networkStatus"));
|
||||
|
||||
NetworkType networkT;
|
||||
if ("WPA".equals(networkType)) {
|
||||
@@ -285,9 +285,9 @@ public final class WifiActivity extends Activity {
|
||||
WifiConfiguration found = findNetworkInExistingConfig(config.SSID);
|
||||
wifiManager.disconnect();
|
||||
if (found == null) {
|
||||
statusView.setText(R.string.wifi_creating_network);
|
||||
statusView.setText(getIdentifier("wifi_creating_network", "string"));
|
||||
} else {
|
||||
statusView.setText(R.string.wifi_modifying_network);
|
||||
statusView.setText(getIdentifier("wifi_modifying_network", "string"));
|
||||
Log.d(TAG, "Removing network " + found.networkId);
|
||||
wifiManager.removeNetwork(found.networkId);
|
||||
wifiManager.saveConfiguration();
|
||||
@@ -307,5 +307,9 @@ public final class WifiActivity extends Activity {
|
||||
wifiManager.reassociate();
|
||||
return networkId;
|
||||
}
|
||||
|
||||
private int getIdentifier(String type, String name) {
|
||||
return getApplicationContext().getResources().getIdentifier(name, type, getApplicationContext().getPackageName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ final class WifiReceiver extends BroadcastReceiver {
|
||||
|
||||
if (state == NetworkInfo.State.CONNECTED && ssid != null){
|
||||
mWifiManager.saveConfiguration();
|
||||
String label = parent.getString(R.string.wifi_connected);
|
||||
String label = parent.getString(parent.getApplicationContext().getResources().getIdentifier("wifi_connected", "string", parent.getApplicationContext().getPackageName()));
|
||||
statusView.setText(label + '\n' + ssid);
|
||||
Runnable delayKill = new Killer(parent);
|
||||
delayKill.run();
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user