state as val

This commit is contained in:
alex 2019-10-17 17:20:35 +03:00
parent 47bb31b93f
commit 292ec56815
1 changed files with 2 additions and 9 deletions

View File

@ -10,6 +10,7 @@ import android.view.ViewGroup
import androidx.annotation.IdRes
import androidx.fragment.app.Fragment
import ru.touchin.roboswag.components.navigation.activities.OnBackPressedListener
import ru.touchin.roboswag.components.navigation.viewcontrollers.EmptyState
import ru.touchin.roboswag.components.navigation.viewcontrollers.ViewController
abstract class BottomNavigationFragment : Fragment() {
@ -75,7 +76,7 @@ abstract class BottomNavigationFragment : Fragment() {
class TabData(
val viewControllerClass: Class<out ViewController<*, *>>,
viewControllerState: Parcelable,
val viewControllerState: Parcelable,
/**
* It can be useful in some cases when it is necessary to create ViewController
* with initial state every time when tab opens.
@ -83,14 +84,6 @@ abstract class BottomNavigationFragment : Fragment() {
val saveStateOnSwitching: Boolean = true
) {
/**
* It is value as class body property instead of value as constructor parameter to specify
* custom getter of this field which returns copy of Parcelable every time it be called.
* This is necessary to avoid modifying this value if it would be a value as constructor parameter
* and every getting of this value would return the same instance.
*/
val viewControllerState = viewControllerState
operator fun component1() = viewControllerClass
operator fun component2() = viewControllerState