forked from github/szkolny
[UI/Agenda] Allow prioritizing event subject over event type.
This commit is contained in:
parent
dfd1083e41
commit
5007587192
@ -422,6 +422,12 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
try {
|
||||
App.data = AppData.get(profile.loginStoreType)
|
||||
d("App", "Loaded AppData: ${App.data}")
|
||||
// apply newly-added config overrides, if not changed by the user yet
|
||||
for ((key, value) in App.data.configOverrides) {
|
||||
val config = App.profile.config
|
||||
if (!config.has(key))
|
||||
config.set(key, value)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e("App", "Cannot load AppData", e)
|
||||
Toast.makeText(this, R.string.app_cannot_load_data, Toast.LENGTH_LONG).show()
|
||||
|
@ -43,4 +43,6 @@ abstract class BaseConfig(
|
||||
db.configDao().add(ConfigEntry(profileId ?: -1, key, value))
|
||||
}
|
||||
}
|
||||
|
||||
fun has(key: String) = values.containsKey(key)
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ class ProfileConfigUI(base: ProfileConfig) {
|
||||
var agendaGroupByType by base.config<Boolean>(false)
|
||||
var agendaLessonChanges by base.config<Boolean>(true)
|
||||
var agendaTeacherAbsence by base.config<Boolean>(true)
|
||||
var agendaSubjectImportant by base.config<Boolean>(false)
|
||||
var agendaElearningMark by base.config<Boolean>(false)
|
||||
var agendaElearningGroup by base.config<Boolean>(true)
|
||||
|
||||
|
@ -11,6 +11,7 @@ import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import com.github.tibolte.agendacalendarview.render.EventRenderer
|
||||
import com.mikepenz.iconics.view.IconicsTextView
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.R
|
||||
import pl.szczodrzynski.edziennik.databinding.AgendaWrappedEventBinding
|
||||
import pl.szczodrzynski.edziennik.databinding.AgendaWrappedEventCompactBinding
|
||||
@ -53,16 +54,24 @@ class AgendaEventRenderer(
|
||||
else
|
||||
event.time!!.stringHM
|
||||
|
||||
val agendaSubjectImportant = App.profile.config.ui.agendaSubjectImportant
|
||||
val eventSubtitle = listOfNotNull(
|
||||
timeText,
|
||||
event.subjectLongName,
|
||||
event.subjectLongName.takeIf { !agendaSubjectImportant },
|
||||
event.typeName.takeIf { agendaSubjectImportant },
|
||||
event.teacherName,
|
||||
event.teamName
|
||||
).join(", ")
|
||||
|
||||
card.foreground.setTintColor(event.eventColor)
|
||||
card.background.setTintColor(event.eventColor)
|
||||
manager.setEventTopic(title, event, doneIconColor = textColor)
|
||||
manager.setEventTopic(
|
||||
title = title,
|
||||
event = event,
|
||||
doneIconColor = textColor,
|
||||
showType = !agendaSubjectImportant,
|
||||
showSubject = agendaSubjectImportant,
|
||||
)
|
||||
title.setTextColor(textColor)
|
||||
subtitle?.text = eventSubtitle
|
||||
subtitle?.setTextColor(textColor)
|
||||
|
@ -113,7 +113,18 @@ class EventDetailsDialog(
|
||||
|
||||
b.typeColor.background?.setTintColor(event.eventColor)
|
||||
|
||||
b.details = mutableListOf(
|
||||
val agendaSubjectImportant = event.subjectLongName != null
|
||||
&& App.config[event.profileId].ui.agendaSubjectImportant
|
||||
|
||||
b.name = if (agendaSubjectImportant)
|
||||
event.subjectLongName
|
||||
else
|
||||
event.typeName
|
||||
|
||||
b.details = listOfNotNull(
|
||||
if (agendaSubjectImportant)
|
||||
event.typeName
|
||||
else
|
||||
event.subjectLongName,
|
||||
event.teamName?.asColoredSpannable(colorSecondary)
|
||||
).concat(bullet)
|
||||
|
@ -24,6 +24,7 @@ class EventListAdapter(
|
||||
val showDate: Boolean = false,
|
||||
val showColor: Boolean = true,
|
||||
val showType: Boolean = true,
|
||||
val showTypeColor: Boolean = showType,
|
||||
val showTime: Boolean = true,
|
||||
val showSubject: Boolean = true,
|
||||
val markAsSeen: Boolean = true,
|
||||
|
@ -113,7 +113,7 @@ class EventViewHolder(
|
||||
b.attachmentIcon.isVisible = item.hasAttachments
|
||||
|
||||
b.typeColor.background?.setTintColor(item.eventColor)
|
||||
b.typeColor.isVisible = adapter.showType && adapter.showColor
|
||||
b.typeColor.isVisible = adapter.showTypeColor
|
||||
|
||||
b.editButton.isVisible = !adapter.simpleMode
|
||||
&& item.addedManually
|
||||
|
@ -63,9 +63,10 @@ class HomeEventsCard(
|
||||
simpleMode = true,
|
||||
showWeekDay = true,
|
||||
showDate = true,
|
||||
showType = true,
|
||||
showType = !profile.config.ui.agendaSubjectImportant,
|
||||
showTypeColor = true,
|
||||
showTime = false,
|
||||
showSubject = false,
|
||||
showSubject = profile.config.ui.agendaSubjectImportant,
|
||||
markAsSeen = false,
|
||||
onEventClick = {
|
||||
EventDetailsDialog(
|
||||
|
@ -48,6 +48,7 @@ class EventManager(val app: App) : CoroutineScope {
|
||||
title: TextView,
|
||||
event: EventFull,
|
||||
showType: Boolean = true,
|
||||
showSubject: Boolean = false,
|
||||
showNotes: Boolean = true,
|
||||
doneIconColor: Int? = null
|
||||
) {
|
||||
@ -60,6 +61,7 @@ class EventManager(val app: App) : CoroutineScope {
|
||||
if (event.hasNotes() && hasReplacingNotes && showNotes) "{cmd-swap-horizontal} " else null,
|
||||
if (event.hasNotes() && !hasReplacingNotes && showNotes) "{cmd-playlist-edit} " else null,
|
||||
if (showType) "${event.typeName ?: "wydarzenie"} - " else null,
|
||||
if (showSubject) event.subjectLongName?.plus(" - ") else null,
|
||||
topicSpan,
|
||||
).concat()
|
||||
|
||||
|
@ -171,7 +171,7 @@ class NoteManager(private val app: App) {
|
||||
activity = activity,
|
||||
simpleMode = true,
|
||||
showDate = true,
|
||||
showColor = false,
|
||||
showTypeColor = false,
|
||||
showTime = false,
|
||||
markAsSeen = false,
|
||||
showNotes = false,
|
||||
|
@ -50,6 +50,14 @@
|
||||
android:minHeight="32dp"
|
||||
android:text="@string/agenda_config_teacher_absence" />
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:checked="@={config.ui.agendaSubjectImportant}"
|
||||
android:minHeight="32dp"
|
||||
android:text="@string/agenda_config_subject_important" />
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -17,6 +17,7 @@
|
||||
type="pl.szczodrzynski.edziennik.data.db.full.EventFull" />
|
||||
<variable name="eventShared" type="boolean" />
|
||||
<variable name="eventOwn" type="boolean" />
|
||||
<variable name="name" type="java.lang.CharSequence" />
|
||||
<variable name="details" type="java.lang.CharSequence" />
|
||||
<variable name="monthName" type="String" />
|
||||
</data>
|
||||
@ -55,7 +56,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{event.typeName}"
|
||||
android:text="@{name}"
|
||||
android:textIsSelectable="true"
|
||||
android:textAppearance="@style/NavView.TextView.Title"
|
||||
android:visibility="@{event.typeName == null ? View.GONE : View.VISIBLE}"
|
||||
|
@ -83,6 +83,7 @@
|
||||
},
|
||||
"university": {
|
||||
"configOverrides": {
|
||||
"agendaSubjectImportant": true,
|
||||
"shareByDefault": true,
|
||||
"timetableColorSubjectName": true,
|
||||
"timetableTrimHourRange": true
|
||||
|
@ -1551,4 +1551,5 @@
|
||||
<string name="settings_register_share_by_default_subtext">Ustaw tworzone wydarzenia domyślnie jako udostępnione</string>
|
||||
<string name="settings_registration_section">Rejestracja</string>
|
||||
<string name="home_timetable_all_lessons">Wszystkie lekcje:</string>
|
||||
<string name="agenda_config_subject_important">Wyświetl nazwę przedmiotu zamiast rodzaju</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user