dev
Aurelien Hubert 7 years ago
parent 885671be31
commit 7a1baf623e
  1. 19
      app/src/main/java/net/pokeranalytics/android/ui/fragment/report/AbstractReportFragment.kt
  2. 8
      app/src/main/java/net/pokeranalytics/android/ui/fragment/report/ProgressReportFragment.kt

@ -9,7 +9,6 @@ import net.pokeranalytics.android.R
import net.pokeranalytics.android.calculus.Report
import net.pokeranalytics.android.model.LiveData
import net.pokeranalytics.android.model.realm.ReportSetup
import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity
import net.pokeranalytics.android.ui.fragment.data.DataManagerFragment
abstract class AbstractReportFragment : DataManagerFragment() {
@ -28,8 +27,6 @@ abstract class AbstractReportFragment : DataManagerFragment() {
protected var reportTitle: String? = null
protected lateinit var parentActivity: PokerAnalyticsActivity
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -41,25 +38,17 @@ abstract class AbstractReportFragment : DataManagerFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
parentActivity = activity as PokerAnalyticsActivity
// Avoid a bug during setting the titleResId
toolbar.title = ""
parentActivity.setSupportActionBar(toolbar)
parentActivity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
setHasOptionsMenu(true)
toolbar.title = reportTitle
setDisplayHomeAsUpEnabled(true)
setToolbarTitle(reportTitle)
}
override fun saveData() {
activity?.let {
val builder = AlertDialog.Builder(it)
// Get the layout inflater
val inflater = requireActivity().layoutInflater;
val inflater = requireActivity().layoutInflater
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout

@ -80,12 +80,12 @@ class ProgressReportFragment : AbstractReportFragment() {
*/
private fun initUI() {
val fragmentManager = parentActivity.supportFragmentManager
val fragmentTransaction = fragmentManager.beginTransaction()
val fragmentManager = parentActivity?.supportFragmentManager
val fragmentTransaction = fragmentManager?.beginTransaction()
graphFragment = GraphFragment()
fragmentTransaction.add(R.id.graphContainer, graphFragment)
fragmentTransaction.commit()
fragmentTransaction?.add(R.id.graphContainer, graphFragment)
fragmentTransaction?.commit()
stat.aggregationTypes.firstOrNull()?.let { aggregationType ->
reports[aggregationType]?.let { report ->

Loading…
Cancel
Save