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 {
|
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
implementation "androidx.core:core-ktx:1.2.0-rc01"
|
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 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 lateinit var gradeColors: List<Pair<Int, Int>>
|
||||||
|
|
||||||
private val vulcanGradeColors = listOf(
|
private val vulcanGradeColors = listOf(
|
||||||
@ -272,13 +279,7 @@ class GradeStatisticsFragment : BaseFragment(), GradeStatisticsView, GradeView.G
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
gradeStatisticsTypeSwitch.setOnCheckedChangeListener { _, checkedId ->
|
gradeStatisticsTypeSwitch.setOnCheckedChangeListener { _, _ -> presenter.onTypeChange() }
|
||||||
presenter.onTypeChange(when (checkedId) {
|
|
||||||
R.id.gradeStatisticsTypeSemester -> ViewType.SEMESTER
|
|
||||||
R.id.gradeStatisticsTypePartial -> ViewType.PARTIAL
|
|
||||||
else -> ViewType.POINTS
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
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")
|
Timber.i("Select grade stats semester: $type")
|
||||||
disposable.clear()
|
disposable.clear()
|
||||||
view?.run {
|
view?.run {
|
||||||
@ -214,7 +215,7 @@ class GradeStatisticsPresenter @Inject constructor(
|
|||||||
|
|
||||||
private fun showErrorViewOnError(message: String, error: Throwable) {
|
private fun showErrorViewOnError(message: String, error: Throwable) {
|
||||||
view?.run {
|
view?.run {
|
||||||
if (isBarViewEmpty || isPieViewEmpty) {
|
if ((isBarViewEmpty && currentType == ViewType.POINTS) || (isPieViewEmpty) && currentType != ViewType.POINTS) {
|
||||||
lastError = error
|
lastError = error
|
||||||
setErrorDetails(message)
|
setErrorDetails(message)
|
||||||
showErrorView(true)
|
showErrorView(true)
|
||||||
|
@ -10,6 +10,8 @@ interface GradeStatisticsView : BaseView {
|
|||||||
|
|
||||||
val isBarViewEmpty: Boolean
|
val isBarViewEmpty: Boolean
|
||||||
|
|
||||||
|
val currentType: ViewType
|
||||||
|
|
||||||
fun initView()
|
fun initView()
|
||||||
|
|
||||||
fun updateSubjects(data: ArrayList<String>)
|
fun updateSubjects(data: ArrayList<String>)
|
||||||
|
@ -57,6 +57,7 @@ class AttendanceRemoteTest {
|
|||||||
subject = "Fizyka",
|
subject = "Fizyka",
|
||||||
name = "Obecność",
|
name = "Obecność",
|
||||||
date = date,
|
date = date,
|
||||||
|
timeId = 0,
|
||||||
number = 0,
|
number = 0,
|
||||||
deleted = false,
|
deleted = false,
|
||||||
excusable = false,
|
excusable = false,
|
||||||
@ -65,7 +66,8 @@ class AttendanceRemoteTest {
|
|||||||
lateness = false,
|
lateness = false,
|
||||||
presence = false,
|
presence = false,
|
||||||
categoryId = 1,
|
categoryId = 1,
|
||||||
absence = false
|
absence = false,
|
||||||
|
excuseStatus = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user