forked from github/wulkanowy-mirror
Fix error view which overlaps grade statistics content (#627)
This commit is contained in:
parent
54f3733b56
commit
6be801d4a8
@ -122,7 +122,7 @@ configurations.all {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.github.wulkanowy:sdk:0.14.0"
|
||||
implementation "io.github.wulkanowy:sdk:069677aa2089b5678adbcae79dc253220995f172"
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "androidx.core:core-ktx:1.2.0-rc01"
|
||||
|
@ -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>)
|
||||
|
@ -57,6 +57,7 @@ class AttendanceRemoteTest {
|
||||
subject = "Fizyka",
|
||||
name = "Obecność",
|
||||
date = date,
|
||||
timeId = 0,
|
||||
number = 0,
|
||||
deleted = false,
|
||||
excusable = false,
|
||||
@ -65,7 +66,8 @@ class AttendanceRemoteTest {
|
||||
lateness = false,
|
||||
presence = false,
|
||||
categoryId = 1,
|
||||
absence = false
|
||||
absence = false,
|
||||
excuseStatus = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user