Skip to content
qiibeta edited this page Oct 23, 2019 · 13 revisions

Components to Know

Scene Components
Scene The Scene is the View wrapper with lifecycle management.
NavigationScene The NavigationScene implements navigation and backStack handling for Scene.
GroupScene The GroupScene can add other Scene/NavigationScene/GroupScene as child.

Scene api comparison

Lifecycle

Fragment lifecycle Scene lifecycle
onAttach() onAttach() deprecated
onCreate() onCreate() deprecated
onCreateView() onCreateView()
onViewCreated() onViewCreated()
onActivityCreated() onActivityCreated()
onStart() onStart()
onResume() onResume()
onPause() onPause()
onStop() onStop()
onDestroyView() onDestroyView()
onDestroy() onDestroy() deprecated
onDetach() onDetach() deprecated
onSaveInstanceState() onSaveInstanceState()
onViewStateRestored() onViewStateRestored()
Fragment lifecycle GroupScene lifecycle Description
onPostActivityCreated() all Children Scenes finish onActivityCreated() onPostActivityCreated()
onPostStart() all Children Scenes finish onStart() onPostStart()
onPostResume() all Children Scenes finish onResume() onPostResume()

Common api

Fragment api Scene api
setArguments()/getArguments() setArguments()/getArguments()
getActivity()/requireActivity() getActivity()/requireActivity()
getContext()/requireContext() getContext()/requireContext()/getSceneContext()
getResource() getResource()
getLifecycle()/getViewLifecycle() getLifecycle()
getViewModelStore() getViewModelStore()
startActivity() getNavigationScene().startActivity()
startActivityForResult() getNavigationScene().startActivityForResult()
requestPermissions() getNavigationScene().requestPermissions()
isVisible() isVisible()
getChildFragmentManager() extends GroupScene, use GroupScene api instead
setUserVisibleHint() extends UserVisibleHintGroupScene, use setUserVisibleHint()

GroupScene api

FragmentManager api GroupScene api
beginTransaction().add().commitNow() add()
beginTransaction().remove().commitNow() remove()
beginTransaction().show().commitNow() show()
beginTransaction().hide().commitNow() hide()
beginTransaction().replace().commitNow() replace()
findFragmentByTag() findSceneByTag()
getFragments() getSceneList()

NavigationScene api

Activity api NavigationScene api
startActivity(Intent) push(Scene)
Trancelucent Activity push(Scene, new PushOptions.Builder().setTrucluent(true).build())()
startActivityForResult(Intent) push(Scene, new PushOptions.Builder().setResultCallback().build())
setResult(Intent) setResult(Scene, Object)
finish() remove(Scene)
onBackPressed() pop()
getOnBackPressedDispatcher().addCallback() addOnBackPressedListener()
overridePendingTransition() overrideAnimationExecutor(Scene)
AppCompatActivity class AppCompatScene class

Other Scene api

Scene other api Description
getNavigationScene() Get NavigationScene instance
getParentScene() Get NavigationScene instance or GroupScene instance
getScope() Scope can be used to send any Object to children Scene
setTheme()/getTheme() Scene can use another different theme resource

Desigin library

Android Design library utility api Description
GroupSceneUIUtility.setupWithViewPager() Bind Scene to ViewPager
GroupSceneUIUtility.setupWithNavigationView() Bind Scene to NavigationView
GroupSceneUIUtility.setupWithBottomNavigationView() Bind Scene to BottomNavigationView