@@ -7,51 +7,51 @@ import android.os.Bundle
77import android.view.View
88import android.widget.Toast
99import com.bumptech.glide.Glide
10+ import com.eericxu.cslayout.databinding.AtyCsBinding
1011import com.eericxu.cslibrary.ScaleViewGesture
1112import com.eericxu.cslibrary.createAnimator
1213import com.eericxu.cslibrary.finishShareAnim
1314import com.eericxu.cslibrary.keyparms.KeyParams
1415import com.eericxu.cslibrary.startShareAnim
15- import kotlinx.android.synthetic.main.aty_cs.*
1616
17- class CSAty : BaseAty () {
17+ class CSAty : BindBaseAty <AtyCsBinding >() {
18+ override fun inflate () = AtyCsBinding .inflate(layoutInflater)
1819 override fun onCreate (savedInstanceState : Bundle ? ) {
1920 super .onCreate(savedInstanceState)
20- setContentView(R .layout.aty_cs)
21- csLayout.visibility = View .INVISIBLE
21+ bind.csLayout.visibility = View .INVISIBLE
2222 val parm = intent.getParcelableExtra<KeyParams >(" imgView" )
23- val params = iv_cover .layoutParams
23+ val params = bind.ivCover .layoutParams
2424 val p = Point ()
2525 window.windowManager.defaultDisplay.getSize(p)
2626 params.height = (p.x * (parm.rect.height() * 1f / parm.rect.width())).toInt()
27- iv_cover .layoutParams = params
27+ bind.ivCover .layoutParams = params
2828 Glide .with (this )
2929 .load(intent.getIntExtra(" img" , R .mipmap.img_1))
30- .into(iv_cover )
30+ .into(bind.ivCover )
3131
32- ScaleViewGesture (this ).bindToView(iv_cover, csLayout)?.onClick = {
32+ ScaleViewGesture (this ).bindToView(bind.ivCover, bind. csLayout)?.onClick = {
3333 Toast .makeText(it.context, " Click" , Toast .LENGTH_SHORT ).show()
3434 }
3535
3636 val builder = StringBuilder ()
3737 for (i in 0 .. 100 ) {
3838 builder.append(" 以敦煌为圆心的东北东\n " )
3939 }
40- tv_content .text = builder.toString()
40+ bind.tvContent .text = builder.toString()
4141 }
4242
4343 var anim: Animator ? = null
4444 // 父类中重写onWindowFocusChanged 当window第一次获取焦点时执行
4545 override fun onFirstFocus () {
46- val animator = createAnimator(true , intent, " imgView" , iv_cover )
46+ val animator = createAnimator(true , intent, " imgView" , bind.ivCover )
4747 (animator as ValueAnimator ).addUpdateListener {
48- tv_content. translationY = iv_cover .translationY * 0.6f
49- tv_content. translationX = iv_cover .translationX
48+ bind.tvContent. translationY = bind.ivCover .translationY * 0.6f
49+ bind.tvContent. translationX = bind.ivCover .translationX
5050 }
51- csLayout.visibility = View .VISIBLE
51+ bind. csLayout.visibility = View .VISIBLE
5252 anim = startShareAnim(
53- csLayout,
54- createAnimator(true , intent, " tvTit" , tv_title ),
53+ bind. csLayout,
54+ createAnimator(true , intent, " tvTit" , bind.tvTitle ),
5555 animator
5656 )
5757 }
@@ -60,14 +60,14 @@ class CSAty : BaseAty() {
6060 override fun finish () {
6161 if (anim != null && anim?.isRunning == true )
6262 return
63- val animator = createAnimator(false , intent, " imgView" , iv_cover )
63+ val animator = createAnimator(false , intent, " imgView" , bind.ivCover )
6464 (animator as ValueAnimator ).addUpdateListener {
65- tv_content. translationY = iv_cover .translationY * 0.6f
66- tv_content. translationX = iv_cover .translationX
65+ bind.tvContent. translationY = bind.ivCover .translationY * 0.6f
66+ bind.tvContent. translationX = bind.ivCover .translationX
6767 }
6868 finishShareAnim(
69- csLayout,
70- createAnimator(false , intent, " tvTit" , tv_title ),
69+ bind. csLayout,
70+ createAnimator(false , intent, " tvTit" , bind.tvTitle ),
7171 animator,
7272 onAnimEnd = {
7373 superFinish()
0 commit comments