forked from github/wulkanowy-mirror
Add missing text when no grade description (#269)
This commit is contained in:
parent
919680c766
commit
ca23f92096
@ -72,7 +72,7 @@ play {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
implementation('com.github.wulkanowy:api:ea81799e98') { exclude module: "threetenbp" }
|
implementation('com.github.wulkanowy:api:a875c1de3b') { exclude module: "threetenbp" }
|
||||||
|
|
||||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||||
implementation "androidx.appcompat:appcompat:1.0.2"
|
implementation "androidx.appcompat:appcompat:1.0.2"
|
||||||
|
@ -46,6 +46,9 @@ class GradeDetailsFragment : BaseSessionFragment(), GradeDetailsView, GradeView.
|
|||||||
override val weightString: String
|
override val weightString: String
|
||||||
get() = getString(R.string.grade_weight)
|
get() = getString(R.string.grade_weight)
|
||||||
|
|
||||||
|
override val noDescriptionString: String
|
||||||
|
get() = getString(R.string.all_no_description)
|
||||||
|
|
||||||
override val isViewEmpty
|
override val isViewEmpty
|
||||||
get() = gradeDetailsAdapter.isEmpty
|
get() = gradeDetailsAdapter.isEmpty
|
||||||
|
|
||||||
|
@ -14,8 +14,12 @@ import io.github.wulkanowy.utils.toFormattedString
|
|||||||
import kotlinx.android.extensions.LayoutContainer
|
import kotlinx.android.extensions.LayoutContainer
|
||||||
import kotlinx.android.synthetic.main.item_grade_details.*
|
import kotlinx.android.synthetic.main.item_grade_details.*
|
||||||
|
|
||||||
class GradeDetailsItem(val grade: Grade, private val weightString: String, private val valueBgColor: Int) :
|
class GradeDetailsItem(
|
||||||
AbstractFlexibleItem<GradeDetailsItem.ViewHolder>() {
|
val grade: Grade,
|
||||||
|
private val valueBgColor: Int,
|
||||||
|
private val weightString: String,
|
||||||
|
private val noDescriptionString: String
|
||||||
|
) : AbstractFlexibleItem<GradeDetailsItem.ViewHolder>() {
|
||||||
|
|
||||||
override fun getLayoutRes() = R.layout.item_grade_details
|
override fun getLayoutRes() = R.layout.item_grade_details
|
||||||
|
|
||||||
@ -33,7 +37,11 @@ class GradeDetailsItem(val grade: Grade, private val weightString: String, priva
|
|||||||
text = grade.entry
|
text = grade.entry
|
||||||
setBackgroundResource(valueBgColor)
|
setBackgroundResource(valueBgColor)
|
||||||
}
|
}
|
||||||
gradeItemDescription.text = if (grade.description.isNotBlank()) grade.description else grade.gradeSymbol
|
gradeItemDescription.text = when {
|
||||||
|
grade.description.isNotBlank() -> grade.description
|
||||||
|
grade.gradeSymbol.isNotBlank() -> grade.gradeSymbol
|
||||||
|
else -> noDescriptionString
|
||||||
|
}
|
||||||
gradeItemDate.text = grade.date.toFormattedString()
|
gradeItemDate.text = grade.date.toFormattedString()
|
||||||
gradeItemWeight.text = "$weightString: ${grade.weight}"
|
gradeItemWeight.text = "$weightString: ${grade.weight}"
|
||||||
gradeItemNote.visibility = if (!grade.isRead) VISIBLE else GONE
|
gradeItemNote.visibility = if (!grade.isRead) VISIBLE else GONE
|
||||||
|
@ -150,8 +150,9 @@ class GradeDetailsPresenter @Inject constructor(
|
|||||||
subItems = it.value.map { item ->
|
subItems = it.value.map { item ->
|
||||||
GradeDetailsItem(
|
GradeDetailsItem(
|
||||||
grade = item,
|
grade = item,
|
||||||
|
valueBgColor = item.getBackgroundColor(preferencesRepository.gradeColorTheme),
|
||||||
weightString = view?.weightString.orEmpty(),
|
weightString = view?.weightString.orEmpty(),
|
||||||
valueBgColor = item.getBackgroundColor(preferencesRepository.gradeColorTheme)
|
noDescriptionString = view?.noDescriptionString.orEmpty()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ interface GradeDetailsView : BaseSessionView {
|
|||||||
|
|
||||||
val weightString: String
|
val weightString: String
|
||||||
|
|
||||||
|
val noDescriptionString: String
|
||||||
|
|
||||||
fun initView()
|
fun initView()
|
||||||
|
|
||||||
fun updateData(data: List<GradeDetailsHeader>)
|
fun updateData(data: List<GradeDetailsHeader>)
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.modules.grade.details.GradeDetailsDialog">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user