@@ -5,14 +5,14 @@ import android.view.View
5
5
import androidx.appcompat.app.AppCompatActivity
6
6
import androidx.recyclerview.widget.LinearLayoutManager
7
7
import com.livermor.delegateadapter.delegate.CompositeDelegateAdapter
8
- import com.livermor.dumchev.delegateadapters.R
9
8
import com.livermor.dumchev.delegateadapters.base.adapter.CheckDelegateAdapter
10
9
import com.livermor.dumchev.delegateadapters.base.adapter.GenerateItemsDelegateAdapter
11
10
import com.livermor.dumchev.delegateadapters.base.adapter.TxtDelegateAdapter
12
- import kotlinx.android.synthetic.main.activity_main.*
11
+ import com.livermor.dumchev.delegateadapters.databinding.ActivityBaseExampleBinding
13
12
14
13
/* *
15
- * @author dumchev on 28.11.17.
14
+
15
+ @author dumchev on 28.11.17.
16
16
*/
17
17
class BaseExampleActivity : AppCompatActivity () {
18
18
@@ -21,12 +21,14 @@ class BaseExampleActivity : AppCompatActivity() {
21
21
CheckDelegateAdapter (),
22
22
GenerateItemsDelegateAdapter { generateNewData() }
23
23
)
24
+ private lateinit var binding: ActivityBaseExampleBinding
24
25
25
26
override fun onCreate (savedInstanceState : Bundle ? ) {
26
27
super .onCreate(savedInstanceState)
27
- setContentView(R .layout.activity_base_example)
28
- rv.layoutManager = LinearLayoutManager (this )
29
- rv.adapter = adapter
28
+ binding = ActivityBaseExampleBinding .inflate(layoutInflater)
29
+ setContentView(binding.root)
30
+ binding.rv.layoutManager = LinearLayoutManager (this )
31
+ binding.rv.adapter = adapter
30
32
adapter.swapData(MockDataFactory .prepareData())
31
33
}
32
34
@@ -36,6 +38,6 @@ class BaseExampleActivity : AppCompatActivity() {
36
38
37
39
private fun generateNewData () {
38
40
adapter.swapData(MockDataFactory .prepareData())
39
- rv.scrollToPosition(0 )
41
+ binding. rv.scrollToPosition(0 )
40
42
}
41
- }
43
+ }
0 commit comments