Class SubmitReceiptFragment<V extends SubmitReceiptView,P extends SubmitReceiptPresenter<V>>
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V,P>
-
- com.cheetahdigital.receipt.ui.submit.SubmitReceiptFragment<V,P>
-
- All Implemented Interfaces:
android.content.ComponentCallbacks
,android.view.View.OnClickListener
,android.view.View.OnCreateContextMenuListener
,androidx.activity.result.ActivityResultCaller
,androidx.lifecycle.HasDefaultViewModelProviderFactory
,androidx.lifecycle.LifecycleOwner
,androidx.lifecycle.ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
,com.cheetahdigital.corekit.sdk.analytics.AnalyticsManager.AnalyticsScreen
,SubmitReceiptView
,com.cheetahdigital.uikit.architecture.mvp.MvpView
public class SubmitReceiptFragment<V extends SubmitReceiptView,P extends SubmitReceiptPresenter<V>> extends com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V,P> implements SubmitReceiptView, android.view.View.OnClickListener
Extends theMvpFragmentView
withSubmitReceiptView
as the View and theSubmitReceiptPresenter
as the presenterThis fragment calls the camera or gallery functions of the phone so that users can submit an image of a receipt Can receive the following intent extras:
IntentKey.PRIMARY_PARAMS
- theReceiptParams
to use
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
IMAGE_FOLDER_NAME
static int
SELECT_PICTURE_REQUEST_CODE
static java.lang.String
TAG
-
Constructor Summary
Constructors Constructor Description SubmitReceiptFragment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected P
createPresenter()
InstantiateMvpFragmentView.mPresenter
to be used for thisMvpActivityView
protected int
getContentLayoutId()
Provide the Content Layout ID which is of a Layout Resource Reference of Androidandroid.view.View.OnClickListener
getImageViewClickListener()
int
getScreenName()
android.view.View.OnClickListener
getSubmitButtonClicked()
void
onActivityCreated(android.os.Bundle savedInstanceState)
void
onActivityResult(int requestCode, int resultCode, android.content.Intent data)
void
onClick(android.view.View v)
android.view.View
onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
protected void
onPhotoTapped()
Choose a photo from the devicevoid
onSaveInstanceState(android.os.Bundle outState)
protected void
onSubmitButtonClicked()
This submits a file receipt to the APIvoid
setImageViewClickListener(android.view.View.OnClickListener onImageViewClickListener)
void
setSubmitButtonClicked(android.view.View.OnClickListener onSubmitButtonClicked)
void
showError(java.lang.String error)
This notifies the view when the API call returns an errorvoid
showReceiptSuccessfulDialog(Receipt receipt)
This notifies the view when the submission of the receipt to the API returns a successful response-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView
captureSharedElementValues, getPresenter, getSharedElementViews, initSharedElementValues, isSharedAnimationEnabled, onAttach, onDestroyView, onViewCreated, startActivity, startActivityForResult
-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, 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, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onStart, onStop, 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, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
-
-
-
Field Detail
-
TAG
public static final java.lang.String TAG
- See Also:
- Constant Field Values
-
SELECT_PICTURE_REQUEST_CODE
public static int SELECT_PICTURE_REQUEST_CODE
-
IMAGE_FOLDER_NAME
public static java.lang.String IMAGE_FOLDER_NAME
-
-
Method Detail
-
getImageViewClickListener
public android.view.View.OnClickListener getImageViewClickListener()
-
setImageViewClickListener
public void setImageViewClickListener(android.view.View.OnClickListener onImageViewClickListener)
-
getSubmitButtonClicked
public android.view.View.OnClickListener getSubmitButtonClicked()
-
setSubmitButtonClicked
public void setSubmitButtonClicked(android.view.View.OnClickListener onSubmitButtonClicked)
-
getContentLayoutId
protected int getContentLayoutId()
Description copied from class:com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView
Provide the Content Layout ID which is of a Layout Resource Reference of Android- Specified by:
getContentLayoutId
in classcom.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V extends SubmitReceiptView,P extends SubmitReceiptPresenter<V>>
- Returns:
- id of the content layout
-
onCreateView
@Nullable public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
- Overrides:
onCreateView
in classcom.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V extends SubmitReceiptView,P extends SubmitReceiptPresenter<V>>
-
createPresenter
protected P createPresenter()
Description copied from class:com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView
InstantiateMvpFragmentView.mPresenter
to be used for thisMvpActivityView
- Specified by:
createPresenter
in classcom.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V extends SubmitReceiptView,P extends SubmitReceiptPresenter<V>>
- Returns:
- return the
MvpBasePresenter
-
showReceiptSuccessfulDialog
public void showReceiptSuccessfulDialog(Receipt receipt)
Description copied from interface:SubmitReceiptView
This notifies the view when the submission of the receipt to the API returns a successful response- Specified by:
showReceiptSuccessfulDialog
in interfaceSubmitReceiptView
- Parameters:
receipt
-Receipt
object
-
showError
public void showError(java.lang.String error)
Description copied from interface:SubmitReceiptView
This notifies the view when the API call returns an error- Specified by:
showError
in interfaceSubmitReceiptView
- Parameters:
error
- String error message
-
onSubmitButtonClicked
protected void onSubmitButtonClicked()
This submits a file receipt to the API
-
onPhotoTapped
protected void onPhotoTapped()
Choose a photo from the device
-
getScreenName
public int getScreenName()
- Specified by:
getScreenName
in interfacecom.cheetahdigital.corekit.sdk.analytics.AnalyticsManager.AnalyticsScreen
- Overrides:
getScreenName
in classcom.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V extends SubmitReceiptView,P extends SubmitReceiptPresenter<V>>
-
onClick
public void onClick(android.view.View v)
- Specified by:
onClick
in interfaceandroid.view.View.OnClickListener
-
onActivityResult
public void onActivityResult(int requestCode, int resultCode, android.content.Intent data)
- Overrides:
onActivityResult
in classandroidx.fragment.app.Fragment
-
onActivityCreated
public void onActivityCreated(android.os.Bundle savedInstanceState)
- Overrides:
onActivityCreated
in classandroidx.fragment.app.Fragment
-
onSaveInstanceState
public void onSaveInstanceState(android.os.Bundle outState)
- Overrides:
onSaveInstanceState
in classandroidx.fragment.app.Fragment
-
-