Displays camera preview and provides methods for tuning the user interface appearance and parameters of the capture process. This class configures all capture scenarios.
Extends the FrameLayout class.
If you're using CaptureView class within an Android Fragment, you should close this Fragment with a back stack name, because the capture scenario may also show Fragments. Checkout the sample below.
The sample
String BACK_STACK_NAME = "any name";
// Open
getSupportFragment()
.beginTransaction()
.replace( R.id.container, new YourFragment() )
.addToBackStack( BACK_STACK_NAME )
.commit()
// Close
getSupportFragment()
.popBackStack(BACK_STACK_NAME, FragmentManager.POP_BACK_STACK_INCLUSIVE);
class CaptureView{
public class CaptureView( Context context )
public class CaptureView( Context context, AttributeSet attrs )
public class CaptureView( Context context, AttributeSet attrs, Int defStyleAttr )
public class CaptureView( Context context, AttributeSet attrs, Int defStyleAttr, Int defStyleRes )
}
The CaptureView class constructor throws an exception when the appCompatDependency dependency is not set. See the How to Add the Library to Your Android Studio Project to find the dependency definition.
Methods
Attributes
The user interface messages can be adjusted using attributes of your XML layout.
To the CaptureView tag of the XML layout add the following code:
<com.abbyy.mobile.uicomponents.CaptureView
android:id="@+id/captureView"
style="@style/CaptureViewLocalization"
android:layout_width="match_parent"
android:layout_height="match_parent" />
To the CaptureViewLocalization style tag of your values.xml or styles.xml file add the source strings identifiers and edit them as needed.
Source strings identifiers to be added
<style name="CaptureViewLocalization">
<item name="camera_dialog_permission_rationale_message">@string/custom_camera_dialog_permission_rationale_message</item>
<item name="camera_dialog_permission_rationale_negative_button">@string/custom_camera_dialog_permission_rationale_negative_button</item>
<item name="camera_dialog_permission_rationale_positive_button">@string/custom_camera_dialog_permission_rationale_positive_button</item>
<item name="camera_dialog_permission_rationale_title">@string/custom_camera_dialog_permission_rationale_title</item>
<item name="camera_dialog_permission_settings_message">@string/custom_camera_dialog_permission_settings_message</item>
<item name="camera_dialog_permission_settings_negative_button">@string/custom_camera_dialog_permission_settings_negative_button</item>
<item name="camera_dialog_permission_settings_positive_button">@string/custom_camera_dialog_permission_settings_positive_button</item>
<item name="camera_dialog_permission_settings_title">@string/custom_camera_dialog_permission_settings_title</item>
<item name="camera_need_permission_tip_message">@string/custom_camera_need_permission_tip_message</item>
<item name="camera_need_permission_tip_title">@string/custom_camera_need_permission_tip_title</item>
<item name="ics_looking_for_document_tip">@string/custom_ics_looking_for_document_tip</item>
<item name="ics_move_closer_tip">@string/custom_ics_move_closer_tip</item>
<item name="ics_dont_move_tip">@string/custom_ics_dont_move_tip</item>
<item name="mpics_crop_accept_button">@string/custom_mpics_crop_accept_button</item>
<item name="mpics_crop_auto_crop_button">@string/custom_mpics_crop_auto_crop_button</item>
<item name="mpics_crop_cancel_button">@string/custom_mpics_crop_cancel_button</item>
<item name="mpics_crop_screen_title">@string/custom_mpics_crop_screen_title</item>
<item name="mpics_camera_number_of_captured_pages_fixed_count">@string/custom_mpics_camera_number_of_captured_pages_fixed_count</item>
<item name="mpics_camera_number_of_captured_pages">@plurals/custom_mpics_camera_number_of_captured_pages</item>
<item name="mpics_editor_add_page_button">@string/custom_mpics_editor_add_page_button</item>
<item name="mpics_editor_next_document_button">@string/custom_mpics_editor_next_document_button</item>
<item name="mpics_editor_current_document_index">@string/custom_mpics_editor_current_document_index_title</item>
<item name="mpics_editor_delete_all_warning_message">@string/custom_mpics_editor_delete_all_warning_message</item>
<item name="mpics_editor_delete_all_warning_negative_button">@string/custom_mpics_editor_delete_all_warning_negative_button</item>
<item name="mpics_editor_delete_all_warning_positive_button">@string/custom_mpics_editor_delete_all_warning_positive_button</item>
<item name="mpics_editor_delete_all_warning_title">@string/custom_mpics_editor_delete_all_warning_title</item>
<item name="mpics_editor_delete_page_warning_message">@string/custom_mpics_editor_delete_page_warning_message</item>
<item name="mpics_editor_delete_page_warning_negative_button">@string/custom_mpics_editor_delete_page_warning_negative_button</item>
<item name="mpics_editor_delete_page_warning_positive_button">@string/custom_mpics_editor_delete_page_warning_positive_button</item>
<item name="mpics_editor_delete_page_warning_title">@string/custom_mpics_editor_delete_page_warning_title</item>
<item name="mpics_editor_done_button">@string/custom_mpics_editor_done_button</item>
<item name="mpics_editor_error_button">@string/custom_mpics_editor_error_button</item>
<item name="mpics_editor_error_title">@string/custom_mpics_editor_error_title</item>
<item name="mpics_editor_add_more_pages">@string/custom_mpics_editor_add_more_pages</item>
<item name="mpics_editor_retake">@string/custom_mpics_editor_retake</item>
<item name="mpics_editor_delete_page">@string/custom_mpics_editor_delete_page</item>
<item name="mpics_editor_delete_all">@string/custom_mpics_editor_delete_all</item>
<item name="mpics_editor_page_deleted">@string/custom_mpics_editor_page_deleted</item>
<item name="mpics_preview_title">@string/custom_mpics_preview_title</item>
<item name="language_code_afrikaans">@string/custom_language_code_afrikaans</item>
<item name="language_code_albanian">@string/custom_language_code_albanian</item>
<item name="language_code_basque">@string/custom_language_code_basque</item>
<item name="language_code_breton">@string/custom_language_code_breton</item>
<item name="language_code_bulgarian">@string/custom_language_code_bulgarian</item>
<item name="language_code_belarusian">@string/custom_language_code_belarusian</item>
<item name="language_code_catalan">@string/custom_language_code_catalan</item>
<item name="language_code_chechen">@string/custom_language_code_chechen</item>
<item name="language_code_crimean_tatar">@string/custom_language_code_crimean_tatar</item>
<item name="language_code_croatian">@string/custom_language_code_croatian</item>
<item name="language_code_fijian">@string/custom_language_code_fijian</item>
<item name="language_code_hawaiian">@string/custom_language_code_hawaiian</item>
<item name="language_code_hungarian">@string/custom_language_code_hungarian</item>
<item name="language_code_icelandic">@string/custom_language_code_icelandic</item>
<item name="language_code_irish">@string/custom_language_code_irish</item>
<item name="language_code_kabardian">@string/custom_language_code_kabardian</item>
<item name="language_code_latin">@string/custom_language_code_latin</item>
<item name="language_code_latvian">@string/custom_language_code_latvian</item>
<item name="language_code_lithuanian">@string/custom_language_code_lithuanian</item>
<item name="language_code_macedonian">@string/custom_language_code_macedonian</item>
<item name="language_code_malay">@string/custom_language_code_malay</item>
<item name="language_code_maori">@string/custom_language_code_maori</item>
<item name="language_code_moldavian">@string/custom_language_code_moldavian</item>
<item name="language_code_mongol">@string/custom_language_code_mongol</item>
<item name="language_code_ossetic">@string/custom_language_code_ossetic</item>
<item name="language_code_provencal">@string/custom_language_code_provencal</item>
<item name="language_code_rhaeto_romanic">@string/custom_language_code_rhaeto_romanic</item>
<item name="language_code_romanian">@string/custom_language_code_romanian</item>
<item name="language_code_samoan">@string/custom_language_code_samoan</item>
<item name="language_code_serbian">@string/custom_language_code_serbian</item>
<item name="language_code_slovak">@string/custom_language_code_slovak</item>
<item name="language_code_slovenian">@string/custom_language_code_slovenian</item>
<item name="language_code_swahili">@string/custom_language_code_swahili</item>
<item name="language_code_tagalog">@string/custom_language_code_tagalog</item>
<item name="language_code_tatar">@string/custom_language_code_tatar</item>
<item name="language_code_welsh">@string/custom_language_code_welsh</item>
<item name="language_code_czech">@string/custom_language_code_czech</item>
<item name="language_code_chinese">@string/custom_language_code_chinese</item>
<item name="language_code_danish">@string/custom_language_code_danish</item>
<item name="language_code_dutch">@string/custom_language_code_dutch</item>
<item name="language_code_english">@string/custom_language_code_english</item>
<item name="language_code_estonian">@string/custom_language_code_estonian</item>
<item name="language_code_finnish">@string/custom_language_code_finnish</item>
<item name="language_code_french">@string/custom_language_code_french</item>
<item name="language_code_german">@string/custom_language_code_german</item>
<item name="language_code_greek">@string/custom_language_code_greek</item>
<item name="language_code_indonesian">@string/custom_language_code_indonesian</item>
<item name="language_code_italian">@string/custom_language_code_italian</item>
<item name="language_code_japanese">@string/custom_language_code_japanese</item>
<item name="language_code_korean">@string/custom_language_code_korean</item>
<item name="language_code_norwegian_bokmal">@string/custom_language_code_norwegian_bokmal</item>
<item name="language_code_norwegian_nynorsk">@string/custom_language_code_norwegian_nynorsk</item>
<item name="language_code_polish">@string/custom_language_code_polish</item>
<item name="language_code_portuguese">@string/custom_language_code_portuguese</item>
<item name="language_code_portuguese_brazilian">@string/custom_language_code_portuguese_brazilian</item>
<item name="language_code_russian">@string/custom_language_code_russian</item>
<item name="language_code_spanish">@string/custom_language_code_spanish</item>
<item name="language_code_swedish">@string/custom_language_code_swedish</item>
<item name="language_code_turkish">@string/custom_language_code_turkish</item>
<item name="language_code_ukrainian">@string/custom_language_code_ukrainian</item>
<item name="language_afrikaans">@string/custom_language_afrikaans</item>
<item name="language_belarusian">@string/custom_language_belarusian</item>
<item name="language_bulgarian">@string/custom_language_bulgarian</item>
<item name="language_catalan">@string/custom_language_catalan</item>
<item name="language_czech">@string/custom_language_czech</item>
<item name="language_welsh">@string/custom_language_welsh</item>
<item name="language_danish">@string/custom_language_danish</item>
<item name="language_german">@string/custom_language_german</item>
<item name="language_greek">@string/custom_language_greek</item>
<item name="language_english">@string/custom_language_english</item>
<item name="language_spanish">@string/custom_language_spanish</item>
<item name="language_estonian">@string/custom_language_estonian</item>
<item name="language_basque">@string/custom_language_basque</item>
<item name="language_finnish">@string/custom_language_finnish</item>
<item name="language_french">@string/custom_language_french</item>
<item name="language_irish">@string/custom_language_irish</item>
<item name="language_croatian">@string/custom_language_croatian</item>
<item name="language_hungarian">@string/custom_language_hungarian</item>
<item name="language_indonesian">@string/custom_language_indonesian</item>
<item name="language_icelandic">@string/custom_language_icelandic</item>
<item name="language_italian">@string/custom_language_italian</item>
<item name="language_japanese">@string/custom_language_japanese</item>
<item name="language_korean">@string/custom_language_korean</item>
<item name="language_latin">@string/custom_language_latin</item>
<item name="language_lithuanian">@string/custom_language_lithuanian</item>
<item name="language_latvian">@string/custom_language_latvian</item>
<item name="language_maori">@string/custom_language_maori</item>
<item name="language_macedonian">@string/custom_language_macedonian</item>
<item name="language_mongol">@string/custom_language_mongol</item>
<item name="language_malay">@string/custom_language_malay</item>
<item name="language_dutch">@string/custom_language_dutch</item>
<item name="language_polish">@string/custom_language_polish</item>
<item name="language_portuguese">@string/custom_language_portuguese</item>
<item name="language_romanian">@string/custom_language_romanian</item>
<item name="language_russian">@string/custom_language_russian</item>
<item name="language_slovak">@string/custom_language_slovak</item>
<item name="language_slovenian">@string/custom_language_slovenian</item>
<item name="language_albanian">@string/custom_language_albanian</item>
<item name="language_serbian_cyrillic">@string/custom_language_serbian_cyrillic</item>
<item name="language_swedish">@string/custom_language_swedish</item>
<item name="language_swahili">@string/custom_language_swahili</item>
<item name="language_turkish">@string/custom_language_turkish</item>
<item name="language_ukrainian">@string/custom_language_ukrainian</item>
<item name="language_chinese_traditional">@string/custom_language_chinese_traditional</item>
<item name="language_breton">@string/custom_language_breton</item>
<item name="language_chechen">@string/custom_language_chechen</item>
<item name="language_crimean_tatar">@string/custom_language_crimean_tatar</item>
<item name="language_fijian">@string/custom_language_fijian</item>
<item name="language_hawaiian">@string/custom_language_hawaiian</item>
<item name="language_kabardian">@string/custom_language_kabardian</item>
<item name="language_moldavian">@string/custom_language_moldavian</item>
<item name="language_ossetic">@string/custom_language_ossetic</item>
<item name="language_rhaeto_romanic">@string/custom_language_rhaeto_romanic</item>
<item name="language_samoan">@string/custom_language_samoan</item>
<item name="language_tagalog">@string/custom_language_tagalog</item>
<item name="language_tatar">@string/custom_language_tatar</item>
<item name="language_provencal">@string/custom_language_provencal</item>
<item name="language_norwegian_nynorsk">@string/custom_language_norwegian_nynorsk</item>
<item name="language_norwegian_bokmal">@string/custom_language_norwegian_bokmal</item>
<item name="language_portuguese_brazil">@string/custom_language_portuguese_brazil</item>
<item name="language_chinese_simplified">@string/custom_language_chinese_simplified</item>
<item name="language_dutch_belgium">@string/custom_language_dutch_belgium</item>
<item name="language_german_new_spelling">@string/custom_language_german_new_spelling</item>
<item name="language_korean_hangul">@string/custom_language_korean_hangul</item>
<item name="dcs_language_picker_title">@string/custom_dcs_language_picker_title</item>
<item name="dcs_language_picker_last_used_title">@string/custom_dcs_language_picker_last_used_title</item>
<item name="dcs_language_picker_search_bar_placeholder">@string/custom_dcs_language_picker_search_bar_placeholder</item>
<item name="dcs_language_picker_not_found">@string/custom_dcs_language_picker_not_found</item>
<item name="dcs_recognition_in_progress_text">@string/custom_dcs_recognition_in_progress_text</item>
<item name="dcs_start_tip">@string/custom_dcs_start_tip</item>
<item name="dcs_complete_tip">@string/custom_dcs_complete_tip</item>
<item name="dcs_looking_for_document_tip">@string/custom_dcs_looking_for_document_tip</item>
<item name="dcs_move_closer_tip">@string/custom_dcs_move_closer_tip</item>
<item name="dcs_press_capture_button">@string/custom_dcs_press_capture_button</item>
<item name="dcs_flashlight_on">@string/custom_dcs_flashlight_on</item>
<item name="dcs_flashlight_off">@string/custom_dcs_flashlight_off</item>
</style>