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

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    This interface must be implemented by all activites that will host RecognizerRunnerFragment.

    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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    android.widget.FrameLayout
    Returns the FrameLayout that represents the content layout of this fragment.
    Returns the RecognizerRunnerView 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
     
    void
    onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
     
    void
     
    void
    onSaveInstanceState(android.os.Bundle outState)
     
    void
     
    void
     
    void
    Recreates contained RecognizerRunnerView which causes that ScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment) is called again when new RecognizerRunnerView is created.
    void
    Registers the LifecycleObserver that will be notified about all lifecycle events of this RecognizerRunnerFragment
    void
    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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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

      @Nullable @AnyThread public RecognizerRunnerView getRecognizerRunnerView()
      Returns the RecognizerRunnerView managed by this fragment. If RecognizerRunnerView is still not created, returns null.
      Returns:
      the RecognizerRunnerView managed by this fragment.
    • getContentLayout

      @Nullable public android.widget.FrameLayout getContentLayout()
      Returns the FrameLayout that represents the content layout of this fragment. If content layout is still not created (i.e. before Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle) callback has been invoked, returns null. Note that on ScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment) it is guaranteed that content layout exists and contains exactly one view - RecognizerRunnerView, which can also be obtained with getRecognizerRunnerView().
      Returns:
      content layout of this fragment.
    • setCameraEventsListener

      public void setCameraEventsListener(@Nullable BaseCameraEventsListener cameraEventsListener)
      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

      public void registerLifecycleObserver(@Nullable LifecycleObserver lifecycleObserver)
      Registers the LifecycleObserver that will be notified about all lifecycle events of this RecognizerRunnerFragment
      Parameters:
      lifecycleObserver -
    • recreateRecognizerRunnerView

      public void recreateRecognizerRunnerView()
      Recreates contained RecognizerRunnerView which causes that ScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment) is called again when new RecognizerRunnerView is created.
    • onAttach

      public void onAttach(@Nullable android.app.Activity activity)
      Overrides:
      onAttach in class androidx.fragment.app.Fragment
    • onCreate

      public void onCreate(@Nullable android.os.Bundle savedInstanceState)
      Overrides:
      onCreate in class androidx.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 class androidx.fragment.app.Fragment
    • onStart

      public void onStart()
      Overrides:
      onStart in class androidx.fragment.app.Fragment
    • onRequestPermissionsResult

      public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
      Overrides:
      onRequestPermissionsResult in class androidx.fragment.app.Fragment
    • onResume

      public void onResume()
      Overrides:
      onResume in class androidx.fragment.app.Fragment
    • onPause

      public void onPause()
      Overrides:
      onPause in class androidx.fragment.app.Fragment
    • onStop

      public void onStop()
      Overrides:
      onStop in class androidx.fragment.app.Fragment
    • onSaveInstanceState

      public void onSaveInstanceState(@Nullable android.os.Bundle outState)
      Overrides:
      onSaveInstanceState in class androidx.fragment.app.Fragment
    • onDestroyView

      public void onDestroyView()
      Overrides:
      onDestroyView in class androidx.fragment.app.Fragment
    • onDestroy

      public void onDestroy()
      Overrides:
      onDestroy in class androidx.fragment.app.Fragment
    • onConfigurationChanged

      public void onConfigurationChanged(@Nullable android.content.res.Configuration newConfig)
      Specified by:
      onConfigurationChanged in interface android.content.ComponentCallbacks
      Overrides:
      onConfigurationChanged in class androidx.fragment.app.Fragment