-
- 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,net.gini.android.capture.internal.ui.FragmentImplCallback,net.gini.android.capture.onboarding.OnboardingFragmentImplCallback,net.gini.android.capture.onboarding.OnboardingFragmentInterface
public class OnboardingFragmentCompat extends Fragment implements OnboardingFragmentImplCallback, OnboardingFragmentInterface
Component APIWhen you use the Component API with the Android Support Library, the
OnboardingFragmentCompatdisplays important advice for correctly photographing a document.Note: Your Activity hosting this Fragment must extend the and use an AppCompat Theme.
Include the
OnboardingFragmentCompatinto your layout either directly with<fragment>in your Activity's layout or using the androidx.fragment.app.FragmentManager.The default way of showing the Onboarding Screen is as an overlay above the camera preview with a semi-transparent background.
By default an empty last page is added to enable the revealing of the camera preview before the Onboarding Screen is dismissed.
If you would like to display a different number of pages, you can use the createInstance or createInstanceWithoutEmptyLastPage factory method and provide a list of OnboardingPage objects.
If you would like to disable the appending of the empty last page, you can use the createInstanceWithoutEmptyLastPage or the createInstanceWithoutEmptyLastPage factory method.
An OnboardingFragmentListener instance must be available until the
OnboardingFragmentCompatis attached to an activity. Failing to do so will throw an exception. The listener instance can be provided either implicitly by making the hosting Activity implement the OnboardingFragmentListener interface or explicitly by setting the listener using setListener.Your Activity is automatically set as the listener in onCreate.
Customizing the Onboarding ScreenSee the OnboardingActivity for details.
-
-
Method Summary
Modifier and Type Method Description static OnboardingFragmentCompatcreateInstanceWithoutEmptyLastPage(@NonNull() ArrayList<OnboardingPage> pages)Factory method for creating a new instance of the Fragment using the provided list of onboarding pages. static OnboardingFragmentCompatcreateInstance(@NonNull() ArrayList<OnboardingPage> pages)Factory method for creating a new instance of the Fragment using the provided list of onboarding pages. static OnboardingFragmentCompatcreateInstanceWithoutEmptyLastPage()Factory method for creating a new instance of the Fragment without appending an empty page to the default pages. voidonCreate(Bundle savedInstanceState)ViewonCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)PagerAdaptergetViewPagerAdapter(@NonNull() List<OnboardingPage> pages)voidsetListener(@NonNull() OnboardingFragmentListener listener)Set a listener for onboarding events. voidshowAlertDialog(@NonNull() String message, @NonNull() String positiveButtonTitle, @NonNull() DialogInterface.OnClickListener positiveButtonClickListener, @Nullable() String negativeButtonTitle, @Nullable() DialogInterface.OnClickListener negativeButtonClickListener, @Nullable() DialogInterface.OnCancelListener cancelListener)-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, onViewCreated, onViewStateRestored, postponeEnterTransition, 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, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu -
Methods inherited from class net.gini.android.capture.internal.ui.FragmentImplCallback
getActivity, getView, startActivity, startActivityForResult -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
createInstanceWithoutEmptyLastPage
static OnboardingFragmentCompat createInstanceWithoutEmptyLastPage(@NonNull() ArrayList<OnboardingPage> pages)
Factory method for creating a new instance of the Fragment using the provided list of onboarding pages.
This method prevents the appending of an empty page to your pages.
If you don't need a custom number of pages and wish to use the default behaviour, you can use the default constructor of OnboardingFragmentCompat.
- Parameters:
pages- the pages to be shown
-
createInstance
static OnboardingFragmentCompat createInstance(@NonNull() ArrayList<OnboardingPage> pages)
Factory method for creating a new instance of the Fragment using the provided list of onboarding pages.
If you would like to prevent the appending of an empty page, you can use the createInstanceWithoutEmptyLastPage factory method.
If you don't need a custom number of pages and wish to use the default behaviour, you can use the default constructor of OnboardingFragmentCompat.
- Parameters:
pages- the pages to be shown
-
createInstanceWithoutEmptyLastPage
static OnboardingFragmentCompat createInstanceWithoutEmptyLastPage()
Factory method for creating a new instance of the Fragment without appending an empty page to the default pages.
If you wish to use the default behaviour, you can use the default constructor of .
-
onCreateView
@Nullable() View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-
getViewPagerAdapter
PagerAdapter getViewPagerAdapter(@NonNull() List<OnboardingPage> pages)
-
setListener
void setListener(@NonNull() OnboardingFragmentListener listener)
Set a listener for onboarding events.
By default the hosting Activity is expected to implement the OnboardingFragmentListener. In case that is not feasible you may set the listener using this method.
Note: the listener is expected to be available until the fragment is attached to an activity. Make sure to set the listener before that.
- Parameters:
listener- OnboardingFragmentListener instance
-
showAlertDialog
void showAlertDialog(@NonNull() String message, @NonNull() String positiveButtonTitle, @NonNull() DialogInterface.OnClickListener positiveButtonClickListener, @Nullable() String negativeButtonTitle, @Nullable() DialogInterface.OnClickListener negativeButtonClickListener, @Nullable() DialogInterface.OnCancelListener cancelListener)
-
-
-
-