-
Notifications
You must be signed in to change notification settings - Fork 3
/
SimpleFragment.kt
28 lines (24 loc) · 1.07 KB
/
SimpleFragment.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
package com.appspell.wildscroll.fragments
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.appspell.wildscroll.R
import com.appspell.wildscroll.R.layout
import com.appspell.wildscroll.adapter.SampleAdapter
import com.appspell.wildscroll.data.DataSource
class SimpleFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
inflater.inflate(layout.fragment_simple, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val recyclerView = view.findViewById<RecyclerView>(R.id.list)
with(recyclerView) {
layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
adapter = SampleAdapter()
(adapter as SampleAdapter).items = DataSource(resources).companies
}
}
}