Package com.microblink.blinkid.fragment
Class RecognizerRunnerFragment
java.lang.Object
androidx.fragment.app.Fragment
com.microblink.blinkid.fragment.RecognizerRunnerFragment
- All Implemented Interfaces:
android.content.ComponentCallbacks
,android.view.View.OnCreateContextMenuListener
,androidx.activity.result.ActivityResultCaller
,androidx.lifecycle.HasDefaultViewModelProviderFactory
,androidx.lifecycle.LifecycleOwner
,androidx.lifecycle.ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
public final class RecognizerRunnerFragment
extends androidx.fragment.app.Fragment
A wrapper around
RecognizerRunnerView
that automatically
manages its lifecycle.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This interface must be implemented by all activites that will hostRecognizerRunnerFragment
.Nested classes/interfaces inherited from class androidx.fragment.app.Fragment
androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
-
Field Summary
Fields inherited from class androidx.fragment.app.Fragment
mPreviousWho
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionandroid.widget.FrameLayout
Returns theFrameLayout
that represents the content layout of this fragment.Returns theRecognizerRunnerView
managed by this fragment.int
Returns the currently set resource layout identifier for camera splash screen or 0 if splash screen is disabled.void
onAttach
(android.app.Activity activity) void
onConfigurationChanged
(android.content.res.Configuration newConfig) void
onCreate
(android.os.Bundle savedInstanceState) android.view.View
onCreateView
(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState) void
void
void
onPause()
void
onRequestPermissionsResult
(int requestCode, String[] permissions, int[] grantResults) void
onResume()
void
onSaveInstanceState
(android.os.Bundle outState) void
onStart()
void
onStop()
void
Recreates containedRecognizerRunnerView
which causes thatScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment)
is called again when newRecognizerRunnerView
is created.void
registerLifecycleObserver
(LifecycleObserver lifecycleObserver) Registers theLifecycleObserver
that will be notified about all lifecycle events of thisRecognizerRunnerFragment
void
setCameraEventsListener
(BaseCameraEventsListener cameraEventsListener) Sets the camera events listener that will be additionally notified about camera events.void
setSplashScreenResourceId
(int resourceId) Sets the resource layout identifier for camera splash screen.Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttachFragment, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onViewCreated, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Constructor Details
-
RecognizerRunnerFragment
public RecognizerRunnerFragment()
-
-
Method Details
-
setSplashScreenResourceId
public void setSplashScreenResourceId(@LayoutRes int resourceId) Sets the resource layout identifier for camera splash screen. If you wish to disable splash screen, set 0. By default, bult-in splash screen (R.layout.mb_camera_splash) will be used. You can also overwrite that layout resource in your app with custom layout.- Parameters:
resourceId
- Identifier for splash screen layout or 0 to disable splash screen.
-
getSplashScreenResourceId
@LayoutRes public int getSplashScreenResourceId()Returns the currently set resource layout identifier for camera splash screen or 0 if splash screen is disabled.- Returns:
- currently set resource layout identifier
-
getRecognizerRunnerView
Returns theRecognizerRunnerView
managed by this fragment. IfRecognizerRunnerView
is still not created, returns null.- Returns:
- the
RecognizerRunnerView
managed by this fragment.
-
getContentLayout
@Nullable public android.widget.FrameLayout getContentLayout()Returns theFrameLayout
that represents the content layout of this fragment. If content layout is still not created (i.e. beforeFragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
callback has been invoked, returns null. Note that onScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment)
it is guaranteed that content layout exists and contains exactly one view -RecognizerRunnerView
, which can also be obtained withgetRecognizerRunnerView()
.- Returns:
- content layout of this fragment.
-
setCameraEventsListener
Sets the camera events listener that will be additionally notified about camera events.- Parameters:
cameraEventsListener
- camera events listener that will be additionally notified about camera events.
-
registerLifecycleObserver
Registers theLifecycleObserver
that will be notified about all lifecycle events of thisRecognizerRunnerFragment
- Parameters:
lifecycleObserver
-
-
recreateRecognizerRunnerView
public void recreateRecognizerRunnerView()Recreates containedRecognizerRunnerView
which causes thatScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment)
is called again when newRecognizerRunnerView
is created. -
onAttach
public void onAttach(@Nullable android.app.Activity activity) - Overrides:
onAttach
in classandroidx.fragment.app.Fragment
-
onCreate
public void onCreate(@Nullable android.os.Bundle savedInstanceState) - Overrides:
onCreate
in classandroidx.fragment.app.Fragment
-
onCreateView
@Nullable public android.view.View onCreateView(@Nullable android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState) - Overrides:
onCreateView
in classandroidx.fragment.app.Fragment
-
onStart
public void onStart()- Overrides:
onStart
in classandroidx.fragment.app.Fragment
-
onRequestPermissionsResult
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) - Overrides:
onRequestPermissionsResult
in classandroidx.fragment.app.Fragment
-
onResume
public void onResume()- Overrides:
onResume
in classandroidx.fragment.app.Fragment
-
onPause
public void onPause()- Overrides:
onPause
in classandroidx.fragment.app.Fragment
-
onStop
public void onStop()- Overrides:
onStop
in classandroidx.fragment.app.Fragment
-
onSaveInstanceState
public void onSaveInstanceState(@Nullable android.os.Bundle outState) - Overrides:
onSaveInstanceState
in classandroidx.fragment.app.Fragment
-
onDestroyView
public void onDestroyView()- Overrides:
onDestroyView
in classandroidx.fragment.app.Fragment
-
onDestroy
public void onDestroy()- Overrides:
onDestroy
in classandroidx.fragment.app.Fragment
-
onConfigurationChanged
public void onConfigurationChanged(@Nullable android.content.res.Configuration newConfig) - Specified by:
onConfigurationChanged
in interfaceandroid.content.ComponentCallbacks
- Overrides:
onConfigurationChanged
in classandroidx.fragment.app.Fragment
-