forked from github/szkolny
Compare commits
No commits in common. "ab3af676638a21e874c6e8d68167f329bf60b270" and "4d9c9368dde0c9bac5a0fba5771c61a771bf0d61" have entirely different histories.
ab3af67663
...
4d9c9368dd
@ -89,7 +89,6 @@ android {
|
||||
buildFeatures {
|
||||
dataBinding = true
|
||||
viewBinding = true
|
||||
buildConfig true
|
||||
}
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled = true
|
||||
@ -193,14 +192,14 @@ dependencies {
|
||||
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
|
||||
implementation "eu.szkolny:mhttp:af4b62e6e9"
|
||||
implementation "eu.szkolny:nachos:0e5dfcaceb"
|
||||
implementation "eu.szkolny.selective-dao:annotation:6a337f9"
|
||||
implementation "eu.szkolny.selective-dao:annotation:27f8f3f194"
|
||||
officialImplementation "eu.szkolny:ssl-provider:1.0.0"
|
||||
unofficialImplementation "eu.szkolny:ssl-provider:1.0.0"
|
||||
|
||||
implementation "pl.szczodrzynski:numberslidingpicker:2921225f76"
|
||||
implementation "pl.szczodrzynski:recyclertablayout:700f980584"
|
||||
implementation "pl.szczodrzynski:tachyon:551943a6b5"
|
||||
kapt "eu.szkolny.selective-dao:codegen:6a337f9"
|
||||
kapt "eu.szkolny.selective-dao:codegen:27f8f3f194"
|
||||
|
||||
// Iconics & related
|
||||
implementation "com.mikepenz:iconics-core:5.3.2"
|
||||
|
@ -124,8 +124,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
private val job = Job()
|
||||
override val coroutineContext: CoroutineContext
|
||||
get() = job + Dispatchers.Main
|
||||
|
||||
override val workManagerConfiguration: Configuration = Configuration.Builder()
|
||||
override fun getWorkManagerConfiguration() = Configuration.Builder()
|
||||
.setMinimumLoggingLevel(Log.VERBOSE)
|
||||
.build()
|
||||
|
||||
|
@ -144,7 +144,7 @@ class ConfigDelegate<T>(
|
||||
java.lang.Float::class.java -> value.toFloatOrNull()
|
||||
// enums, maps & collections
|
||||
else -> when {
|
||||
Enum::class.java.isAssignableFrom(type) -> value.toIntOrNull()?.toEnum(type) as Enum
|
||||
Enum::class.java.isAssignableFrom(type) -> value.toIntOrNull()?.toEnum(type) as Enum<*>
|
||||
Collection::class.java.isAssignableFrom(type) -> {
|
||||
val array = value.toJsonArray()
|
||||
val genericType = getGenericType()
|
||||
|
@ -391,7 +391,7 @@ open class VulcanHebe(open val data: DataVulcan, open val lastSync: Long?) {
|
||||
fun apiGetList(
|
||||
tag: String,
|
||||
endpoint: String,
|
||||
filterType: HebeFilterType = HebeFilterType.BY_PUPIL,
|
||||
filterType: HebeFilterType? = null,
|
||||
dateFrom: Date? = null,
|
||||
dateTo: Date? = null,
|
||||
lastSync: Long? = null,
|
||||
@ -424,6 +424,8 @@ open class VulcanHebe(open val data: DataVulcan, open val lastSync: Long?) {
|
||||
HebeFilterType.BY_MESSAGEBOX -> {
|
||||
query["box"] = messageBox ?: data.messageBoxKey ?: ""
|
||||
}
|
||||
|
||||
null -> TODO()
|
||||
}
|
||||
|
||||
if (dateFrom != null)
|
||||
|
@ -23,24 +23,20 @@ object WorkerUtils {
|
||||
inline fun scheduleNext(app: App, rescheduleIfFailedFound: Boolean = true, crossinline onReschedule: () -> Unit) {
|
||||
AsyncTask.execute {
|
||||
val workManager = WorkManager.getInstance(app) as WorkManagerImpl
|
||||
val scheduledWork = workManager.workDatabase.workSpecDao().getScheduledWork() as MutableList;
|
||||
|
||||
val scheduledWork = workManager.workDatabase.workSpecDao().scheduledWork
|
||||
scheduledWork.forEach {
|
||||
Utils.d("WorkerUtils", "Work: ${it.id} at ${it.calculateNextRunTime().formatDate()}. State = ${it.state} (finished = ${it.state.isFinished})")
|
||||
Utils.d("WorkerUtils", "Work: ${it.id} at ${(it.periodStartTime + it.initialDelay).formatDate()}. State = ${it.state} (finished = ${it.state.isFinished})")
|
||||
}
|
||||
|
||||
// remove finished work and other than SyncWorker
|
||||
scheduledWork.removeAll { it.workerClassName != SyncWorker::class.java.canonicalName || it.isPeriodic || it.state.isFinished }
|
||||
Utils.d("WorkerUtils", "Found ${scheduledWork.size} unfinished work")
|
||||
|
||||
// remove all enqueued work that had to (but didn't) run at some point in the past (at least 1min ago)
|
||||
val failedWork = scheduledWork.filter { it.state == WorkInfo.State.ENQUEUED && it.calculateNextRunTime() < System.currentTimeMillis() - 1 * MINUTE * 1000 }
|
||||
val failedWork = scheduledWork.filter { it.state == WorkInfo.State.ENQUEUED && it.periodStartTime + it.initialDelay < System.currentTimeMillis() - 1 * MINUTE * 1000 }
|
||||
Utils.d("WorkerUtils", "${failedWork.size} work requests failed to start (out of ${scheduledWork.size} requests)")
|
||||
|
||||
if (rescheduleIfFailedFound) {
|
||||
if (failedWork.isNotEmpty()) {
|
||||
Utils.d("WorkerUtils", "App Manager detected!")
|
||||
EventBus.getDefault().postSticky(AppManagerDetectedEvent(failedWork.map { it.calculateNextRunTime() }))
|
||||
EventBus.getDefault().postSticky(AppManagerDetectedEvent(failedWork.map { it.periodStartTime + it.initialDelay }))
|
||||
}
|
||||
if (scheduledWork.size - failedWork.size < 1) {
|
||||
Utils.d("WorkerUtils", "No pending work found, scheduling next:")
|
||||
|
@ -129,7 +129,7 @@ class LabProfileFragment : LazyFragment(), CoroutineScope {
|
||||
is String -> input
|
||||
is Long -> input.toLong()
|
||||
is Double -> input.toDouble()
|
||||
is Enum<*> -> input.toInt().toEnum(objVal::class.java) as Enum
|
||||
is Enum<*> -> input.toInt().toEnum(objVal::class.java)
|
||||
else -> input
|
||||
}
|
||||
field.set(parent, newVal)
|
||||
|
@ -328,7 +328,7 @@ class HomeTimetableCard(
|
||||
|
||||
for (lesson in nextLessons) {
|
||||
text += listOf(
|
||||
adjustTimeWidth(lesson.displayStartTime?.stringHM),
|
||||
lesson.displayStartTime?.stringHM,
|
||||
lesson.subjectSpannable
|
||||
).concat(" ")
|
||||
}
|
||||
@ -337,12 +337,6 @@ class HomeTimetableCard(
|
||||
b.nextLessons.text = text.concat("\n")
|
||||
}}
|
||||
|
||||
private fun adjustTimeWidth(time: String?) = when {
|
||||
time == null -> ""
|
||||
time.length == 4 -> " $time "
|
||||
else -> "$time "
|
||||
}
|
||||
|
||||
private val LessonFull?.subjectSpannable: CharSequence
|
||||
get() = if (this == null) "?" else when {
|
||||
hasReplacingNotes() -> getNoteSubstituteText(showNotes = true) ?: "?"
|
||||
|
@ -4,13 +4,11 @@
|
||||
|
||||
package pl.szczodrzynski.edziennik.ui.timetable
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.AsyncTask
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -92,17 +90,9 @@ class TimetableFragment : Fragment(), CoroutineScope {
|
||||
}
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
activity.registerReceiver(broadcastReceiver, IntentFilter(ACTION_SCROLL_TO_DATE ),
|
||||
Context.RECEIVER_NOT_EXPORTED)
|
||||
activity.registerReceiver(broadcastReceiver, IntentFilter(ACTION_RELOAD_PAGES),
|
||||
Context.RECEIVER_NOT_EXPORTED)
|
||||
} else @Suppress("UnspecifiedRegisterReceiverFlag") {
|
||||
activity.registerReceiver(broadcastReceiver, IntentFilter(ACTION_SCROLL_TO_DATE))
|
||||
activity.registerReceiver(broadcastReceiver, IntentFilter(ACTION_RELOAD_PAGES))
|
||||
}
|
||||
}
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
activity.unregisterReceiver(broadcastReceiver)
|
||||
|
@ -11,6 +11,7 @@
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
#Tue Aug 22 15:52:38 CEST 2023
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.enableJetifier=true
|
||||
android.nonFinalResIds=false
|
||||
android.nonTransitiveRClass=false
|
||||
|
Loading…
Reference in New Issue
Block a user