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.SettingsRecyclerViewAdapter
|
|
import software.jonasfranz.banking5.adapters.dummy.DummyContent
|
|
|
|
/**
|
|
* A fragment representing a list of Items.
|
|
* Activities containing this fragment MUST implement the
|
|
* [SettingsFragment.OnListFragmentInteractionListener] interface.
|
|
*/
|
|
class SettingsFragment : Fragment() {
|
|
private var columnCount = 1
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
|
|
}
|
|
|
|
override fun onCreateView(
|
|
inflater: LayoutInflater, container: ViewGroup?,
|
|
savedInstanceState: Bundle?
|
|
): View? {
|
|
val view = inflater.inflate(R.layout.fragment_settings_list, container, false)
|
|
|
|
// Set the adapter
|
|
if (view is RecyclerView) {
|
|
with(view) {
|
|
layoutManager = when {
|
|
columnCount <= 1 -> LinearLayoutManager(context)
|
|
else -> GridLayoutManager(context, columnCount)
|
|
}
|
|
adapter =
|
|
SettingsRecyclerViewAdapter(DummyContent.ITEMS, ::onSelectItem)
|
|
}
|
|
}
|
|
return view
|
|
}
|
|
|
|
fun onSelectItem(item: DummyContent.DummyItem) {
|
|
|
|
}
|
|
}
|
|
|