Fix error view which overlaps grade statistics content (#627)
This commit is contained in:

committed by
Rafał Borcz

parent
54f3733b56
commit
6be801d4a8
@ -47,6 +47,13 @@ class GradeStatisticsFragment : BaseFragment(), GradeStatisticsView, GradeView.G
|
||||
|
||||
override val isBarViewEmpty get() = gradeStatisticsChartPoints.isEmpty
|
||||
|
||||
override val currentType
|
||||
get() = when (gradeStatisticsTypeSwitch.checkedRadioButtonId) {
|
||||
R.id.gradeStatisticsTypeSemester -> ViewType.SEMESTER
|
||||
R.id.gradeStatisticsTypePartial -> ViewType.PARTIAL
|
||||
else -> ViewType.POINTS
|
||||
}
|
||||
|
||||
private lateinit var gradeColors: List<Pair<Int, Int>>
|
||||
|
||||
private val vulcanGradeColors = listOf(
|
||||
@ -272,13 +279,7 @@ class GradeStatisticsFragment : BaseFragment(), GradeStatisticsView, GradeView.G
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
gradeStatisticsTypeSwitch.setOnCheckedChangeListener { _, checkedId ->
|
||||
presenter.onTypeChange(when (checkedId) {
|
||||
R.id.gradeStatisticsTypeSemester -> ViewType.SEMESTER
|
||||
R.id.gradeStatisticsTypePartial -> ViewType.PARTIAL
|
||||
else -> ViewType.POINTS
|
||||
})
|
||||
}
|
||||
gradeStatisticsTypeSwitch.setOnCheckedChangeListener { _, _ -> presenter.onTypeChange() }
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
|
@ -94,7 +94,8 @@ class GradeStatisticsPresenter @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun onTypeChange(type: ViewType) {
|
||||
fun onTypeChange() {
|
||||
val type = view?.let { it.currentType } ?: ViewType.POINTS
|
||||
Timber.i("Select grade stats semester: $type")
|
||||
disposable.clear()
|
||||
view?.run {
|
||||
@ -214,7 +215,7 @@ class GradeStatisticsPresenter @Inject constructor(
|
||||
|
||||
private fun showErrorViewOnError(message: String, error: Throwable) {
|
||||
view?.run {
|
||||
if (isBarViewEmpty || isPieViewEmpty) {
|
||||
if ((isBarViewEmpty && currentType == ViewType.POINTS) || (isPieViewEmpty) && currentType != ViewType.POINTS) {
|
||||
lastError = error
|
||||
setErrorDetails(message)
|
||||
showErrorView(true)
|
||||
|
@ -10,6 +10,8 @@ interface GradeStatisticsView : BaseView {
|
||||
|
||||
val isBarViewEmpty: Boolean
|
||||
|
||||
val currentType: ViewType
|
||||
|
||||
fun initView()
|
||||
|
||||
fun updateSubjects(data: ArrayList<String>)
|
||||
|
Reference in New Issue
Block a user