Commit 6ebf305d authored by Andreas Schildbach's avatar Andreas Schildbach
Browse files

MainFragment: Configure click action for hatchery.

parent 7261d3a5
......@@ -32,7 +32,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.Fragment
import de.ccc.events.badge.card10.CARD10_BLUETOOTH_MAC_PREFIX
import de.ccc.events.badge.card10.R
import de.ccc.events.badge.card10.common.ConnectionService
import de.ccc.events.badge.card10.hatchery.AppListFragment
import de.ccc.events.badge.card10.mood.MoodFragment
import de.ccc.events.badge.card10.scanner.ScannerFragment
import kotlinx.android.synthetic.main.main_fragment.*
......@@ -61,18 +61,16 @@ class MainFragment : Fragment() {
showDisconnectedView(view)
}
button_pair.setOnClickListener {
fragmentManager!!.beginTransaction()
.replace(R.id.fragment_container, ScannerFragment())
.addToBackStack(null)
.commit()
}
button_mood.setOnClickListener {
fragmentManager!!.beginTransaction()
.replace(R.id.fragment_container, MoodFragment())
.addToBackStack(null)
.commit()
}
button_pair.setOnClickListener { startFragment(ScannerFragment()) }
button_mood.setOnClickListener { startFragment(MoodFragment()) }
button_hatchery.setOnClickListener { startFragment(AppListFragment()) }
}
private fun startFragment(fragment: Fragment) {
fragmentManager!!.beginTransaction()
.replace(R.id.fragment_container, fragment)
.addToBackStack(null)
.commit()
}
private fun showConnectedView(view: View) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment