Skip to content
Permalink
Browse files

Android Extensions

  • Loading branch information...
imuhao committed Nov 4, 2017
1 parent e2dfe36 commit 9a5fc711181ce32a11c8a510d63012bfb3777783
Showing with 8 additions and 9 deletions.
  1. +8 −9 app/src/main/kotlin/com/caimuhao/kedditbysteps/NewsFragment.kt
@@ -3,11 +3,11 @@ package com.caimuhao.kedditbysteps
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.caimuhao.kedditbysteps.commons.inflate
import kotlinx.android.synthetic.main.fragment_news.*

/**
* @author Smile
@@ -16,15 +16,14 @@ import com.caimuhao.kedditbysteps.commons.inflate
*/
class NewsFragment : Fragment() {

private var newsList: RecyclerView? = null

override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
var view = container?.inflate(R.layout.fragment_news)
newsList = view?.findViewById(R.id.news_list)
newsList?.setHasFixedSize(true)
newsList?.layoutManager = LinearLayoutManager(context)

return view
return container?.inflate(R.layout.fragment_news)
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
news_list.setHasFixedSize(true)
news_list.layoutManager = LinearLayoutManager(context)

}
}

0 comments on commit 9a5fc71

Please sign in to comment.
You can’t perform that action at this time.