Class ChallengeResponseFragment<V extends ChallengeResponseView,P extends ChallengeResponsePresenter<V>>
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V,P>
-
- com.cheetahdigital.challenges.ui.responses.base.ChallengeResponseFragment<V,P>
-
- All Implemented Interfaces:
android.content.ComponentCallbacks,android.view.View.OnClickListener,android.view.View.OnCreateContextMenuListener,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,ChallengeResponseView,AnalyticsManager.AnalyticsScreen,MvpView
- Direct Known Subclasses:
CheckInFragment,GameBaseFragment,MultiQuestionFragment,OverImageFragment,PhotoFragment,SeparateCaptionFragment,UpdateAttributeFragment,UpdatePreferencesFragment,VideoFragment,ViewContentBaseFragment
public abstract class ChallengeResponseFragment<V extends ChallengeResponseView,P extends ChallengeResponsePresenter<V>> extends MvpFragmentView<V,P> implements ChallengeResponseView, android.view.View.OnClickListener
The response screen forChallengeCan receive the following intent extras:- CHALLENGE_ID_KEY -the
Challengeid - RESPONSE_ID_KEY - the
ChallengeResponseid - CHALLENGE_KEY - the
Challengein json format - CHALLENGE_ENABLE_RATING - the flag for enabling rating
- CHALLENGE_FROM_DIALOG - the flag for showing submit button
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCHALLENGE_ENABLE_RATINGstatic java.lang.StringCHALLENGE_FROM_DIALOGstatic java.lang.StringCHALLENGE_ID_KEYstatic java.lang.StringCHALLENGE_KEYprotected android.app.ProgressDialogmProgressDialogprotected booleanmShowAsAlertprotected android.widget.ButtonmSubmitButtonstatic java.lang.StringRESPONDABLE_KEYstatic java.lang.StringRESPONSE_ID_KEYstatic java.lang.StringTAG
-
Constructor Summary
Constructors Constructor Description ChallengeResponseFragment()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ChallengegetChallenge()Get the challengejava.lang.StringgetChallengeIdentifier()Get the challenge identifierjava.lang.StringgetResponseIdentifier()Get the challenge response identifierprotected java.lang.StringgetRewardString(java.lang.String primary, com.google.gson.JsonObject secondary, java.lang.String status)Create reward string for responding to a challengebooleanisAlert()Check if challenge is shown as an alert dialogvoidonChallengeRespondSuccess(Response data)Notifies the view when the challenge respond is successfulvoidonClick(android.view.View view)voidonCreate(android.os.Bundle savedInstanceState)voidonViewCreated(android.view.View view, android.os.Bundle savedInstanceState)protected voidsendRespondSuccessFragmentResult()Send a respond success fragment result to using the request keyAlertChallengeDialog.CHALLENGE_DIALOG_REQUEST_KEYvoidshowErrorMessage(java.lang.String error)Notifies the view when the challenge respond failedvoidshowLoading(boolean show)Notifies the view to show or hide loadingvoidshowReward(java.lang.String primary, com.google.gson.JsonObject secondary, java.lang.String status)Notifies the view to show the reward for responding to the challengeabstract voidsubmitChallenge()Submit challenge response-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView
captureSharedElementValues, createPresenter, getContentLayoutId, getPresenter, getScreenName, getSharedElementViews, initSharedElementValues, isSharedAnimationEnabled, onAttach, onCreateView, onDestroyView, startActivity, startActivityForResult
-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, 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, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, 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 java.lang.String TAG
-
CHALLENGE_ENABLE_RATING
public static java.lang.String CHALLENGE_ENABLE_RATING
-
CHALLENGE_KEY
public static final java.lang.String CHALLENGE_KEY
- See Also:
- Constant Field Values
-
CHALLENGE_ID_KEY
public static final java.lang.String CHALLENGE_ID_KEY
- See Also:
- Constant Field Values
-
RESPONSE_ID_KEY
public static final java.lang.String RESPONSE_ID_KEY
- See Also:
- Constant Field Values
-
RESPONDABLE_KEY
public static final java.lang.String RESPONDABLE_KEY
- See Also:
- Constant Field Values
-
CHALLENGE_FROM_DIALOG
public static final java.lang.String CHALLENGE_FROM_DIALOG
- See Also:
- Constant Field Values
-
mShowAsAlert
protected boolean mShowAsAlert
-
mSubmitButton
protected android.widget.Button mSubmitButton
-
mProgressDialog
protected android.app.ProgressDialog mProgressDialog
-
-
Method Detail
-
submitChallenge
public abstract void submitChallenge()
Submit challenge response
-
onCreate
public void onCreate(@Nullable android.os.Bundle savedInstanceState)- Overrides:
onCreatein classandroidx.fragment.app.Fragment
-
onViewCreated
public void onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)- Overrides:
onViewCreatedin classMvpFragmentView<V extends ChallengeResponseView,P extends ChallengeResponsePresenter<V>>
-
onChallengeRespondSuccess
public void onChallengeRespondSuccess(Response data)
Description copied from interface:ChallengeResponseViewNotifies the view when the challenge respond is successful- Specified by:
onChallengeRespondSuccessin interfaceChallengeResponseView- Parameters:
data-Responsemodel
-
showReward
public void showReward(java.lang.String primary, com.google.gson.JsonObject secondary, java.lang.String status)Description copied from interface:ChallengeResponseViewNotifies the view to show the reward for responding to the challenge- Specified by:
showRewardin interfaceChallengeResponseView- Parameters:
primary- reward string of main prizesecondary- reward string of additional prizestatus- status fChallengeResponse
-
showErrorMessage
public void showErrorMessage(java.lang.String error)
Description copied from interface:ChallengeResponseViewNotifies the view when the challenge respond failed- Specified by:
showErrorMessagein interfaceChallengeResponseView- Parameters:
error- message
-
onClick
public void onClick(android.view.View view)
- Specified by:
onClickin interfaceandroid.view.View.OnClickListener
-
showLoading
public void showLoading(boolean show)
Description copied from interface:ChallengeResponseViewNotifies the view to show or hide loading- Specified by:
showLoadingin interfaceChallengeResponseView- Parameters:
show- true to start loading, false to hide
-
sendRespondSuccessFragmentResult
protected void sendRespondSuccessFragmentResult()
Send a respond success fragment result to using the request keyAlertChallengeDialog.CHALLENGE_DIALOG_REQUEST_KEY
-
getRewardString
protected java.lang.String getRewardString(java.lang.String primary, com.google.gson.JsonObject secondary, java.lang.String status)Create reward string for responding to a challenge- Parameters:
primary- main rewardsecondary- additional rewardstatus- response status- Returns:
- reward string
-
getChallengeIdentifier
public java.lang.String getChallengeIdentifier()
Get the challenge identifier- Returns:
- the challenge identifier
-
getResponseIdentifier
public java.lang.String getResponseIdentifier()
Get the challenge response identifier- Returns:
- the challenge response identifier
-
isAlert
public boolean isAlert()
Check if challenge is shown as an alert dialog- Returns:
- true if shown as alert, false otherwise
-
-