Class HtmlGameFragment<V extends HtmlGameView,P extends HtmlGamePresenter<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>
-
- com.cheetahdigital.challenges.ui.responses.game.base.GameBaseFragment<V,P>
-
- com.cheetahdigital.challenges.ui.responses.game.html.HtmlGameFragment<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
,ChallengeResponseView
,GameView
,HtmlGameView
,WebAppInterface
,com.cheetahdigital.corekit.sdk.analytics.AnalyticsManager.AnalyticsScreen
,com.cheetahdigital.uikit.architecture.mvp.MvpView
public class HtmlGameFragment<V extends HtmlGameView,P extends HtmlGamePresenter<V>> extends GameBaseFragment<V,P> implements HtmlGameView, WebAppInterface
Class that handles the html / javascript challenge
-
-
Field Summary
-
Fields inherited from class com.cheetahdigital.challenges.ui.responses.base.ChallengeResponseFragment
CHALLENGE_ENABLE_RATING, CHALLENGE_FROM_DIALOG, CHALLENGE_ID_KEY, CHALLENGE_KEY, mProgressDialog, mShowAsAlert, mSubmitButton, RESPONDABLE_KEY, RESPONSE_ID_KEY, TAG
-
-
Constructor Summary
Constructors Constructor Description HtmlGameFragment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Notifies the interface implementation to finish the gameprotected 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 Androidvoid
onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
void
postMessage(java.lang.String message)
Notifies the interface implementation to show a messagevoid
prepareGame(java.lang.String url, java.lang.String prizes, java.lang.String genericBlob)
Notifies the view to initialize the gamevoid
setGameError(java.lang.String error)
Game failed to initializevoid
setGameResult(Prize prize)
Notifies the view when the challenge respond is successfulvoid
showLoading(boolean show)
Notifies the view to show or hide loadingvoid
showResult()
Notifies the interface implementation to show the game resultvoid
submitChallenge()
Get game result from server-
Methods inherited from class com.cheetahdigital.challenges.ui.responses.game.base.GameBaseFragment
onActivityCreated, showErrorMessage, showGameLostMessage, showGameWonMessage, showMessage
-
Methods inherited from class com.cheetahdigital.challenges.ui.responses.base.ChallengeResponseFragment
getChallenge, getChallengeIdentifier, getResponseIdentifier, getRewardString, isAlert, onChallengeRespondSuccess, onClick, onCreate, sendRespondSuccessFragmentResult, showReward
-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView
captureSharedElementValues, 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, 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, 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, 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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.cheetahdigital.challenges.ui.responses.base.ChallengeResponseView
onChallengeRespondSuccess, showErrorMessage, showReward
-
Methods inherited from interface com.cheetahdigital.challenges.ui.responses.game.base.GameView
showGameLostMessage, showGameWonMessage
-
-
-
-
Method Detail
-
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 HtmlGameView,P extends HtmlGamePresenter<V>>
- Returns:
- id of the content layout
-
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 HtmlGameView,P extends HtmlGamePresenter<V>>
- Returns:
- return the
MvpBasePresenter
-
onViewCreated
public void onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
- Overrides:
onViewCreated
in classChallengeResponseFragment<V extends HtmlGameView,P extends HtmlGamePresenter<V>>
-
showLoading
public void showLoading(boolean show)
Description copied from interface:ChallengeResponseView
Notifies the view to show or hide loading- Specified by:
showLoading
in interfaceChallengeResponseView
- Overrides:
showLoading
in classChallengeResponseFragment<V extends HtmlGameView,P extends HtmlGamePresenter<V>>
- Parameters:
show
- true to start loading, false to hide
-
prepareGame
public void prepareGame(java.lang.String url, java.lang.String prizes, java.lang.String genericBlob)
Description copied from interface:HtmlGameView
Notifies the view to initialize the game- Specified by:
prepareGame
in interfaceHtmlGameView
- Parameters:
url
- game urlprizes
- serialized list ofPrize
genericBlob
- json object used for game preparation
-
submitChallenge
public void submitChallenge()
Description copied from class:GameBaseFragment
Get game result from server- Specified by:
submitChallenge
in interfaceWebAppInterface
- Overrides:
submitChallenge
in classGameBaseFragment<V extends HtmlGameView,P extends HtmlGamePresenter<V>>
-
setGameResult
public void setGameResult(Prize prize)
Description copied from interface:GameView
Notifies the view when the challenge respond is successful- Specified by:
setGameResult
in interfaceGameView
- Parameters:
prize
-Prize
model
-
showResult
public void showResult()
Description copied from interface:WebAppInterface
Notifies the interface implementation to show the game result- Specified by:
showResult
in interfaceWebAppInterface
-
setGameError
public void setGameError(java.lang.String error)
Description copied from class:GameBaseFragment
Game failed to initialize- Specified by:
setGameError
in interfaceGameView
- Overrides:
setGameError
in classGameBaseFragment<V extends HtmlGameView,P extends HtmlGamePresenter<V>>
- Parameters:
error
- error message
-
postMessage
public void postMessage(java.lang.String message)
Description copied from interface:WebAppInterface
Notifies the interface implementation to show a message- Specified by:
postMessage
in interfaceWebAppInterface
- Parameters:
message
- message to show
-
close
public void close()
Description copied from interface:WebAppInterface
Notifies the interface implementation to finish the game- Specified by:
close
in interfaceWebAppInterface
-
-