|
|
|
|
@ -40,6 +40,8 @@ class ProgressReportFragment : AbstractReportFragment() { |
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
|
|
|
|
|
|
private const val GRAPH_TAG = "graph" |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Creates new instance |
|
|
|
|
*/ |
|
|
|
|
@ -63,15 +65,16 @@ class ProgressReportFragment : AbstractReportFragment() { |
|
|
|
|
|
|
|
|
|
// Life Cycle |
|
|
|
|
|
|
|
|
|
override fun onDestroyView() { |
|
|
|
|
super.onDestroyView() |
|
|
|
|
_binding = null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { |
|
|
|
|
super.onCreateView(inflater, container, savedInstanceState) |
|
|
|
|
_binding = FragmentProgressReportBinding.inflate(inflater, container, false) |
|
|
|
|
return binding.root |
|
|
|
|
|
|
|
|
|
val fragmentTransaction = childFragmentManager.beginTransaction() |
|
|
|
|
this.graphFragment = GraphFragment.newInstance() |
|
|
|
|
fragmentTransaction.add(R.id.graphContainer, this.graphFragment, GRAPH_TAG) |
|
|
|
|
fragmentTransaction.commit() |
|
|
|
|
|
|
|
|
|
return binding.root |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
|
@ -79,17 +82,24 @@ class ProgressReportFragment : AbstractReportFragment() { |
|
|
|
|
initUI() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onDestroyView() { |
|
|
|
|
|
|
|
|
|
// childFragmentManager.findFragmentByTag(GRAPH_TAG)?.let { fragment -> |
|
|
|
|
// val fragmentTransaction = childFragmentManager.beginTransaction() |
|
|
|
|
// fragmentTransaction.remove(fragment) |
|
|
|
|
// fragmentTransaction.commit() |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
super.onDestroyView() |
|
|
|
|
_binding = null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Init UI |
|
|
|
|
*/ |
|
|
|
|
private fun initUI() { |
|
|
|
|
|
|
|
|
|
val chipGroup = binding.chipGroup |
|
|
|
|
val fragmentManager = parentActivity?.supportFragmentManager |
|
|
|
|
val fragmentTransaction = fragmentManager?.beginTransaction() |
|
|
|
|
this.graphFragment = GraphFragment.newInstance(Graph.Style.LINE) |
|
|
|
|
fragmentTransaction?.add(R.id.graphContainer, this.graphFragment) |
|
|
|
|
fragmentTransaction?.commit() |
|
|
|
|
|
|
|
|
|
this.stat.aggregationTypes.firstOrNull()?.let { |
|
|
|
|
this.reports[it] = this.selectedReport |
|
|
|
|
@ -208,11 +218,13 @@ class ProgressReportFragment : AbstractReportFragment() { |
|
|
|
|
when (ds) { |
|
|
|
|
is LineDataSet -> { |
|
|
|
|
this.reportViewModel.setLineDataSet(ds) |
|
|
|
|
graphFragment.reload(Graph.Style.LINE) |
|
|
|
|
this.reportViewModel.style = Graph.Style.LINE |
|
|
|
|
graphFragment.reload() |
|
|
|
|
} |
|
|
|
|
is BarDataSet -> { |
|
|
|
|
this.reportViewModel.setBarDataSet(ds) |
|
|
|
|
graphFragment.reload(Graph.Style.BAR) |
|
|
|
|
this.reportViewModel.style = Graph.Style.BAR |
|
|
|
|
graphFragment.reload() |
|
|
|
|
} |
|
|
|
|
else -> throw PAIllegalStateException("unmanaged data set") |
|
|
|
|
} |
|
|
|
|
|