[Grades] Update fonts and colors a bit.

This commit is contained in:
Kuba Szczodrzyński 2020-03-11 16:25:54 +01:00
parent 4aa31424d6
commit b9b4b0036f
6 changed files with 11 additions and 17 deletions

View File

@ -40,7 +40,7 @@ class QrScannerDialog(
onShowListener?.invoke(TAG)
app = activity.applicationContext as App
scannerView = ZXingScannerView(activity)
scannerView.setPadding(0, 16.dp, 0, 0)
scannerView.setPadding(0, 16.dp, 4.dp, 0)
dialog = MaterialAlertDialogBuilder(activity)
.setTitle(R.string.qr_scanner_dialog_title)
.setView(scannerView)
@ -59,4 +59,4 @@ class QrScannerDialog(
}
scannerView.startCamera()
}}
}
}

View File

@ -58,7 +58,7 @@ class GradeDetailsDialog(
b.weightText = manager.getWeightString(app, grade)
b.commentVisible = false
b.devMode = App.debugMode
b.gradeName.setTextColor(if (ColorUtils.calculateLuminance(gradeColor) > 0.3) 0x99000000.toInt() else 0x99ffffff.toInt())
b.gradeName.setTextColor(if (ColorUtils.calculateLuminance(gradeColor) > 0.3) 0xaa000000.toInt() else 0xccffffff.toInt())
b.gradeName.background.setTintColor(gradeColor)
b.gradeValue = if (grade.weight == 0f || grade.value < 0f) -1f else manager.getGradeValue(grade)

View File

@ -77,9 +77,9 @@ class GradeView : AppCompatTextView {
TYPE_SEMESTER2_PROPOSED,
TYPE_YEAR_PROPOSED -> android.R.attr.textColorPrimary.resolveAttr(context)
else -> if (ColorUtils.calculateLuminance(gradeColor) > 0.3)
0x99000000.toInt()
0xaa000000.toInt()
else
0x99ffffff.toInt()
0xccffffff.toInt()
})
//typeface = Typeface.create("sans-serif-light", Typeface.NORMAL)

View File

@ -3,7 +3,6 @@ package pl.szczodrzynski.edziennik.ui.modules.grades.editor
import android.content.Context
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.graphics.Typeface
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -49,8 +48,7 @@ class GradesEditorAdapter(
holder.gradesListName.text = editorGrade.name
holder.gradesListName.isSelected = true
holder.gradesListName.setTypeface(null, Typeface.BOLD)
holder.gradesListName.setTextColor(if (ColorUtils.calculateLuminance(gradeColor) > 0.25) -0x1000000 else -0x1)
holder.gradesListName.setTextColor(if (ColorUtils.calculateLuminance(gradeColor) > 0.25) 0xaa000000.toInt() else 0xccffffff.toInt())
holder.gradesListName.background.colorFilter = PorterDuffColorFilter(gradeColor, PorterDuff.Mode.MULTIPLY)
holder.gradesListCategory.text = editorGrade.category
if (editorGrade.weight < 0) {

View File

@ -60,16 +60,13 @@ class GradesEditorFragment : Fragment() {
if (context == null)
return null
app = activity.application as App
context!!.theme.applyStyle(Themes.appTheme, true)
if (app.profile == null)
return inflater.inflate(R.layout.fragment_loading, container, false)
// activity, context and profile is valid
b = FragmentGradesEditorBinding.inflate(inflater)
return b.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
if (app.profile == null || !isAdded)
if (!isAdded)
return
subjectId = arguments.getLong("subjectId", -1)

View File

@ -16,11 +16,8 @@ import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.view.get
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.R
import pl.szczodrzynski.edziennik.*
import pl.szczodrzynski.edziennik.databinding.GradesItemSubjectBinding
import pl.szczodrzynski.edziennik.dp
import pl.szczodrzynski.edziennik.setText
import pl.szczodrzynski.edziennik.ui.modules.grades.GradeView
import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter
import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter.Companion.STATE_CLOSED
@ -38,7 +35,7 @@ class SubjectViewHolder(
override fun onBind(activity: AppCompatActivity, app: App, item: GradesSubject, position: Int, adapter: GradesAdapter) {
val manager = app.gradesManager
val contextWrapper = ContextThemeWrapper(activity, Themes.themeInt)
val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
b.subjectName.text = item.subjectName
b.dropdownIcon.rotation = when (item.state) {
@ -62,6 +59,7 @@ class SubjectViewHolder(
if (firstSemester.number != item.semester) {
b.gradesContainer.addView(TextView(contextWrapper).apply {
setTextColor(android.R.attr.textColorSecondary.resolveAttr(context))
setText(R.string.grades_preview_other_semester, firstSemester.number)
setPadding(0, 0, 5.dp, 0)
maxLines = 1
@ -88,6 +86,7 @@ class SubjectViewHolder(
}
b.previewContainer.addView(TextView(contextWrapper).apply {
setTextColor(android.R.attr.textColorSecondary.resolveAttr(context))
text = manager.getAverageString(app, firstSemester.averages, nameSemester = true, showSemester = firstSemester.number)
//gravity = Gravity.END
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {