Skip to content

Commit

Permalink
Rename startPreloadFragment to startPreloadedFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
erolaksoy committed Dec 19, 2024
1 parent 77cc015 commit 6889f37
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/trendyol/medusa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class MainActivity : AppCompatActivity(), Navigator.NavigatorListener {
multipleStackNavigator.clearGroup("group1")
}
findViewById<Button>(R.id.startPreloadedFragment).setOnClickListener {
multipleStackNavigator.startPreloadFragment(SamplePreloadFragment.newInstance(), SamplePreloadFragment.TAG)
multipleStackNavigator.startPreloadedFragment(SamplePreloadFragment.newInstance(), SamplePreloadFragment.TAG)
}
multipleStackNavigator.observeDestinationChanges(this) {
Log.d("Destination Changed", "${it.javaClass.name} - ${it.tag}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PreloadFragmentTest {
navigator.preloadFragment(testChildFragment, fragmentTag)
parentFragment.childFragmentManager.executePendingTransactions()

val result = navigator.startPreloadFragment(null, fragmentTag)
val result = navigator.startPreloadedFragment(null, fragmentTag)
parentFragment.childFragmentManager.executePendingTransactions()

Truth.assertThat(result).isEqualTo(PreloadedFragmentResult.Success)
Expand All @@ -68,7 +68,7 @@ class PreloadFragmentTest {
val navigator = parentFragment.navigator
val fallbackFragment = TestChildFragment.newInstance("Fallback Fragment")

val result = navigator.startPreloadFragment(fallbackFragment, fragmentTag)
val result = navigator.startPreloadedFragment(fallbackFragment, fragmentTag)
parentFragment.childFragmentManager.executePendingTransactions()

val startedFragment = parentFragment.childFragmentManager.findFragmentByTag(fragmentTag)
Expand All @@ -89,7 +89,7 @@ class PreloadFragmentTest {
val fragmentTag = "non_existent_fragment"
val navigator = parentFragment.navigator

val result = navigator.startPreloadFragment(null, fragmentTag)
val result = navigator.startPreloadedFragment(null, fragmentTag)
parentFragment.childFragmentManager.executePendingTransactions()

val fragment = parentFragment.childFragmentManager.findFragmentByTag(fragmentTag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ open class MultipleStackNavigator(
fragmentManagerController.preloadFragment(FragmentData(fragment, fragmentTag))
}

override fun startPreloadFragment(fallbackFragment: Fragment?, fragmentTag: String): PreloadedFragmentResult {
override fun startPreloadedFragment(fallbackFragment: Fragment?, fragmentTag: String): PreloadedFragmentResult {
val currentFragmentTag = getCurrentFragmentTag()
val result = fragmentManagerController.showPreloadedFragment(currentFragmentTag, fragmentTag, fallbackFragment)
if (result !is PreloadedFragmentResult.NotFound) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ interface Navigator {
*
* This method attaches the given fragment to the fragment manager and prepares it in a hidden.
* The fragment will not be visible to the user until it is started later using
* [startPreloadFragment].
* [startPreloadedFragment].
*
* @param fragment The fragment instance to preload.
* @param fragmentTag The unique tag of fragment.
Expand All @@ -98,7 +98,7 @@ interface Navigator {
* - [PreloadedFragmentResult.FallbackSuccess] if the fallback fragment was used instead.
* - [PreloadedFragmentResult.NotFound] if no suitable fragment was found and no fallback was provided.
*/
fun startPreloadFragment(fallbackFragment: Fragment?, fragmentTag: String): PreloadedFragmentResult
fun startPreloadedFragment(fallbackFragment: Fragment?, fragmentTag: String): PreloadedFragmentResult

/**
* Modifies fragment stack. Pops current fragment from
Expand Down

0 comments on commit 6889f37

Please sign in to comment.