You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.6 KiB
52 lines
1.6 KiB
package software.jonasfranz.banking5.fragments
|
|
|
|
import android.content.Context
|
|
import android.os.Bundle
|
|
import android.support.v4.app.Fragment
|
|
import android.support.v7.widget.GridLayoutManager
|
|
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 software.jonasfranz.banking5.R
|
|
import software.jonasfranz.banking5.adapters.TransactionsRecyclerViewAdapter
|
|
|
|
import software.jonasfranz.banking5.adapters.dummy.DummyContent
|
|
import software.jonasfranz.banking5.adapters.dummy.DummyContent.DummyItem
|
|
|
|
/**
|
|
* A fragment representing a list of Items.
|
|
*/
|
|
class TransactionFragment : Fragment(){
|
|
|
|
// TODO: Customize parameters
|
|
private var columnCount = 1
|
|
|
|
|
|
override fun onCreateView(
|
|
inflater: LayoutInflater, container: ViewGroup?,
|
|
savedInstanceState: Bundle?
|
|
): View? {
|
|
val view = inflater.inflate(R.layout.fragment_transaction_list, container, false)
|
|
|
|
// Set the adapter
|
|
if (view is RecyclerView) {
|
|
with(view) {
|
|
layoutManager = when {
|
|
columnCount <= 1 -> LinearLayoutManager(context)
|
|
else -> GridLayoutManager(context, columnCount)
|
|
}
|
|
adapter = TransactionsRecyclerViewAdapter(
|
|
DummyContent.ITEMS,
|
|
::onListFragmentInteraction
|
|
)
|
|
}
|
|
}
|
|
return view
|
|
}
|
|
|
|
fun onListFragmentInteraction(item: DummyItem?) {
|
|
|
|
}
|
|
}
|
|
|