|
|
|
|
@ -7,36 +7,29 @@ import androidx.fragment.app.Fragment |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
import net.pokeranalytics.android.calculus.Report |
|
|
|
|
import net.pokeranalytics.android.calculus.Stat |
|
|
|
|
import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity |
|
|
|
|
import net.pokeranalytics.android.ui.activity.components.ReportActivity |
|
|
|
|
import net.pokeranalytics.android.ui.activity.components.ReportParameters |
|
|
|
|
import net.pokeranalytics.android.ui.fragment.report.ProgressReportFragment |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StatisticsDetailsParameters(var stat: Stat, var report: Report, var title: String) |
|
|
|
|
|
|
|
|
|
class ProgressReportActivity : PokerAnalyticsActivity() { |
|
|
|
|
class ProgressReportActivity : ReportActivity() { |
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
|
|
|
|
|
|
// Unparcel fails when setting a custom Parcelable object on Entry so we use a static reference to passe objects |
|
|
|
|
private var parameters: StatisticsDetailsParameters? = null |
|
|
|
|
private var displayAggregationChoices: Boolean = true |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Default constructor |
|
|
|
|
*/ |
|
|
|
|
fun newInstance(context: Context, stat: Stat, report: Report, displayAggregationChoices: Boolean = true, title: String) { |
|
|
|
|
this.parameters = StatisticsDetailsParameters(stat, report, title) |
|
|
|
|
this.displayAggregationChoices = displayAggregationChoices |
|
|
|
|
fun newInstance(context: Context, report: Report, title: String, stat: Stat? = null, displayAggregationChoices: Boolean = true) { |
|
|
|
|
parameters = ReportParameters(report, title, stat, showAggregationChoices = displayAggregationChoices) |
|
|
|
|
val intent = Intent(context, ProgressReportActivity::class.java) |
|
|
|
|
context.startActivity(intent) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun newInstanceForResult(fragment: Fragment, stat: Stat, report: Report, displayAggregationChoices: Boolean = true, title: String) { |
|
|
|
|
this.parameters = StatisticsDetailsParameters(stat, report, title) |
|
|
|
|
this.displayAggregationChoices = displayAggregationChoices |
|
|
|
|
fun newInstanceForResult(fragment: Fragment, report: Report, title: String, stat: Stat? = null, displayAggregationChoices: Boolean = true) { |
|
|
|
|
parameters = ReportParameters(report, title, stat, showAggregationChoices = displayAggregationChoices) |
|
|
|
|
val intent = Intent(fragment.context, ProgressReportActivity::class.java) |
|
|
|
|
fragment.startActivityForResult(intent, ReportActivity.DEFAULT_REQUEST_CODE) |
|
|
|
|
fragment.startActivityForResult(intent, DEFAULT_REQUEST_CODE) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
@ -58,8 +51,9 @@ class ProgressReportActivity : PokerAnalyticsActivity() { |
|
|
|
|
fragmentTransaction.commit() |
|
|
|
|
|
|
|
|
|
parameters?.let { |
|
|
|
|
|
|
|
|
|
statisticDetailsFragment.setData(it.stat, it.report, displayAggregationChoices, it.title) |
|
|
|
|
val report = it.report |
|
|
|
|
val stat = it.stat ?: report.options.stats.first() |
|
|
|
|
statisticDetailsFragment.setData(report, stat, it.showAggregationChoices, it.title) |
|
|
|
|
parameters = null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|