|
|
|
@ -21,13 +21,16 @@ class ProgressReportActivity : ReportActivity() { |
|
|
|
* Default constructor |
|
|
|
* Default constructor |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun newInstance(context: Context, report: Report, title: String, stat: Stat? = null, displayAggregationChoices: Boolean = true) { |
|
|
|
fun newInstance(context: Context, report: Report, title: String, stat: Stat? = null, displayAggregationChoices: Boolean = true) { |
|
|
|
ReportViewModel.parameters = ReportParameters(report, title, stat, showAggregationChoices = displayAggregationChoices) |
|
|
|
|
|
|
|
|
|
|
|
val parameters = ReportParameters(report, title, stat, showAggregationChoices = displayAggregationChoices) |
|
|
|
|
|
|
|
ReportViewModel.defineParameters(parameters) |
|
|
|
val intent = Intent(context, ProgressReportActivity::class.java) |
|
|
|
val intent = Intent(context, ProgressReportActivity::class.java) |
|
|
|
context.startActivity(intent) |
|
|
|
context.startActivity(intent) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun newInstanceForResult(fragment: Fragment, report: Report, title: String, stat: Stat? = null, displayAggregationChoices: Boolean = true) { |
|
|
|
fun newInstanceForResult(fragment: Fragment, report: Report, title: String, stat: Stat? = null, displayAggregationChoices: Boolean = true) { |
|
|
|
ReportViewModel.parameters = ReportParameters(report, title, stat, showAggregationChoices = displayAggregationChoices) |
|
|
|
val parameters = ReportParameters(report, title, stat, showAggregationChoices = displayAggregationChoices) |
|
|
|
|
|
|
|
ReportViewModel.defineParameters(parameters) |
|
|
|
val intent = Intent(fragment.context, ProgressReportActivity::class.java) |
|
|
|
val intent = Intent(fragment.context, ProgressReportActivity::class.java) |
|
|
|
fragment.startActivityForResult(intent, RequestCode.DEFAULT.value) |
|
|
|
fragment.startActivityForResult(intent, RequestCode.DEFAULT.value) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -45,28 +48,9 @@ class ProgressReportActivity : ReportActivity() { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun initUI() { |
|
|
|
private fun initUI() { |
|
|
|
|
|
|
|
|
|
|
|
ReportViewModel.parameters?.let { |
|
|
|
val progressFragment = ProgressReportFragment() |
|
|
|
this.viewModel.report = it.report |
|
|
|
|
|
|
|
this.viewModel.title = it.title |
|
|
|
|
|
|
|
this.viewModel.stat = it.stat ?: it.report.options.stats.first() |
|
|
|
|
|
|
|
this.viewModel.showAggregationChoices = it.showAggregationChoices |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReportViewModel.parameters = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// parameters?.let { |
|
|
|
|
|
|
|
// val report = it.report |
|
|
|
|
|
|
|
// val stat = it.stat ?: report.options.stats.first() |
|
|
|
|
|
|
|
// statisticDetailsFragment.setData(report, stat, it.showAggregationChoices, it.title) |
|
|
|
|
|
|
|
// parameters = null |
|
|
|
|
|
|
|
// } ?: run { |
|
|
|
|
|
|
|
// throw PAIllegalStateException("Request to show Progress Activity with null ReportParameters") |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val statisticDetailsFragment = ProgressReportFragment() |
|
|
|
|
|
|
|
val fragmentTransaction = supportFragmentManager.beginTransaction() |
|
|
|
val fragmentTransaction = supportFragmentManager.beginTransaction() |
|
|
|
fragmentTransaction.add(R.id.statisticDetailsContainer, statisticDetailsFragment) |
|
|
|
fragmentTransaction.add(R.id.statisticDetailsContainer, progressFragment) |
|
|
|
fragmentTransaction.commit() |
|
|
|
fragmentTransaction.commit() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|