diff --git a/.editorconfig b/.editorconfig index 35fbd466..7c537735 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,7 @@ [*] charset=utf-8 end_of_line=lf -insert_final_newline=true +insert_final_newline=Advanced indent_style=space indent_size=4 diff --git a/README.cs.md b/README.cs.md index 68978352..a27b098a 100644 --- a/README.cs.md +++ b/README.cs.md @@ -3,12 +3,12 @@ # Wulkanowy MOD ## Funkce: -* skrýt špatná hodnocení -* skrýt špatnou docházku (vše kromě oprávněné docházky/docházky) -* skrýt komentáře -* falešná účast +* skrýt známky +* Skrýt jednotlivé záznamy o docházce. +* Skrýt komentáře. +* falešná docházka % -Chcete-li se dostat do skrytého panelu, přejděte na kartu „Další“ a poté dlouze stiskněte dlaždici „Nastavení“. +Pro přístup ke skrytému panelu přejděte na kartu "Více", poté na "Nastavení" a nakonec klikněte na poslední dlaždici. # Wulkanowy diff --git a/README.de.md b/README.de.md index a134dd65..3c2c748a 100644 --- a/README.de.md +++ b/README.de.md @@ -3,12 +3,12 @@ # Wulkanowy MOD ## Funktionen: -* schlechte Bewertungen ausblenden -* schlechte Anwesenheit ausblenden (alles außer berechtigter Anwesenheit/Anwesenheit) -* Kommentare ausblenden -* gefälschte Anwesenheit +* Noten ausblenden +* Individuelle Anwesenheitslisten ausblenden. +* Kommentare ausblenden. +* Anwesenheit fälschen % -Um zum ausgeblendeten Bereich zu gelangen, gehen Sie zur Registerkarte „Mehr“ und drücken Sie dann lange auf die Kachel „Einstellungen“. +Um auf das verborgene Panel zuzugreifen, gehen Sie auf die Registerkarte "Mehr", dann auf "Einstellungen" und schließlich auf die letzte Kachel. # Wulkanowy diff --git a/README.en.md b/README.en.md index 7058b834..08210481 100644 --- a/README.en.md +++ b/README.en.md @@ -3,12 +3,12 @@ # Wulkanowy MOD ## Functions: -* hide bad grades -* hide bad attendance (everything except present/excused attendance) +* hide grades +* hide individual attendance entries * hide comments -* fake attendance +* fake attendance %. -To get to the hidden panel, go to the "More" tab and then long-press the "Settings" tile. +To get to the hidden panel, go to the "More" tab, then "Settings", and finally click the last tile. # Wulkanowy diff --git a/README.md b/README.md index 477d4f0f..61e8ed4d 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,12 @@ # Wulkanowy MOD ## Funkcje: -* ukryj złe oceny -* ukryj złą frekwencję (wszystko prócz obecności/frekwencji usprawiedliwionej) +* ukryj oceny +* ukryj poszczególne wpisy frekwencji * ukryj uwagi -* sfałszuj frekwencję +* sfałszuj % frekwencji -Aby dostać się do ukrytego panelu, przejdź do karty "Więcej", a następnie przytrzymaj kafelek "Ustawienia". +Aby dostać się do ukrytego panelu, przejdź do karty "Więcej", następnie "Ustawienia", a na końcu kliknij ostatni kafelek. # Wulkanowy diff --git a/README.sk.md b/README.sk.md index f7c9869a..85e6a1c0 100644 --- a/README.sk.md +++ b/README.sk.md @@ -3,12 +3,12 @@ # Wulkanowy MOD ## Funkcie: -* skryť zlé hodnotenia -* skryť zlú dochádzku (všetko okrem odôvodnenej dochádzky/dochádzky) -* skryť komentáre -* falošná účasť +* skryť známky +* Skryť individuálne záznamy o dochádzke. +* Skryť komentáre. +* falošná dochádzka % -Ak chcete prejsť na skrytý panel, prejdite na kartu „Viac“ a potom dlho stlačte dlaždicu „Nastavenia“. +Ak chcete získať prístup k skrytému panelu, prejdite na kartu "Viac", potom na "Nastavenia" a nakoniec kliknite na poslednú dlaždicu. # Wulkanowy diff --git a/app/build.gradle b/app/build.gradle index 07719dfd..6f3c4733 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,7 +28,7 @@ android { minSdkVersion 21 targetSdkVersion 34 versionCode 151 - versionName "2.5.2" + versionName "2.6.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" resValue "string", "app_name", "Wulkanowy" diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceDao.kt index 9b6759b2..7d20c9a7 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceDao.kt +++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceDao.kt @@ -3,6 +3,7 @@ package io.github.wulkanowy.data.db.dao import androidx.room.Dao import androidx.room.Query import io.github.wulkanowy.data.db.entities.Attendance +import io.github.wulkanowy.ui.modules.dashboard.DashboardItem import kotlinx.coroutines.flow.Flow import java.time.LocalDate import javax.inject.Singleton @@ -18,12 +19,4 @@ interface AttendanceDao : BaseDao { start: LocalDate, end: LocalDate ): Flow> - - @Query("SELECT * FROM Attendance WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :start AND date <= :end AND (presence OR excused)") - fun loadAllCensored( - diaryId: Int, - studentId: Int, - start: LocalDate, - end: LocalDate - ): Flow> } diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.kt index 972ef3df..98de5ba3 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.kt +++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.kt @@ -11,7 +11,4 @@ import javax.inject.Singleton interface NoteDao : BaseDao { @Query("SELECT * FROM Notes WHERE student_id = :studentId") fun loadAll(studentId: Int): Flow> - - @Query("SELECT * FROM Notes WHERE student_id = :studentId AND 1 != 1") - fun pretendLoadingAll(studentId: Int): Flow> } diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt index eb8656de..ebe6f5db 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt @@ -9,6 +9,7 @@ import io.github.wulkanowy.data.db.entities.Student import io.github.wulkanowy.data.mappers.mapToEntities import io.github.wulkanowy.data.networkBoundResource import io.github.wulkanowy.sdk.pojo.Absent +import io.github.wulkanowy.sdk.pojo.Attendance as SdkAttendance import io.github.wulkanowy.ui.modules.dashboard.DashboardItem import io.github.wulkanowy.utils.AutoRefreshHelper import io.github.wulkanowy.utils.getRefreshKey @@ -16,6 +17,7 @@ import io.github.wulkanowy.utils.monday import io.github.wulkanowy.utils.sunday import io.github.wulkanowy.utils.uniqueSubtract import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map import kotlinx.coroutines.sync.Mutex import java.time.LocalDate import java.time.LocalDateTime @@ -36,6 +38,64 @@ class AttendanceRepository @Inject constructor( private val cacheKey = "attendance" + private fun filterAttendance( + hiddenAttendanceTiles: List, + attendanceItem: Attendance + ): Boolean { + return when { + attendanceItem.absence && attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.EXCUSED_ABSENCE + ) -> false + + attendanceItem.absence && !attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.UNEXCUSED_ABSENCE + ) -> false + + attendanceItem.lateness && attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.EXCUSED_LATENESS + ) -> false + + attendanceItem.lateness && !attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.UNEXCUSED_LATENESS + ) -> false + + attendanceItem.exemption && hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.EXEMPTION) -> false + attendanceItem.deleted && hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.DELETED) -> false + attendanceItem.presence && hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.PRESENT) -> false + + else -> !hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.UNKNOWN) + } + } + + private fun filterAttendance( + hiddenAttendanceTiles: List, + attendanceItem: SdkAttendance + ): Boolean { + return when { + attendanceItem.absence && attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.EXCUSED_ABSENCE + ) -> false + + attendanceItem.absence && !attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.UNEXCUSED_ABSENCE + ) -> false + + attendanceItem.lateness && attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.EXCUSED_LATENESS + ) -> false + + attendanceItem.lateness && !attendanceItem.excused && hiddenAttendanceTiles.contains( + DashboardItem.HiddenAttendanceTile.UNEXCUSED_LATENESS + ) -> false + + attendanceItem.exemption && hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.EXEMPTION) -> false + attendanceItem.deleted && hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.DELETED) -> false + attendanceItem.presence && hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.PRESENT) -> false + + else -> !hiddenAttendanceTiles.contains(DashboardItem.HiddenAttendanceTile.UNKNOWN) + } + } + fun getAttendance( student: Student, semester: Semester, @@ -53,30 +113,16 @@ class AttendanceRepository @Inject constructor( it.isEmpty() || forceRefresh || isExpired }, query = { - val badAttendanceHidden = preferencesRepository - .selectedHiddenSettingTiles - .contains(DashboardItem.HiddenSettingTile.NOTES) + val hiddenAttendanceItems = preferencesRepository.hiddenAttendanceItems - if (badAttendanceHidden) { - attendanceDb.loadAllCensored( - semester.diaryId, - semester.studentId, - start.monday, - end.sunday - ) - } else { - attendanceDb.loadAll( - semester.diaryId, - semester.studentId, - start.monday, - end.sunday - ) - } + attendanceDb + .loadAll(semester.diaryId, semester.studentId, start.monday, end.sunday) + .map { + it.filter { item -> filterAttendance(hiddenAttendanceItems, item) } + } }, fetch = { - val badAttendanceHidden = preferencesRepository - .selectedHiddenSettingTiles - .contains(DashboardItem.HiddenSettingTile.NOTES) + val hiddenAttendanceItems = preferencesRepository.hiddenAttendanceItems val lessons = timetableDb.load( semester.diaryId, semester.studentId, start.monday, end.sunday @@ -84,7 +130,7 @@ class AttendanceRepository @Inject constructor( wulkanowySdkFactory.create(student, semester) .getAttendance(start.monday, end.sunday) - .filter { !badAttendanceHidden || (it.presence || it.excused) } + .filter { item -> filterAttendance(hiddenAttendanceItems, item) } .mapToEntities(semester, lessons) }, saveFetchResult = { old, new -> @@ -105,15 +151,13 @@ class AttendanceRepository @Inject constructor( start: LocalDate, end: LocalDate ): Flow> { - val badAttendanceHidden = preferencesRepository - .selectedHiddenSettingTiles - .contains(DashboardItem.HiddenSettingTile.BAD_ATTENDANCE) + val hiddenAttendanceItems = preferencesRepository.hiddenAttendanceItems - return if (badAttendanceHidden) { - attendanceDb.loadAllCensored(semester.diaryId, semester.studentId, start, end) - } else { - attendanceDb.loadAll(semester.diaryId, semester.studentId, start, end) - } + return attendanceDb + .loadAll(semester.diaryId, semester.studentId, start.monday, end.sunday) + .map { + it.filter { item -> filterAttendance(hiddenAttendanceItems, item) } + } } suspend fun updateTimetable(timetable: List) { diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt index d39bdd4b..6be0928e 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt @@ -7,7 +7,6 @@ import io.github.wulkanowy.data.db.entities.Semester import io.github.wulkanowy.data.db.entities.Student import io.github.wulkanowy.data.mappers.mapToEntities import io.github.wulkanowy.data.networkBoundResource -import io.github.wulkanowy.ui.modules.dashboard.DashboardItem import io.github.wulkanowy.utils.AutoRefreshHelper import io.github.wulkanowy.utils.getRefreshKey import io.github.wulkanowy.utils.toLocalDate @@ -41,27 +40,16 @@ class NoteRepository @Inject constructor( val isExpired = refreshHelper.shouldBeRefreshed( getRefreshKey(cacheKey, semester) ) + it.isEmpty() || forceRefresh || isExpired }, - query = { - val notesHidden = preferencesRepository - .selectedHiddenSettingTiles - .contains(DashboardItem.HiddenSettingTile.NOTES) - - if (notesHidden) { - noteDb.pretendLoadingAll(student.studentId) - } else { - noteDb.loadAll(student.studentId) - } - }, + query = { noteDb.loadAll(student.studentId) }, fetch = { - val notesHidden = preferencesRepository - .selectedHiddenSettingTiles - .contains(DashboardItem.HiddenSettingTile.NOTES) + val showNotes = preferencesRepository.showNotes wulkanowySdkFactory.create(student, semester) .getNotes() - .filter { !notesHidden } + .filter { showNotes } .mapToEntities(semester) }, saveFetchResult = { old, new -> @@ -80,15 +68,7 @@ class NoteRepository @Inject constructor( ) fun getNotesFromDatabase(student: Student): Flow> { - val notesHidden = preferencesRepository - .selectedHiddenSettingTiles - .contains(DashboardItem.HiddenSettingTile.NOTES) - - return if (notesHidden) { - noteDb.pretendLoadingAll(student.studentId) - } else { - noteDb.loadAll(student.studentId) - } + return noteDb.loadAll(student.studentId) } suspend fun updateNote(note: Note) { diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt index 8707c54a..4ba74ec0 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt @@ -2,13 +2,12 @@ package io.github.wulkanowy.data.repositories import android.content.Context import android.content.SharedPreferences -import android.os.Build -import androidx.annotation.RequiresApi import androidx.annotation.StringRes import androidx.core.content.edit import com.fredporciuncula.flow.preferences.FlowSharedPreferences import com.fredporciuncula.flow.preferences.Preference import com.fredporciuncula.flow.preferences.Serializer +import com.fredporciuncula.flow.preferences.map import dagger.hilt.android.qualifiers.ApplicationContext import io.github.wulkanowy.R import io.github.wulkanowy.data.enums.AppTheme @@ -25,7 +24,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import okhttp3.internal.notifyAll +import timber.log.Timber import java.time.Instant import java.util.UUID import javax.inject.Inject @@ -38,6 +37,8 @@ class PreferencesRepository @Inject constructor( private val flowSharedPref: FlowSharedPreferences, private val json: Json, ) { + private val NO_ATTENDANCE_VALUE = -1.0 + val isShowPresent: Boolean get() = getBoolean( R.string.pref_key_attendance_present, @@ -296,33 +297,22 @@ class PreferencesRepository @Inject constructor( selectedDashboardTilesPreference.set(filteredValue) } - var selectedHiddenSettingTiles: List - get() = selectedHiddenSettingTilesPreference.get() - .map { DashboardItem.HiddenSettingTile.valueOf(it) } - set(value) { - val filteredValue = value - .map { it.name } - .toSet() + var attendancePercentage: Double? + get() = attendancePercentagePreference.get().takeIf { it != NO_ATTENDANCE_VALUE } + set(value) = attendancePercentagePreference.set(value ?: NO_ATTENDANCE_VALUE) - selectedHiddenSettingTilesPreference.set(filteredValue) - } - - var attendancePercentage: Float? - get() { - val value = attendancePercentagePreference.get() - return if (value == context.resources.getInteger(R.integer.pref_default_attendance_percentage).toFloat()) { - null - } else { - value - } - } - set(value) = value?.let { attendancePercentagePreference.set(it) } - ?: attendancePercentagePreference.delete() + var hiddenAttendanceItems: List + get() = hiddenAttendanceItemsPreference.get().toList() + set(value) = hiddenAttendanceItemsPreference.set(value.toSet()) var hiddenGrades: List get() = hiddenGradesPreference.get().toList() set(value) = hiddenGradesPreference.set(value.toSet()) + var showNotes: Boolean + get() = showNotesPreference.get() + set(value) = showNotesPreference.set(value) + private val hiddenGradesPreference: Preference> get() { val defaultSet = context.resources.getStringArray(R.array.pref_default_hidden_grades).toSet() @@ -331,6 +321,26 @@ class PreferencesRepository @Inject constructor( return flowSharedPref.getStringSet(prefKey, defaultSet) } + private val showNotesPreference: Preference + get() = flowSharedPref.getBoolean( + context.getString(R.string.pref_key_show_notes), + context.resources.getBoolean(R.bool.pref_default_show_notes) + ) + + private val hiddenAttendanceItemsPreference: Preference> + get() { + val defaultSet = + context.resources.getStringArray(R.array.pref_default_hidden_attendance_items).toSet() + val prefKey = "attendance_items" + + return flowSharedPref + .getStringSet(prefKey, defaultSet) + .map( + mapper = { it -> it.map { DashboardItem.HiddenAttendanceTile.valueOf(it) }.toSet() }, + reverse = { it -> it.map { it.name }.toSet() } + ) + } + private val selectedDashboardTilesPreference: Preference> get() { val defaultSet = @@ -340,21 +350,19 @@ class PreferencesRepository @Inject constructor( return flowSharedPref.getStringSet(prefKey, defaultSet) } - private val selectedHiddenSettingTilesPreference: Preference> + private val attendancePercentagePreference: Preference get() { - val defaultSet = - context.resources.getStringArray(R.array.pref_default_hidden_settings_tiles).toSet() - val prefKey = "hidden_settings_tiles" + val prefKey = context.getString(R.string.pref_key_attendance_percentage) + val defaultValue = context.resources.getString(R.string.pref_default_attendance_percentage) - return flowSharedPref.getStringSet(prefKey, defaultSet) + return flowSharedPref + .getString(prefKey, defaultValue) + .map( + mapper = { it.toDoubleOrNull() ?: NO_ATTENDANCE_VALUE }, + reverse = { it.toString() } + ) } - private val attendancePercentagePreference: Preference - get() = flowSharedPref.getFloat( - context.getString(R.string.pref_key_attendance_percentage), - context.resources.getInteger(R.integer.pref_default_attendance_percentage).toFloat() - ) - var dismissedAdminMessageIds: List get() = sharedPref.getStringSet(PREF_KEY_ADMIN_DISMISSED_MESSAGE_IDS, emptySet()) .orEmpty() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt index ae0a189f..4e9f68c9 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt @@ -54,7 +54,7 @@ class AttendanceSummaryAdapter @Inject constructor( private fun bindHeaderViewHolder(binding: ScrollableHeaderAttendanceSummaryBinding) { binding.attendanceSummaryScrollableHeaderPercentage.text = formatPercentage( - attendancePercentage?.toDouble() ?: + attendancePercentage ?: items.calculatePercentage() ) } @@ -68,8 +68,8 @@ class AttendanceSummaryAdapter @Inject constructor( else -> item.month.getFormattedName() } attendanceSummaryPercentage.text = when (position) { - -1 -> formatPercentage(attendancePercentage?.toDouble() ?: item.calculatePercentage()) - else -> formatPercentage(attendancePercentage?.toDouble() ?: item.calculatePercentage()) + -1 -> formatPercentage(attendancePercentage ?: item.calculatePercentage()) + else -> formatPercentage(attendancePercentage ?: item.calculatePercentage()) } attendanceSummaryPresent.text = item.presence.toString() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardItem.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardItem.kt index 6a05b105..506f6124 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardItem.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardItem.kt @@ -148,10 +148,15 @@ sealed class DashboardItem(val type: Type) { CONFERENCES, } - enum class HiddenSettingTile { - BAD_ATTENDANCE, - NOTES, - ATTENDANCE, + enum class HiddenAttendanceTile { + UNEXCUSED_ABSENCE, + EXEMPTION, + EXCUSED_LATENESS, + UNEXCUSED_LATENESS, + PRESENT, + DELETED, + EXCUSED_ABSENCE, + UNKNOWN, } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardPresenter.kt index 5a18683a..9ba71937 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardPresenter.kt @@ -338,7 +338,7 @@ class DashboardPresenter @Inject constructor( } else null }, attendancePercentage = DashboardItem.HorizontalGroup.Cell( - data = attendancePercentage?.toDouble() ?: attendanceResource.dataOrNull?.calculatePercentage(), + data = attendancePercentage ?: attendanceResource.dataOrNull?.calculatePercentage(), error = attendanceResource.errorOrNull != null, isLoading = attendanceResource is Resource.Loading, ), diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt index d26cb2f2..27023d13 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt @@ -1,45 +1,19 @@ package io.github.wulkanowy.ui.modules.more import android.os.Bundle -import android.text.InputFilter -import android.text.InputType -import android.text.Spanned import android.view.View -import android.widget.EditText -import androidx.appcompat.app.AlertDialog import androidx.recyclerview.widget.LinearLayoutManager -import com.google.android.material.dialog.MaterialAlertDialogBuilder import dagger.hilt.android.AndroidEntryPoint import io.github.wulkanowy.R import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.databinding.FragmentMoreBinding import io.github.wulkanowy.ui.base.BaseFragment import io.github.wulkanowy.ui.modules.Destination -import io.github.wulkanowy.ui.modules.dashboard.DashboardItem import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.ui.modules.message.MessageFragment -import timber.log.Timber import javax.inject.Inject -private class AttendancePercentageFilter : InputFilter { - override fun filter( - source: CharSequence?, - start: Int, - end: Int, - dest: Spanned?, - dstart: Int, - dend: Int - ): CharSequence? { - val input = dest.toString() + source.toString() - val floatRepresentation = input.toFloatOrNull() - - if (floatRepresentation != null && floatRepresentation in 0.0..100.0) return null - - return "" - } -} - @AndroidEntryPoint class MoreFragment : BaseFragment(R.layout.fragment_more), MoreView, MainView.TitledView, MainView.MainChildView { @@ -68,7 +42,6 @@ class MoreFragment : BaseFragment(R.layout.fragment_more), override fun initView() { moreAdapter.onClickListener = presenter::onItemSelected - moreAdapter.onLongClickListener = presenter::onItemHold with(binding.moreRecycler) { layoutManager = LinearLayoutManager(context) @@ -105,68 +78,6 @@ class MoreFragment : BaseFragment(R.layout.fragment_more), super.onDestroyView() } - private fun showGradeDialog() { - val hiddenGrades = preferencesRepository.hiddenGrades - - val grades = requireContext().resources.getStringArray(R.array.hidden_settings_bad_grades) - val selectedItemsState = grades.map { grade -> hiddenGrades.any { it == grade } } - - MaterialAlertDialogBuilder(requireContext()) - .setTitle(R.string.pref_hidden_settings_hide_grades_title) - .setMultiChoiceItems(grades, selectedItemsState.toBooleanArray()) { _, _, _ -> } - .setPositiveButton(android.R.string.ok) { dialog, _ -> - val selectedState = (dialog as AlertDialog).listView.checkedItemPositions - val selectedValues = grades.filterIndexed { index, _ -> selectedState[index] } - - Timber.i("Selected hidden grades: $selectedValues") - presenter.onHiddenGradesSelected(selectedValues) - } - .show() - } - - override fun showHiddenSettings(data: List) { - val entries = requireContext().resources.getStringArray(R.array.hidden_settings_entries) - val values = requireContext().resources.getStringArray(R.array.hidden_settings_values) - val selectedItemsState = values.map { value -> data.any { it.name == value } } - - val attendancePercentage = preferencesRepository.attendancePercentage - - val input = EditText(requireContext()).apply { - setPadding(40, 20, 40, 20) - hint = requireContext().getString(R.string.pref_hidden_settings_hint) - filters = arrayOf(AttendancePercentageFilter()) - inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL - } - - // enable only if attendance modifier is enabled - val attendanceModifierEnabled = data.any { it == DashboardItem.HiddenSettingTile.ATTENDANCE } - input.isEnabled = attendanceModifierEnabled - - if (attendancePercentage != null) input.setText(attendancePercentage.toString()) - - MaterialAlertDialogBuilder(requireContext()) - .setTitle(R.string.pref_hidden_settings_title) - .setMultiChoiceItems(entries, selectedItemsState.toBooleanArray()) { dialog, index, _ -> - // if attendance modifier is enabled, enable text input - if (index == values.indexOf(DashboardItem.HiddenSettingTile.ATTENDANCE.name)) - input.isEnabled = (dialog as AlertDialog).listView.checkedItemPositions[index] - } - .setView(input) - .setPositiveButton(android.R.string.ok) { dialog, _ -> - val selectedState = (dialog as AlertDialog).listView.checkedItemPositions - val selectedValues = values.filterIndexed { index, _ -> selectedState[index] } - val inputAttendancePercentage = selectedValues - .find { it == DashboardItem.HiddenSettingTile.ATTENDANCE.name } - ?.let { input.text.toString().toFloatOrNull() } - - Timber.i("Selected hidden settings: $selectedValues") - presenter.onHiddenSettingsSelected(selectedValues, inputAttendancePercentage) - } - .setNegativeButton(android.R.string.cancel) { _, _ -> } - .setNeutralButton(R.string.pref_hidden_settings_hide_grades_title) { _, _ -> showGradeDialog() } - .show() - } - override fun restartApp() { startActivity(MainActivity.getStartIntent(requireContext())) requireActivity().finishAffinity() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt index 7e36e3c8..0ebaf4c7 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt @@ -6,23 +6,19 @@ import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.ui.modules.Destination -import io.github.wulkanowy.ui.modules.dashboard.DashboardItem -import okhttp3.internal.notify import timber.log.Timber import javax.inject.Inject class MorePresenter @Inject constructor( errorHandler: ErrorHandler, studentRepository: StudentRepository, - private val preferencesRepository: PreferencesRepository + preferencesRepository: PreferencesRepository ) : BasePresenter(errorHandler, studentRepository) { private val moreAppMenuItem = preferencesRepository.appMenuItemOrder .sortedBy { it.order } .drop(4) - private val selectedHiddenSettingsTiles = preferencesRepository.selectedHiddenSettingTiles - override fun onAttachView(view: MoreView) { super.onAttachView(view) view.initView() @@ -36,30 +32,6 @@ class MorePresenter @Inject constructor( view?.openView(moreItem.destination) } - fun onItemHold(moreItem: MoreItem) { - Timber.i("More item hold") - - when (moreItem.destination) { - Destination.Settings -> view?.showHiddenSettings(selectedHiddenSettingsTiles) - else -> return - } - } - - fun onHiddenSettingsSelected(selectedItems: List, attendance: Float?) { - preferencesRepository.selectedHiddenSettingTiles = selectedItems.map { - DashboardItem.HiddenSettingTile.valueOf(it) - } - - preferencesRepository.attendancePercentage = attendance - - view?.restartApp() - } - - fun onHiddenGradesSelected(selectedItems: List) { - preferencesRepository.hiddenGrades = selectedItems - view?.restartApp() - } - fun onViewReselected() { Timber.i("More view is reselected") view?.popView(2) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt index ab2f1444..05b426d6 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt @@ -2,7 +2,6 @@ package io.github.wulkanowy.ui.modules.more import io.github.wulkanowy.ui.base.BaseView import io.github.wulkanowy.ui.modules.Destination -import io.github.wulkanowy.ui.modules.dashboard.DashboardItem interface MoreView : BaseView { @@ -14,7 +13,5 @@ interface MoreView : BaseView { fun openView(destination: Destination) - fun showHiddenSettings(data: List) - fun restartApp() } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt index 62ad347f..59a13fbb 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt @@ -3,6 +3,7 @@ package io.github.wulkanowy.ui.modules.note import io.github.wulkanowy.data.* import io.github.wulkanowy.data.db.entities.Note import io.github.wulkanowy.data.repositories.NoteRepository +import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.ui.base.BasePresenter @@ -17,6 +18,7 @@ class NotePresenter @Inject constructor( studentRepository: StudentRepository, private val noteRepository: NoteRepository, private val semesterRepository: SemesterRepository, + private val preferencesRepository: PreferencesRepository, private val analytics: AnalyticsHelper ) : BasePresenter(errorHandler, studentRepository) { @@ -48,6 +50,19 @@ class NotePresenter @Inject constructor( } private fun loadData(forceRefresh: Boolean = false) { + if (!preferencesRepository.showNotes) { + view?.run { + enableSwipe(false) + showEmpty(false) + showContent(false) + showErrorView(false) + showProgress(false) + showEmpty(true) + } + + return + } + flatResourceFlow { val student = studentRepository.getCurrentStudent() val semester = semesterRepository.getCurrentSemester(student) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsFragment.kt new file mode 100644 index 00000000..e45a5443 --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsFragment.kt @@ -0,0 +1,147 @@ +package io.github.wulkanowy.ui.modules.settings.mod_settings + +import android.content.SharedPreferences +import android.os.Bundle +import android.view.View +import androidx.appcompat.app.AlertDialog +import androidx.preference.EditTextPreference +import androidx.preference.MultiSelectListPreference +import androidx.preference.PreferenceFragmentCompat +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import dagger.hilt.android.AndroidEntryPoint +import io.github.wulkanowy.R +import io.github.wulkanowy.data.repositories.PreferencesRepository +import io.github.wulkanowy.ui.base.BaseActivity +import io.github.wulkanowy.ui.base.ErrorDialog +import io.github.wulkanowy.ui.modules.dashboard.DashboardItem +import io.github.wulkanowy.ui.modules.main.MainActivity +import io.github.wulkanowy.ui.modules.main.MainView +import io.github.wulkanowy.utils.AppInfo +import timber.log.Timber +import javax.inject.Inject + +@AndroidEntryPoint +class ModSettingsFragment : PreferenceFragmentCompat(), + SharedPreferences.OnSharedPreferenceChangeListener, + MainView.TitledView, ModSettingsView { + + @Inject + lateinit var presenter: ModSettingsPresenter + + @Inject + lateinit var appInfo: AppInfo + + @Inject + lateinit var preferencesRepository: PreferencesRepository + + override val titleStringId get() = R.string.pref_mod_settings_title + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + presenter.onAttachView(this) + } + + override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { + setPreferencesFromResource(R.xml.scheme_preferences_mod_settings, rootKey) + + val attendancePercentagePreference: EditTextPreference? = findPreference("attendance_percentage") + attendancePercentagePreference?.setOnBindEditTextListener { editText -> + editText.inputType = android.text.InputType.TYPE_CLASS_NUMBER or android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL + editText.filters = arrayOf( + android.text.InputFilter { source, _, _, dest, _, _ -> + if (source == "." && dest.isEmpty()) { + return@InputFilter "0." + } + + val input = dest.toString() + source.toString() + if (input == "100.00") { + return@InputFilter null + } + + val inputVal = input.toFloatOrNull() + if (inputVal != null && inputVal >= 0 && inputVal <= 100) { + null + } else { + "" + } + } + ) + } + } + + override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { + presenter.onSharedPreferenceChanged(key) + } + + override fun showError(text: String, error: Throwable) { + (activity as? BaseActivity<*, *>)?.showError(text, error) + } + + override fun showMessage(text: String) { + (activity as? BaseActivity<*, *>)?.showMessage(text) + } + + override fun showExpiredCredentialsDialog() { + (activity as? BaseActivity<*, *>)?.showExpiredCredentialsDialog() + } + + override fun onCaptchaVerificationRequired(url: String?) { + (activity as? BaseActivity<*, *>)?.onCaptchaVerificationRequired(url) + } + + override fun showDecryptionFailedDialog() { + (activity as? BaseActivity<*, *>)?.showDecryptionFailedDialog() + } + + override fun showChangePasswordSnackbar(redirectUrl: String) { + (activity as? BaseActivity<*, *>)?.showChangePasswordSnackbar(redirectUrl) + } + + override fun openClearLoginView() { + (activity as? BaseActivity<*, *>)?.openClearLoginView() + } + + override fun showErrorDetailsDialog(error: Throwable) { + ErrorDialog.newInstance(error).show(childFragmentManager, error.toString()) + } + + override fun showAuthDialog() { + (activity as? BaseActivity<*, *>)?.showAuthDialog() + } + + override fun onResume() { + super.onResume() + preferenceScreen.sharedPreferences?.registerOnSharedPreferenceChangeListener(this) + } + + override fun onPause() { + super.onPause() + preferenceScreen.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this) + } + + override fun showAttendanceSettings(items: List) { + val entries = requireContext().resources.getStringArray(R.array.mod_settings_attendance_entries) + val values = requireContext().resources.getStringArray(R.array.mod_settings_attendance_values) + val selectedItemsState = values.map { value -> items.any { it.name == value } } + + MaterialAlertDialogBuilder(requireContext()) + .setTitle(R.string.attendance_title) + .setMultiChoiceItems(entries, selectedItemsState.toBooleanArray()) { _, _, _ -> } + .setPositiveButton(android.R.string.ok) { dialog, _ -> + val selectedState = (dialog as AlertDialog).listView.checkedItemPositions + val selectedValues = values + .filterIndexed { index, _ -> selectedState[index] } + .map { DashboardItem.HiddenAttendanceTile.valueOf(it) } + + Timber.i("Selected attendance to hide: $selectedValues") + presenter.onAttendanceSettingsSelected(selectedValues) + } + .setNegativeButton(android.R.string.cancel) { _, _ -> } + .show() + } + + override fun restartApp() { + startActivity(MainActivity.getStartIntent(requireContext())) + requireActivity().finishAffinity() + } +} diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsPresenter.kt new file mode 100644 index 00000000..10bbefbc --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsPresenter.kt @@ -0,0 +1,40 @@ +package io.github.wulkanowy.ui.modules.settings.mod_settings + +import io.github.wulkanowy.data.repositories.PreferencesRepository +import io.github.wulkanowy.data.repositories.StudentRepository +import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler +import io.github.wulkanowy.ui.modules.dashboard.DashboardItem +import io.github.wulkanowy.utils.AnalyticsHelper +import timber.log.Timber +import javax.inject.Inject + +class ModSettingsPresenter @Inject constructor( + errorHandler: ErrorHandler, + studentRepository: StudentRepository, + private val analytics: AnalyticsHelper, + private val preferencesRepository: PreferencesRepository +) : BasePresenter(errorHandler, studentRepository) { + + override fun onAttachView(view: ModSettingsView) { + super.onAttachView(view) + + Timber.i("Mod settings view was initialized") + } + + fun onSharedPreferenceChanged(key: String?) { + key ?: return + Timber.i("Change mod settings $key") + analytics.logEvent("setting_changed", "name" to key) + } + + fun onHiddenGradesSelected(selectedItems: List) { + preferencesRepository.hiddenGrades = selectedItems + view?.restartApp() + } + + fun onAttendanceSettingsSelected(selectedValues: List) { + preferencesRepository.hiddenAttendanceItems = selectedValues + view?.restartApp() + } +} diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsView.kt new file mode 100644 index 00000000..0133d2a4 --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/mod_settings/ModSettingsView.kt @@ -0,0 +1,9 @@ +package io.github.wulkanowy.ui.modules.settings.mod_settings + +import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.modules.dashboard.DashboardItem + +interface ModSettingsView : BaseView { + fun restartApp() + fun showAttendanceSettings(items: List) +} diff --git a/app/src/main/res/values-cs/mod_values.xml b/app/src/main/res/values-cs/mod_values.xml index 02b35b92..bbcb8acf 100644 --- a/app/src/main/res/values-cs/mod_values.xml +++ b/app/src/main/res/values-cs/mod_values.xml @@ -1,12 +1,19 @@ - Skrytá nastavení - Procento docházky - Skrýt známky + Skrytá nastavení + Procento docházky + Skrýt známky + Skryté položky docházky + Poznámky k pořadu - - Špatná účast - Poznámky - Falešná účast + + Neomluvená absence + Výjimka + Ospravedlněné zpoždění + Neomluvené zpoždění + Přítomnost + Smazáno + Ospravedlněná absence + Neznámá diff --git a/app/src/main/res/values-da-rDK/mod_values.xml b/app/src/main/res/values-da-rDK/mod_values.xml index 1d61d6c8..5cb747a7 100644 --- a/app/src/main/res/values-da-rDK/mod_values.xml +++ b/app/src/main/res/values-da-rDK/mod_values.xml @@ -1,12 +1,19 @@ - Hidden settings - Attendance percentage - Hide grades + Hidden settings + Attendance percentage + Hide grades + Hidden attendance items + Show notes - - Bad attendance - Notes - Fake attendance + + Unexcused absence + Exemption + Excused lateness + Unexcused lateness + Present + Deleted + Excused absence + Unknown diff --git a/app/src/main/res/values-de/mod_values.xml b/app/src/main/res/values-de/mod_values.xml index 5a9728c3..9344adb9 100644 --- a/app/src/main/res/values-de/mod_values.xml +++ b/app/src/main/res/values-de/mod_values.xml @@ -1,12 +1,19 @@ - Geheime Einstellungen - Prozentuale Erwartung - Hide Grades + Geheime Einstellungen + Prozentuale Erwartung + Hide Grades + Versteckte Anwesenheitsposten + Notizen anzeigen - - Schlechte Anwesenheit - Notizen - Vorgetäuschte 100-prozentige Anwesenheit + + Unentschuldigtes Fehlen + Befreiung + Entschuldigtes Zuspätkommen + Unentschuldigtes Zuspätkommen + Anwesend + Löschen + Unentschuldigtes Fehlen + Unbekannt diff --git a/app/src/main/res/values-es-rES/mod_values.xml b/app/src/main/res/values-es-rES/mod_values.xml index 1d61d6c8..5cb747a7 100644 --- a/app/src/main/res/values-es-rES/mod_values.xml +++ b/app/src/main/res/values-es-rES/mod_values.xml @@ -1,12 +1,19 @@ - Hidden settings - Attendance percentage - Hide grades + Hidden settings + Attendance percentage + Hide grades + Hidden attendance items + Show notes - - Bad attendance - Notes - Fake attendance + + Unexcused absence + Exemption + Excused lateness + Unexcused lateness + Present + Deleted + Excused absence + Unknown diff --git a/app/src/main/res/values-it-rIT/mod_values.xml b/app/src/main/res/values-it-rIT/mod_values.xml index 1d61d6c8..cdb6ac02 100644 --- a/app/src/main/res/values-it-rIT/mod_values.xml +++ b/app/src/main/res/values-it-rIT/mod_values.xml @@ -1,12 +1,19 @@ - Hidden settings - Attendance percentage - Hide grades + Hidden settings + Attendance percentage + Hide grades + Hidden attendance items + Note sullo spettacolo - - Bad attendance - Notes - Fake attendance + + Unexcused absence + Exemption + Excused lateness + Unexcused lateness + Present + Deleted + Excused absence + Unknown diff --git a/app/src/main/res/values-pl/mod_values.xml b/app/src/main/res/values-pl/mod_values.xml index b2fc8e65..b376f0fe 100644 --- a/app/src/main/res/values-pl/mod_values.xml +++ b/app/src/main/res/values-pl/mod_values.xml @@ -1,12 +1,19 @@ - Sekretne ustawienia - Procent frekwencji - Ukryj oceny + Sekretne ustawienia + Procent frekwencji + Ukryj oceny + Ukryte wpisy frekwencji + Pokazuj uwagi - - Słaba frekwencja - Uwagi - Fałszywa frekwencja + + Nieusprawiedliwiona nieobecność + Zwolnienie + Usprawiedliwione spóźnienie + Nieusprawiedliwione spóźnienie + Obecność + Usunięte + Nieobecność usprawiedliwiona + Nieznane diff --git a/app/src/main/res/values-ru/mod_values.xml b/app/src/main/res/values-ru/mod_values.xml index 98474259..25caf0dd 100644 --- a/app/src/main/res/values-ru/mod_values.xml +++ b/app/src/main/res/values-ru/mod_values.xml @@ -1,12 +1,19 @@ - Секретные настройки - Процент посещаемости - Скрыть оценки + Секретные настройки + Процент посещаемости + Скрыть оценки + Скрытые элементы посещаемости + Показать заметки - - Плохая посещаемость - Примечания - Фейковая посещаемость + + Отсутствие без уважительной причины + Исключение + Опоздание без уважительной причины + Не оправданное опоздание + Присутствует + Удалено + Отсутствие без уважительной причины + Неизвестный diff --git a/app/src/main/res/values-sk/mod_values.xml b/app/src/main/res/values-sk/mod_values.xml index 402ae178..c740440d 100644 --- a/app/src/main/res/values-sk/mod_values.xml +++ b/app/src/main/res/values-sk/mod_values.xml @@ -1,12 +1,19 @@ - Skryté nastavenia - Percento dochádzky - Skryť známky + Skryté nastavenia + Percento dochádzky + Skryť známky + Skryté položky dochádzky + Zobraziť poznámky - - Zlá účasť - Poznámky - Falošná účasť + + Neospravedlnená neprítomnosť + Vynechanie + Ospravedlnené meškanie + Neospravedlnené meškanie + Prítomnosť + Zrušené + Ospravedlnená absencia + Neznámy diff --git a/app/src/main/res/values-uk/mod_values.xml b/app/src/main/res/values-uk/mod_values.xml index 1e34afbc..9fa72b9d 100644 --- a/app/src/main/res/values-uk/mod_values.xml +++ b/app/src/main/res/values-uk/mod_values.xml @@ -1,12 +1,19 @@ - Секретні налаштування - Відсоток відвідуваності - Приховати оцінки + Секретні налаштування + Відсоток відвідуваності + Приховати оцінки + Приховані елементи відвідування + Показати нотатки - - Погана відвідуваність - Примітки - Фальшива явка + + Прогул без поважних причин + Звільнення + Поважне запізнення + Запізнення без поважних причин + Присутній + Видалено + Поважна відсутність + Невідомо diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml deleted file mode 100644 index a1c270e6..00000000 --- a/app/src/main/res/values/integers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - -1 - diff --git a/app/src/main/res/values/mod_values.xml b/app/src/main/res/values/mod_values.xml index 4b2f1cec..204d0ae6 100644 --- a/app/src/main/res/values/mod_values.xml +++ b/app/src/main/res/values/mod_values.xml @@ -1,19 +1,43 @@ - Hidden settings - Attendance percentage - attendance_percentage - Hide grades + Wulkanowy MOD settings + Hidden attendance items + Attendance percentage + Hidden grades - - Bad attendance - Notes - Fake attendance + hidden_grades + attendance_items + attendance_percentage + -1 + + Show notes + show_notes + true + + + Unexcused absence + Exemption + Excused lateness + Unexcused lateness + Present + Deleted + Excused absence + Unknown - - BAD_ATTENDANCE - NOTES - ATTENDANCE + + + UNEXCUSED_ABSENCE + EXEMPTION + EXCUSED_LATENESS + UNEXCUSED_LATENESS + PRESENT + DELETED + EXCUSED_ABSENCE + UNKNOWN + + + + diff --git a/app/src/main/res/xml/scheme_preferences.xml b/app/src/main/res/xml/scheme_preferences.xml index 5bf7ad8a..b0d37b93 100644 --- a/app/src/main/res/xml/scheme_preferences.xml +++ b/app/src/main/res/xml/scheme_preferences.xml @@ -30,4 +30,9 @@ app:key="about" app:summary="@string/pref_about_category_summary" app:title="@string/about_title" /> + diff --git a/app/src/main/res/xml/scheme_preferences_mod_settings.xml b/app/src/main/res/xml/scheme_preferences_mod_settings.xml new file mode 100644 index 00000000..4deb55dd --- /dev/null +++ b/app/src/main/res/xml/scheme_preferences_mod_settings.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + diff --git a/app/src/play/res/xml/scheme_preferences.xml b/app/src/play/res/xml/scheme_preferences.xml index 05b0bf64..62b01703 100644 --- a/app/src/play/res/xml/scheme_preferences.xml +++ b/app/src/play/res/xml/scheme_preferences.xml @@ -36,4 +36,9 @@ app:key="about" app:summary="@string/pref_about_category_summary" app:title="@string/about_title" /> +