public abstract class BaseScanActivity extends android.app.Activity implements MetadataListener, OrientationAllowedListener, OnSizeChangedListener, CameraEventsListener, ScanResultListener, OnActivityFlipListener
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EXTRAS_ALLOW_PINCH_TO_ZOOM
Whether pinch to zoom will be allowed (default is false)
|
static java.lang.String |
EXTRAS_BEEP_RESOURCE
Resource ID of sound which is to be played after finishing the scan
procedure
|
static java.lang.String |
EXTRAS_CAMERA_ASPECT_MODE
Aspect mode of camera to be used (fill screen by cropping frame or fit by letterboxing
|
static java.lang.String |
EXTRAS_CAMERA_TYPE
Type of camera to be used (back facing, front facing, default)
|
static java.lang.String |
EXTRAS_CAMERA_VIDEO_PRESET
Request usage of maximum possible camera resolution for performing a scan.
|
static java.lang.String |
EXTRAS_HELP_INTENT
Help activity called when help should be shown
|
static java.lang.String |
EXTRAS_IMAGE_LISTENER
Define an
ImageListener that will obtain images that are being processed. |
static java.lang.String |
EXTRAS_IMAGE_METADATA_SETTINGS
Define a
MetadataSettings.ImageMetadataSettings that will define
which images will be sent to ImageListener set via EXTRAS_IMAGE_LISTENER extra. |
static java.lang.String |
EXTRAS_LICENSE_KEY
Key for setting the license key
|
static java.lang.String |
EXTRAS_LICENSEE
Key for setting the license owner
|
static java.lang.String |
EXTRAS_OPTIMIZE_CAMERA_FOR_NEAR_SCANNING
Flag which indicates mb should optimize camera parameters for near object scanning.
|
static java.lang.String |
EXTRAS_RECOGNITION_RESULTS
Recognition results after recognition
|
static java.lang.String |
EXTRAS_RECOGNITION_SETTINGS
Key for setting the settings object used to initialize recognizer
|
static java.lang.String |
EXTRAS_ROI
Key for setting region of interest that will be scanned
|
static java.lang.String |
EXTRAS_ROTATE_ROI
Key for defining whether region of interest will be rotated with user interface
|
static java.lang.String |
EXTRAS_SET_FLAG_SECURE
Request setting of FLAG_SECURE on activity window which indicates that the display has
a secure video output and supports compositing secure surfaces.
|
static java.lang.String |
EXTRAS_SHOW_FOCUS_RECTANGLE
Whether focus area rectangle will be shown
|
static java.lang.String |
EXTRAS_SPLASH_SCREEN_LAYOUT_RESOURCE
Defines the ID of the layout resource that will be used as camera splash screen displayed
while camera is being initialized.
|
static java.lang.String |
EXTRAS_USE_LEGACY_CAMERA_API
Force using legacy Camera API even on Lollipop devices that support new Camera2 API.
|
protected android.widget.Button |
mBackButton
This is a back button
|
protected android.widget.TextView |
mDebugStatus
This text field contains debug status messages
|
protected android.os.Handler |
mHandler |
protected android.widget.Button |
mHelpButton
This is a help button
|
protected android.content.Intent |
mHelpIntent
Intent which shows the help activity
|
protected ImageListener |
mImageListener |
protected android.view.ViewGroup |
mLayout |
protected MetadataSettings |
mMetadataSettings |
protected PointSetView |
mPointSetView |
protected QuadViewManager |
mQuadViewManager
Actual viewfinder that draws animations
|
protected RecognitionSettings |
mRecognitionSettings |
protected SimpleRectangleView |
mRectView |
protected boolean |
mShowFocusRectangle |
protected android.widget.TextView |
mStatusTextView
This is a text field that contains status messages
|
protected android.widget.Button |
mTorchButton
This is a torch control button
|
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OKACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE| Constructor and Description |
|---|
BaseScanActivity() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
addChildViews(RecognizerView recognizerView) |
protected void |
addChildViews(RecognizerView recognizerView,
int viewfinderId)
adds fixed and rotatable views to given mbView
|
protected PointSetView |
createPointSetView(RecognizerView recognizerView) |
protected QuadViewManager |
createQuadView(RecognizerView recognizerView) |
protected RecognizerView |
createRecognizerView(android.os.Bundle intentExtras) |
protected void |
displayDetectionStatus(DetectionStatus detectionStatus) |
protected void |
displayMessageImmediately(java.lang.CharSequence text) |
protected void |
finishAndWaitForAnimation() |
protected Orientation |
getDefaultOrientation()
Method returns the default status messages orientation for given
settings.
|
protected RecognizerView |
getRecognizerView() |
protected void |
initDebugStatus() |
boolean |
isFinishing() |
boolean |
isOrientationAllowed(Orientation orientation)
Called in onOrientationChange.
|
void |
onActivityFlip()
Called when activity is flipped.
|
void |
onAutofocusFailed()
This method will be called when camera focusing has failed.
|
void |
onAutofocusStarted(android.graphics.Rect[] areas)
This method will be called when camera focusing has started.
|
void |
onAutofocusStopped(android.graphics.Rect[] areas)
This method will be called when camera focusing has stopped.
|
void |
onCameraPermissionDenied()
Called on Android 6.0 and newer when runtime camera permission was not given to the app.
|
void |
onCameraPreviewStarted()
Called just after camera preview has successfully
started and no exceptions occurred.
|
void |
onCameraPreviewStopped()
Called inside pause method of CameraView just haver camera preview has been stopped.
|
void |
onConfigurationChanged(android.content.res.Configuration newConfig) |
protected abstract void |
onConfigureRecognizerView(RecognizerView recognizerView,
android.os.Bundle intentExtras) |
protected void |
onCreate(android.os.Bundle savedInstanceState) |
protected void |
onDestroy() |
protected void |
onDetectorResultAvailable(DetectorResult detectorResult) |
void |
onError(java.lang.Throwable exc)
Called when recognition results with exception.
|
void |
onMetadataAvailable(Metadata metadata) |
protected void |
onPause() |
void |
onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults) |
protected void |
onResume() |
void |
onScanningDone(RecognitionResults results)
This method is called when recognition is done.
|
void |
onSizeChanged(int width,
int height)
Called when CameraView changes the size of itself and its children.
|
protected void |
onStart() |
protected void |
onStop() |
protected void |
postDisplayMessage(java.lang.CharSequence text) |
protected void |
setHelpButtonEnabled(boolean enabled) |
protected void |
soundNotification()
plays beep
|
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, enterPictureInPictureMode, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMediaController, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isChangingConfigurations, isChild, isDestroyed, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onActivityResult, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackPressed, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onLowMemory, onMenuItemSelected, onMenuOpened, onMultiWindowModeChanged, onNavigateUp, onNavigateUpFromChild, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPictureInPictureModeChanged, onPostCreate, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onPreparePanel, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRestart, onRestoreInstanceState, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onStateNotSaved, onTitleChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, postponeEnterTransition, recreate, registerForContextMenu, releaseInstance, removeDialog, reportFullyDrawn, requestDragAndDropPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, runOnUiThread, setActionBar, setContentTransitionManager, setContentView, setContentView, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setMediaController, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTaskDescription, setTheme, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, setVrModeEnabled, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenuapplyOverrideConfiguration, attachBaseContext, getAssets, getResources, getThemebindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiverpublic static final java.lang.String EXTRAS_CAMERA_TYPE
public static final java.lang.String EXTRAS_CAMERA_ASPECT_MODE
public static final java.lang.String EXTRAS_HELP_INTENT
public static final java.lang.String EXTRAS_LICENSE_KEY
public static final java.lang.String EXTRAS_LICENSEE
public static final java.lang.String EXTRAS_RECOGNITION_SETTINGS
public static final java.lang.String EXTRAS_ROI
public static final java.lang.String EXTRAS_ROTATE_ROI
public static final java.lang.String EXTRAS_RECOGNITION_RESULTS
public static final java.lang.String EXTRAS_SHOW_FOCUS_RECTANGLE
public static final java.lang.String EXTRAS_ALLOW_PINCH_TO_ZOOM
public static final java.lang.String EXTRAS_BEEP_RESOURCE
public static final java.lang.String EXTRAS_SPLASH_SCREEN_LAYOUT_RESOURCE
public static final java.lang.String EXTRAS_OPTIMIZE_CAMERA_FOR_NEAR_SCANNING
public static final java.lang.String EXTRAS_IMAGE_LISTENER
ImageListener that will obtain images that are being processed.
Make sure that your ImageListener implementation correctly implements Parcelable
interface with static CREATOR field. Without this, you might encounter a runtime error.public static final java.lang.String EXTRAS_IMAGE_METADATA_SETTINGS
MetadataSettings.ImageMetadataSettings that will define
which images will be sent to ImageListener set via EXTRAS_IMAGE_LISTENER extra.
If not set, ImageListener set via EXTRAS_IMAGE_LISTENER will receive all possible
images.public static final java.lang.String EXTRAS_CAMERA_VIDEO_PRESET
public static final java.lang.String EXTRAS_USE_LEGACY_CAMERA_API
public static final java.lang.String EXTRAS_SET_FLAG_SECURE
protected android.content.Intent mHelpIntent
protected android.view.ViewGroup mLayout
protected android.widget.Button mHelpButton
protected android.widget.Button mBackButton
protected android.widget.Button mTorchButton
protected android.widget.TextView mStatusTextView
protected android.widget.TextView mDebugStatus
protected QuadViewManager mQuadViewManager
protected PointSetView mPointSetView
protected android.os.Handler mHandler
protected SimpleRectangleView mRectView
protected boolean mShowFocusRectangle
protected RecognitionSettings mRecognitionSettings
protected ImageListener mImageListener
protected MetadataSettings mMetadataSettings
protected final void onCreate(android.os.Bundle savedInstanceState)
onCreate in class android.app.Activityprotected void initDebugStatus()
protected void soundNotification()
protected final void onStart()
onStart in class android.app.Activitypublic void onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults)
onRequestPermissionsResult in class android.app.Activityprotected final void onResume()
onResume in class android.app.Activityprotected final void onPause()
onPause in class android.app.Activityprotected final void onStop()
onStop in class android.app.Activitypublic void onConfigurationChanged(android.content.res.Configuration newConfig)
onConfigurationChanged in interface android.content.ComponentCallbacksonConfigurationChanged in class android.app.Activitypublic void onActivityFlip()
OnActivityFlipListeneronActivityFlip in interface OnActivityFlipListenerprotected final void onDestroy()
onDestroy in class android.app.Activityprotected QuadViewManager createQuadView(RecognizerView recognizerView)
protected PointSetView createPointSetView(RecognizerView recognizerView)
protected void addChildViews(RecognizerView recognizerView, int viewfinderId)
recognizerView - protected abstract void addChildViews(RecognizerView recognizerView)
protected void postDisplayMessage(java.lang.CharSequence text)
protected void displayMessageImmediately(java.lang.CharSequence text)
protected void finishAndWaitForAnimation()
public boolean isFinishing()
isFinishing in class android.app.Activitypublic boolean isOrientationAllowed(Orientation orientation)
OrientationAllowedListenerisOrientationAllowed in interface OrientationAllowedListenerorientation - Orientation of the device.protected void setHelpButtonEnabled(boolean enabled)
protected void displayDetectionStatus(DetectionStatus detectionStatus)
public void onMetadataAvailable(Metadata metadata)
onMetadataAvailable in interface MetadataListenerprotected void onDetectorResultAvailable(DetectorResult detectorResult)
public void onAutofocusFailed()
AutofocusListeneronAutofocusFailed in interface AutofocusListenerpublic void onAutofocusStopped(android.graphics.Rect[] areas)
AutofocusListeneronAutofocusStopped in interface AutofocusListenerareas - Areas where focus is being measured. Null on devices that do not support fine-grained camera controlpublic void onAutofocusStarted(android.graphics.Rect[] areas)
AutofocusListeneronAutofocusStarted in interface AutofocusListenerareas - Areas where focus is being measured. Null on devices that do not support fine-grained camera controlpublic void onCameraPermissionDenied()
CameraEventsListeneronCameraPermissionDenied in interface CameraEventsListenerpublic void onSizeChanged(int width,
int height)
OnSizeChangedListeneronSizeChanged in interface OnSizeChangedListenerwidth - New width of the view.height - New height of the view.public void onCameraPreviewStarted()
CameraEventsListeneronCameraPreviewStarted in interface CameraEventsListenerpublic void onCameraPreviewStopped()
CameraEventsListeneronCameraPreviewStopped in interface CameraEventsListenerpublic void onError(java.lang.Throwable exc)
CameraEventsListeneronError in interface CameraEventsListenerexc - Exception that occurred during recognition.protected final RecognizerView getRecognizerView()
protected Orientation getDefaultOrientation()
protected RecognizerView createRecognizerView(android.os.Bundle intentExtras)
public void onScanningDone(RecognitionResults results)
ScanResultListeneronScanningDone in interface ScanResultListenerresults - Recognition results.protected abstract void onConfigureRecognizerView(RecognizerView recognizerView, android.os.Bundle intentExtras)