我有一个包含3个场景的AuthorizationActivity,它们只是不同数量的字段,所以当用户来时,Activity首先运行"启动场景",有2个按钮(登录,注册) ,通过点击每个用户看到相同的活动但不同的场景。通过单击“返回”按钮上的我更改场景,例如,如果用户登录,则返回单击 - >将场景改为泼水。
现在我有一个问题,当他第一次登录,输入文字(验证工作,逻辑工作,一切都很酷),然后他决定回去,再次登录(逻辑被破坏,验证不起作用,事情不好)
内存越来越大,所以我猜问题是多个场景对象,因为如果我在SignIn上并且所有字段都正确填充,则调试显示我的模型是空的。我感谢任何帮助)
go SignUp
fun goSignUpTransition(v: View) {
TransitionManager.beginDelayedTransition(rootContainer_AS, changeBounds)
back.isClickable = true
splashSceneFields.sceneRoot.visibility = View.GONE
val layoutParams = innerArcContainer_SSM.layoutParams
layoutParams.height = signUpHeaderHeight
innerArcContainer_SSM.layoutParams = layoutParams
val pp = localRoot.layoutParams as LinearLayout.LayoutParams
pp.topMargin = signUpMargin
this.signUpContainer.visibility = View.VISIBLE
this.signUpContainer.animate().alpha(1f).start()
this.wellaLogo_SA.visibility = View.GONE
this.wellaLogo_SA.animate().alpha(0f).start()
this.title_SSM.text = getString(R.string.sign_up_text)
val alpha = this.toolbarControllers_SSM.animate().alpha(1f)
alpha.duration = ANIM_DURATION
alpha.start()
TransitionManager.go(signUpScene)
splashSceneFields.sceneRoot.visibility = View.VISIBLE
}
回去
fun goSplashTransition(v: View) {
galleryBottomSheet.photoURI = null
userPhoto_SSM.setImageResource(R.drawable.ic_photo_upload_white_big)
TransitionManager.beginDelayedTransition(rootContainer_AS, changeBounds)
splashSceneFields.sceneRoot.visibility = View.GONE
val layoutParams = innerArcContainer_SSM.layoutParams
layoutParams.height = preAnimDimension
innerArcContainer_SSM.layoutParams = layoutParams
val pp = localRoot.layoutParams as LinearLayout.LayoutParams
pp.topMargin = 0
val animator = wellaLogo_SA.animate()
animator.scaleX(1f).scaleY(1f).duration = ANIM_DURATION
animator.start()
val alpha = this.toolbarControllers_SSM.animate().alpha(0f)
alpha.duration = ANIM_DURATION
alpha.start()
this.signUpContainer.animate().alpha(0f).start()
this.signUpContainer.visibility = View.GONE
this.wellaLogo_SA.visibility = View.VISIBLE
this.wellaLogo_SA.animate().alpha(1f).start()
TransitionManager.go(splashSceneFields)
back.isClickable = false
splashSceneFields.sceneRoot.visibility = View.VISIBLE
}
答案 0 :(得分:3)
自己找到解决方案,每当场景来临时,我必须再次找到我的所有观点,设置听众等等。场景有一个setEnterAction
你想要绑定UI或更新你的模型(我应该这样做)和setExitAction
如果你有必要发布/清除/更新的东西,那就去做吧那里。