1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-09-20 03:39:08 -05:00

Fix error view which overlaps grade statistics content (#627)

This commit is contained in:
Mikołaj Pich 2019-12-30 22:57:48 +01:00 committed by Rafał Borcz
parent 54f3733b56
commit 6be801d4a8
5 changed files with 17 additions and 11 deletions

View File

@ -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"

View File

@ -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) {

View File

@ -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)

View File

@ -10,6 +10,8 @@ interface GradeStatisticsView : BaseView {
val isBarViewEmpty: Boolean
val currentType: ViewType
fun initView()
fun updateSubjects(data: ArrayList<String>)

View File

@ -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
)
}
}