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 forChallenge
Can receive the following intent extras:- CHALLENGE_ID_KEY -the
Challenge
id - RESPONSE_ID_KEY - the
ChallengeResponse
id - CHALLENGE_KEY - the
Challenge
in 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.String
CHALLENGE_ENABLE_RATING
static java.lang.String
CHALLENGE_FROM_DIALOG
static java.lang.String
CHALLENGE_ID_KEY
static java.lang.String
CHALLENGE_KEY
protected android.app.ProgressDialog
mProgressDialog
protected boolean
mShowAsAlert
protected android.widget.Button
mSubmitButton
static java.lang.String
RESPONDABLE_KEY
static java.lang.String
RESPONSE_ID_KEY
static java.lang.String
TAG
-
Constructor Summary
Constructors Constructor Description ChallengeResponseFragment()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Challenge
getChallenge()
Get the challengejava.lang.String
getChallengeIdentifier()
Get the challenge identifierjava.lang.String
getResponseIdentifier()
Get the challenge response identifierprotected java.lang.String
getRewardString(java.lang.String primary, com.google.gson.JsonObject secondary, java.lang.String status)
Create reward string for responding to a challengeboolean
isAlert()
Check if challenge is shown as an alert dialogvoid
onChallengeRespondSuccess(Response data)
Notifies the view when the challenge respond is successfulvoid
onClick(android.view.View view)
void
onCreate(android.os.Bundle savedInstanceState)
void
onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
protected void
sendRespondSuccessFragmentResult()
Send a respond success fragment result to using the request keyAlertChallengeDialog.CHALLENGE_DIALOG_REQUEST_KEY
void
showErrorMessage(java.lang.String error)
Notifies the view when the challenge respond failedvoid
showLoading(boolean show)
Notifies the view to show or hide loadingvoid
showReward(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 void
submitChallenge()
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:
onCreate
in classandroidx.fragment.app.Fragment
-
onViewCreated
public void onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
- Overrides:
onViewCreated
in classMvpFragmentView<V extends ChallengeResponseView,P extends ChallengeResponsePresenter<V>>
-
onChallengeRespondSuccess
public void onChallengeRespondSuccess(Response data)
Description copied from interface:ChallengeResponseView
Notifies the view when the challenge respond is successful- Specified by:
onChallengeRespondSuccess
in interfaceChallengeResponseView
- Parameters:
data
-Response
model
-
showReward
public void showReward(java.lang.String primary, com.google.gson.JsonObject secondary, java.lang.String status)
Description copied from interface:ChallengeResponseView
Notifies the view to show the reward for responding to the challenge- Specified by:
showReward
in 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:ChallengeResponseView
Notifies the view when the challenge respond failed- Specified by:
showErrorMessage
in interfaceChallengeResponseView
- Parameters:
error
- message
-
onClick
public void onClick(android.view.View view)
- Specified by:
onClick
in interfaceandroid.view.View.OnClickListener
-
showLoading
public void showLoading(boolean show)
Description copied from interface:ChallengeResponseView
Notifies the view to show or hide loading- Specified by:
showLoading
in 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
-
-