Class HtmlGameFragment<V extends HtmlGameView,​P extends HtmlGamePresenter<V>>

  • 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
    • Nested Class Summary

      • Nested classes/interfaces inherited from class androidx.fragment.app.Fragment

        androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Notifies the interface implementation to finish the game
      protected P createPresenter()
      Instantiate MvpFragmentView.mPresenter to be used for this MvpActivityView
      protected int getContentLayoutId()
      Provide the Content Layout ID which is of a Layout Resource Reference of Android
      void onViewCreated​(android.view.View view, android.os.Bundle savedInstanceState)  
      void postMessage​(java.lang.String message)
      Notifies the interface implementation to show a message
      void prepareGame​(java.lang.String url, java.lang.String prizes, java.lang.String genericBlob)
      Notifies the view to initialize the game
      void setGameError​(java.lang.String error)
      Game failed to initialize
      void setGameResult​(Prize prize)
      Notifies the view when the challenge respond is successful
      void showLoading​(boolean show)
      Notifies the view to show or hide loading
      void showResult()
      Notifies the interface implementation to show the game result
      void submitChallenge()
      Get game result from server
      • 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
    • Constructor Detail

      • HtmlGameFragment

        public HtmlGameFragment()
    • 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 class com.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
        Instantiate MvpFragmentView.mPresenter to be used for this MvpActivityView
        Specified by:
        createPresenter in class com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V extends HtmlGameView,​P extends HtmlGamePresenter<V>>
        Returns:
        return the MvpBasePresenter
      • 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 interface HtmlGameView
        Parameters:
        url - game url
        prizes - serialized list of Prize
        genericBlob - json object used for game preparation
      • setGameResult

        public void setGameResult​(Prize prize)
        Description copied from interface: GameView
        Notifies the view when the challenge respond is successful
        Specified by:
        setGameResult in interface GameView
        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 interface WebAppInterface
      • 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 interface WebAppInterface
        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 interface WebAppInterface