-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathThreeLayoutsPolishedActivity.kt
83 lines (65 loc) · 2.33 KB
/
ThreeLayoutsPolishedActivity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package co.linminphyo.motionmovies.poster
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import co.linminphyo.motionmovies.R
import kotlinx.android.synthetic.main.layout_movie_info_with_synopsis.motion_layout_movie_info
import kotlinx.android.synthetic.main.layout_3_screens_combined.motion_layout_poster_and_movie_info
import kotlinx.android.synthetic.main.layout_more_movies_basics.motion_layout_more_movies
import kotlinx.android.synthetic.main.layout_movie_info_basics.*
/**
* Created by lin min phyo on 2019-06-26.
*/
class ThreeLayoutsPolishedActivity : AppCompatActivity() {
private val recyclerViewMoreMovies by lazy {
this.findViewById<RecyclerView>(R.id.rv_more_movies).apply {
layoutManager = LinearLayoutManager(context , RecyclerView.HORIZONTAL , false)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.layout_3_screens_combined_polished)
recyclerViewMoreMovies.adapter = PosterAdapter()
motion_layout_poster_and_movie_info.setTransitionListener(object : TransitionListener {
override fun onTransitionTrigger(
p0: MotionLayout?,
p1: Int,
p2: Boolean,
p3: Float
) {
}
override fun onTransitionStarted(
p0: MotionLayout?,
p1: Int,
p2: Int
) {
}
override fun onTransitionChange(
motionLayout: MotionLayout?,
p1: Int,
p2: Int,
progress: Float
) {
if(motionLayout?.startState == R.id.frame_poster_top && motionLayout.endState == R.id.frame_more_movies_expanded){
motion_layout_more_movies.progress = progress
} else{
Log.i("Progress" , progress.toString())
if(progress != 1f){
motion_layout_movie_info.progress = progress
}
}
}
override fun onTransitionCompleted(
p0: MotionLayout?,
p1: Int
) {
}
})
motion_layout_poster_and_movie_info.progress = 1f
motion_layout_movie_info.progress = 1f
}
}