Merge pull request #104 from TouchInstinct/refactor/tag_parameter_in_navigation_actions

Refactor – changed mutual order of parameters `tag` and `transactionSetup` in `FragmentNavigation` and `ViewControllerNavigation`
This commit is contained in:
Даниил Борисовский 2019-11-11 22:12:53 +03:00 committed by GitHub
commit a0bdc1518d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 39 deletions

View File

@ -83,8 +83,8 @@ open class FragmentNavigation(
* @param addToStack Flag to add this transaction to the back stack;
* @param args Bundle to be set as [Fragment.getArguments] of instantiated [Fragment];
* @param backStackName Name of [Fragment] in back stack;
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
*/
fun addToStack(
fragmentClass: Class<out Fragment>,
@ -93,8 +93,8 @@ open class FragmentNavigation(
addToStack: Boolean,
args: Bundle?,
backStackName: String?,
transactionSetup: ((FragmentTransaction) -> Unit)?,
tag: String?
tag: String?,
transactionSetup: ((FragmentTransaction) -> Unit)?
) {
if (fragmentManager.isDestroyed) {
Lc.assertion("FragmentManager is destroyed")
@ -146,18 +146,18 @@ open class FragmentNavigation(
*
* @param fragmentClass Class of [Fragment] to instantiate;
* @param args Bundle to be set as [Fragment.getArguments] of instantiated [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
*/
fun push(
fragmentClass: Class<out Fragment>,
args: Bundle? = null,
addToStack: Boolean = true,
backStackName: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
addToStack(fragmentClass, null, 0, addToStack, args, backStackName, transactionSetup, tag)
addToStack(fragmentClass, null, 0, addToStack, args, backStackName, tag, transactionSetup)
}
/**
@ -166,16 +166,16 @@ open class FragmentNavigation(
* @param fragmentClass Class of [Fragment] to instantiate;
* @param targetFragment Target fragment to be set as [Fragment.getTargetFragment] of instantiated [Fragment];
* @param args Bundle to be set as [Fragment.getArguments] of instantiated [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
*/
fun pushForResult(
fragmentClass: Class<out Fragment>,
targetFragment: Fragment,
targetRequestCode: Int,
args: Bundle? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
addToStack(
fragmentClass,
@ -184,8 +184,8 @@ open class FragmentNavigation(
true,
args,
null,
transactionSetup,
tag
tag,
transactionSetup
)
}
@ -195,17 +195,17 @@ open class FragmentNavigation(
*
* @param fragmentClass Class of [Fragment] to instantiate;
* @param args Bundle to be set as [Fragment.getArguments] of instantiated [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
*/
fun setAsTop(
fragmentClass: Class<out Fragment>,
args: Bundle? = null,
addToStack: Boolean = true,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
addToStack(fragmentClass, null, 0, addToStack, args, TOP_FRAGMENT_TAG_MARK, transactionSetup, tag)
addToStack(fragmentClass, null, 0, addToStack, args, TOP_FRAGMENT_TAG_MARK, tag, transactionSetup)
}
/**
@ -213,18 +213,18 @@ open class FragmentNavigation(
*
* @param fragmentClass Class of [Fragment] to instantiate;
* @param args Bundle to be set as [Fragment.getArguments] of instantiated [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info.
*/
@JvmOverloads
fun setInitial(
fragmentClass: Class<out Fragment>,
args: Bundle? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
beforeSetInitialActions()
setAsTop(fragmentClass, args, false, transactionSetup, tag)
setAsTop(fragmentClass, args, false, tag, transactionSetup)
}
/**

View File

@ -51,8 +51,8 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
* @param state [Parcelable] of [ViewController]'s fragment;
* @param addToStack Flag to add this transaction to the back stack;
* @param backStackName Name of [Fragment] in back stack;
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param TState Type of state of fragment.
*/
fun <TState : Parcelable> pushViewController(
@ -60,8 +60,8 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
state: TState,
addToStack: Boolean = true,
backStackName: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
addToStack(
ViewControllerFragment::class.java,
@ -70,8 +70,8 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
addToStack,
ViewControllerFragment.args(viewControllerClass, state),
backStackName,
transactionSetup,
tag
tag,
transactionSetup
)
}
@ -83,8 +83,8 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
* @param targetFragment [ViewControllerFragment] to be set as target;
* @param state [Parcelable] of [ViewController]'s fragment;
* @param backStackName Name of [Fragment] in back stack;
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param TState Type of state of fragment;
* @param TTargetFragment Type of target fragment.
*/
@ -94,8 +94,8 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
targetFragment: TTargetFragment,
targetRequestCode: Int,
backStackName: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
addToStack(
ViewControllerFragment::class.java,
@ -104,8 +104,8 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
true,
ViewControllerFragment.args(viewControllerClass, state),
backStackName,
transactionSetup,
tag
tag,
transactionSetup
)
}
@ -115,16 +115,16 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
*
* @param viewControllerClass Class of [ViewController] to be pushed;
* @param state [Parcelable] of [ViewController]'s fragment;
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param TState Type of state of fragment.
*/
fun <TState : Parcelable> setViewControllerAsTop(
viewControllerClass: Class<out ViewController<out TActivity, TState>>,
state: TState,
addToStack: Boolean = true,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
addToStack(
ViewControllerFragment::class.java,
@ -133,8 +133,8 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
addToStack,
ViewControllerFragment.args(viewControllerClass, state),
TOP_FRAGMENT_TAG_MARK,
transactionSetup,
tag
tag,
transactionSetup
)
}
@ -144,18 +144,18 @@ open class ViewControllerNavigation<TActivity : FragmentActivity>(
*
* @param viewControllerClass Class of [ViewController] to be pushed;
* @param state [Parcelable] of [ViewController]'s fragment;
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param tag Optional tag name for the [Fragment];
* @param transactionSetup Function to setup transaction before commit. It is useful to specify transition animations or additional info;
* @param TState Type of state of fragment.
*/
fun <TState : Parcelable> setInitialViewController(
viewControllerClass: Class<out ViewController<out TActivity, TState>>,
state: TState,
transactionSetup: ((FragmentTransaction) -> Unit)? = null,
tag: String? = null
tag: String? = null,
transactionSetup: ((FragmentTransaction) -> Unit)? = null
) {
beforeSetInitialActions()
setViewControllerAsTop(viewControllerClass, state, false, transactionSetup, tag)
setViewControllerAsTop(viewControllerClass, state, false, tag, transactionSetup)
}
}