diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 0816fb00..3820b739 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -25,7 +25,7 @@
 -keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
 -keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
 -keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
--keep class pl.szczodrzynski.edziennik.ui.modules.home.HomeCardModel { *; }
+-keep class pl.szczodrzynski.edziennik.ui.home.HomeCardModel { *; }
 -keepclassmembers class pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig { public *; }
 -keepnames class pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider
 -keepnames class pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider
@@ -67,7 +67,7 @@
 
 -keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.request.** { *; }
 -keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.response.** { *; }
--keepclassmembernames class pl.szczodrzynski.edziennik.ui.modules.login.LoginInfo$Platform { *; }
+-keepclassmembernames class pl.szczodrzynski.edziennik.ui.login.LoginInfo$Platform { *; }
 
 -keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData { *; }
 -keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData$Type { *; }
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index cbe7bd48..c710c6b8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -121,32 +121,32 @@
               / ____ \ (__| |_| |\ V /| | |_| |  __/\__ \
              /_/    \_\___|\__|_| \_/ |_|\__|_|\___||___/
         -->
-        <activity android:name=".ui.modules.base.CrashActivity"
+        <activity android:name=".ui.base.CrashActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:process=":error_activity"
             android:theme="@style/DeadTheme" />
-        <activity android:name=".ui.modules.intro.ChangelogIntroActivity"
+        <activity android:name=".ui.intro.ChangelogIntroActivity"
             android:configChanges="orientation|keyboardHidden"
             android:label="@string/app_name"
             android:theme="@style/Theme.Intro" />
-        <activity android:name=".ui.modules.login.LoginActivity"
+        <activity android:name=".ui.login.LoginActivity"
             android:configChanges="orientation|screenSize"
             android:launchMode="singleTop"
             android:theme="@style/AppTheme.Light" />
-        <activity android:name=".ui.modules.home.CounterActivity"
+        <activity android:name=".ui.home.CounterActivity"
             android:theme="@style/AppTheme.Black" />
-        <activity android:name=".ui.modules.feedback.FeedbackActivity"
+        <activity android:name=".ui.feedback.FeedbackActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:label="@string/app_name"
             android:theme="@style/AppTheme" />
-        <activity android:name=".ui.modules.settings.SettingsLicenseActivity"
+        <activity android:name=".ui.settings.SettingsLicenseActivity"
             android:configChanges="orientation|keyboardHidden"
             android:theme="@style/AppTheme" />
         <activity android:name="com.canhub.cropper.CropImageActivity"
             android:configChanges="orientation|keyboardHidden"
             android:theme="@style/Base.Theme.AppCompat" />
-        <activity android:name=".ui.modules.base.BuildInvalidActivity" />
-        <activity android:name=".ui.modules.settings.contributors.ContributorsActivity" />
+        <activity android:name=".ui.base.BuildInvalidActivity" />
+        <activity android:name=".ui.settings.contributors.ContributorsActivity" />
 
         <!--  _____               _
              |  __ \             (_)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/App.kt b/app/src/main/java/pl/szczodrzynski/edziennik/App.kt
index 55b0ff69..77a2af31 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/App.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/App.kt
@@ -38,10 +38,13 @@ import pl.szczodrzynski.edziennik.data.api.events.ProfileListEmptyEvent
 import pl.szczodrzynski.edziennik.data.api.szkolny.interceptor.Signing
 import pl.szczodrzynski.edziennik.data.db.AppDb
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.MS
+import pl.szczodrzynski.edziennik.ext.setLanguage
 import pl.szczodrzynski.edziennik.network.cookie.DumbCookieJar
 import pl.szczodrzynski.edziennik.sync.SyncWorker
 import pl.szczodrzynski.edziennik.sync.UpdateWorker
-import pl.szczodrzynski.edziennik.ui.modules.base.CrashActivity
+import pl.szczodrzynski.edziennik.ui.base.CrashActivity
 import pl.szczodrzynski.edziennik.utils.*
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.managers.*
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt
deleted file mode 100644
index 9504026b..00000000
--- a/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt
+++ /dev/null
@@ -1,1382 +0,0 @@
-package pl.szczodrzynski.edziennik
-
-import android.content.ClipData
-import android.content.ClipboardManager
-import android.content.Context
-import android.content.Intent
-import android.content.res.ColorStateList
-import android.content.res.Resources
-import android.database.Cursor
-import android.graphics.PorterDuff
-import android.graphics.PorterDuffColorFilter
-import android.graphics.Rect
-import android.graphics.Typeface
-import android.graphics.drawable.Drawable
-import android.os.Build
-import android.os.Bundle
-import android.os.Parcelable
-import android.text.*
-import android.text.style.CharacterStyle
-import android.text.style.ForegroundColorSpan
-import android.text.style.StrikethroughSpan
-import android.text.style.StyleSpan
-import android.util.*
-import android.util.Base64
-import android.util.Base64.NO_WRAP
-import android.util.Base64.encodeToString
-import android.view.View
-import android.view.WindowManager
-import android.widget.*
-import androidx.annotation.*
-import androidx.core.database.getIntOrNull
-import androidx.core.database.getLongOrNull
-import androidx.core.database.getStringOrNull
-import androidx.core.util.forEach
-import androidx.lifecycle.LifecycleOwner
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.Observer
-import androidx.recyclerview.widget.RecyclerView
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
-import androidx.viewpager.widget.ViewPager
-import com.google.android.material.button.MaterialButton
-import com.google.android.material.datepicker.CalendarConstraints
-import com.google.android.material.dialog.MaterialAlertDialogBuilder
-import com.google.gson.*
-import com.google.gson.JsonArray
-import com.google.gson.JsonObject
-import com.mikepenz.iconics.typeface.IIcon
-import com.mikepenz.materialdrawer.holder.StringHolder
-import im.wangchao.mhttp.Response
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch
-import okhttp3.RequestBody
-import okio.Buffer
-import pl.szczodrzynski.edziennik.data.api.*
-import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApiException
-import pl.szczodrzynski.edziennik.data.api.szkolny.response.ApiResponse
-import pl.szczodrzynski.edziennik.data.db.entity.Notification
-import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.data.db.entity.Teacher
-import pl.szczodrzynski.edziennik.data.db.entity.Team
-import pl.szczodrzynski.edziennik.utils.models.Time
-import pl.szczodrzynski.navlib.ImageHolder
-import java.io.InterruptedIOException
-import java.io.PrintWriter
-import java.io.StringWriter
-import java.math.BigInteger
-import java.net.ConnectException
-import java.net.SocketTimeoutException
-import java.net.UnknownHostException
-import java.nio.charset.Charset
-import java.security.MessageDigest
-import java.text.SimpleDateFormat
-import java.util.*
-import java.util.zip.CRC32
-import javax.crypto.Mac
-import javax.crypto.spec.SecretKeySpec
-import javax.net.ssl.SSLException
-import kotlin.Pair
-
-
-fun List<Teacher>.byId(id: Long) = firstOrNull { it.id == id }
-fun List<Teacher>.byNameFirstLast(nameFirstLast: String) = firstOrNull { it.name + " " + it.surname == nameFirstLast }
-fun List<Teacher>.byNameLastFirst(nameLastFirst: String) = firstOrNull { it.surname + " " + it.name == nameLastFirst }
-fun List<Teacher>.byNameFDotLast(nameFDotLast: String) = firstOrNull { it.name + "." + it.surname == nameFDotLast }
-fun List<Teacher>.byNameFDotSpaceLast(nameFDotSpaceLast: String) = firstOrNull { it.name + ". " + it.surname == nameFDotSpaceLast }
-
-fun JsonObject?.get(key: String): JsonElement? = this?.get(key)
-
-fun JsonObject?.getBoolean(key: String): Boolean? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asBoolean }
-fun JsonObject?.getString(key: String): String? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asString }
-fun JsonObject?.getInt(key: String): Int? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asInt }
-fun JsonObject?.getLong(key: String): Long? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asLong }
-fun JsonObject?.getFloat(key: String): Float? = get(key)?.let { if(!it.isJsonPrimitive) null else it.asFloat }
-fun JsonObject?.getChar(key: String): Char? = get(key)?.let { if(!it.isJsonPrimitive) null else it.asCharacter }
-fun JsonObject?.getJsonObject(key: String): JsonObject? = get(key)?.let { if (it.isJsonObject) it.asJsonObject else null }
-fun JsonObject?.getJsonArray(key: String): JsonArray? = get(key)?.let { if (it.isJsonArray) it.asJsonArray else null }
-
-fun JsonObject?.getBoolean(key: String, defaultValue: Boolean): Boolean = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asBoolean } ?: defaultValue
-fun JsonObject?.getString(key: String, defaultValue: String): String = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asString } ?: defaultValue
-fun JsonObject?.getInt(key: String, defaultValue: Int): Int = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asInt } ?: defaultValue
-fun JsonObject?.getLong(key: String, defaultValue: Long): Long = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asLong } ?: defaultValue
-fun JsonObject?.getFloat(key: String, defaultValue: Float): Float = get(key)?.let { if(!it.isJsonPrimitive) defaultValue else it.asFloat } ?: defaultValue
-fun JsonObject?.getChar(key: String, defaultValue: Char): Char = get(key)?.let { if(!it.isJsonPrimitive) defaultValue else it.asCharacter } ?: defaultValue
-fun JsonObject?.getJsonObject(key: String, defaultValue: JsonObject): JsonObject = get(key)?.let { if (it.isJsonObject) it.asJsonObject else defaultValue } ?: defaultValue
-fun JsonObject?.getJsonArray(key: String, defaultValue: JsonArray): JsonArray = get(key)?.let { if (it.isJsonArray) it.asJsonArray else defaultValue } ?: defaultValue
-
-fun JsonArray.getBoolean(key: Int): Boolean? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asBoolean }
-fun JsonArray.getString(key: Int): String? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asString }
-fun JsonArray.getInt(key: Int): Int? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asInt }
-fun JsonArray.getLong(key: Int): Long? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asLong }
-fun JsonArray.getFloat(key: Int): Float? = if (key >= size()) null else get(key)?.let { if(!it.isJsonPrimitive) null else it.asFloat }
-fun JsonArray.getChar(key: Int): Char? = if (key >= size()) null else get(key)?.let { if(!it.isJsonPrimitive) null else it.asCharacter }
-fun JsonArray.getJsonObject(key: Int): JsonObject? = if (key >= size()) null else get(key)?.let { if (it.isJsonObject) it.asJsonObject else null }
-fun JsonArray.getJsonArray(key: Int): JsonArray? = if (key >= size()) null else get(key)?.let { if (it.isJsonArray) it.asJsonArray else null }
-
-fun String.toJsonObject(): JsonObject? = try { JsonParser().parse(this).asJsonObject } catch (ignore: Exception) { null }
-
-operator fun JsonObject.set(key: String, value: JsonElement) = this.add(key, value)
-operator fun JsonObject.set(key: String, value: Boolean) = this.addProperty(key, value)
-operator fun JsonObject.set(key: String, value: String?) = this.addProperty(key, value)
-operator fun JsonObject.set(key: String, value: Number) = this.addProperty(key, value)
-operator fun JsonObject.set(key: String, value: Char) = this.addProperty(key, value)
-
-operator fun Profile.set(key: String, value: JsonElement) = this.studentData.add(key, value)
-operator fun Profile.set(key: String, value: Boolean) = this.studentData.addProperty(key, value)
-operator fun Profile.set(key: String, value: String?) = this.studentData.addProperty(key, value)
-operator fun Profile.set(key: String, value: Number) = this.studentData.addProperty(key, value)
-operator fun Profile.set(key: String, value: Char) = this.studentData.addProperty(key, value)
-
-fun JsonArray.asJsonObjectList() = this.mapNotNull { it.asJsonObject }
-
-fun CharSequence?.isNotNullNorEmpty(): Boolean {
-    return this != null && this.isNotEmpty()
-}
-
-fun <T> Collection<T>?.isNotNullNorEmpty(): Boolean {
-    return this != null && this.isNotEmpty()
-}
-
-fun CharSequence?.isNotNullNorBlank(): Boolean {
-    return this != null && this.isNotBlank()
-}
-
-fun currentTimeUnix() = System.currentTimeMillis() / 1000
-
-fun Bundle?.getInt(key: String, defaultValue: Int): Int {
-    return this?.getInt(key, defaultValue) ?: defaultValue
-}
-fun Bundle?.getLong(key: String, defaultValue: Long): Long {
-    return this?.getLong(key, defaultValue) ?: defaultValue
-}
-fun Bundle?.getFloat(key: String, defaultValue: Float): Float {
-    return this?.getFloat(key, defaultValue) ?: defaultValue
-}
-fun Bundle?.getString(key: String, defaultValue: String): String {
-    return this?.getString(key, defaultValue) ?: defaultValue
-}
-
-fun Bundle?.getIntOrNull(key: String): Int? {
-    return this?.get(key) as? Int
-}
-fun <T : Any> Bundle?.get(key: String): T? {
-    return this?.get(key) as? T?
-}
-
-/**
- * `   The quick BROWN_fox Jumps OveR THE       LAZy-DOG.   `
- *
- * converts to
- *
- * `The Quick Brown_fox Jumps Over The Lazy-Dog.`
- */
-fun String?.fixName(): String {
-    return this?.fixWhiteSpaces()?.toProperCase() ?: ""
-}
-
-/**
- * `The quick BROWN_fox Jumps OveR THE       LAZy-DOG.`
- *
- * converts to
- *
- * `The Quick Brown_fox Jumps Over The       Lazy-Dog.`
- */
-fun String.toProperCase(): String = changeStringCase(this)
-
-/**
- * `John Smith` -> `Smith John`
- *
- * `JOHN SMith` -> `SMith JOHN`
- */
-fun String.swapFirstLastName(): String {
-    return this.split(" ").let {
-        if (it.size > 1)
-            it[1]+" "+it[0]
-        else
-            it[0]
-    }
-}
-
-fun String.splitName(): Pair<String, String>? {
-    return this.split(" ").let {
-        if (it.size >= 2) Pair(it[0], it[1])
-        else null
-    }
-}
-
-fun changeStringCase(s: String): String {
-    val delimiters = " '-/"
-    val sb = StringBuilder()
-    var capNext = true
-    for (ch in s.toCharArray()) {
-        var c = ch
-        c = if (capNext)
-            Character.toUpperCase(c)
-        else
-            Character.toLowerCase(c)
-        sb.append(c)
-        capNext = delimiters.indexOf(c) >= 0
-    }
-    return sb.toString()
-}
-
-fun buildFullName(firstName: String?, lastName: String?): String {
-    return "$firstName $lastName".fixName()
-}
-
-fun String.getShortName(): String {
-    return split(" ").let {
-        if (it.size > 1)
-            "${it[0]} ${it[1][0]}."
-        else
-            it[0]
-    }
-}
-
-/**
- * "John Smith"             -> "JS"
- *
- * "JOHN SMith"             -> "JS"
- *
- * "John"                   -> "J"
- *
- * "John "                  -> "J"
- *
- * "John     Smith      "   -> "JS"
- *
- * " "                      -> ""
- *
- * "  "                     -> ""
- */
-fun String?.getNameInitials(): String {
-    if (this.isNullOrBlank()) return ""
-    return this.toUpperCase().fixWhiteSpaces().split(" ").take(2).map { it[0] }.joinToString("")
-}
-
-fun List<String>.join(delimiter: String): String {
-    return concat(delimiter).toString()
-}
-
-fun colorFromName(name: String?): Int {
-    val i = (name ?: "").crc32()
-    return when ((i / 10 % 16 + 1).toInt()) {
-        13 -> 0xffF44336
-        4  -> 0xffF50057
-        2  -> 0xffD500F9
-        9  -> 0xff6200EA
-        5  -> 0xffFFAB00
-        1  -> 0xff304FFE
-        6  -> 0xff40C4FF
-        14 -> 0xff26A69A
-        15 -> 0xff00C853
-        7  -> 0xffFFD600
-        3  -> 0xffFF3D00
-        8  -> 0xffDD2C00
-        10 -> 0xff795548
-        12 -> 0xff2979FF
-        11 -> 0xffFF6D00
-        else -> 0xff64DD17
-    }.toInt()
-}
-
-fun colorFromCssName(name: String): Int {
-    return when (name) {
-        "red" -> 0xffff0000
-        "green" -> 0xff008000
-        "blue" -> 0xff0000ff
-        "violet" -> 0xffee82ee
-        "brown" -> 0xffa52a2a
-        "orange" -> 0xffffa500
-        "black" -> 0xff000000
-        "white" -> 0xffffffff
-        else -> -1L
-    }.toInt()
-}
-
-fun List<Profile>.filterOutArchived() = this.filter { !it.archived }
-
-fun Response?.getUnixDate(): Long {
-    val rfcDate = this?.headers()?.get("date") ?: return currentTimeUnix()
-    val pattern = "EEE, dd MMM yyyy HH:mm:ss Z"
-    val format = SimpleDateFormat(pattern, Locale.ENGLISH)
-    return format.parse(rfcDate).time / 1000
-}
-
-const val MINUTE = 60L
-const val HOUR = 60L*MINUTE
-const val DAY = 24L*HOUR
-const val WEEK = 7L*DAY
-const val MONTH = 30L*DAY
-const val YEAR = 365L*DAY
-const val MS = 1000L
-
-fun <T> LongSparseArray<T>.values(): List<T> {
-    val result = mutableListOf<T>()
-    forEach { _, value ->
-        result += value
-    }
-    return result
-}
-
-fun SparseArray<*>.keys(): List<Int> {
-    val result = mutableListOf<Int>()
-    forEach { key, _ ->
-        result += key
-    }
-    return result
-}
-fun <T> SparseArray<T>.values(): List<T> {
-    val result = mutableListOf<T>()
-    forEach { _, value ->
-        result += value
-    }
-    return result
-}
-
-fun SparseIntArray.keys(): List<Int> {
-    val result = mutableListOf<Int>()
-    forEach { key, _ ->
-        result += key
-    }
-    return result
-}
-fun SparseIntArray.values(): List<Int> {
-    val result = mutableListOf<Int>()
-    forEach { _, value ->
-        result += value
-    }
-    return result
-}
-
-fun <K, V> List<Pair<K, V>>.keys(): List<K> {
-    val result = mutableListOf<K>()
-    forEach { pair ->
-        result += pair.first
-    }
-    return result
-}
-fun <K, V> List<Pair<K, V>>.values(): List<V> {
-    val result = mutableListOf<V>()
-    forEach { pair ->
-        result += pair.second
-    }
-    return result
-}
-
-fun <T> List<T>.toSparseArray(destination: SparseArray<T>, key: (T) -> Int) {
-    forEach {
-        destination.put(key(it), it)
-    }
-}
-fun <T> List<T>.toSparseArray(destination: LongSparseArray<T>, key: (T) -> Long) {
-    forEach {
-        destination.put(key(it), it)
-    }
-}
-
-fun <T> List<T>.toSparseArray(key: (T) -> Int): SparseArray<T> {
-    val result = SparseArray<T>()
-    toSparseArray(result, key)
-    return result
-}
-fun <T> List<T>.toSparseArray(key: (T) -> Long): LongSparseArray<T> {
-    val result = LongSparseArray<T>()
-    toSparseArray(result, key)
-    return result
-}
-
-fun <T> SparseArray<T>.singleOrNull(predicate: (T) -> Boolean): T? {
-    forEach { _, value ->
-        if (predicate(value))
-            return value
-    }
-    return null
-}
-fun <T> LongSparseArray<T>.singleOrNull(predicate: (T) -> Boolean): T? {
-    forEach { _, value ->
-        if (predicate(value))
-            return value
-    }
-    return null
-}
-
-fun String.fixWhiteSpaces() = buildString(length) {
-    var wasWhiteSpace = true
-    for (c in this@fixWhiteSpaces) {
-        if (c.isWhitespace()) {
-            if (!wasWhiteSpace) {
-                append(c)
-                wasWhiteSpace = true
-            }
-        } else {
-            append(c)
-            wasWhiteSpace = false
-        }
-    }
-}.trimEnd()
-
-fun List<Team>.getById(id: Long): Team? {
-    return singleOrNull { it.id == id }
-}
-fun LongSparseArray<Team>.getById(id: Long): Team? {
-    forEach { _, value ->
-        if (value.id == id)
-            return value
-    }
-    return null
-}
-
-operator fun MatchResult.get(group: Int): String {
-    if (group >= groupValues.size)
-        return ""
-    return groupValues[group]
-}
-
-fun Context.setLanguage(language: String) {
-    val locale = Locale(language.toLowerCase(Locale.ROOT))
-    val configuration = resources.configuration
-    Locale.setDefault(locale)
-    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
-        configuration.setLocale(locale)
-    }
-    configuration.locale = locale
-    resources.updateConfiguration(configuration, resources.displayMetrics)
-}
-
-/*
-  Code copied from android-28/java.util.Locale.initDefault()
- */
-fun initDefaultLocale() {
-    run {
-        // user.locale gets priority
-        /*val languageTag: String? = System.getProperty("user.locale", "")
-        if (languageTag.isNotNullNorEmpty()) {
-            return@run Locale(languageTag)
-        }*/
-
-        // user.locale is empty
-        val language: String? = System.getProperty("user.language", "pl")
-        val region: String? = System.getProperty("user.region")
-        val country: String?
-        val variant: String?
-        // for compatibility, check for old user.region property
-        if (region != null) {
-            // region can be of form country, country_variant, or _variant
-            val i = region.indexOf('_')
-            if (i >= 0) {
-                country = region.substring(0, i)
-                variant = region.substring(i + 1)
-            } else {
-                country = region
-                variant = ""
-            }
-        } else {
-            country = System.getProperty("user.country", "")
-            variant = System.getProperty("user.variant", "")
-        }
-        return@run Locale(language)
-    }.let {
-        Locale.setDefault(it)
-    }
-}
-
-fun String.crc16(): Int {
-    var crc = 0xFFFF
-    for (aBuffer in this) {
-        crc = crc.ushr(8) or (crc shl 8) and 0xffff
-        crc = crc xor (aBuffer.toInt() and 0xff) // byte to int, trunc sign
-        crc = crc xor (crc and 0xff shr 4)
-        crc = crc xor (crc shl 12 and 0xffff)
-        crc = crc xor (crc and 0xFF shl 5 and 0xffff)
-    }
-    crc = crc and 0xffff
-    return crc + 32768
-}
-
-fun String.crc32(): Long {
-    val crc = CRC32()
-    crc.update(toByteArray())
-    return crc.value
-}
-
-fun String.hmacSHA1(password: String): String {
-    val key = SecretKeySpec(password.toByteArray(), "HmacSHA1")
-
-    val mac = Mac.getInstance("HmacSHA1").apply {
-        init(key)
-        update(this@hmacSHA1.toByteArray())
-    }
-
-    return encodeToString(mac.doFinal(), NO_WRAP)
-}
-
-fun String.md5(): String {
-    val md = MessageDigest.getInstance("MD5")
-    return BigInteger(1, md.digest(toByteArray())).toString(16).padStart(32, '0')
-}
-
-fun String.sha1Hex(): String {
-    val md = MessageDigest.getInstance("SHA-1")
-    md.update(toByteArray())
-    return md.digest().joinToString("") { "%02x".format(it) }
-}
-
-fun String.sha256(): ByteArray {
-    val md = MessageDigest.getInstance("SHA-256")
-    md.update(toByteArray())
-    return md.digest()
-}
-
-fun RequestBody.bodyToString(): String {
-    val buffer = Buffer()
-    writeTo(buffer)
-    return buffer.readUtf8()
-}
-
-fun Long.formatDate(format: String = "yyyy-MM-dd HH:mm:ss"): String = SimpleDateFormat(format).format(this)
-
-fun CharSequence?.asColoredSpannable(colorInt: Int): Spannable {
-    val spannable = SpannableString(this)
-    spannable.setSpan(ForegroundColorSpan(colorInt), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
-    return spannable
-}
-fun CharSequence?.asStrikethroughSpannable(): Spannable {
-    val spannable = SpannableString(this)
-    spannable.setSpan(StrikethroughSpan(), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
-    return spannable
-}
-fun CharSequence?.asItalicSpannable(): Spannable {
-    val spannable = SpannableString(this)
-    spannable.setSpan(StyleSpan(Typeface.ITALIC), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
-    return spannable
-}
-fun CharSequence?.asBoldSpannable(): Spannable {
-    val spannable = SpannableString(this)
-    spannable.setSpan(StyleSpan(Typeface.BOLD), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
-    return spannable
-}
-fun CharSequence.asSpannable(
-    vararg spans: CharacterStyle,
-    substring: CharSequence? = null,
-    ignoreCase: Boolean = false,
-    ignoreDiacritics: Boolean = false
-): Spannable {
-    val spannable = SpannableString(this)
-    substring?.let { substr ->
-        val string = if (ignoreDiacritics)
-            this.cleanDiacritics()
-        else
-            this
-        val search = if (ignoreDiacritics)
-            substr.cleanDiacritics()
-        else
-            substr.toString()
-
-        var index = 0
-        do {
-            index = string.indexOf(
-                string = search,
-                startIndex = index,
-                ignoreCase = ignoreCase
-            )
-
-            if (index >= 0) {
-                spans.forEach {
-                    spannable.setSpan(
-                        CharacterStyle.wrap(it),
-                        index,
-                        index + substring.length,
-                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
-                    )
-                }
-                index += substring.length.coerceAtLeast(1)
-            }
-        } while (index >= 0)
-
-    } ?: spans.forEach {
-        spannable.setSpan(it, 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
-    }
-    return spannable
-}
-
-fun CharSequence.cleanDiacritics(): String {
-    val nameClean = StringBuilder()
-    forEach {
-        val ch = when (it) {
-            'ż' -> 'z'
-            'ó' -> 'o'
-            'ł' -> 'l'
-            'ć' -> 'c'
-            'ę' -> 'e'
-            'ś' -> 's'
-            'ą' -> 'a'
-            'ź' -> 'z'
-            'ń' -> 'n'
-            else -> it
-        }
-        nameClean.append(ch)
-    }
-    return nameClean.toString()
-}
-
-/**
- * Returns a new read-only list only of those given elements, that are not empty.
- * Applies for CharSequence and descendants.
- */
-fun <T : CharSequence> listOfNotEmpty(vararg elements: T): List<T> = elements.filterNot { it.isEmpty() }
-
-fun List<CharSequence?>.concat(delimiter: CharSequence? = null): CharSequence {
-    if (this.isEmpty()) {
-        return ""
-    }
-
-    if (this.size == 1) {
-        return this[0] ?: ""
-    }
-
-    var spanned = delimiter is Spanned
-    if (!spanned) {
-        for (piece in this) {
-            if (piece is Spanned) {
-                spanned = true
-                break
-            }
-        }
-    }
-
-    var first = true
-    if (spanned) {
-        val ssb = SpannableStringBuilder()
-        for (piece in this) {
-            if (piece == null)
-                continue
-            if (!first && delimiter != null)
-                ssb.append(delimiter)
-            first = false
-            ssb.append(piece)
-        }
-        return SpannedString(ssb)
-    } else {
-        val sb = StringBuilder()
-        for (piece in this) {
-            if (piece == null)
-                continue
-            if (!first && delimiter != null)
-                sb.append(delimiter)
-            first = false
-            sb.append(piece)
-        }
-        return sb.toString()
-    }
-}
-
-fun TextView.setText(@StringRes resid: Int, vararg formatArgs: Any) {
-    text = context.getString(resid, *formatArgs)
-}
-
-fun MaterialAlertDialogBuilder.setTitle(@StringRes resid: Int, vararg formatArgs: Any): MaterialAlertDialogBuilder {
-    setTitle(context.getString(resid, *formatArgs))
-    return this
-}
-
-fun MaterialAlertDialogBuilder.setMessage(@StringRes resid: Int, vararg formatArgs: Any): MaterialAlertDialogBuilder {
-    setMessage(context.getString(resid, *formatArgs))
-    return this
-}
-
-fun JsonObject(vararg properties: Pair<String, Any?>): JsonObject {
-    return JsonObject().apply {
-        for (property in properties) {
-            when (property.second) {
-                is JsonElement -> add(property.first, property.second as JsonElement?)
-                is String -> addProperty(property.first, property.second as String?)
-                is Char -> addProperty(property.first, property.second as Char?)
-                is Number -> addProperty(property.first, property.second as Number?)
-                is Boolean -> addProperty(property.first, property.second as Boolean?)
-            }
-        }
-    }
-}
-
-fun JsonObject.toBundle(): Bundle {
-    return Bundle().also {
-        for ((key, value) in this.entrySet()) {
-            when (value) {
-                is JsonObject -> it.putBundle(key, value.toBundle())
-                is JsonPrimitive -> when {
-                    value.isString -> it.putString(key, value.asString)
-                    value.isBoolean -> it.putBoolean(key, value.asBoolean)
-                    value.isNumber -> it.putInt(key, value.asInt)
-                }
-            }
-        }
-    }
-}
-
-fun JsonArray(vararg properties: Any?): JsonArray {
-    return JsonArray().apply {
-        for (property in properties) {
-            when (property) {
-                is JsonElement -> add(property as JsonElement?)
-                is String -> add(property as String?)
-                is Char -> add(property as Char?)
-                is Number -> add(property as Number?)
-                is Boolean -> add(property as Boolean?)
-            }
-        }
-    }
-}
-
-fun Bundle(vararg properties: Pair<String, Any?>): Bundle {
-    return Bundle().apply {
-        for (property in properties) {
-            when (property.second) {
-                is String -> putString(property.first, property.second as String?)
-                is Char -> putChar(property.first, property.second as Char)
-                is Int -> putInt(property.first, property.second as Int)
-                is Long -> putLong(property.first, property.second as Long)
-                is Float -> putFloat(property.first, property.second as Float)
-                is Short -> putShort(property.first, property.second as Short)
-                is Double -> putDouble(property.first, property.second as Double)
-                is Boolean -> putBoolean(property.first, property.second as Boolean)
-                is Bundle -> putBundle(property.first, property.second as Bundle)
-                is Parcelable -> putParcelable(property.first, property.second as Parcelable)
-                is Array<*> -> putParcelableArray(property.first, property.second as Array<out Parcelable>)
-            }
-        }
-    }
-}
-fun Intent(action: String? = null, vararg properties: Pair<String, Any?>): Intent {
-    return Intent(action).putExtras(Bundle(*properties))
-}
-fun Intent(packageContext: Context, cls: Class<*>, vararg properties: Pair<String, Any?>): Intent {
-    return Intent(packageContext, cls).putExtras(Bundle(*properties))
-}
-
-fun Bundle.toJsonObject(): JsonObject {
-    val json = JsonObject()
-    keySet()?.forEach { key ->
-        get(key)?.let {
-            when (it) {
-                is String -> json.addProperty(key, it)
-                is Char -> json.addProperty(key, it)
-                is Int -> json.addProperty(key, it)
-                is Long -> json.addProperty(key, it)
-                is Float -> json.addProperty(key, it)
-                is Short -> json.addProperty(key, it)
-                is Double -> json.addProperty(key, it)
-                is Boolean -> json.addProperty(key, it)
-                is Bundle -> json.add(key, it.toJsonObject())
-                else -> json.addProperty(key, it.toString())
-            }
-        }
-    }
-    return json
-}
-fun Intent.toJsonObject() = extras?.toJsonObject()
-
-fun JsonArray?.isNullOrEmpty(): Boolean = (this?.size() ?: 0) == 0
-fun JsonArray.isEmpty(): Boolean = this.size() == 0
-operator fun JsonArray.plusAssign(o: JsonElement) = this.add(o)
-operator fun JsonArray.plusAssign(o: String) = this.add(o)
-operator fun JsonArray.plusAssign(o: Char) = this.add(o)
-operator fun JsonArray.plusAssign(o: Number) = this.add(o)
-operator fun JsonArray.plusAssign(o: Boolean) = this.add(o)
-
-@Suppress("UNCHECKED_CAST")
-inline fun <T : View> T.onClick(crossinline onClickListener: (v: T) -> Unit) {
-    setOnClickListener { v: View ->
-        onClickListener(v as T)
-    }
-}
-
-@Suppress("UNCHECKED_CAST")
-inline fun <T : View> T.onLongClick(crossinline onLongClickListener: (v: T) -> Boolean) {
-    setOnLongClickListener { v: View ->
-        onLongClickListener(v as T)
-    }
-}
-
-@Suppress("UNCHECKED_CAST")
-inline fun <T : CompoundButton> T.onChange(crossinline onChangeListener: (v: T, isChecked: Boolean) -> Unit) {
-    setOnCheckedChangeListener { buttonView, isChecked ->
-        onChangeListener(buttonView as T, isChecked)
-    }
-}
-
-@Suppress("UNCHECKED_CAST")
-inline fun <T : MaterialButton> T.onChange(crossinline onChangeListener: (v: T, isChecked: Boolean) -> Unit) {
-    clearOnCheckedChangeListeners()
-    addOnCheckedChangeListener { buttonView, isChecked ->
-        onChangeListener(buttonView as T, isChecked)
-    }
-}
-
-fun View.attachToastHint(stringRes: Int) = onLongClick {
-    Toast.makeText(it.context, stringRes, Toast.LENGTH_SHORT).show()
-    true
-}
-
-fun View.detachToastHint() = setOnLongClickListener(null)
-
-fun <T> LiveData<T>.observeOnce(lifecycleOwner: LifecycleOwner, observer: Observer<T>) {
-    observe(lifecycleOwner, object : Observer<T> {
-        override fun onChanged(t: T?) {
-            observer.onChanged(t)
-            removeObserver(this)
-        }
-    })
-}
-
-/**
- * Convert a value in dp to pixels.
- */
-val Int.dp: Int
-    get() = (this * Resources.getSystem().displayMetrics.density).toInt()
-/**
- * Convert a value in pixels to dp.
- */
-val Int.px: Int
-    get() = (this / Resources.getSystem().displayMetrics.density).toInt()
-
-@ColorInt
-fun @receiver:AttrRes Int.resolveAttr(context: Context?): Int {
-    val typedValue = TypedValue()
-    context?.theme?.resolveAttribute(this, typedValue, true)
-    return typedValue.data
-}
-@ColorInt
-fun @receiver:ColorRes Int.resolveColor(context: Context): Int {
-    return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-        context.resources.getColor(this, context.theme)
-    }
-    else {
-        context.resources.getColor(this)
-    }
-}
-fun @receiver:DrawableRes Int.resolveDrawable(context: Context): Drawable {
-    return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-        context.resources.getDrawable(this, context.theme)
-    }
-    else {
-        context.resources.getDrawable(this)
-    }
-}
-
-fun @receiver:StringRes Int.resolveString(context: Context) = context.getString(this)
-
-fun View.findParentById(targetId: Int): View? {
-    if (id == targetId) {
-        return this
-    }
-    val viewParent = this.parent ?: return null
-    if (viewParent is View) {
-        return viewParent.findParentById(targetId)
-    }
-    return null
-}
-
-fun CoroutineScope.startCoroutineTimer(delayMillis: Long = 0, repeatMillis: Long = 0, action: suspend CoroutineScope.() -> Unit) = launch {
-    delay(delayMillis)
-    if (repeatMillis > 0) {
-        while (true) {
-            action()
-            delay(repeatMillis)
-        }
-    } else {
-        action()
-    }
-}
-
-operator fun Time?.compareTo(other: Time?): Int {
-    if (this == null && other == null)
-        return 0
-    if (this == null)
-        return -1
-    if (other == null)
-        return 1
-    return this.compareTo(other)
-}
-
-operator fun StringBuilder.plusAssign(str: String?) {
-    this.append(str)
-}
-
-fun Context.timeTill(time: Int, delimiter: String = " ", countInSeconds: Boolean = false): String {
-    val parts = mutableListOf<Pair<Int, Int>>()
-
-    val hours = time / 3600
-    val minutes = (time - hours*3600) / 60
-    val seconds = time - minutes*60 - hours*3600
-
-    if (!countInSeconds) {
-        var prefixAdded = false
-        if (hours > 0) {
-            if (!prefixAdded) parts += R.plurals.time_till_text to hours
-            prefixAdded = true
-            parts += R.plurals.time_till_hours to hours
-        }
-        if (minutes > 0) {
-            if (!prefixAdded) parts += R.plurals.time_till_text to minutes
-            prefixAdded = true
-            parts += R.plurals.time_till_minutes to minutes
-        }
-        if (hours == 0 && minutes < 10) {
-            if (!prefixAdded) parts += R.plurals.time_till_text to seconds
-            prefixAdded = true
-            parts += R.plurals.time_till_seconds to seconds
-        }
-    } else {
-        parts += R.plurals.time_till_text to time
-        parts += R.plurals.time_till_seconds to time
-    }
-
-    return parts.joinToString(delimiter) { resources.getQuantityString(it.first, it.second, it.second) }
-}
-
-fun Context.timeLeft(time: Int, delimiter: String = " ", countInSeconds: Boolean = false): String {
-    val parts = mutableListOf<Pair<Int, Int>>()
-
-    val hours = time / 3600
-    val minutes = (time - hours*3600) / 60
-    val seconds = time - minutes*60 - hours*3600
-
-    if (!countInSeconds) {
-        var prefixAdded = false
-        if (hours > 0) {
-            if (!prefixAdded) parts += R.plurals.time_left_text to hours
-            prefixAdded = true
-            parts += R.plurals.time_left_hours to hours
-        }
-        if (minutes > 0) {
-            if (!prefixAdded) parts += R.plurals.time_left_text to minutes
-            prefixAdded = true
-            parts += R.plurals.time_left_minutes to minutes
-        }
-        if (hours == 0 && minutes < 10) {
-            if (!prefixAdded) parts += R.plurals.time_left_text to seconds
-            prefixAdded = true
-            parts += R.plurals.time_left_seconds to seconds
-        }
-    } else {
-        parts += R.plurals.time_left_text to time
-        parts += R.plurals.time_left_seconds to time
-    }
-
-    return parts.joinToString(delimiter) { resources.getQuantityString(it.first, it.second, it.second) }
-}
-
-inline fun <reified T> Any?.instanceOfOrNull(): T? {
-    return when (this) {
-        is T -> this
-        else -> null
-    }
-}
-
-fun Drawable.setTintColor(color: Int): Drawable {
-    colorFilter = PorterDuffColorFilter(
-            color,
-            PorterDuff.Mode.SRC_ATOP
-    )
-    return this
-}
-
-inline fun <T> List<T>.ifNotEmpty(block: (List<T>) -> Unit) {
-    if (!isEmpty())
-        block(this)
-}
-
-val String.firstLettersName: String
-    get() {
-        var nameShort = ""
-        this.split(" ").forEach {
-            if (it.isBlank())
-                return@forEach
-            nameShort += it[0].toLowerCase()
-        }
-        return nameShort
-    }
-
-val Throwable.stackTraceString: String
-    get() {
-        val sw = StringWriter()
-        printStackTrace(PrintWriter(sw))
-        return sw.toString()
-    }
-
-inline fun <T> LongSparseArray<T>.filter(predicate: (T) -> Boolean): List<T> {
-    val destination = ArrayList<T>()
-    this.forEach { _, element -> if (predicate(element)) destination.add(element) }
-    return destination
-}
-
-fun CharSequence.replaceSpanned(oldValue: String, newValue: CharSequence, ignoreCase: Boolean = false): CharSequence {
-    var seq = this
-    var index = seq.indexOf(oldValue, ignoreCase = ignoreCase)
-    while (index != -1) {
-        val sb = SpannableStringBuilder()
-        sb.appendRange(seq, 0, index)
-        sb.append(newValue)
-        sb.appendRange(seq, index + oldValue.length, seq.length)
-        seq = sb
-        index = seq.indexOf(oldValue, startIndex = index + 1, ignoreCase = ignoreCase)
-    }
-    return seq
-}
-
-fun SpannableStringBuilder.replaceSpan(spanClass: Class<*>, prefix: CharSequence, suffix: CharSequence): SpannableStringBuilder {
-    getSpans(0, length, spanClass).forEach {
-        val spanStart = getSpanStart(it)
-        insert(spanStart, prefix)
-        val spanEnd = getSpanEnd(it)
-        insert(spanEnd, suffix)
-    }
-    return this
-}
-
-fun Int.toColorStateList(): ColorStateList {
-    val states = arrayOf(
-        intArrayOf( android.R.attr.state_enabled ),
-        intArrayOf(-android.R.attr.state_enabled ),
-        intArrayOf(-android.R.attr.state_checked ),
-        intArrayOf( android.R.attr.state_pressed )
-    )
-
-    val colors = intArrayOf(
-            this,
-            this,
-            this,
-            this
-    )
-
-    return ColorStateList(states, colors)
-}
-
-fun SpannableStringBuilder.appendText(text: CharSequence): SpannableStringBuilder {
-    append(text)
-    return this
-}
-fun SpannableStringBuilder.appendSpan(text: CharSequence, what: Any, flags: Int): SpannableStringBuilder {
-    val start: Int = length
-    append(text)
-    setSpan(what, start, length, flags)
-    return this
-}
-
-fun joinNotNullStrings(delimiter: String = "", vararg parts: String?): String {
-    var first = true
-    val sb = StringBuilder()
-    for (part in parts) {
-        if (part == null)
-            continue
-        if (!first)
-            sb += delimiter
-        first = false
-        sb += part
-    }
-    return sb.toString()
-}
-
-fun String.notEmptyOrNull(): String? {
-    return if (isEmpty())
-        null
-    else
-        this
-}
-
-fun String.base64Encode(): String {
-    return encodeToString(toByteArray(), NO_WRAP)
-}
-fun ByteArray.base64Encode(): String {
-    return encodeToString(this, NO_WRAP)
-}
-fun String.base64Decode(): ByteArray {
-    return Base64.decode(this, Base64.DEFAULT)
-}
-fun String.base64DecodeToString(): String {
-    return Base64.decode(this, Base64.DEFAULT).toString(Charset.defaultCharset())
-}
-
-fun CheckBox.trigger() { isChecked = !isChecked }
-
-fun Context.plural(@PluralsRes resId: Int, value: Int): String = resources.getQuantityString(resId, value, value)
-
-fun Context.getNotificationTitle(type: Int): String {
-    return getString(when (type) {
-        Notification.TYPE_UPDATE -> R.string.notification_type_update
-        Notification.TYPE_ERROR -> R.string.notification_type_error
-        Notification.TYPE_TIMETABLE_CHANGED -> R.string.notification_type_timetable_change
-        Notification.TYPE_TIMETABLE_LESSON_CHANGE -> R.string.notification_type_timetable_lesson_change
-        Notification.TYPE_NEW_GRADE -> R.string.notification_type_new_grade
-        Notification.TYPE_NEW_EVENT -> R.string.notification_type_new_event
-        Notification.TYPE_NEW_HOMEWORK -> R.string.notification_type_new_homework
-        Notification.TYPE_NEW_SHARED_EVENT -> R.string.notification_type_new_shared_event
-        Notification.TYPE_NEW_SHARED_HOMEWORK -> R.string.notification_type_new_shared_homework
-        Notification.TYPE_REMOVED_SHARED_EVENT -> R.string.notification_type_removed_shared_event
-        Notification.TYPE_NEW_MESSAGE -> R.string.notification_type_new_message
-        Notification.TYPE_NEW_NOTICE -> R.string.notification_type_notice
-        Notification.TYPE_NEW_ATTENDANCE -> R.string.notification_type_attendance
-        Notification.TYPE_SERVER_MESSAGE -> R.string.notification_type_server_message
-        Notification.TYPE_LUCKY_NUMBER -> R.string.notification_type_lucky_number
-        Notification.TYPE_FEEDBACK_MESSAGE -> R.string.notification_type_feedback_message
-        Notification.TYPE_NEW_ANNOUNCEMENT -> R.string.notification_type_new_announcement
-        Notification.TYPE_AUTO_ARCHIVING -> R.string.notification_type_auto_archiving
-        Notification.TYPE_TEACHER_ABSENCE -> R.string.notification_type_new_teacher_absence
-        Notification.TYPE_GENERAL -> R.string.notification_type_general
-        else -> R.string.notification_type_general
-    })
-}
-
-fun Cursor?.getString(columnName: String) = this?.getStringOrNull(getColumnIndex(columnName))
-fun Cursor?.getInt(columnName: String) = this?.getIntOrNull(getColumnIndex(columnName))
-fun Cursor?.getLong(columnName: String) = this?.getLongOrNull(getColumnIndex(columnName))
-
-fun CharSequence.containsAll(list: List<CharSequence>, ignoreCase: Boolean = false): Boolean {
-    for (i in list) {
-        if (!contains(i, ignoreCase))
-            return false
-    }
-    return true
-}
-
-inline fun RadioButton.setOnSelectedListener(crossinline listener: (buttonView: CompoundButton) -> Unit)
-        = setOnCheckedChangeListener { buttonView, isChecked -> if (isChecked) listener(buttonView) }
-
-fun Response.toErrorCode() = when (this.code()) {
-    400 -> ERROR_REQUEST_HTTP_400
-    401 -> ERROR_REQUEST_HTTP_401
-    403 -> ERROR_REQUEST_HTTP_403
-    404 -> ERROR_REQUEST_HTTP_404
-    405 -> ERROR_REQUEST_HTTP_405
-    410 -> ERROR_REQUEST_HTTP_410
-    424 -> ERROR_REQUEST_HTTP_424
-    500 -> ERROR_REQUEST_HTTP_500
-    503 -> ERROR_REQUEST_HTTP_503
-    else -> null
-}
-fun Throwable.toErrorCode() = when (this) {
-    is UnknownHostException -> ERROR_REQUEST_FAILURE_HOSTNAME_NOT_FOUND
-    is SSLException -> ERROR_REQUEST_FAILURE_SSL_ERROR
-    is SocketTimeoutException -> ERROR_REQUEST_FAILURE_TIMEOUT
-    is InterruptedIOException, is ConnectException -> ERROR_REQUEST_FAILURE_NO_INTERNET
-    is SzkolnyApiException -> this.error?.toErrorCode()
-    else -> null
-}
-fun ApiResponse.Error.toErrorCode() = when (this.code) {
-    "PdoError" -> ERROR_API_PDO_ERROR
-    "InvalidClient" -> ERROR_API_INVALID_CLIENT
-    "InvalidArgument" -> ERROR_API_INVALID_ARGUMENT
-    "InvalidSignature" -> ERROR_API_INVALID_SIGNATURE
-    "MissingScopes" -> ERROR_API_MISSING_SCOPES
-    "ResourceNotFound" -> ERROR_API_RESOURCE_NOT_FOUND
-    "InternalServerError" -> ERROR_API_INTERNAL_SERVER_ERROR
-    "PhpError" -> ERROR_API_PHP_E_ERROR
-    "PhpWarning" -> ERROR_API_PHP_E_WARNING
-    "PhpParse" -> ERROR_API_PHP_E_PARSE
-    "PhpNotice" -> ERROR_API_PHP_E_NOTICE
-    "PhpOther" -> ERROR_API_PHP_E_OTHER
-    "ApiMaintenance" -> ERROR_API_MAINTENANCE
-    "MissingArgument" -> ERROR_API_MISSING_ARGUMENT
-    "MissingPayload" -> ERROR_API_PAYLOAD_EMPTY
-    "InvalidAction" -> ERROR_API_INVALID_ACTION
-    "VersionNotFound" -> ERROR_API_UPDATE_NOT_FOUND
-    "InvalidDeviceIdUserCode" -> ERROR_API_INVALID_DEVICEID_USERCODE
-    "InvalidPairToken" -> ERROR_API_INVALID_PAIRTOKEN
-    "InvalidBrowserId" -> ERROR_API_INVALID_BROWSERID
-    "InvalidDeviceId" -> ERROR_API_INVALID_DEVICEID
-    "InvalidDeviceIdBrowserId" -> ERROR_API_INVALID_DEVICEID_BROWSERID
-    "HelpCategoryNotFound" -> ERROR_API_HELP_CATEGORY_NOT_FOUND
-    else -> ERROR_API_EXCEPTION
-}
-fun Throwable.toApiError(tag: String) = ApiError.fromThrowable(tag, this)
-
-inline fun <A, B, R> ifNotNull(a: A?, b: B?, code: (A, B) -> R): R? {
-    if (a != null && b != null) {
-        return code(a, b)
-    }
-    return null
-}
-
-@kotlin.jvm.JvmName("averageOrNullOfInt")
-fun Iterable<Int>.averageOrNull() = this.average().let { if (it.isNaN()) null else it }
-@kotlin.jvm.JvmName("averageOrNullOfFloat")
-fun Iterable<Float>.averageOrNull() = this.average().let { if (it.isNaN()) null else it }
-
-fun String.copyToClipboard(context: Context) {
-    val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
-    val clipData = ClipData.newPlainText("Tekst", this)
-    clipboard.setPrimaryClip(clipData)
-}
-
-fun TextView.getTextPosition(range: IntRange): Rect {
-    val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
-
-    // Initialize global value
-    var parentTextViewRect = Rect()
-
-    // Initialize values for the computing of clickedText position
-    //val completeText = parentTextView.text as SpannableString
-    val textViewLayout = this.layout
-
-    val startOffsetOfClickedText = range.first//completeText.getSpanStart(clickedText)
-    val endOffsetOfClickedText = range.last//completeText.getSpanEnd(clickedText)
-    var startXCoordinatesOfClickedText = textViewLayout.getPrimaryHorizontal(startOffsetOfClickedText)
-    var endXCoordinatesOfClickedText = textViewLayout.getPrimaryHorizontal(endOffsetOfClickedText)
-
-    // Get the rectangle of the clicked text
-    val currentLineStartOffset = textViewLayout.getLineForOffset(startOffsetOfClickedText)
-    val currentLineEndOffset = textViewLayout.getLineForOffset(endOffsetOfClickedText)
-    val keywordIsInMultiLine = currentLineStartOffset != currentLineEndOffset
-    textViewLayout.getLineBounds(currentLineStartOffset, parentTextViewRect)
-
-    // Update the rectangle position to his real position on screen
-    val parentTextViewLocation = intArrayOf(0, 0)
-    this.getLocationOnScreen(parentTextViewLocation)
-
-    val parentTextViewTopAndBottomOffset = (parentTextViewLocation[1] - this.scrollY + this.compoundPaddingTop)
-    parentTextViewRect.top += parentTextViewTopAndBottomOffset
-    parentTextViewRect.bottom += parentTextViewTopAndBottomOffset
-
-    // In the case of multi line text, we have to choose what rectangle take
-    if (keywordIsInMultiLine) {
-        val screenHeight = windowManager.defaultDisplay.height
-        val dyTop = parentTextViewRect.top
-        val dyBottom = screenHeight - parentTextViewRect.bottom
-        val onTop = dyTop > dyBottom
-
-        if (onTop) {
-            endXCoordinatesOfClickedText = textViewLayout.getLineRight(currentLineStartOffset);
-        } else {
-            parentTextViewRect = Rect()
-            textViewLayout.getLineBounds(currentLineEndOffset, parentTextViewRect);
-            parentTextViewRect.top += parentTextViewTopAndBottomOffset;
-            parentTextViewRect.bottom += parentTextViewTopAndBottomOffset;
-            startXCoordinatesOfClickedText = textViewLayout.getLineLeft(currentLineEndOffset);
-        }
-    }
-
-    parentTextViewRect.left += (
-            parentTextViewLocation[0] +
-                    startXCoordinatesOfClickedText +
-                    this.compoundPaddingLeft -
-                    this.scrollX
-            ).toInt()
-    parentTextViewRect.right = (
-            parentTextViewRect.left +
-                    endXCoordinatesOfClickedText -
-                    startXCoordinatesOfClickedText
-            ).toInt()
-
-    return parentTextViewRect
-}
-
-inline fun ViewPager.addOnPageSelectedListener(crossinline block: (position: Int) -> Unit) = addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
-    override fun onPageScrollStateChanged(state: Int) {}
-    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
-    override fun onPageSelected(position: Int) { block(position) }
-})
-
-val SwipeRefreshLayout.onScrollListener: RecyclerView.OnScrollListener
-    get() = object : RecyclerView.OnScrollListener() {
-        override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
-            if (recyclerView.canScrollVertically(-1))
-                this@onScrollListener.isEnabled = false
-            if (!recyclerView.canScrollVertically(-1) && newState == RecyclerView.SCROLL_STATE_IDLE)
-                this@onScrollListener.isEnabled = true
-        }
-    }
-
-operator fun <K, V> Iterable<Pair<K, V>>.get(key: K): V? {
-    return firstOrNull { it.first == key }?.second
-}
-
-fun ByteArray.toHexString() = joinToString("") { "%02x".format(it) }
-
-fun <E> MutableList<E>.after(what: E, insert: E) {
-    val index = indexOf(what)
-    if (index != -1)
-        add(index + 1, insert)
-}
-
-fun <E> MutableList<E>.before(what: E, insert: E) {
-    val index = indexOf(what)
-    if (index != -1)
-        add(index, insert)
-}
-
-fun <E> MutableList<E>.after(what: E, insert: Collection<E>) {
-    val index = indexOf(what)
-    if (index != -1)
-        addAll(index + 1, insert)
-}
-
-fun <E> MutableList<E>.before(what: E, insert: Collection<E>) {
-    val index = indexOf(what)
-    if (index != -1)
-        addAll(index, insert)
-}
-
-fun Context.getSyncInterval(interval: Int): String {
-    val hours = interval / 60 / 60
-    val minutes = interval / 60 % 60
-    val hoursText = if (hours > 0)
-        plural(R.plurals.time_till_hours, hours)
-    else
-        null
-    val minutesText = if (minutes > 0)
-        plural(R.plurals.time_till_minutes, minutes)
-    else
-        ""
-    return hoursText?.plus(" $minutesText") ?: minutesText
-}
-
-fun Profile.getSchoolYearConstrains(): CalendarConstraints {
-    return CalendarConstraints.Builder()
-        .setStart(dateSemester1Start.inMillisUtc)
-        .setEnd(dateYearEnd.inMillisUtc)
-        .build()
-}
-
-fun CharSequence.getWordBounds(position: Int, onlyInWord: Boolean = false): Pair<Int, Int>? {
-    if (length == 0)
-        return null
-
-    // only if cursor between letters
-    if (onlyInWord) {
-        if (position < 1)
-            return null
-        if (position == length)
-            return null
-
-        val charBefore = this[position - 1]
-        if (!charBefore.isLetterOrDigit())
-            return null
-        val charAfter = this[position]
-        if (!charAfter.isLetterOrDigit())
-            return null
-    }
-
-    var rangeStart = substring(0 until position).indexOfLast { !it.isLetterOrDigit() }
-    if (rangeStart == -1) // no whitespace, set to first index
-        rangeStart = 0
-    else // cut the leading whitespace
-        rangeStart += 1
-
-    var rangeEnd = substring(position).indexOfFirst { !it.isLetterOrDigit() }
-    if (rangeEnd == -1) // no whitespace, set to last index
-        rangeEnd = length
-    else // append the substring offset
-        rangeEnd += position
-
-    if (!onlyInWord && rangeStart == rangeEnd)
-        return null
-    return rangeStart to rangeEnd
-}
-
-infix fun Int.hasSet(what: Int) = this and what == what
-
-fun Int.toStringHolder() = StringHolder(this)
-fun CharSequence.toStringHolder() = StringHolder(this)
-fun IIcon.toImageHolder() = ImageHolder(this)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt
index db7e5e19..affb686f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt
@@ -43,40 +43,41 @@ import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata.*
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.ActivitySzkolnyBinding
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.sync.AppManagerDetectedEvent
 import pl.szczodrzynski.edziennik.sync.SyncWorker
 import pl.szczodrzynski.edziennik.sync.UpdateWorker
-import pl.szczodrzynski.edziennik.ui.dialogs.RegisterUnavailableDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.ServerMessageDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.UpdateAvailableDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.profile.ProfileConfigDialog
+import pl.szczodrzynski.edziennik.ui.agenda.AgendaFragment
+import pl.szczodrzynski.edziennik.ui.announcements.AnnouncementsFragment
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceFragment
+import pl.szczodrzynski.edziennik.ui.base.MainSnackbar
+import pl.szczodrzynski.edziennik.ui.behaviour.BehaviourFragment
+import pl.szczodrzynski.edziennik.ui.debug.DebugFragment
+import pl.szczodrzynski.edziennik.ui.debug.LabFragment
+import pl.szczodrzynski.edziennik.ui.dialogs.ChangelogDialog
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.ProfileConfigDialog
+import pl.szczodrzynski.edziennik.ui.dialogs.sync.RegisterUnavailableDialog
+import pl.szczodrzynski.edziennik.ui.dialogs.sync.ServerMessageDialog
 import pl.szczodrzynski.edziennik.ui.dialogs.sync.SyncViewListDialog
-import pl.szczodrzynski.edziennik.ui.modules.agenda.AgendaFragment
-import pl.szczodrzynski.edziennik.ui.modules.announcements.AnnouncementsFragment
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceFragment
-import pl.szczodrzynski.edziennik.ui.modules.base.MainSnackbar
-import pl.szczodrzynski.edziennik.ui.modules.behaviour.BehaviourFragment
-import pl.szczodrzynski.edziennik.ui.modules.debug.DebugFragment
-import pl.szczodrzynski.edziennik.ui.modules.debug.LabFragment
-import pl.szczodrzynski.edziennik.ui.modules.error.ErrorDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.error.ErrorSnackbar
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
-import pl.szczodrzynski.edziennik.ui.modules.feedback.FeedbackFragment
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradesListFragment
-import pl.szczodrzynski.edziennik.ui.modules.grades.editor.GradesEditorFragment
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
-import pl.szczodrzynski.edziennik.ui.modules.homework.HomeworkFragment
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity
-import pl.szczodrzynski.edziennik.ui.modules.messages.compose.MessagesComposeFragment
-import pl.szczodrzynski.edziennik.ui.modules.messages.list.MessagesFragment
-import pl.szczodrzynski.edziennik.ui.modules.messages.single.MessageFragment
-import pl.szczodrzynski.edziennik.ui.modules.notifications.NotificationsListFragment
-import pl.szczodrzynski.edziennik.ui.modules.settings.ProfileManagerFragment
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsFragment
-import pl.szczodrzynski.edziennik.ui.modules.teachers.TeachersListFragment
-import pl.szczodrzynski.edziennik.ui.modules.timetable.TimetableFragment
-import pl.szczodrzynski.edziennik.ui.modules.webpush.WebPushFragment
+import pl.szczodrzynski.edziennik.ui.dialogs.sync.UpdateAvailableDialog
+import pl.szczodrzynski.edziennik.ui.error.ErrorDetailsDialog
+import pl.szczodrzynski.edziennik.ui.error.ErrorSnackbar
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
+import pl.szczodrzynski.edziennik.ui.feedback.FeedbackFragment
+import pl.szczodrzynski.edziennik.ui.grades.GradesListFragment
+import pl.szczodrzynski.edziennik.ui.grades.editor.GradesEditorFragment
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
+import pl.szczodrzynski.edziennik.ui.homework.HomeworkFragment
+import pl.szczodrzynski.edziennik.ui.login.LoginActivity
+import pl.szczodrzynski.edziennik.ui.messages.compose.MessagesComposeFragment
+import pl.szczodrzynski.edziennik.ui.messages.list.MessagesFragment
+import pl.szczodrzynski.edziennik.ui.messages.single.MessageFragment
+import pl.szczodrzynski.edziennik.ui.notifications.NotificationsListFragment
+import pl.szczodrzynski.edziennik.ui.settings.ProfileManagerFragment
+import pl.szczodrzynski.edziennik.ui.settings.SettingsFragment
+import pl.szczodrzynski.edziennik.ui.teachers.TeachersListFragment
+import pl.szczodrzynski.edziennik.ui.timetable.TimetableFragment
+import pl.szczodrzynski.edziennik.ui.webpush.WebPushFragment
 import pl.szczodrzynski.edziennik.utils.*
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.Utils.dpToPx
@@ -1212,7 +1213,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
         }
         pausedNavigationData = null
 
-        val arguments = args 
+        val arguments = args
             ?: navBackStack.firstOrNull { it.first.id == target.id }?.second
             ?: Bundle()
         bottomSheet.close()
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt
index a39a5872..ff165a46 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt
@@ -11,7 +11,7 @@ import android.provider.OpenableColumns
 import com.canhub.cropper.CropImage
 import com.canhub.cropper.CropImageView
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity
+import pl.szczodrzynski.edziennik.ui.login.LoginActivity
 import java.io.File
 import java.io.FileOutputStream
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/config/ProfileConfigUI.kt b/app/src/main/java/pl/szczodrzynski/edziennik/config/ProfileConfigUI.kt
index d40f0dfc..187cb6bd 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/config/ProfileConfigUI.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/config/ProfileConfigUI.kt
@@ -7,7 +7,7 @@ package pl.szczodrzynski.edziennik.config
 import pl.szczodrzynski.edziennik.config.utils.get
 import pl.szczodrzynski.edziennik.config.utils.set
 import pl.szczodrzynski.edziennik.data.db.entity.Profile.Companion.AGENDA_DEFAULT
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardModel
+import pl.szczodrzynski.edziennik.ui.home.HomeCardModel
 
 class ProfileConfigUI(private val config: ProfileConfig) {
     private var mAgendaViewType: Int? = null
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigGsonUtils.kt b/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigGsonUtils.kt
index eb04578d..0b0a634e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigGsonUtils.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigGsonUtils.kt
@@ -5,13 +5,14 @@ package pl.szczodrzynski.edziennik.config.utils
 
 import com.google.gson.Gson
 import com.google.gson.JsonParser
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardModel
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ui.home.HomeCardModel
 import pl.szczodrzynski.edziennik.utils.models.Time
 
 class ConfigGsonUtils {
+    @Suppress("UNCHECKED_CAST")
     fun <T> deserializeList(gson: Gson, str: String?, classOfT: Class<T>): List<T> {
-        val json = JsonParser().parse(str)
+        val json = JsonParser.parseString(str)
         val list: MutableList<T> = mutableListOf()
         if (!json.isJsonArray)
             return list
@@ -41,4 +42,4 @@ class ConfigGsonUtils {
 
         return list
     }
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigMigration.kt b/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigMigration.kt
index 58dc35f7..dcb4ab94 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigMigration.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/config/utils/ConfigMigration.kt
@@ -7,9 +7,9 @@ package pl.szczodrzynski.edziennik.config.utils
 import android.content.Context
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.BuildConfig
-import pl.szczodrzynski.edziennik.HOUR
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.config.Config
+import pl.szczodrzynski.edziennik.ext.HOUR
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.ORDER_BY_DATE_DESC
 import pl.szczodrzynski.edziennik.utils.models.Time
 import kotlin.math.abs
@@ -42,7 +42,7 @@ class ConfigMigration(app: App, config: Config) {
                     MainActivity.DRAWER_ITEM_SETTINGS
             )
             sync.enabled = true
-            sync.interval = 1*HOUR.toInt()
+            sync.interval = 1* HOUR.toInt()
             sync.notifyAboutUpdates = true
             sync.onlyWifi = false
             sync.quietHoursEnabled = false
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/ApiService.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/ApiService.kt
index ad9c4296..f68e8840 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/ApiService.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/ApiService.kt
@@ -22,7 +22,7 @@ import pl.szczodrzynski.edziennik.data.api.task.ErrorReportTask
 import pl.szczodrzynski.edziennik.data.api.task.IApiTask
 import pl.szczodrzynski.edziennik.data.api.task.SzkolnyTask
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.toApiError
+import pl.szczodrzynski.edziennik.ext.toApiError
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import kotlin.math.min
 import kotlin.math.roundToInt
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/EdziennikNotification.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/EdziennikNotification.kt
index 605b644c..0b413356 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/EdziennikNotification.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/EdziennikNotification.kt
@@ -11,8 +11,8 @@ import android.content.Context
 import androidx.core.app.NotificationCompat
 import androidx.core.app.NotificationCompat.PRIORITY_MIN
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.Bundle
 import pl.szczodrzynski.edziennik.R
+import pl.szczodrzynski.edziennik.ext.Bundle
 import pl.szczodrzynski.edziennik.receivers.SzkolnyReceiver
 import kotlin.math.roundToInt
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/ProfileArchiver.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/ProfileArchiver.kt
index 15da9765..27c61abc 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/ProfileArchiver.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/ProfileArchiver.kt
@@ -6,9 +6,9 @@ package pl.szczodrzynski.edziennik.data.api.edziennik
 
 import android.content.Intent
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.Intent
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.Intent
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.models.Date
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/DataEdudziennik.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/DataEdudziennik.kt
index 49a9d4a0..76b0e9fd 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/DataEdudziennik.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/DataEdudziennik.kt
@@ -4,10 +4,13 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik
 
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_EDUDZIENNIK_WEB
 import pl.szczodrzynski.edziennik.data.api.models.Data
-import pl.szczodrzynski.edziennik.data.db.entity.*
+import pl.szczodrzynski.edziennik.data.db.entity.EventType
+import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
+import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.*
 
 /**
  * Use http://patorjk.com/software/taag/#p=display&f=Big for the ascii art
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAnnouncements.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAnnouncements.kt
index a39d7afa..a577a123 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAnnouncements.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAnnouncements.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ANNOUNCEMENT_ID
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_ANNOUNCEMENTS
@@ -13,7 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
 import pl.szczodrzynski.edziennik.data.db.entity.Announcement
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class EdudziennikWebAnnouncements(override val data: DataEdudziennik,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt
index 7fe18171..02ba0c85 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt
@@ -4,7 +4,6 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_ENTRIES
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPE
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPES
@@ -14,8 +13,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 import java.util.*
 
@@ -44,7 +44,7 @@ class EdudziennikWebAttendance(override val data: DataEdudziennik,
                 return@map Triple(
                         symbol,
                         name,
-                        when (name.toLowerCase(Locale.ROOT)) {
+                        when (name.lowercase()) {
                             "obecność" -> Attendance.TYPE_PRESENT
                             "nieobecność" -> Attendance.TYPE_ABSENT
                             "spóźnienie" -> Attendance.TYPE_BELATED
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebEvents.kt
index 35c68478..a296723c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebEvents.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebEvents.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EVENT_ID
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_EVENTS
@@ -14,7 +13,8 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class EdudziennikWebEvents(override val data: DataEdudziennik,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebExams.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebExams.kt
index c700100c..a30cb421 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebExams.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebExams.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EVENT_TYPE_ID
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EXAM_ID
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
@@ -16,7 +15,8 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class EdudziennikWebExams(override val data: DataEdudziennik,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetAnnouncement.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetAnnouncement.kt
index 5d915e64..5584b555 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetAnnouncement.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetAnnouncement.kt
@@ -10,7 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
 import pl.szczodrzynski.edziennik.data.api.events.AnnouncementGetEvent
 import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.get
 
 class EdudziennikWebGetAnnouncement(override val data: DataEdudziennik,
                                     private val announcement: AnnouncementFull,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetHomework.kt
index 12c13d68..d6c568ab 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGetHomework.kt
@@ -6,8 +6,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
 import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 
 class EdudziennikWebGetHomework(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGrades.kt
index 8758d76d..3ffba09b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebGrades.kt
@@ -6,8 +6,6 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
 import android.graphics.Color
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.colorFromCssName
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_GRADES
@@ -22,7 +20,9 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_PROPOSED
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.colorFromCssName
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt
index db037967..176c6d3d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_HOMEWORK_ID
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
@@ -15,7 +14,8 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class EdudziennikWebHomework(override val data: DataEdudziennik,
@@ -49,7 +49,7 @@ class EdudziennikWebHomework(override val data: DataEdudziennik,
                     val teacherName = homeworkElement.child(2).text()
                     val teacher = data.getTeacherByFirstLast(teacherName)
 
-                    val topic = homeworkElement.child(4).text()?.trim()
+                    val topic = homeworkElement.child(4).text().trim()
 
                     val eventObject = Event(
                             profileId = profileId,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebNotes.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebNotes.kt
index 8865fb8a..56457a91 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebNotes.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebNotes.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_NOTE_ID
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_NOTES
@@ -13,7 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Notice
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class EdudziennikWebNotes(override val data: DataEdudziennik,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebStart.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebStart.kt
index 3fdd6e0e..e415986c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebStart.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebStart.kt
@@ -4,8 +4,6 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
-import pl.szczodrzynski.edziennik.MONTH
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.ERROR_EDUDZIENNIK_WEB_TEAM_MISSING
 import pl.szczodrzynski.edziennik.data.api.Regexes
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECTS_START
@@ -14,8 +12,10 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZI
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.db.entity.Team
-import pl.szczodrzynski.edziennik.firstLettersName
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.MONTH
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.firstLettersName
+import pl.szczodrzynski.edziennik.ext.get
 
 class EdudziennikWebStart(override val data: DataEdudziennik,
                           override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTeachers.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTeachers.kt
index d2f3ba15..115f9919 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTeachers.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTeachers.kt
@@ -4,12 +4,12 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
-import pl.szczodrzynski.edziennik.MONTH
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_TEACHERS
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_TEACHERS
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.MONTH
+import pl.szczodrzynski.edziennik.ext.get
 
 class EdudziennikWebTeachers(override val data: DataEdudziennik,
                              override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTimetable.kt
index 17bc6017..6cab6026 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTimetable.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebTimetable.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
 import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_TEACHER_ID
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
@@ -16,9 +15,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.getString
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/firstlogin/EdudziennikFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/firstlogin/EdudziennikFirstLogin.kt
index a93632b1..808435af 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/firstlogin/EdudziennikFirstLogin.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/firstlogin/EdudziennikFirstLogin.kt
@@ -13,10 +13,10 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.login.EdudziennikLoginWeb
 import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.getShortName
-import pl.szczodrzynski.edziennik.set
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.getShortName
+import pl.szczodrzynski.edziennik.ext.set
 
 class EdudziennikFirstLogin(val data: DataEdudziennik, val onSuccess: () -> Unit) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/login/EdudziennikLoginWeb.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/login/EdudziennikLoginWeb.kt
index 6b1615a2..d730fe91 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/login/EdudziennikLoginWeb.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/login/EdudziennikLoginWeb.kt
@@ -10,8 +10,8 @@ import im.wangchao.mhttp.callback.TextCallbackHandler
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getUnixDate
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.getUnixDate
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.Utils.d
 
 class EdudziennikLoginWeb(val data: DataEdudziennik, val onSuccess: () -> Unit) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/DataLibrus.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/DataLibrus.kt
index e77dd50d..5d82191d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/DataLibrus.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/DataLibrus.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus
 
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_API
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_MESSAGES
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_PORTAL
@@ -13,7 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_SYNERGIA
 import pl.szczodrzynski.edziennik.data.api.models.Data
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 
 class DataLibrus(app: App, profile: Profile?, loginStore: LoginStore) : Data(app, profile, loginStore) {
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/LibrusRecaptchaHelper.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/LibrusRecaptchaHelper.kt
index 3652f18a..a44076b4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/LibrusRecaptchaHelper.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/LibrusRecaptchaHelper.kt
@@ -10,7 +10,7 @@ import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import kotlinx.coroutines.launch
-import pl.szczodrzynski.edziennik.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import kotlin.coroutines.CoroutineContext
 
 class LibrusRecaptchaHelper(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusApi.kt
index d06cc219..2b736a0f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusApi.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusApi.kt
@@ -11,7 +11,7 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.net.HttpURLConnection.*
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusPortal.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusPortal.kt
index 4a5e0af6..d1d34226 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusPortal.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusPortal.kt
@@ -7,7 +7,7 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.net.HttpURLConnection
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAnnouncements.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAnnouncements.kt
index d19be231..fcf68cad 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAnnouncements.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAnnouncements.kt
@@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Announcement
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiAnnouncements(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendanceTypes.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendanceTypes.kt
index c620d13d..417a1de0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendanceTypes.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendanceTypes.kt
@@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.AttendanceType
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiAttendanceTypes(override val data: DataLibrus,
                                override val lastSync: Long?,
@@ -58,7 +59,7 @@ class LibrusApiAttendanceTypes(override val data: DataLibrus,
                 ))
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_ATTENDANCE_TYPES, 2*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_ATTENDANCE_TYPES, 2* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_ATTENDANCE_TYPES)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendances.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendances.kt
index 7857dc2a..314a0716 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendances.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiAttendances.kt
@@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiAttendances(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeCategories.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeCategories.kt
index 650dfbb5..24992be1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeCategories.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeCategories.kt
@@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_BEHAVIOUR_GRADE_CATEGORIES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiBehaviourGradeCategories(override val data: DataLibrus,
                                         override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeComments.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeComments.kt
index eedb1d1d..4f44c0f0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeComments.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGradeComments.kt
@@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiBehaviourGradeComments(override val data: DataLibrus,
                                       override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGrades.kt
index fae79a50..7a528407 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiBehaviourGrades.kt
@@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_POINT_SUM
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import java.text.DecimalFormat
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClasses.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClasses.kt
index 171e80e1..43baf873 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClasses.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClasses.kt
@@ -4,14 +4,14 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_CLASSES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Team
-import pl.szczodrzynski.edziennik.getJsonObject
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.getJsonObject
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiClasses(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClassrooms.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClassrooms.kt
index 80a11105..6fbebca5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClassrooms.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiClassrooms.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_CLASSROOMS
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Classroom
+import pl.szczodrzynski.edziennik.ext.*
 import java.util.*
 
 class LibrusApiClassrooms(override val data: DataLibrus,
@@ -25,8 +26,8 @@ class LibrusApiClassrooms(override val data: DataLibrus,
 
             classrooms?.forEach { classroom ->
                 val id = classroom.getLong("Id") ?: return@forEach
-                val name = classroom.getString("Name")?.toLowerCase(Locale.getDefault()) ?: ""
-                val symbol = classroom.getString("Symbol")?.toLowerCase(Locale.getDefault()) ?: ""
+                val name = classroom.getString("Name")?.lowercase() ?: ""
+                val symbol = classroom.getString("Symbol")?.lowercase() ?: ""
                 val nameShort = name.fixWhiteSpaces().split(" ").onEach { it[0] }.joinToString()
                 val symbolParts = symbol.fixWhiteSpaces().split(" ")
 
@@ -40,7 +41,7 @@ class LibrusApiClassrooms(override val data: DataLibrus,
                 data.classrooms.put(id, Classroom(profileId, id, friendlyName))
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_CLASSROOMS, 4*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_CLASSROOMS, 4* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_CLASSROOMS)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGradeCategories.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGradeCategories.kt
index 94ce6972..c48d34f8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGradeCategories.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGradeCategories.kt
@@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_DESCRIPTIVE_GRADE_CATEGORIES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiDescriptiveGradeCategories(override val data: DataLibrus,
                                           override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGrades.kt
index 8cc4f1c1..9b214d04 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiDescriptiveGrades.kt
@@ -15,6 +15,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_TEXT
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiDescriptiveGrades(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEventTypes.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEventTypes.kt
index 331b8249..c2129ba6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEventTypes.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEventTypes.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_EVENT_TYPES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.EventType
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiEventTypes(override val data: DataLibrus,
                           override val lastSync: Long?,
@@ -30,7 +31,7 @@ class LibrusApiEventTypes(override val data: DataLibrus,
                 data.eventTypes.put(id, EventType(profileId, id, name, color))
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_EVENT_TYPES, 4*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_EVENT_TYPES, 4* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_EVENT_TYPES)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt
index 7a76f88e..82a0e267 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt
@@ -13,6 +13,7 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeCategories.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeCategories.kt
index 518e643f..c6c4fecc 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeCategories.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeCategories.kt
@@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiGradeCategories(override val data: DataLibrus,
                                override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeComments.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeComments.kt
index 971ac35b..96225b67 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeComments.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGradeComments.kt
@@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiGradeComments(override val data: DataLibrus,
                              override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGrades.kt
index c2e2d0ce..58621a0e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiGrades.kt
@@ -16,6 +16,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_PROPO
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiHomework.kt
index c1183c19..f304aaad 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiHomework.kt
@@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiHomework(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLessons.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLessons.kt
index e32790c9..66075008 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLessons.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLessons.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_LESSONS
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.LibrusLesson
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiLessons(override val data: DataLibrus,
                        override val lastSync: Long?,
@@ -39,7 +40,7 @@ class LibrusApiLessons(override val data: DataLibrus,
                 data.librusLessons.put(id, librusLesson)
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_LESSONS, 4*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_LESSONS, 4* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_LESSONS)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLuckyNumber.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLuckyNumber.kt
index 80e6e299..6ebe9e63 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLuckyNumber.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiLuckyNumber.kt
@@ -4,12 +4,12 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
 
-import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_LUCKY_NUMBER
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.LuckyNumber
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
@@ -22,7 +22,7 @@ class LibrusApiLuckyNumber(override val data: DataLibrus,
     }
 
     init {
-        var nextSync = System.currentTimeMillis() + 2*DAY*1000
+        var nextSync = System.currentTimeMillis() + 2* DAY *1000
 
         apiGet(TAG, "LuckyNumbers") { json ->
             if (json.isJsonNull) {
@@ -41,7 +41,7 @@ class LibrusApiLuckyNumber(override val data: DataLibrus,
                     if (luckyNumberDate >= Date.getToday())
                         nextSync = luckyNumberDate.combineWith(Time(15, 0, 0))
                     else
-                        nextSync = System.currentTimeMillis() + 6*HOUR*1000
+                        nextSync = System.currentTimeMillis() + 6* HOUR *1000
 
                     data.luckyNumberList.add(luckyNumberObject)
                     data.metadataList.add(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiMe.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiMe.kt
index 9d5ce1d4..ea46971f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiMe.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiMe.kt
@@ -4,10 +4,10 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
 
-import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_ME
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiMe(override val data: DataLibrus,
                   override val lastSync: Long?,
@@ -34,7 +34,7 @@ class LibrusApiMe(override val data: DataLibrus,
             data.profile?.studentNameLong =
                     buildFullName(user?.getString("FirstName"), user?.getString("LastName"))
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_ME, 2*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_ME, 2* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_ME)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNoticeTypes.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNoticeTypes.kt
index 55e753ee..7e90fbb2 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNoticeTypes.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNoticeTypes.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_NOTICE_TYPES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.NoticeType
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiNoticeTypes(override val data: DataLibrus,
                            override val lastSync: Long?,
@@ -29,7 +30,7 @@ class LibrusApiNoticeTypes(override val data: DataLibrus,
                 data.noticeTypes.put(id, NoticeType(profileId, id, name))
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_NOTICE_TYPES, 4*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_NOTICE_TYPES, 4* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_NOTICE_TYPES)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNotices.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNotices.kt
index ba531afe..ea61428e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNotices.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiNotices.kt
@@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Notice
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiNotices(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGradeCategories.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGradeCategories.kt
index bba6ead9..775f0897 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGradeCategories.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGradeCategories.kt
@@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_POINT_GRADE_CATEGORIES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiPointGradeCategories(override val data: DataLibrus,
                                     override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGrades.kt
index 9da2c435..8a7ad29f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPointGrades.kt
@@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_POINT_AVG
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiPointGrades(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPtMeetings.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPtMeetings.kt
index 6c0a9dd7..170c6135 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPtMeetings.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPtMeetings.kt
@@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
@@ -64,7 +65,7 @@ class LibrusApiPtMeetings(override val data: DataLibrus,
 
             data.toRemove.add(DataRemoveModel.Events.futureWithType(Event.TYPE_PT_MEETING))
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_PT_MEETINGS, 12*HOUR)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_PT_MEETINGS, 12* HOUR)
             onSuccess(ENDPOINT_LIBRUS_API_PT_MEETINGS)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt
index 9073d03f..5dac1841 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt
@@ -4,13 +4,13 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
 
-import pl.szczodrzynski.edziennik.JsonObject
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_PUSH_CONFIG
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getJsonObject
+import pl.szczodrzynski.edziennik.ext.JsonObject
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getJsonObject
 
 class LibrusApiPushConfig(override val data: DataLibrus,
                           override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSchools.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSchools.kt
index d405f9bf..e42ab949 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSchools.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSchools.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_SCHOOLS
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Time
 import java.util.*
 
@@ -29,7 +30,7 @@ class LibrusApiSchools(override val data: DataLibrus,
             // create the school's short name using first letters of each long name's word
             // append the town name and save to student data
             val schoolNameShort = schoolNameLong?.firstLettersName
-            val schoolTown = school?.getString("Town")?.toLowerCase(Locale.getDefault())
+            val schoolTown = school?.getString("Town")?.lowercase()
             data.schoolName = schoolId.toString() + schoolNameShort + "_" + schoolTown
 
             school?.getJsonArray("LessonsRange")?.let { ranges ->
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSubjects.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSubjects.kt
index cfd9bd31..17e30559 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSubjects.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiSubjects.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_SUBJECTS
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Subject
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiSubjects(override val data: DataLibrus,
                         override val lastSync: Long?,
@@ -32,7 +33,7 @@ class LibrusApiSubjects(override val data: DataLibrus,
 
             data.subjectList.put(1, Subject(profileId, 1, "Zachowanie", "zach"))
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_SUBJECTS, 4*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_SUBJECTS, 4* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_SUBJECTS)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDayTypes.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDayTypes.kt
index e09504bf..c87e71d8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDayTypes.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDayTypes.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_TEACHER_FREE_DAY_TYPES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.TeacherAbsenceType
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiTeacherFreeDayTypes(override val data: DataLibrus,
                                    override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDays.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDays.kt
index 973ada46..54a3fb36 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDays.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTeacherFreeDays.kt
@@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.TeacherAbsence
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
@@ -64,7 +65,7 @@ class LibrusApiTeacherFreeDays(override val data: DataLibrus,
                 ))
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_TEACHER_FREE_DAYS, 6*HOUR, DRAWER_ITEM_AGENDA)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_TEACHER_FREE_DAYS, 6* HOUR, DRAWER_ITEM_AGENDA)
             onSuccess(ENDPOINT_LIBRUS_API_TEACHER_FREE_DAYS)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGradeCategories.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGradeCategories.kt
index 45b6b069..441e3b60 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGradeCategories.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGradeCategories.kt
@@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_TEXT_GRADE_CATEGORIES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiTextGradeCategories(override val data: DataLibrus,
                                    override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGrades.kt
index 7b7c8c6f..bb19f11f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTextGrades.kt
@@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_DESCRIPTIV
 import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusApiTextGrades(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTimetables.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTimetables.kt
index 9a463a6b..b224a381 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTimetables.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiTimetables.kt
@@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUnits.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUnits.kt
index 791283ed..03fcf4a5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUnits.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUnits.kt
@@ -8,6 +8,7 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_UNITS
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiUnits(override val data: DataLibrus,
                      override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUsers.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUsers.kt
index 0ac9a5ea..fb82849f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUsers.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiUsers.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_USERS
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiUsers(override val data: DataLibrus,
                      override val lastSync: Long?,
@@ -37,7 +38,7 @@ class LibrusApiUsers(override val data: DataLibrus,
                 data.teacherList.put(id, teacher)
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_USERS, 4*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_USERS, 4* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_USERS)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiVirtualClasses.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiVirtualClasses.kt
index 9937f808..2d6a7958 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiVirtualClasses.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiVirtualClasses.kt
@@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.db.entity.Team
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusApiVirtualClasses(override val data: DataLibrus,
                               override val lastSync: Long?,
@@ -31,7 +32,7 @@ class LibrusApiVirtualClasses(override val data: DataLibrus,
                 data.teamList.put(id, Team(profileId, id, name, 2, code, teacherId))
             }
 
-            data.setSyncNext(ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES, 4*DAY)
+            data.setSyncNext(ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES, 4* DAY)
             onSuccess(ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetList.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetList.kt
index 9f962bf9..7d0cfeef 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetList.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetList.kt
@@ -4,7 +4,6 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.messages
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES
 import pl.szczodrzynski.edziennik.data.api.ERROR_NOT_IMPLEMENTED
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
@@ -13,8 +12,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_MESS
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
 import pl.szczodrzynski.edziennik.data.db.entity.*
 import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
 
@@ -109,7 +109,7 @@ class LibrusMessagesGetList(override val data: DataLibrus,
                             id
                     )
 
-                    element.select("isAnyFileAttached")?.text()?.let {
+                    element.select("isAnyFileAttached").text()?.let {
                         if (it == "1")
                             messageObject.hasAttachments = true
                     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetMessage.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetMessage.kt
index fce75981..8e6435c6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetMessage.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetMessage.kt
@@ -15,10 +15,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
 import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
-import pl.szczodrzynski.edziennik.notEmptyOrNull
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.notEmptyOrNull
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 import java.nio.charset.Charset
 
@@ -108,7 +108,7 @@ class LibrusMessagesGetMessage(override val data: DataLibrus,
                             readDate = readDate
                     )
 
-                    messageRecipientObject.fullName = profile.accountName ?: profile.studentNameLong ?: ""
+                    messageRecipientObject.fullName = profile.accountName ?: profile.studentNameLong
 
                     messageRecipientList.add(messageRecipientObject)
                 }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetRecipientList.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetRecipientList.kt
index 053258d8..b6881f17 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetRecipientList.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesGetRecipientList.kt
@@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
 import pl.szczodrzynski.edziennik.data.api.events.RecipientListGetEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusMessagesGetRecipientList(override val data: DataLibrus,
                                      val onSuccess: () -> Unit
@@ -28,9 +29,9 @@ class LibrusMessagesGetRecipientList(override val data: DataLibrus,
         messagesGet(TAG, "Receivers/action/GetTypes", parameters = mapOf(
             "includeClass" to 1
         )) { doc ->
-            doc.select("response GetTypes data list ArrayItem")?.forEach {
-                val id = it.getElementsByTag("id")?.firstOrNull()?.ownText() ?: return@forEach
-                val name = it.getElementsByTag("name")?.firstOrNull()?.ownText() ?: return@forEach
+            doc.select("response GetTypes data list ArrayItem").forEach {
+                val id = it.getElementsByTag("id").firstOrNull()?.ownText() ?: return@forEach
+                val name = it.getElementsByTag("name").firstOrNull()?.ownText() ?: return@forEach
                 listTypes += id to name
             }
 
@@ -55,7 +56,7 @@ class LibrusMessagesGetRecipientList(override val data: DataLibrus,
             if (dataEl is JsonObject) {
                 val listEl = dataEl.get("ArrayItem")
                 if (listEl is JsonArray) {
-                    listEl.asJsonObjectList()?.forEach { item ->
+                    listEl.asJsonObjectList().forEach { item ->
                         processElement(item, type.first, type.second)
                     }
                 }
@@ -71,7 +72,7 @@ class LibrusMessagesGetRecipientList(override val data: DataLibrus,
     private fun processElement(element: JsonObject, typeId: String, typeName: String, listName: String? = null) {
         val listEl = element.getJsonObject("list")?.get("ArrayItem")
         if (listEl is JsonArray) {
-            listEl.asJsonObjectList()?.let { list ->
+            listEl.asJsonObjectList().let { list ->
                 val label = element.getString("label") ?: ""
                 list.forEach { item ->
                     processElement(item, typeId, typeName, label)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesSendMessage.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesSendMessage.kt
index e388f6fd..02248e99 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesSendMessage.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusMessagesSendMessage.kt
@@ -5,16 +5,15 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.messages
 
 import org.greenrobot.eventbus.EventBus
-import pl.szczodrzynski.edziennik.base64Encode
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
 import pl.szczodrzynski.edziennik.data.api.events.MessageSentEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Message
-import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
-import pl.szczodrzynski.edziennik.getJsonObject
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.base64Encode
+import pl.szczodrzynski.edziennik.ext.getJsonObject
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 
 class LibrusMessagesSendMessage(override val data: DataLibrus,
                                 val recipients: List<Teacher>,
@@ -42,14 +41,14 @@ class LibrusMessagesSendMessage(override val data: DataLibrus,
             val id = response.getLong("data")
 
             if (response.getString("status") != "ok" || id == null) {
-                val message = response.getString("message")
+                // val message = response.getString("message")
                 // TODO error
                 return@messagesGetJson
             }
 
             LibrusMessagesGetList(data, type = Message.TYPE_SENT, lastSync = null) {
                 val message = data.messageList.firstOrNull { it.isSent && it.id == id }
-                val metadata = data.metadataList.firstOrNull { it.thingType == Metadata.TYPE_MESSAGE && it.thingId == message?.id }
+                // val metadata = data.metadataList.firstOrNull { it.thingType == Metadata.TYPE_MESSAGE && it.thingId == message?.id }
                 val event = MessageSentEvent(data.profileId, message, message?.addedDate)
 
                 EventBus.getDefault().postSticky(event)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusSandboxDownloadAttachment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusSandboxDownloadAttachment.kt
index 567071aa..c58c185f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusSandboxDownloadAttachment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/messages/LibrusSandboxDownloadAttachment.kt
@@ -7,8 +7,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
 import pl.szczodrzynski.edziennik.data.api.events.AttachmentGetEvent
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils
 import java.io.File
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessage.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessage.kt
index 3bf890f1..b9df2af1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessage.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessage.kt
@@ -10,10 +10,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
 import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
-import pl.szczodrzynski.edziennik.singleOrNull
-import pl.szczodrzynski.edziennik.swapFirstLastName
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.singleOrNull
+import pl.szczodrzynski.edziennik.ext.swapFirstLastName
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusSynergiaGetMessage(override val data: DataLibrus,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessages.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessages.kt
index b67dcdb4..01cc69f6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessages.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetMessages.kt
@@ -7,6 +7,7 @@ import pl.szczodrzynski.edziennik.data.api.Regexes
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
 import pl.szczodrzynski.edziennik.data.db.entity.*
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaHomework.kt
index 42064610..ddf6635c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaHomework.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.HOUR
 import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORK
 import pl.szczodrzynski.edziennik.data.api.POST
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
@@ -14,8 +13,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
 import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.HOUR
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LibrusSynergiaHomework(override val data: DataLibrus,
@@ -42,7 +42,7 @@ class LibrusSynergiaHomework(override val data: DataLibrus,
             doc.select("table.myHomeworkTable > tbody").firstOrNull()?.also { homeworkTable ->
                 val homeworkElements = homeworkTable.children()
 
-                homeworkElements.forEachIndexed { i, el ->
+                homeworkElements.forEach { el ->
                     val elements = el.children()
 
                     val subjectName = elements[0].text().trim()
@@ -56,7 +56,7 @@ class LibrusSynergiaHomework(override val data: DataLibrus,
                     val eventDate = Date.fromY_m_d(elements[6].text().trim())
                     val id = "/podglad/([0-9]+)'".toRegex().find(
                             elements[9].select("input").attr("onclick")
-                    )?.get(1)?.toLong() ?: return@forEachIndexed
+                    )?.get(1)?.toLong() ?: return@forEach
 
                     val lessons = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
                     val startTime = lessons.firstOrNull { it.subjectId == subjectId }?.startTime
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaInfo.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaInfo.kt
index 66e11785..74458fb5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaInfo.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaInfo.kt
@@ -5,10 +5,10 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.MONTH
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_SYNERGIA_INFO
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
+import pl.szczodrzynski.edziennik.ext.MONTH
 
 class LibrusSynergiaInfo(override val data: DataLibrus,
                          override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/firstlogin/LibrusFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/firstlogin/LibrusFirstLogin.kt
index 68f44269..43e5bda9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/firstlogin/LibrusFirstLogin.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/firstlogin/LibrusFirstLogin.kt
@@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.login.LibrusLoginPor
 import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.*
 
 class LibrusFirstLogin(val data: DataLibrus, val onSuccess: () -> Unit) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginApi.kt
index 7151cf29..58f7181d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginApi.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginApi.kt
@@ -12,9 +12,9 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getString
-import pl.szczodrzynski.edziennik.getUnixDate
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.getUnixDate
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.net.HttpURLConnection.*
 
@@ -63,7 +63,7 @@ class LibrusLoginApi {
     }
 
     private fun copyFromLoginStore() {
-        data.loginStore.data?.apply {
+        data.loginStore.data.apply {
             if (has("accountLogin")) {
                 data.apiLogin = getString("accountLogin")
                 remove("accountLogin")
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginMessages.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginMessages.kt
index 9bfad99f..2a61f641 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginMessages.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginMessages.kt
@@ -12,7 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.LibrusRecaptchaHelper
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getUnixDate
+import pl.szczodrzynski.edziennik.ext.getUnixDate
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.io.StringWriter
 import javax.xml.parsers.DocumentBuilderFactory
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginPortal.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginPortal.kt
index f164e3ed..ed01d01f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginPortal.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginPortal.kt
@@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.net.HttpURLConnection.*
 import java.util.*
@@ -83,7 +84,7 @@ class LibrusLoginPortal(val data: DataLibrus, val onSuccess: () -> Unit) {
                         } else {
                             val csrfMatcher = Pattern.compile("name=\"csrf-token\" content=\"([A-z0-9=+/\\-_]+?)\"", Pattern.DOTALL).matcher(text)
                             if (csrfMatcher.find()) {
-                                login(csrfMatcher.group(1))
+                                login(csrfMatcher.group(1) ?: "")
                             } else {
                                 data.error(ApiError(TAG, ERROR_LOGIN_LIBRUS_PORTAL_CSRF_MISSING)
                                         .withResponse(response)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginSynergia.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginSynergia.kt
index 4a292cfe..a95af893 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginSynergia.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/LibrusLoginSynergia.kt
@@ -12,8 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getString
-import pl.szczodrzynski.edziennik.getUnixDate
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.getUnixDate
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.net.HttpURLConnection
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/SynergiaTokenExtractor.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/SynergiaTokenExtractor.kt
index 5072e5a2..807bb131 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/SynergiaTokenExtractor.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/login/SynergiaTokenExtractor.kt
@@ -7,6 +7,7 @@ import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusPortal
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils.d
 
 class SynergiaTokenExtractor(override val data: DataLibrus, val onSuccess: () -> Unit) : LibrusPortal(data) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/DataMobidziennik.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/DataMobidziennik.kt
index ddfb0113..3553d72d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/DataMobidziennik.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/DataMobidziennik.kt
@@ -6,12 +6,12 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik
 
 import android.util.LongSparseArray
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_MOBIDZIENNIK_WEB
 import pl.szczodrzynski.edziennik.data.api.models.Data
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTeams.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTeams.kt
index b32e9d29..dbd1c03d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTeams.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTeams.kt
@@ -6,8 +6,8 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.api
 
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
 import pl.szczodrzynski.edziennik.data.db.entity.Team
-import pl.szczodrzynski.edziennik.getById
-import pl.szczodrzynski.edziennik.values
+import pl.szczodrzynski.edziennik.ext.getById
+import pl.szczodrzynski.edziennik.ext.values
 
 class MobidziennikApiTeams(val data: DataMobidziennik, tableTeams: List<String>?, tableRelations: List<String>?) {
     init {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt
index 023e817b..8e490832 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt
@@ -11,9 +11,9 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.keys
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.keys
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiUsers.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiUsers.kt
index b95a55fe..943983d4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiUsers.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiUsers.kt
@@ -6,7 +6,7 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.api
 
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
-import pl.szczodrzynski.edziennik.fixName
+import pl.szczodrzynski.edziennik.ext.fixName
 
 class MobidziennikApiUsers(val data: DataMobidziennik, rows: List<String>) {
     init {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api2/MobidziennikApi2Main.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api2/MobidziennikApi2Main.kt
index 70d32b18..9c231849 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api2/MobidziennikApi2Main.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api2/MobidziennikApi2Main.kt
@@ -14,8 +14,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.ENDPOINT_MOBID
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.login.MobidziennikLoginApi2
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.getJsonObject
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getJsonObject
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils
 
 class MobidziennikApi2Main(val data: DataMobidziennik,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAccountEmail.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAccountEmail.kt
index ef4c2847..9dc3878c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAccountEmail.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAccountEmail.kt
@@ -4,12 +4,12 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.web
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.data.api.Regexes
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.ENDPOINT_MOBIDZIENNIK_WEB_ACCOUNT_EMAIL
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.MobidziennikWeb
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.get
 
 class MobidziennikWebAccountEmail(override val data: DataMobidziennik,
                                   override val lastSync: Long?,
@@ -26,7 +26,7 @@ class MobidziennikWebAccountEmail(override val data: DataMobidziennik,
             val email = Regexes.MOBIDZIENNIK_ACCOUNT_EMAIL.find(text)?.let { it[1] }
             data.loginEmail = email
 
-            data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_ACCOUNT_EMAIL, if (email == null) 3*DAY else 7*DAY)
+            data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_ACCOUNT_EMAIL, if (email == null) 3* DAY else 7* DAY)
             onSuccess(ENDPOINT_MOBIDZIENNIK_WEB_ACCOUNT_EMAIL)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt
index cbd797b1..9160e4d6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt
@@ -20,9 +20,9 @@ import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_RELEA
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_UNKNOWN
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
@@ -131,11 +131,11 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
                 // verify the lesson count is the same as dates & entries
                 if (count != lessonDates.count() || count != entries.count())
                     return@forEach
-                ranges.forEach { range ->
+                ranges.onEach { range ->
                     val lessonDate = dateIterator.next()
                     val entry = entriesIterator.next()
                     if (range == null || entry.isBlank())
-                        return@forEach
+                        return@onEach
                     val startTime = Time.fromH_m(range[1])
 
                     range[2].split(" / ").mapNotNull {
@@ -186,7 +186,7 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
             if (entry.startsWith(symbol) && symbol.length > typeSymbol.length)
                 typeSymbol = symbol
         }
-        entry = entry.removePrefix(typeSymbol)
+        // entry = entry.removePrefix(typeSymbol)
 
         var isCustom = false
         val baseType = when (typeSymbol) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebCalendar.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebCalendar.kt
index 53122198..b6a10335 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebCalendar.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebCalendar.kt
@@ -12,10 +12,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.Mobidzien
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils.crc16
 import pl.szczodrzynski.edziennik.utils.models.Date
-import java.util.*
 
 class MobidziennikWebCalendar(override val data: DataMobidziennik,
                               override val lastSync: Long?,
@@ -30,7 +29,7 @@ class MobidziennikWebCalendar(override val data: DataMobidziennik,
             MobidziennikLuckyNumberExtractor(data, text)
 
             Regexes.MOBIDZIENNIK_CLASS_CALENDAR.find(text)?.let {
-                val events = JsonParser().parse(it.groupValues[1]).asJsonArray
+                val events = JsonParser.parseString(it.groupValues[1]).asJsonArray
                 for (eventEl in events) {
                     val event = eventEl.asJsonObject
 
@@ -50,7 +49,7 @@ class MobidziennikWebCalendar(override val data: DataMobidziennik,
                     val dateString = event.getString("start") ?: continue
                     val eventDate = Date.fromY_m_d(dateString)
 
-                    val eventType = when (event.getString("color")?.toLowerCase(Locale.getDefault())) {
+                    val eventType = when (event.getString("color")?.lowercase()) {
                         "#c54449" -> Event.TYPE_SHORT_QUIZ
                         "#ab0001" -> Event.TYPE_EXAM
                         "#008928" -> Event.TYPE_CLASS_EVENT
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetEvent.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetEvent.kt
index 41e46e65..69a2dce0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetEvent.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetEvent.kt
@@ -11,7 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidzienn
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.MobidziennikWeb
 import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class MobidziennikWebGetEvent(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetHomework.kt
index 5b8d348f..9dbdd439 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetHomework.kt
@@ -10,7 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidzienn
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.MobidziennikWeb
 import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.get
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetMessage.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetMessage.kt
index ee26f390..3e196ec0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetMessage.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetMessage.kt
@@ -13,9 +13,9 @@ import pl.szczodrzynski.edziennik.data.api.events.MessageGetEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
 import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.Utils.monthFromName
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetRecipientList.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetRecipientList.kt
index 0ed1e4a6..b6f2afa7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetRecipientList.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetRecipientList.kt
@@ -9,12 +9,12 @@ import androidx.room.OnConflictStrategy
 import com.google.gson.JsonObject
 import com.google.gson.JsonParser
 import org.greenrobot.eventbus.EventBus
-import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.Regexes
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.MobidziennikWeb
 import pl.szczodrzynski.edziennik.data.api.events.RecipientListGetEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
+import pl.szczodrzynski.edziennik.ext.*
 
 class MobidziennikWebGetRecipientList(override val data: DataMobidziennik,
                                       val onSuccess: () -> Unit
@@ -26,7 +26,7 @@ class MobidziennikWebGetRecipientList(override val data: DataMobidziennik,
     init {
         webGet(TAG, "/mobile/dodajwiadomosc") { text ->
             Regexes.MOBIDZIENNIK_MESSAGE_RECIPIENTS_JSON.find(text)?.let { match ->
-                val recipientLists = JsonParser().parse(match[1]).asJsonArray
+                val recipientLists = JsonParser.parseString(match[1]).asJsonArray
                 recipientLists?.asJsonObjectList()?.forEach { list ->
                     val listType = list.getString("typ")?.toIntOrNull() ?: -1
                     val listName = list.getString("nazwa") ?: ""
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGrades.kt
index 43b67d23..285441b6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGrades.kt
@@ -14,9 +14,9 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_NORMAL
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.fixWhiteSpaces
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.fixWhiteSpaces
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebHomework.kt
index ddae85e6..f9638ac1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebHomework.kt
@@ -11,7 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.ENDPOINT_MOBID
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.MobidziennikWeb
 import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.get
+import pl.szczodrzynski.edziennik.ext.get
 
 class MobidziennikWebHomework(override val data: DataMobidziennik,
                               override val lastSync: Long?,
@@ -48,8 +48,8 @@ class MobidziennikWebHomework(override val data: DataMobidziennik,
 
                 event.attachmentIds = mutableListOf()
                 event.attachmentNames = mutableListOf()
-                Regexes.MOBIDZIENNIK_MOBILE_HOMEWORK_ATTACHMENT.findAll(tableRow).forEach {
-                    event.attachmentIds?.add(it[1].toLongOrNull() ?: return@forEach)
+                Regexes.MOBIDZIENNIK_MOBILE_HOMEWORK_ATTACHMENT.findAll(tableRow).onEach {
+                    event.attachmentIds?.add(it[1].toLongOrNull() ?: return@onEach)
                     event.attachmentNames?.add(it[2])
                 }
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesAll.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesAll.kt
index 803ee48d..aebff41e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesAll.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesAll.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.MobidziennikWeb
@@ -14,8 +13,9 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED
 import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_SENT
 import pl.szczodrzynski.edziennik.data.db.entity.MessageRecipient
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 import java.net.URLEncoder
 
@@ -36,7 +36,7 @@ class MobidziennikWebMessagesAll(override val data: DataMobidziennik,
 
             val listElement = doc.getElementsByClass("spis").first()
             if (listElement == null) {
-                data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7*DAY)
+                data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7* DAY)
                 onSuccess(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL)
                 return@webGet
             }
@@ -89,7 +89,7 @@ class MobidziennikWebMessagesAll(override val data: DataMobidziennik,
 
             // sync every 7 days as we probably don't expect more than
             // 30 received messages during a week, without any normal sync
-            data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7*DAY)
+            data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7* DAY)
             onSuccess(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesInbox.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesInbox.kt
index 5e5e5b19..ed9c2ae1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesInbox.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesInbox.kt
@@ -12,8 +12,8 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.data.db.entity.MessageRecipient
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class MobidziennikWebMessagesInbox(override val data: DataMobidziennik,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesSent.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesSent.kt
index 80e54e59..c6508a26 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesSent.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebMessagesSent.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.web
 
 import org.jsoup.Jsoup
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES
 import pl.szczodrzynski.edziennik.data.api.Regexes
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
@@ -15,9 +14,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.data.db.entity.MessageRecipient
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.singleOrNull
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.singleOrNull
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class MobidziennikWebMessagesSent(override val data: DataMobidziennik,
@@ -96,7 +96,7 @@ class MobidziennikWebMessagesSent(override val data: DataMobidziennik,
                         ))
             }
 
-            data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_SENT, 1*DAY, DRAWER_ITEM_MESSAGES)
+            data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_SENT, 1* DAY, DRAWER_ITEM_MESSAGES)
             onSuccess(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_SENT)
         }
     }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebTimetable.kt
index 224653dd..dd0ff03f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebTimetable.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebTimetable.kt
@@ -15,11 +15,14 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel.Timetable.Comp
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.MS
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import pl.szczodrzynski.edziennik.utils.models.Week
 import kotlin.collections.set
-import kotlin.text.replace
 
 class MobidziennikWebTimetable(
     override val data: DataMobidziennik,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/firstlogin/MobidziennikFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/firstlogin/MobidziennikFirstLogin.kt
index 11b668f9..91390c5c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/firstlogin/MobidziennikFirstLogin.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/firstlogin/MobidziennikFirstLogin.kt
@@ -7,8 +7,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.data.Mobidzien
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.login.MobidziennikLoginWeb
 import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.set
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.set
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class MobidziennikFirstLogin(val data: DataMobidziennik, val onSuccess: () -> Unit) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginApi2.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginApi2.kt
index db750981..9258886b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginApi2.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginApi2.kt
@@ -9,10 +9,14 @@ import com.google.gson.JsonObject
 import im.wangchao.mhttp.Request
 import im.wangchao.mhttp.Response
 import im.wangchao.mhttp.callback.JsonCallbackHandler
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.ext.JsonObject
+import pl.szczodrzynski.edziennik.ext.getJsonObject
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.Utils
 
 class MobidziennikLoginApi2(val data: DataMobidziennik, val onSuccess: () -> Unit) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginWeb.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginWeb.kt
index 78526b0c..ce801a73 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginWeb.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/login/MobidziennikLoginWeb.kt
@@ -11,8 +11,8 @@ import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.DataMobidziennik
 import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.Mobidziennik
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getUnixDate
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.getUnixDate
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.Utils.d
 
 class MobidziennikLoginWeb(val data: DataMobidziennik, val onSuccess: () -> Unit) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/DataPodlasie.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/DataPodlasie.kt
index 7962de7e..0a5cce84 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/DataPodlasie.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/DataPodlasie.kt
@@ -4,11 +4,13 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.podlasie
 
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_PODLASIE_API
 import pl.szczodrzynski.edziennik.data.api.models.Data
-import pl.szczodrzynski.edziennik.data.db.entity.*
-import kotlin.text.replace
+import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
+import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 
 class DataPodlasie(app: App, profile: Profile?, loginStore: LoginStore) : Data(app, profile, loginStore) {
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/PodlasieApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/PodlasieApi.kt
index 985b9899..726b851a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/PodlasieApi.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/PodlasieApi.kt
@@ -12,9 +12,9 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.DataPodlasie
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getJsonObject
-import pl.szczodrzynski.edziennik.toHexString
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getJsonObject
+import pl.szczodrzynski.edziennik.ext.toHexString
 import pl.szczodrzynski.edziennik.utils.Utils
 import java.security.MessageDigest
 import java.text.SimpleDateFormat
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiEvents.kt
index 6139b402..f51c7477 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiEvents.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiEvents.kt
@@ -9,8 +9,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.DataPodlasie
 import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import java.util.*
@@ -26,7 +26,7 @@ class PodlasieApiEvents(val data: DataPodlasie, val rows: List<JsonObject>) {
             val name = event.getString("Name")?.replace("&#34;", "\"") ?: ""
             val description = event.getString("Description")?.replace("&#34;", "\"") ?: ""
 
-            val type = when (event.getString("Category")?.toLowerCase(Locale.getDefault())) {
+            val type = when (event.getString("Category")?.lowercase()) {
                 "klasówka" -> Event.TYPE_EXAM
                 "praca domowa" -> Event.TYPE_HOMEWORK
                 "wycieczka" -> Event.TYPE_EXCURSION
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiFinalGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiFinalGrades.kt
index bb4f696c..94dadfc8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiFinalGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiFinalGrades.kt
@@ -15,8 +15,8 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_FINAL
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_PROPOSED
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 
 class PodlasieApiFinalGrades(val data: DataPodlasie, val rows: List<JsonObject>) {
     init { data.profile?.also { profile ->
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiGrades.kt
index c3946c76..4aa749ef 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiGrades.kt
@@ -10,10 +10,10 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.DataPodlasie
 import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.getFloat
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getFloat
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class PodlasieApiGrades(val data: DataPodlasie, val rows: List<JsonObject>) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiHomework.kt
index 1165cf79..be2fd062 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiHomework.kt
@@ -5,13 +5,13 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.data.api
 
 import com.google.gson.JsonObject
-import pl.szczodrzynski.edziennik.crc32
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.DataPodlasie
 import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class PodlasieApiHomework(val data: DataPodlasie, val rows: List<JsonObject>) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiMain.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiMain.kt
index f108d35e..bf9379b3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiMain.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiMain.kt
@@ -4,14 +4,14 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.data.api
 
-import pl.szczodrzynski.edziennik.asJsonObjectList
 import pl.szczodrzynski.edziennik.data.api.PODLASIE_API_USER_ENDPOINT
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.DataPodlasie
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.ENDPOINT_PODLASIE_API_MAIN
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.data.PodlasieApi
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getJsonArray
+import pl.szczodrzynski.edziennik.ext.asJsonObjectList
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getJsonArray
 
 class PodlasieApiMain(override val data: DataPodlasie,
                       override val lastSync: Long?,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTeachers.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTeachers.kt
index ca1fa7b4..f4769169 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTeachers.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTeachers.kt
@@ -7,9 +7,9 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.data.api
 import com.google.gson.JsonObject
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.DataPodlasie
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 
 class PodlasieApiTeachers(val data: DataPodlasie, val rows: List<JsonObject>) {
     init {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTimetable.kt
index 13cff861..8c95d054 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTimetable.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/data/api/PodlasieApiTimetable.kt
@@ -8,8 +8,8 @@ import com.google.gson.JsonObject
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.DataPodlasie
 import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import pl.szczodrzynski.edziennik.utils.models.Week
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/firstlogin/PodlasieFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/firstlogin/PodlasieFirstLogin.kt
index a1e9d0eb..a99ea2ee 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/firstlogin/PodlasieFirstLogin.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/podlasie/firstlogin/PodlasieFirstLogin.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.firstlogin
 
 import org.greenrobot.eventbus.EventBus
-import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.LOGIN_TYPE_PODLASIE
 import pl.szczodrzynski.edziennik.data.api.PODLASIE_API_LOGOUT_DEVICES_ENDPOINT
 import pl.szczodrzynski.edziennik.data.api.PODLASIE_API_USER_ENDPOINT
@@ -14,6 +13,10 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.data.PodlasieApi
 import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.login.PodlasieLoginApi
 import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.getShortName
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.set
 
 class PodlasieFirstLogin(val data: DataPodlasie, val onSuccess: () -> Unit) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/DataTemplate.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/DataTemplate.kt
index dcf569cf..17644978 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/DataTemplate.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/DataTemplate.kt
@@ -5,13 +5,13 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.template
 
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_TEMPLATE_API
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_TEMPLATE_WEB
 import pl.szczodrzynski.edziennik.data.api.models.Data
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 
 /**
  * Use http://patorjk.com/software/taag/#p=display&f=Big for the ascii art
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateApi.kt
index d3d4c607..69e8f654 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateApi.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateApi.kt
@@ -5,11 +5,11 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.template.data
 
 import com.google.gson.JsonObject
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.ERROR_TEMPLATE_WEB_OTHER
 import pl.szczodrzynski.edziennik.data.api.GET
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.DataTemplate
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
 
 open class TemplateApi(open val data: DataTemplate, open val lastSync: Long?) {
     companion object {
@@ -28,6 +28,7 @@ open class TemplateApi(open val data: DataTemplate, open val lastSync: Long?) {
      * You can customize this method's parameters to best fit the implemented e-register.
      * Just make sure that [tag] and [onSuccess] is present.
      */
+    @Suppress("UNUSED_PARAMETER")
     fun apiGet(tag: String, endpoint: String, method: Int = GET, payload: JsonObject? = null, onSuccess: (json: JsonObject?) -> Unit) {
         val json = JsonObject()
         json.addProperty("foo", "bar")
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateWeb.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateWeb.kt
index 0db508c7..2db8c41b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateWeb.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateWeb.kt
@@ -5,11 +5,11 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.template.data
 
 import com.google.gson.JsonObject
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.ERROR_TEMPLATE_WEB_OTHER
 import pl.szczodrzynski.edziennik.data.api.GET
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.DataTemplate
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
 
 open class TemplateWeb(open val data: DataTemplate, open val lastSync: Long?) {
     companion object {
@@ -28,6 +28,7 @@ open class TemplateWeb(open val data: DataTemplate, open val lastSync: Long?) {
      * You can customize this method's parameters to best fit the implemented e-register.
      * Just make sure that [tag] and [onSuccess] is present.
      */
+    @Suppress("UNUSED_PARAMETER")
     fun webGet(tag: String, endpoint: String, method: Int = GET, payload: JsonObject? = null, onSuccess: (json: JsonObject?) -> Unit) {
         val json = JsonObject()
         json.addProperty("foo", "bar")
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/api/TemplateApiSample.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/api/TemplateApiSample.kt
index 632a8e74..d61dc8f9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/api/TemplateApiSample.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/api/TemplateApiSample.kt
@@ -4,12 +4,12 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.template.data.api
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.DataTemplate
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.ENDPOINT_TEMPLATE_API_SAMPLE
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.data.TemplateApi
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.DAY
 
 class TemplateApiSample(override val data: DataTemplate,
                         override val lastSync: Long?,
@@ -20,7 +20,7 @@ class TemplateApiSample(override val data: DataTemplate,
     }
 
     init {
-        apiGet(TAG, "/api/v3/getData.php") { json ->
+        apiGet(TAG, "/api/v3/getData.php") { _ ->
             // here you can access and update any fields of the `data` object
 
             // ================
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample.kt
index f0ba882e..0732710a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample.kt
@@ -4,13 +4,13 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.template.data.web
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_GRADES
 import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOME
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.DataTemplate
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.ENDPOINT_TEMPLATE_WEB_SAMPLE
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.data.TemplateWeb
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.DAY
 
 class TemplateWebSample(override val data: DataTemplate,
                         override val lastSync: Long?,
@@ -21,7 +21,7 @@ class TemplateWebSample(override val data: DataTemplate,
     }
 
     init {
-        webGet(TAG, "/api/v3/getData.php") { json ->
+        webGet(TAG, "/api/v3/getData.php") {
             // here you can access and update any fields of the `data` object
 
             // ================
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample2.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample2.kt
index 02d58231..ecf41b64 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample2.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/web/TemplateWebSample2.kt
@@ -4,12 +4,12 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.template.data.web
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.DataTemplate
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.ENDPOINT_TEMPLATE_WEB_SAMPLE_2
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.data.TemplateWeb
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.DAY
 
 class TemplateWebSample2(override val data: DataTemplate,
                          override val lastSync: Long?,
@@ -20,7 +20,7 @@ class TemplateWebSample2(override val data: DataTemplate,
     }
 
     init {
-        webGet(TAG, "/api/v3/getData.php") { json ->
+        webGet(TAG, "/api/v3/getData.php") {
             // here you can access and update any fields of the `data` object
 
             // ================
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginApi.kt
index fc1fc20e..f49e433a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginApi.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginApi.kt
@@ -4,12 +4,12 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.template.login
 
-import pl.szczodrzynski.edziennik.HOUR
 import pl.szczodrzynski.edziennik.data.api.ERROR_LOGIN_DATA_MISSING
 import pl.szczodrzynski.edziennik.data.api.ERROR_PROFILE_MISSING
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.DataTemplate
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.HOUR
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
 
 class TemplateLoginApi(val data: DataTemplate, val onSuccess: () -> Unit) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginWeb.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginWeb.kt
index d7a24ef0..2f5b72c6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginWeb.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/login/TemplateLoginWeb.kt
@@ -4,11 +4,11 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.template.login
 
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.ERROR_LOGIN_DATA_MISSING
 import pl.szczodrzynski.edziennik.data.api.ERROR_PROFILE_MISSING
 import pl.szczodrzynski.edziennik.data.api.edziennik.template.DataTemplate
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
 
 class TemplateLoginWeb(val data: DataTemplate, val onSuccess: () -> Unit) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/DataVulcan.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/DataVulcan.kt
index e3516ad4..c6d797fa 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/DataVulcan.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/DataVulcan.kt
@@ -6,14 +6,14 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan
 
 import com.google.gson.JsonObject
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.crc16
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_VULCAN_HEBE
 import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_VULCAN_WEB_MAIN
 import pl.szczodrzynski.edziennik.data.api.models.Data
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.crc16
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.fslogin.realm.RealmData
 
 class DataVulcan(app: App, profile: Profile?, loginStore: LoginStore) : Data(app, profile, loginStore) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanHebe.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanHebe.kt
index a34e0a1b..170b1c5f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanHebe.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanHebe.kt
@@ -23,6 +23,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
 import pl.szczodrzynski.edziennik.data.db.entity.Subject
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.data.db.entity.Team
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanWebMain.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanWebMain.kt
index d32161a6..3c7f4bdf 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanWebMain.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanWebMain.kt
@@ -11,11 +11,11 @@ import im.wangchao.mhttp.Request
 import im.wangchao.mhttp.Response
 import im.wangchao.mhttp.callback.TextCallbackHandler
 import pl.droidsonroids.jspoon.Jspoon
-import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.login.CufsCertificate
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
 import java.io.File
@@ -175,7 +175,7 @@ open class VulcanWebMain(open val data: DataVulcan, open val lastSync: Long?) {
                     count++
                 }
                 schoolSymbols.removeAll {
-                    it.toLowerCase() == "default"
+                    it.lowercase() == "default"
                             || !it.matches(Regexes.VULCAN_WEB_SYMBOL_VALIDATE)
                 }
                 
@@ -280,7 +280,7 @@ open class VulcanWebMain(open val data: DataVulcan, open val lastSync: Long?) {
                     return
 
                 try {
-                    val json = JsonParser().parse(text).asJsonObject
+                    val json = JsonParser.parseString(text).asJsonObject
                     onSuccess(json, response)
                 } catch (e: Exception) {
                     data.error(ApiError(tag, EXCEPTION_VULCAN_WEB_REQUEST)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAddressbook.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAddressbook.kt
index 5069838e..13eeb8db 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAddressbook.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAddressbook.kt
@@ -17,7 +17,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Teacher.Companion.TYPE_PARENT
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher.Companion.TYPE_PARENTS_COUNCIL
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher.Companion.TYPE_STUDENT
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher.Companion.TYPE_TEACHER
-import kotlin.text.replace
+import pl.szczodrzynski.edziennik.ext.*
 
 class VulcanHebeAddressbook(
     override val data: DataVulcan,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAttendance.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAttendance.kt
index b3ebafa4..9f3dcaea 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAttendance.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeAttendance.kt
@@ -13,6 +13,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 
 class VulcanHebeAttendance(
     override val data: DataVulcan,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeExams.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeExams.kt
index 64b52e2b..308a3e26 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeExams.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeExams.kt
@@ -12,6 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 
 class VulcanHebeExams(
     override val data: DataVulcan,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGradeSummary.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGradeSummary.kt
index e38ac393..390b0383 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGradeSummary.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGradeSummary.kt
@@ -4,14 +4,14 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_GRADE_SUMMARY
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_GRADE_SUMMARY
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils
 
 class VulcanHebeGradeSummary(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGrades.kt
index 9c0591de..f345b9e5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGrades.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeGrades.kt
@@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 import java.text.DecimalFormat
 import kotlin.math.roundToInt
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeHomework.kt
index cb792e2c..06eea284 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeHomework.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeHomework.kt
@@ -4,7 +4,6 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe
 
-import pl.szczodrzynski.edziennik.asJsonObjectList
 import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_HOMEWORK
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_HOMEWORK
@@ -12,9 +11,10 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.getJsonArray
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.asJsonObjectList
+import pl.szczodrzynski.edziennik.ext.getJsonArray
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils
 
 class VulcanHebeHomework(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeLuckyNumber.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeLuckyNumber.kt
index 8ff1631b..bfa07399 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeLuckyNumber.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeLuckyNumber.kt
@@ -12,8 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.LuckyNumber
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.getInt
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import pl.szczodrzynski.edziennik.utils.models.Week
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMain.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMain.kt
index 5e2d31c0..3ec7203c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMain.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMain.kt
@@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_MAIN
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class VulcanHebeMain(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessages.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessages.kt
index eb4091e0..5d6e5da4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessages.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessages.kt
@@ -17,9 +17,9 @@ import pl.szczodrzynski.edziennik.data.db.entity.*
 import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_DELETED
 import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED
 import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_SENT
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.navlib.crc16
-import kotlin.text.replace
 
 class VulcanHebeMessages(
     override val data: DataVulcan,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessagesChangeStatus.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessagesChangeStatus.kt
index a5be03b9..bd86cfce 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessagesChangeStatus.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeMessagesChangeStatus.kt
@@ -5,7 +5,6 @@
 package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe
 
 import org.greenrobot.eventbus.EventBus
-import pl.szczodrzynski.edziennik.JsonObject
 import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_MESSAGES_STATUS
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
@@ -13,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.events.MessageGetEvent
 import pl.szczodrzynski.edziennik.data.db.entity.MessageRecipient
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
+import pl.szczodrzynski.edziennik.ext.JsonObject
 
 class VulcanHebeMessagesChangeStatus(
     override val data: DataVulcan,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeNotices.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeNotices.kt
index 5b67b272..be1e0545 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeNotices.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeNotices.kt
@@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Notice
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.*
 
 class VulcanHebeNotices(
     override val data: DataVulcan,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeSendMessage.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeSendMessage.kt
index 2e7b1491..e71c4089 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeSendMessage.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeSendMessage.kt
@@ -13,8 +13,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.api.events.MessageSentEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Message
-import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
+import pl.szczodrzynski.edziennik.ext.*
 
 class VulcanHebeSendMessage(
     override val data: DataVulcan,
@@ -88,7 +88,7 @@ class VulcanHebeSendMessage(
 
             VulcanHebeMessages(data, null) {
                 val message = data.messageList.firstOrNull { it.isSent && it.subject == subject }
-                val metadata = data.metadataList.firstOrNull { it.thingType == Metadata.TYPE_MESSAGE && it.thingId == messageId }
+                // val metadata = data.metadataList.firstOrNull { it.thingType == Metadata.TYPE_MESSAGE && it.thingId == messageId }
                 val event = MessageSentEvent(data.profileId, message, message?.addedDate)
 
                 EventBus.getDefault().postSticky(event)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTimetable.kt
index ffbb0289..c20cf1bf 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTimetable.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTimetable.kt
@@ -20,6 +20,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Lesson.Companion.TYPE_SHIFTED_S
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson.Companion.TYPE_SHIFTED_TARGET
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
+import pl.szczodrzynski.edziennik.ext.getBoolean
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getJsonObject
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Week
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/web/VulcanWebLuckyNumber.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/web/VulcanWebLuckyNumber.kt
index cbf24c2a..adb4363d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/web/VulcanWebLuckyNumber.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/web/VulcanWebLuckyNumber.kt
@@ -4,7 +4,6 @@
 
 package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.web
 
-import pl.szczodrzynski.edziennik.DAY
 import pl.szczodrzynski.edziennik.data.api.VULCAN_WEB_ENDPOINT_LUCKY_NUMBER
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_WEB_LUCKY_NUMBERS
@@ -12,7 +11,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanWebMain
 import pl.szczodrzynski.edziennik.data.db.entity.LuckyNumber
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
-import pl.szczodrzynski.edziennik.getJsonArray
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.getJsonArray
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import pl.szczodrzynski.edziennik.utils.models.Week
@@ -62,12 +62,12 @@ class VulcanWebLuckyNumber(override val data: DataVulcan,
                                     profile?.empty ?: false
                             ))
                 }
-            } ?: {
+            } ?: run {
                 // no lucky number
                 if (Date.getToday().weekDay <= Week.FRIDAY && Time.getNow().hour >= 22) {
                     // working days, after 10PM
                     // consider the lucky number is disabled; sync in 4 days
-                    nextSync = System.currentTimeMillis() + 4*DAY*1000
+                    nextSync = System.currentTimeMillis() + 4* DAY *1000
                 }
                 else if (Date.getToday().weekDay <= Week.FRIDAY && Time.getNow().hour < 22) {
                     // working days, before 10PM
@@ -77,7 +77,7 @@ class VulcanWebLuckyNumber(override val data: DataVulcan,
                     // weekends
                     nextSync = Week.getNearestWeekDayDate(Week.MONDAY).combineWith(Time(5, 0, 0))
                 }
-            }()
+            }
 
             data.setSyncNext(ENDPOINT_VULCAN_WEB_LUCKY_NUMBERS, SYNC_ALWAYS)
             onSuccess(ENDPOINT_VULCAN_WEB_LUCKY_NUMBERS)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/firstlogin/VulcanFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/firstlogin/VulcanFirstLogin.kt
index 2bf633f8..61502488 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/firstlogin/VulcanFirstLogin.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/firstlogin/VulcanFirstLogin.kt
@@ -17,6 +17,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.login.VulcanLoginWeb
 import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.getJsonObject
+import pl.szczodrzynski.edziennik.ext.getString
 
 class VulcanFirstLogin(val data: DataVulcan, val onSuccess: () -> Unit) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginHebe.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginHebe.kt
index ded6e937..241f249a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginHebe.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginHebe.kt
@@ -6,7 +6,6 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.login
 
 import com.google.gson.JsonObject
 import io.github.wulkanowy.signer.hebe.generateKeyPair
-import pl.szczodrzynski.edziennik.JsonObject
 import pl.szczodrzynski.edziennik.data.api.ERROR_LOGIN_DATA_MISSING
 import pl.szczodrzynski.edziennik.data.api.VULCAN_API_DEVICE_NAME
 import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_REGISTER_NEW
@@ -14,8 +13,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
-import pl.szczodrzynski.edziennik.getString
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.JsonObject
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 
 class VulcanLoginHebe(val data: DataVulcan, val onSuccess: () -> Unit) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginWebMain.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginWebMain.kt
index 2b62eb14..3160ceb2 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginWebMain.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginWebMain.kt
@@ -9,8 +9,8 @@ import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
 import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanWebMain
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.getString
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.fslogin.FSLogin
 import pl.szczodrzynski.fslogin.realm.toRealm
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/ApiError.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/ApiError.kt
index d99e16a2..bb5d20cc 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/ApiError.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/ApiError.kt
@@ -13,8 +13,8 @@ import pl.szczodrzynski.edziennik.data.api.ERROR_API_EXCEPTION
 import pl.szczodrzynski.edziennik.data.api.ERROR_EXCEPTION
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApiException
 import pl.szczodrzynski.edziennik.data.api.szkolny.request.ErrorReportRequest
-import pl.szczodrzynski.edziennik.stackTraceString
-import pl.szczodrzynski.edziennik.toErrorCode
+import pl.szczodrzynski.edziennik.ext.stackTraceString
+import pl.szczodrzynski.edziennik.ext.toErrorCode
 
 class ApiError(val tag: String, var errorCode: Int) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/Data.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/Data.kt
index 68d7a17e..0f882a04 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/Data.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/models/Data.kt
@@ -7,11 +7,14 @@ import androidx.core.util.size
 import androidx.room.OnConflictStrategy
 import com.google.gson.JsonObject
 import im.wangchao.mhttp.Response
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.BuildConfig
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.ERROR_REQUEST_FAILURE
 import pl.szczodrzynski.edziennik.data.api.interfaces.EndpointCallback
 import pl.szczodrzynski.edziennik.data.db.AppDb
 import pl.szczodrzynski.edziennik.data.db.entity.*
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyApi.kt
index 3b574b96..1996b1a3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyApi.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyApi.kt
@@ -28,9 +28,12 @@ import pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage
 import pl.szczodrzynski.edziennik.data.db.entity.Notification
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.ui.modules.error.ErrorDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.error.ErrorSnackbar
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginInfo
+import pl.szczodrzynski.edziennik.ext.md5
+import pl.szczodrzynski.edziennik.ext.toApiError
+import pl.szczodrzynski.edziennik.ext.toErrorCode
+import pl.szczodrzynski.edziennik.ui.error.ErrorDetailsDialog
+import pl.szczodrzynski.edziennik.ui.error.ErrorSnackbar
+import pl.szczodrzynski.edziennik.ui.login.LoginInfo
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import retrofit2.Response
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyService.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyService.kt
index 26a9a44e..0e86a7bd 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyService.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/SzkolnyService.kt
@@ -6,7 +6,7 @@ package pl.szczodrzynski.edziennik.data.api.szkolny
 
 import pl.szczodrzynski.edziennik.data.api.szkolny.request.*
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.*
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginInfo
+import pl.szczodrzynski.edziennik.ui.login.LoginInfo
 import retrofit2.Call
 import retrofit2.http.*
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/ApiCacheInterceptor.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/ApiCacheInterceptor.kt
index 19a84546..f1f8e341 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/ApiCacheInterceptor.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/ApiCacheInterceptor.kt
@@ -7,7 +7,7 @@ package pl.szczodrzynski.edziennik.data.api.szkolny.interceptor
 import okhttp3.*
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.ApiResponse
-import pl.szczodrzynski.edziennik.md5
+import pl.szczodrzynski.edziennik.ext.md5
 
 class ApiCacheInterceptor(val app: App) : Interceptor {
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/SignatureInterceptor.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/SignatureInterceptor.kt
index 30d0ec7e..b766cea5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/SignatureInterceptor.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/SignatureInterceptor.kt
@@ -6,7 +6,12 @@ package pl.szczodrzynski.edziennik.data.api.szkolny.interceptor
 
 import okhttp3.Interceptor
 import okhttp3.Response
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.BuildConfig
+import pl.szczodrzynski.edziennik.ext.bodyToString
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.hmacSHA1
+import pl.szczodrzynski.edziennik.ext.md5
 
 class SignatureInterceptor(val app: App) : Interceptor {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt
index 2df7f141..4bcafcd8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt
@@ -9,7 +9,7 @@ import android.content.pm.PackageInfo
 import android.content.pm.PackageManager
 import android.util.Base64
 import pl.szczodrzynski.edziennik.BuildConfig
-import pl.szczodrzynski.edziennik.sha256
+import pl.szczodrzynski.edziennik.ext.sha256
 import java.security.MessageDigest
 
 object Signing {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/response/RegisterAvailabilityStatus.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/response/RegisterAvailabilityStatus.kt
index 82f2e050..617a7167 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/response/RegisterAvailabilityStatus.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/response/RegisterAvailabilityStatus.kt
@@ -5,15 +5,15 @@
 package pl.szczodrzynski.edziennik.data.api.szkolny.response
 
 import pl.szczodrzynski.edziennik.BuildConfig
-import pl.szczodrzynski.edziennik.DAY
-import pl.szczodrzynski.edziennik.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
 
 data class RegisterAvailabilityStatus(
-        val available: Boolean,
-        val name: String?,
-        val userMessage: Message?,
-        val nextCheckAt: Long = currentTimeUnix() + 7 * DAY,
-        val minVersionCode: Int = BuildConfig.VERSION_CODE
+    val available: Boolean,
+    val name: String?,
+    val userMessage: Message?,
+    val nextCheckAt: Long = currentTimeUnix() + 7 * DAY,
+    val minVersionCode: Int = BuildConfig.VERSION_CODE
 ) {
     data class Message(
             val title: String,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/AppSync.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/AppSync.kt
index 15482c53..f0c2f72e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/AppSync.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/AppSync.kt
@@ -11,7 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApiException
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Notification
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.toErrorCode
+import pl.szczodrzynski.edziennik.ext.toErrorCode
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class AppSync(val app: App, val notifications: MutableList<Notification>, val profiles: List<Profile>, val api: SzkolnyApi) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt
index 69f44523..3913709a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt
@@ -8,7 +8,7 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.*
-import pl.szczodrzynski.edziennik.getNotificationTitle
+import pl.szczodrzynski.edziennik.ext.getNotificationTitle
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Week
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt
index 6597125a..8b4682d6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt
@@ -13,6 +13,9 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
 import com.mikepenz.iconics.utils.*
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_SERVER_MESSAGE
+import pl.szczodrzynski.edziennik.ext.Intent
+import pl.szczodrzynski.edziennik.ext.asBoldSpannable
+import pl.szczodrzynski.edziennik.ext.concat
 import pl.szczodrzynski.edziennik.utils.models.Time
 import pl.szczodrzynski.edziennik.data.db.entity.Notification as AppNotification
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/SzkolnyTask.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/SzkolnyTask.kt
index 3ac80495..7b4931bc 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/SzkolnyTask.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/SzkolnyTask.kt
@@ -5,12 +5,12 @@
 package pl.szczodrzynski.edziennik.data.api.task
 
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.HOUR
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikCallback
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.db.entity.Notification
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.HOUR
 import pl.szczodrzynski.edziennik.utils.Utils.d
 
 class SzkolnyTask(val app: App, val syncingProfiles: List<Profile>) : IApiTask(-1) {
@@ -36,7 +36,7 @@ class SzkolnyTask(val app: App, val syncingProfiles: List<Profile>) : IApiTask(-
         //    - every 24 hours && any profile is registered
         //    - if there are new notifications && any browser is paired
         val shouldAppSync =
-                System.currentTimeMillis() - app.config.sync.lastAppSync > 24*HOUR*1000
+                System.currentTimeMillis() - app.config.sync.lastAppSync > 24* HOUR *1000
                         && appSyncProfiles.isNotEmpty()
                         || notificationList.isNotEmpty()
                         && app.config.sync.webPushEnabled
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Event.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Event.kt
index af313865..795bad85 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Event.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Event.kt
@@ -8,9 +8,9 @@ import androidx.room.Entity
 import androidx.room.Ignore
 import androidx.room.Index
 import com.google.gson.annotations.SerializedName
-import pl.szczodrzynski.edziennik.MINUTE
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.MINUTE
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import java.util.*
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/LoginStore.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/LoginStore.kt
index 192bd1f6..32c0d7e7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/LoginStore.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/LoginStore.kt
@@ -8,7 +8,7 @@ import android.os.Bundle
 import androidx.room.ColumnInfo
 import androidx.room.Entity
 import com.google.gson.JsonObject
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.ext.*
 
 @Entity(tableName = "loginStores", primaryKeys = ["loginStoreId"])
 class LoginStore(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Message.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Message.kt
index 927e6d1d..18a87df7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Message.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Message.kt
@@ -7,7 +7,7 @@ import androidx.room.ColumnInfo
 import androidx.room.Entity
 import androidx.room.Ignore
 import androidx.room.Index
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 
 @Entity(tableName = "messages",
         primaryKeys = ["profileId", "messageId"],
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt
index 9c2552a6..d34eda1e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt
@@ -15,8 +15,10 @@ import androidx.room.Entity
 import androidx.room.Ignore
 import com.google.gson.JsonObject
 import pl.droidsonroids.gif.GifDrawable
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.api.*
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.ProfileImageHolder
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.navlib.ImageHolder
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Subject.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Subject.java
index a034c785..1a4c46e4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Subject.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Subject.java
@@ -9,7 +9,7 @@ import androidx.room.Entity;
 
 import java.util.List;
 
-import pl.szczodrzynski.edziennik.ExtensionsKt;
+import pl.szczodrzynski.edziennik.ext.GraphicsExtensionsKt;
 
 @Entity(tableName = "subjects",
         primaryKeys = {"profileId", "subjectId"})
@@ -31,7 +31,7 @@ public class Subject {
         this.id = id;
         this.longName = longName;
         this.shortName = shortName;
-        this.color = ExtensionsKt.colorFromName(longName);
+        this.color = GraphicsExtensionsKt.colorFromName(longName);
     }
 
     @Override
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Teacher.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Teacher.kt
index cf5aa195..c0cb2a97 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Teacher.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Teacher.kt
@@ -9,7 +9,10 @@ import android.graphics.Bitmap
 import androidx.room.ColumnInfo
 import androidx.room.Entity
 import androidx.room.Ignore
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.R
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.getNameInitials
+import pl.szczodrzynski.edziennik.ext.join
 import java.util.*
 
 @Entity(tableName = "teachers",
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/EventFull.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/EventFull.kt
index 5e3e62de..bfa6954b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/EventFull.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/EventFull.kt
@@ -6,7 +6,7 @@ package pl.szczodrzynski.edziennik.data.db.full
 import androidx.room.Ignore
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
-import pl.szczodrzynski.edziennik.ui.modules.search.Searchable
+import pl.szczodrzynski.edziennik.ui.search.Searchable
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/MessageFull.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/MessageFull.kt
index 8ff6fd73..c3bf8543 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/MessageFull.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/full/MessageFull.kt
@@ -7,7 +7,7 @@ import androidx.room.Ignore
 import androidx.room.Relation
 import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.data.db.entity.MessageRecipient
-import pl.szczodrzynski.edziennik.ui.modules.search.Searchable
+import pl.szczodrzynski.edziennik.ui.search.Searchable
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 
 class MessageFull(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration72.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration72.kt
index 88567b47..65f9c4ce 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration72.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration72.kt
@@ -6,7 +6,7 @@ package pl.szczodrzynski.edziennik.data.db.migration
 
 import androidx.room.migration.Migration
 import androidx.sqlite.db.SupportSQLiteDatabase
-import pl.szczodrzynski.edziennik.crc32
+import pl.szczodrzynski.edziennik.ext.crc32
 
 class Migration72 : Migration(71, 72) {
     override fun migrate(database: SupportSQLiteDatabase) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration92.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration92.kt
index 4b36c0e9..3010a371 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration92.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration92.kt
@@ -13,7 +13,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Event.Companion.TYPE_ELEARNING
 import pl.szczodrzynski.edziennik.data.db.entity.Event.Companion.TYPE_INFORMATION
 import pl.szczodrzynski.edziennik.data.db.entity.EventType.Companion.SOURCE_DEFAULT
 import pl.szczodrzynski.edziennik.data.db.entity.EventType.Companion.SOURCE_REGISTER
-import pl.szczodrzynski.edziennik.getInt
+import pl.szczodrzynski.edziennik.ext.getInt
 
 class Migration92 : Migration(91, 92) {
     override fun migrate(database: SupportSQLiteDatabase) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt
index 6396a87c..80dcd4ea 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt
@@ -13,7 +13,7 @@ import com.google.firebase.iid.zzad
 import com.google.firebase.iid.zzaz
 import com.google.firebase.messaging.zzc
 import com.google.gson.JsonObject
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.ext.*
 import java.util.*
 import com.google.firebase.messaging.zzo.zza as logNotificationOpen
 import com.google.firebase.messaging.zzo.zza as logNotificationReceived
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyAppFirebase.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyAppFirebase.kt
index 13eb0980..da822462 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyAppFirebase.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyAppFirebase.kt
@@ -15,6 +15,10 @@ import pl.szczodrzynski.edziennik.data.api.szkolny.response.RegisterAvailability
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.Update
 import pl.szczodrzynski.edziennik.data.api.task.PostNotifications
 import pl.szczodrzynski.edziennik.data.db.entity.*
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getNotificationTitle
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.sync.UpdateWorker
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
@@ -104,7 +108,7 @@ class SzkolnyAppFirebase(val app: App, val profiles: List<Profile>, val message:
     }
 
     private fun sharedEvent(teamCode: String, jsonStr: String, message: String) {
-        val json = JsonParser().parse(jsonStr).asJsonObject
+        val json = JsonParser.parseString(jsonStr).asJsonObject
         val teams = app.db.teamDao().allNow
         // not used, as the server provides a sharing message
         //val eventTypes = app.db.eventTypeDao().allNow
@@ -188,8 +192,7 @@ class SzkolnyAppFirebase(val app: App, val profiles: List<Profile>, val message:
 
             if (!notificationFilter.contains(Notification.TYPE_REMOVED_SHARED_EVENT)) {
                 val notification = Notification(
-                        id = Notification.buildId(profile.id
-                                ?: 0, Notification.TYPE_REMOVED_SHARED_EVENT, eventId),
+                        id = Notification.buildId(profile.id, Notification.TYPE_REMOVED_SHARED_EVENT, eventId),
                         title = app.getNotificationTitle(Notification.TYPE_REMOVED_SHARED_EVENT),
                         text = message,
                         type = Notification.TYPE_REMOVED_SHARED_EVENT,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt
index cc59faf4..a9a183e5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt
@@ -11,7 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.api.edziennik.librus.*
 import pl.szczodrzynski.edziennik.data.api.task.IApiTask
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getString
 
 class SzkolnyLibrusFirebase(val app: App, val profiles: List<Profile>, val message: FirebaseService.Message) {
     /*{
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyMobidziennikFirebase.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyMobidziennikFirebase.kt
index b097dbed..d5b6c077 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyMobidziennikFirebase.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyMobidziennikFirebase.kt
@@ -14,8 +14,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.api.task.IApiTask
 import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.getLong
-import pl.szczodrzynski.edziennik.getString
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getString
 
 class SzkolnyMobidziennikFirebase(val app: App, val profiles: List<Profile>, val message: FirebaseService.Message) {
     /*{
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyVulcanFirebase.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyVulcanFirebase.kt
index 06c2f171..74ccdd85 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyVulcanFirebase.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyVulcanFirebase.kt
@@ -10,6 +10,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.api.task.IApiTask
 import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getString
+import pl.szczodrzynski.edziennik.ext.toJsonObject
 import java.util.*
 
 class SzkolnyVulcanFirebase(val app: App, val profiles: List<Profile>, val message: FirebaseService.Message) {
@@ -32,7 +35,7 @@ class SzkolnyVulcanFirebase(val app: App, val profiles: List<Profile>, val messa
         val loginId = data.getInt("loginid")
 
         /* pl.vulcan.uonetmobile.auxilary.enums.CDCPushEnum */
-        val viewIdPair = when (type.toLowerCase(Locale.ROOT)) {
+        val viewIdPair = when (type.lowercase()) {
             "wiadomosc" -> MainActivity.DRAWER_ITEM_MESSAGES to Message.TYPE_RECEIVED
             "ocena" -> MainActivity.DRAWER_ITEM_GRADES to 0
             "uwaga" -> MainActivity.DRAWER_ITEM_BEHAVIOUR to 0
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/ArrayExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/ArrayExtensions.kt
new file mode 100644
index 00000000..34da3ec0
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/ArrayExtensions.kt
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.text.SpannableStringBuilder
+import android.text.Spanned
+import android.text.SpannedString
+import android.util.LongSparseArray
+import android.util.SparseArray
+import android.util.SparseIntArray
+import androidx.core.util.forEach
+import java.util.*
+
+fun <T> Collection<T>?.isNotNullNorEmpty(): Boolean {
+    return this != null && this.isNotEmpty()
+}
+
+fun List<String>.join(delimiter: String): String {
+    return concat(delimiter).toString()
+}
+
+fun <T> LongSparseArray<T>.values(): List<T> {
+    val result = mutableListOf<T>()
+    forEach { _, value ->
+        result += value
+    }
+    return result
+}
+
+fun SparseArray<*>.keys(): List<Int> {
+    val result = mutableListOf<Int>()
+    forEach { key, _ ->
+        result += key
+    }
+    return result
+}
+fun <T> SparseArray<T>.values(): List<T> {
+    val result = mutableListOf<T>()
+    forEach { _, value ->
+        result += value
+    }
+    return result
+}
+
+fun SparseIntArray.keys(): List<Int> {
+    val result = mutableListOf<Int>()
+    forEach { key, _ ->
+        result += key
+    }
+    return result
+}
+fun SparseIntArray.values(): List<Int> {
+    val result = mutableListOf<Int>()
+    forEach { _, value ->
+        result += value
+    }
+    return result
+}
+
+fun <K, V> List<Pair<K, V>>.keys(): List<K> {
+    val result = mutableListOf<K>()
+    forEach { pair ->
+        result += pair.first
+    }
+    return result
+}
+fun <K, V> List<Pair<K, V>>.values(): List<V> {
+    val result = mutableListOf<V>()
+    forEach { pair ->
+        result += pair.second
+    }
+    return result
+}
+
+fun <T> List<T>.toSparseArray(destination: SparseArray<T>, key: (T) -> Int) {
+    forEach {
+        destination.put(key(it), it)
+    }
+}
+fun <T> List<T>.toSparseArray(destination: LongSparseArray<T>, key: (T) -> Long) {
+    forEach {
+        destination.put(key(it), it)
+    }
+}
+
+fun <T> List<T>.toSparseArray(key: (T) -> Int): SparseArray<T> {
+    val result = SparseArray<T>()
+    toSparseArray(result, key)
+    return result
+}
+fun <T> List<T>.toSparseArray(key: (T) -> Long): LongSparseArray<T> {
+    val result = LongSparseArray<T>()
+    toSparseArray(result, key)
+    return result
+}
+
+fun <T> SparseArray<T>.singleOrNull(predicate: (T) -> Boolean): T? {
+    forEach { _, value ->
+        if (predicate(value))
+            return value
+    }
+    return null
+}
+fun <T> LongSparseArray<T>.singleOrNull(predicate: (T) -> Boolean): T? {
+    forEach { _, value ->
+        if (predicate(value))
+            return value
+    }
+    return null
+}
+
+/**
+ * Returns a new read-only list only of those given elements, that are not empty.
+ * Applies for CharSequence and descendants.
+ */
+fun <T : CharSequence> listOfNotEmpty(vararg elements: T): List<T> = elements.filterNot { it.isEmpty() }
+
+fun List<CharSequence?>.concat(delimiter: CharSequence? = null): CharSequence {
+    if (this.isEmpty()) {
+        return ""
+    }
+
+    if (this.size == 1) {
+        return this[0] ?: ""
+    }
+
+    var spanned = delimiter is Spanned
+    if (!spanned) {
+        for (piece in this) {
+            if (piece is Spanned) {
+                spanned = true
+                break
+            }
+        }
+    }
+
+    var first = true
+    if (spanned) {
+        val ssb = SpannableStringBuilder()
+        for (piece in this) {
+            if (piece == null)
+                continue
+            if (!first && delimiter != null)
+                ssb.append(delimiter)
+            first = false
+            ssb.append(piece)
+        }
+        return SpannedString(ssb)
+    } else {
+        val sb = StringBuilder()
+        for (piece in this) {
+            if (piece == null)
+                continue
+            if (!first && delimiter != null)
+                sb.append(delimiter)
+            first = false
+            sb.append(piece)
+        }
+        return sb.toString()
+    }
+}
+
+inline fun <T> List<T>.ifNotEmpty(block: (List<T>) -> Unit) {
+    if (!isEmpty())
+        block(this)
+}
+
+inline fun <T> LongSparseArray<T>.filter(predicate: (T) -> Boolean): List<T> {
+    val destination = ArrayList<T>()
+    this.forEach { _, element -> if (predicate(element)) destination.add(element) }
+    return destination
+}
+
+fun CharSequence.containsAll(list: List<CharSequence>, ignoreCase: Boolean = false): Boolean {
+    for (i in list) {
+        if (!contains(i, ignoreCase))
+            return false
+    }
+    return true
+}
+
+fun <E> MutableList<E>.after(what: E, insert: E) {
+    val index = indexOf(what)
+    if (index != -1)
+        add(index + 1, insert)
+}
+
+fun <E> MutableList<E>.before(what: E, insert: E) {
+    val index = indexOf(what)
+    if (index != -1)
+        add(index, insert)
+}
+
+fun <E> MutableList<E>.after(what: E, insert: Collection<E>) {
+    val index = indexOf(what)
+    if (index != -1)
+        addAll(index + 1, insert)
+}
+
+fun <E> MutableList<E>.before(what: E, insert: Collection<E>) {
+    val index = indexOf(what)
+    if (index != -1)
+        addAll(index, insert)
+}
+
+operator fun <K, V> Iterable<Pair<K, V>>.get(key: K): V? {
+    return firstOrNull { it.first == key }?.second
+}
+
+@kotlin.jvm.JvmName("averageOrNullOfInt")
+fun Iterable<Int>.averageOrNull() = this.average().let { if (it.isNaN()) null else it }
+@kotlin.jvm.JvmName("averageOrNullOfFloat")
+fun Iterable<Float>.averageOrNull() = this.average().let { if (it.isNaN()) null else it }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/BundleExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/BundleExtensions.kt
new file mode 100644
index 00000000..cc6488bd
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/BundleExtensions.kt
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import android.os.Parcelable
+import com.google.gson.JsonObject
+
+fun Bundle?.getInt(key: String, defaultValue: Int): Int {
+    return this?.getInt(key, defaultValue) ?: defaultValue
+}
+fun Bundle?.getLong(key: String, defaultValue: Long): Long {
+    return this?.getLong(key, defaultValue) ?: defaultValue
+}
+fun Bundle?.getFloat(key: String, defaultValue: Float): Float {
+    return this?.getFloat(key, defaultValue) ?: defaultValue
+}
+fun Bundle?.getString(key: String, defaultValue: String): String {
+    return this?.getString(key, defaultValue) ?: defaultValue
+}
+
+fun Bundle?.getIntOrNull(key: String): Int? {
+    return this?.get(key) as? Int
+}
+
+@Suppress("UNCHECKED_CAST")
+fun <T : Any> Bundle?.get(key: String): T? {
+    return this?.get(key) as? T?
+}
+
+@Suppress("UNCHECKED_CAST")
+fun Bundle(vararg properties: Pair<String, Any?>): Bundle {
+    return Bundle().apply {
+        for (property in properties) {
+            when (property.second) {
+                is String -> putString(property.first, property.second as String?)
+                is Char -> putChar(property.first, property.second as Char)
+                is Int -> putInt(property.first, property.second as Int)
+                is Long -> putLong(property.first, property.second as Long)
+                is Float -> putFloat(property.first, property.second as Float)
+                is Short -> putShort(property.first, property.second as Short)
+                is Double -> putDouble(property.first, property.second as Double)
+                is Boolean -> putBoolean(property.first, property.second as Boolean)
+                is Bundle -> putBundle(property.first, property.second as Bundle)
+                is Parcelable -> putParcelable(property.first, property.second as Parcelable)
+                is Array<*> -> putParcelableArray(property.first, property.second as Array<out Parcelable>)
+            }
+        }
+    }
+}
+fun Intent(action: String? = null, vararg properties: Pair<String, Any?>): Intent {
+    return Intent(action).putExtras(Bundle(*properties))
+}
+fun Intent(packageContext: Context, cls: Class<*>, vararg properties: Pair<String, Any?>): Intent {
+    return Intent(packageContext, cls).putExtras(Bundle(*properties))
+}
+
+fun Bundle.toJsonObject(): JsonObject {
+    val json = JsonObject()
+    keySet()?.forEach { key ->
+        get(key)?.let {
+            when (it) {
+                is String -> json.addProperty(key, it)
+                is Char -> json.addProperty(key, it)
+                is Int -> json.addProperty(key, it)
+                is Long -> json.addProperty(key, it)
+                is Float -> json.addProperty(key, it)
+                is Short -> json.addProperty(key, it)
+                is Double -> json.addProperty(key, it)
+                is Boolean -> json.addProperty(key, it)
+                is Bundle -> json.add(key, it.toJsonObject())
+                else -> json.addProperty(key, it.toString())
+            }
+        }
+    }
+    return json
+}
+fun Intent.toJsonObject() = extras?.toJsonObject()
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/ContextExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/ContextExtensions.kt
new file mode 100644
index 00000000..395b0102
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/ContextExtensions.kt
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.content.Context
+import android.os.Build
+import java.util.*
+
+fun Context.setLanguage(language: String) {
+    val locale = Locale(language.lowercase())
+    val configuration = resources.configuration
+    Locale.setDefault(locale)
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+        configuration.setLocale(locale)
+    }
+    configuration.locale = locale
+    resources.updateConfiguration(configuration, resources.displayMetrics)
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/CryptoExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/CryptoExtensions.kt
new file mode 100644
index 00000000..f1a67e37
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/CryptoExtensions.kt
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.util.Base64
+import java.math.BigInteger
+import java.nio.charset.Charset
+import java.security.MessageDigest
+import java.util.zip.CRC32
+import javax.crypto.Mac
+import javax.crypto.spec.SecretKeySpec
+
+fun String.crc16(): Int {
+    var crc = 0xFFFF
+    for (aBuffer in this) {
+        crc = crc.ushr(8) or (crc shl 8) and 0xffff
+        crc = crc xor (aBuffer.code and 0xff) // byte to int, trunc sign
+        crc = crc xor (crc and 0xff shr 4)
+        crc = crc xor (crc shl 12 and 0xffff)
+        crc = crc xor (crc and 0xFF shl 5 and 0xffff)
+    }
+    crc = crc and 0xffff
+    return crc + 32768
+}
+
+fun String.crc32(): Long {
+    val crc = CRC32()
+    crc.update(toByteArray())
+    return crc.value
+}
+
+fun String.hmacSHA1(password: String): String {
+    val key = SecretKeySpec(password.toByteArray(), "HmacSHA1")
+
+    val mac = Mac.getInstance("HmacSHA1").apply {
+        init(key)
+        update(this@hmacSHA1.toByteArray())
+    }
+
+    return Base64.encodeToString(mac.doFinal(), Base64.NO_WRAP)
+}
+
+fun String.md5(): String {
+    val md = MessageDigest.getInstance("MD5")
+    return BigInteger(1, md.digest(toByteArray())).toString(16).padStart(32, '0')
+}
+
+fun String.sha1Hex(): String {
+    val md = MessageDigest.getInstance("SHA-1")
+    md.update(toByteArray())
+    return md.digest().joinToString("") { "%02x".format(it) }
+}
+
+fun String.sha256(): ByteArray {
+    val md = MessageDigest.getInstance("SHA-256")
+    md.update(toByteArray())
+    return md.digest()
+}
+
+fun String.base64Encode(): String {
+    return Base64.encodeToString(toByteArray(), Base64.NO_WRAP)
+}
+fun ByteArray.base64Encode(): String {
+    return Base64.encodeToString(this, Base64.NO_WRAP)
+}
+fun String.base64Decode(): ByteArray {
+    return Base64.decode(this, Base64.DEFAULT)
+}
+fun String.base64DecodeToString(): String {
+    return Base64.decode(this, Base64.DEFAULT).toString(Charset.defaultCharset())
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/DataExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/DataExtensions.kt
new file mode 100644
index 00000000..663a58c4
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/DataExtensions.kt
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.content.Context
+import android.util.LongSparseArray
+import androidx.core.util.forEach
+import com.google.android.material.datepicker.CalendarConstraints
+import com.google.gson.JsonElement
+import pl.szczodrzynski.edziennik.R
+import pl.szczodrzynski.edziennik.data.db.entity.Notification
+import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.data.db.entity.Teacher
+import pl.szczodrzynski.edziennik.data.db.entity.Team
+
+fun List<Teacher>.byId(id: Long) = firstOrNull { it.id == id }
+fun List<Teacher>.byNameFirstLast(nameFirstLast: String) = firstOrNull { it.name + " " + it.surname == nameFirstLast }
+fun List<Teacher>.byNameLastFirst(nameLastFirst: String) = firstOrNull { it.surname + " " + it.name == nameLastFirst }
+fun List<Teacher>.byNameFDotLast(nameFDotLast: String) = firstOrNull { it.name + "." + it.surname == nameFDotLast }
+fun List<Teacher>.byNameFDotSpaceLast(nameFDotSpaceLast: String) = firstOrNull { it.name + ". " + it.surname == nameFDotSpaceLast }
+
+fun List<Profile>.filterOutArchived() = this.filter { !it.archived }
+
+fun List<Team>.getById(id: Long): Team? {
+    return singleOrNull { it.id == id }
+}
+
+fun LongSparseArray<Team>.getById(id: Long): Team? {
+    forEach { _, value ->
+        if (value.id == id)
+            return value
+    }
+    return null
+}
+
+operator fun Profile.set(key: String, value: JsonElement) = this.studentData.add(key, value)
+operator fun Profile.set(key: String, value: Boolean) = this.studentData.addProperty(key, value)
+operator fun Profile.set(key: String, value: String?) = this.studentData.addProperty(key, value)
+operator fun Profile.set(key: String, value: Number) = this.studentData.addProperty(key, value)
+operator fun Profile.set(key: String, value: Char) = this.studentData.addProperty(key, value)
+
+fun Context.getNotificationTitle(type: Int): String {
+    return getString(when (type) {
+        Notification.TYPE_UPDATE -> R.string.notification_type_update
+        Notification.TYPE_ERROR -> R.string.notification_type_error
+        Notification.TYPE_TIMETABLE_CHANGED -> R.string.notification_type_timetable_change
+        Notification.TYPE_TIMETABLE_LESSON_CHANGE -> R.string.notification_type_timetable_lesson_change
+        Notification.TYPE_NEW_GRADE -> R.string.notification_type_new_grade
+        Notification.TYPE_NEW_EVENT -> R.string.notification_type_new_event
+        Notification.TYPE_NEW_HOMEWORK -> R.string.notification_type_new_homework
+        Notification.TYPE_NEW_SHARED_EVENT -> R.string.notification_type_new_shared_event
+        Notification.TYPE_NEW_SHARED_HOMEWORK -> R.string.notification_type_new_shared_homework
+        Notification.TYPE_REMOVED_SHARED_EVENT -> R.string.notification_type_removed_shared_event
+        Notification.TYPE_NEW_MESSAGE -> R.string.notification_type_new_message
+        Notification.TYPE_NEW_NOTICE -> R.string.notification_type_notice
+        Notification.TYPE_NEW_ATTENDANCE -> R.string.notification_type_attendance
+        Notification.TYPE_SERVER_MESSAGE -> R.string.notification_type_server_message
+        Notification.TYPE_LUCKY_NUMBER -> R.string.notification_type_lucky_number
+        Notification.TYPE_FEEDBACK_MESSAGE -> R.string.notification_type_feedback_message
+        Notification.TYPE_NEW_ANNOUNCEMENT -> R.string.notification_type_new_announcement
+        Notification.TYPE_AUTO_ARCHIVING -> R.string.notification_type_auto_archiving
+        Notification.TYPE_TEACHER_ABSENCE -> R.string.notification_type_new_teacher_absence
+        Notification.TYPE_GENERAL -> R.string.notification_type_general
+        else -> R.string.notification_type_general
+    })
+}
+
+fun Profile.getSchoolYearConstrains(): CalendarConstraints {
+    return CalendarConstraints.Builder()
+        .setStart(dateSemester1Start.inMillisUtc)
+        .setEnd(dateYearEnd.inMillisUtc)
+        .build()
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/DialogExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/DialogExtensions.kt
similarity index 77%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/DialogExtensions.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ext/DialogExtensions.kt
index 5bf46d16..a918e60b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/DialogExtensions.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/DialogExtensions.kt
@@ -2,16 +2,16 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs
+package pl.szczodrzynski.edziennik.ext
 
 import android.text.InputType
 import android.view.LayoutInflater
+import androidx.annotation.StringRes
 import androidx.core.view.isVisible
 import androidx.core.widget.addTextChangedListener
 import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import com.google.android.material.textfield.TextInputEditText
 import pl.szczodrzynski.edziennik.databinding.DialogEditTextBinding
-import pl.szczodrzynski.edziennik.isNotNullNorBlank
 
 fun MaterialAlertDialogBuilder.input(
     message: CharSequence? = null,
@@ -42,3 +42,13 @@ fun MaterialAlertDialogBuilder.input(
 
     return this
 }
+
+fun MaterialAlertDialogBuilder.setTitle(@StringRes resId: Int, vararg formatArgs: Any): MaterialAlertDialogBuilder {
+    setTitle(context.getString(resId, *formatArgs))
+    return this
+}
+
+fun MaterialAlertDialogBuilder.setMessage(@StringRes resId: Int, vararg formatArgs: Any): MaterialAlertDialogBuilder {
+    setMessage(context.getString(resId, *formatArgs))
+    return this
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/GraphicsExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/GraphicsExtensions.kt
new file mode 100644
index 00000000..43000d20
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/GraphicsExtensions.kt
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.content.Context
+import android.content.res.ColorStateList
+import android.graphics.PorterDuff
+import android.graphics.PorterDuffColorFilter
+import android.graphics.drawable.Drawable
+import android.util.TypedValue
+import androidx.annotation.AttrRes
+import androidx.annotation.ColorInt
+import androidx.annotation.ColorRes
+import androidx.annotation.DrawableRes
+import androidx.core.content.res.ResourcesCompat
+import com.mikepenz.iconics.typeface.IIcon
+import pl.szczodrzynski.navlib.ImageHolder
+
+fun colorFromName(name: String?): Int {
+    val i = (name ?: "").crc32()
+    return when ((i / 10 % 16 + 1).toInt()) {
+        13 -> 0xffF44336
+        4  -> 0xffF50057
+        2  -> 0xffD500F9
+        9  -> 0xff6200EA
+        5  -> 0xffFFAB00
+        1  -> 0xff304FFE
+        6  -> 0xff40C4FF
+        14 -> 0xff26A69A
+        15 -> 0xff00C853
+        7  -> 0xffFFD600
+        3  -> 0xffFF3D00
+        8  -> 0xffDD2C00
+        10 -> 0xff795548
+        12 -> 0xff2979FF
+        11 -> 0xffFF6D00
+        else -> 0xff64DD17
+    }.toInt()
+}
+
+fun colorFromCssName(name: String): Int {
+    return when (name) {
+        "red" -> 0xffff0000
+        "green" -> 0xff008000
+        "blue" -> 0xff0000ff
+        "violet" -> 0xffee82ee
+        "brown" -> 0xffa52a2a
+        "orange" -> 0xffffa500
+        "black" -> 0xff000000
+        "white" -> 0xffffffff
+        else -> -1L
+    }.toInt()
+}
+
+@ColorInt
+fun @receiver:AttrRes Int.resolveAttr(context: Context?): Int {
+    val typedValue = TypedValue()
+    context?.theme?.resolveAttribute(this, typedValue, true)
+    return typedValue.data
+}
+@ColorInt
+fun @receiver:ColorRes Int.resolveColor(context: Context): Int {
+    return ResourcesCompat.getColor(context.resources, this, context.theme)
+}
+fun @receiver:DrawableRes Int.resolveDrawable(context: Context): Drawable {
+    return ResourcesCompat.getDrawable(context.resources, this, context.theme)!!
+}
+
+fun Int.toColorStateList(): ColorStateList {
+    val states = arrayOf(
+        intArrayOf( android.R.attr.state_enabled ),
+        intArrayOf(-android.R.attr.state_enabled ),
+        intArrayOf(-android.R.attr.state_checked ),
+        intArrayOf( android.R.attr.state_pressed )
+    )
+
+    val colors = intArrayOf(
+        this,
+        this,
+        this,
+        this
+    )
+
+    return ColorStateList(states, colors)
+}
+
+fun Drawable.setTintColor(color: Int): Drawable {
+    colorFilter = PorterDuffColorFilter(
+        color,
+        PorterDuff.Mode.SRC_ATOP
+    )
+    return this
+}
+
+fun IIcon.toImageHolder() = ImageHolder(this)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/JsonExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/JsonExtensions.kt
new file mode 100644
index 00000000..9f0db8ad
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/JsonExtensions.kt
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.os.Bundle
+import com.google.gson.JsonArray
+import com.google.gson.JsonElement
+import com.google.gson.JsonObject
+import com.google.gson.JsonParser
+import com.google.gson.JsonPrimitive
+
+fun JsonObject?.get(key: String): JsonElement? = this?.get(key)
+
+fun JsonObject?.getBoolean(key: String): Boolean? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asBoolean }
+fun JsonObject?.getString(key: String): String? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asString }
+fun JsonObject?.getInt(key: String): Int? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asInt }
+fun JsonObject?.getLong(key: String): Long? = get(key)?.let { if (!it.isJsonPrimitive) null else it.asLong }
+fun JsonObject?.getFloat(key: String): Float? = get(key)?.let { if(!it.isJsonPrimitive) null else it.asFloat }
+fun JsonObject?.getChar(key: String): Char? = get(key)?.let { if(!it.isJsonPrimitive) null else it.asString[0] }
+fun JsonObject?.getJsonObject(key: String): JsonObject? = get(key)?.let { if (it.isJsonObject) it.asJsonObject else null }
+fun JsonObject?.getJsonArray(key: String): JsonArray? = get(key)?.let { if (it.isJsonArray) it.asJsonArray else null }
+
+fun JsonObject?.getBoolean(key: String, defaultValue: Boolean): Boolean = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asBoolean } ?: defaultValue
+fun JsonObject?.getString(key: String, defaultValue: String): String = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asString } ?: defaultValue
+fun JsonObject?.getInt(key: String, defaultValue: Int): Int = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asInt } ?: defaultValue
+fun JsonObject?.getLong(key: String, defaultValue: Long): Long = get(key)?.let { if (!it.isJsonPrimitive) defaultValue else it.asLong } ?: defaultValue
+fun JsonObject?.getFloat(key: String, defaultValue: Float): Float = get(key)?.let { if(!it.isJsonPrimitive) defaultValue else it.asFloat } ?: defaultValue
+fun JsonObject?.getChar(key: String, defaultValue: Char): Char = get(key)?.let { if(!it.isJsonPrimitive) defaultValue else it.asString[0] } ?: defaultValue
+fun JsonObject?.getJsonObject(key: String, defaultValue: JsonObject): JsonObject = get(key)?.let { if (it.isJsonObject) it.asJsonObject else defaultValue } ?: defaultValue
+fun JsonObject?.getJsonArray(key: String, defaultValue: JsonArray): JsonArray = get(key)?.let { if (it.isJsonArray) it.asJsonArray else defaultValue } ?: defaultValue
+
+fun JsonArray.getBoolean(key: Int): Boolean? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asBoolean }
+fun JsonArray.getString(key: Int): String? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asString }
+fun JsonArray.getInt(key: Int): Int? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asInt }
+fun JsonArray.getLong(key: Int): Long? = if (key >= size()) null else get(key)?.let { if (!it.isJsonPrimitive) null else it.asLong }
+fun JsonArray.getFloat(key: Int): Float? = if (key >= size()) null else get(key)?.let { if(!it.isJsonPrimitive) null else it.asFloat }
+fun JsonArray.getChar(key: Int): Char? = if (key >= size()) null else get(key)?.let { if(!it.isJsonPrimitive) null else it.asString[0] }
+fun JsonArray.getJsonObject(key: Int): JsonObject? = if (key >= size()) null else get(key)?.let { if (it.isJsonObject) it.asJsonObject else null }
+fun JsonArray.getJsonArray(key: Int): JsonArray? = if (key >= size()) null else get(key)?.let { if (it.isJsonArray) it.asJsonArray else null }
+
+fun String.toJsonObject(): JsonObject? = try { JsonParser.parseString(this).asJsonObject } catch (ignore: Exception) { null }
+
+operator fun JsonObject.set(key: String, value: JsonElement) = this.add(key, value)
+operator fun JsonObject.set(key: String, value: Boolean) = this.addProperty(key, value)
+operator fun JsonObject.set(key: String, value: String?) = this.addProperty(key, value)
+operator fun JsonObject.set(key: String, value: Number) = this.addProperty(key, value)
+operator fun JsonObject.set(key: String, value: Char) = this.addProperty(key, value)
+
+fun JsonArray.asJsonObjectList() = this.mapNotNull { it.asJsonObject }
+
+fun JsonObject(vararg properties: Pair<String, Any?>): JsonObject {
+    return JsonObject().apply {
+        for (property in properties) {
+            when (property.second) {
+                is JsonElement -> add(property.first, property.second as JsonElement?)
+                is String -> addProperty(property.first, property.second as String?)
+                is Char -> addProperty(property.first, property.second as Char?)
+                is Number -> addProperty(property.first, property.second as Number?)
+                is Boolean -> addProperty(property.first, property.second as Boolean?)
+            }
+        }
+    }
+}
+
+fun JsonObject.toBundle(): Bundle {
+    return Bundle().also {
+        for ((key, value) in this.entrySet()) {
+            when (value) {
+                is JsonObject -> it.putBundle(key, value.toBundle())
+                is JsonPrimitive -> when {
+                    value.isString -> it.putString(key, value.asString)
+                    value.isBoolean -> it.putBoolean(key, value.asBoolean)
+                    value.isNumber -> it.putInt(key, value.asInt)
+                }
+            }
+        }
+    }
+}
+
+fun JsonArray(vararg properties: Any?): JsonArray {
+    return JsonArray().apply {
+        for (property in properties) {
+            when (property) {
+                is JsonElement -> add(property as JsonElement?)
+                is String -> add(property as String?)
+                is Char -> add(property as Char?)
+                is Number -> add(property as Number?)
+                is Boolean -> add(property as Boolean?)
+            }
+        }
+    }
+}
+
+fun JsonArray?.isNullOrEmpty(): Boolean = (this?.size() ?: 0) == 0
+operator fun JsonArray.plusAssign(o: JsonElement) = this.add(o)
+operator fun JsonArray.plusAssign(o: String) = this.add(o)
+operator fun JsonArray.plusAssign(o: Char) = this.add(o)
+operator fun JsonArray.plusAssign(o: Number) = this.add(o)
+operator fun JsonArray.plusAssign(o: Boolean) = this.add(o)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/MiscExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/MiscExtensions.kt
new file mode 100644
index 00000000..22ed9e43
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/MiscExtensions.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.database.Cursor
+import androidx.core.database.getIntOrNull
+import androidx.core.database.getLongOrNull
+import androidx.core.database.getStringOrNull
+import androidx.lifecycle.LifecycleOwner
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.Observer
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+import java.io.PrintWriter
+import java.io.StringWriter
+
+fun <T> LiveData<T>.observeOnce(lifecycleOwner: LifecycleOwner, observer: Observer<T>) {
+    observe(lifecycleOwner, object : Observer<T> {
+        override fun onChanged(t: T?) {
+            observer.onChanged(t)
+            removeObserver(this)
+        }
+    })
+}
+
+fun CoroutineScope.startCoroutineTimer(delayMillis: Long = 0, repeatMillis: Long = 0, action: suspend CoroutineScope.() -> Unit) = launch {
+    delay(delayMillis)
+    if (repeatMillis > 0) {
+        while (true) {
+            action()
+            delay(repeatMillis)
+        }
+    } else {
+        action()
+    }
+}
+
+inline fun <reified T> Any?.instanceOfOrNull(): T? {
+    return when (this) {
+        is T -> this
+        else -> null
+    }
+}
+
+val Throwable.stackTraceString: String
+    get() {
+        val sw = StringWriter()
+        printStackTrace(PrintWriter(sw))
+        return sw.toString()
+    }
+
+fun Cursor?.getString(columnName: String) = this?.getStringOrNull(getColumnIndex(columnName))
+fun Cursor?.getInt(columnName: String) = this?.getIntOrNull(getColumnIndex(columnName))
+fun Cursor?.getLong(columnName: String) = this?.getLongOrNull(getColumnIndex(columnName))
+
+inline fun <A, B, R> ifNotNull(a: A?, b: B?, code: (A, B) -> R): R? {
+    if (a != null && b != null) {
+        return code(a, b)
+    }
+    return null
+}
+
+infix fun Int.hasSet(what: Int) = this and what == what
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/NetworkExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/NetworkExtensions.kt
new file mode 100644
index 00000000..00c0cf91
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/NetworkExtensions.kt
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import im.wangchao.mhttp.Response
+import okhttp3.RequestBody
+import okio.Buffer
+import pl.szczodrzynski.edziennik.data.api.*
+import pl.szczodrzynski.edziennik.data.api.models.ApiError
+import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApiException
+import pl.szczodrzynski.edziennik.data.api.szkolny.response.ApiResponse
+import java.io.InterruptedIOException
+import java.net.ConnectException
+import java.net.SocketTimeoutException
+import java.net.UnknownHostException
+import javax.net.ssl.SSLException
+
+fun RequestBody.bodyToString(): String {
+    val buffer = Buffer()
+    writeTo(buffer)
+    return buffer.readUtf8()
+}
+
+fun Response.toErrorCode() = when (this.code()) {
+    400 -> ERROR_REQUEST_HTTP_400
+    401 -> ERROR_REQUEST_HTTP_401
+    403 -> ERROR_REQUEST_HTTP_403
+    404 -> ERROR_REQUEST_HTTP_404
+    405 -> ERROR_REQUEST_HTTP_405
+    410 -> ERROR_REQUEST_HTTP_410
+    424 -> ERROR_REQUEST_HTTP_424
+    500 -> ERROR_REQUEST_HTTP_500
+    503 -> ERROR_REQUEST_HTTP_503
+    else -> null
+}
+
+fun Throwable.toErrorCode() = when (this) {
+    is UnknownHostException -> ERROR_REQUEST_FAILURE_HOSTNAME_NOT_FOUND
+    is SSLException -> ERROR_REQUEST_FAILURE_SSL_ERROR
+    is SocketTimeoutException -> ERROR_REQUEST_FAILURE_TIMEOUT
+    is InterruptedIOException, is ConnectException -> ERROR_REQUEST_FAILURE_NO_INTERNET
+    is SzkolnyApiException -> this.error?.toErrorCode()
+    else -> null
+}
+fun ApiResponse.Error.toErrorCode() = when (this.code) {
+    "PdoError" -> ERROR_API_PDO_ERROR
+    "InvalidClient" -> ERROR_API_INVALID_CLIENT
+    "InvalidArgument" -> ERROR_API_INVALID_ARGUMENT
+    "InvalidSignature" -> ERROR_API_INVALID_SIGNATURE
+    "MissingScopes" -> ERROR_API_MISSING_SCOPES
+    "ResourceNotFound" -> ERROR_API_RESOURCE_NOT_FOUND
+    "InternalServerError" -> ERROR_API_INTERNAL_SERVER_ERROR
+    "PhpError" -> ERROR_API_PHP_E_ERROR
+    "PhpWarning" -> ERROR_API_PHP_E_WARNING
+    "PhpParse" -> ERROR_API_PHP_E_PARSE
+    "PhpNotice" -> ERROR_API_PHP_E_NOTICE
+    "PhpOther" -> ERROR_API_PHP_E_OTHER
+    "ApiMaintenance" -> ERROR_API_MAINTENANCE
+    "MissingArgument" -> ERROR_API_MISSING_ARGUMENT
+    "MissingPayload" -> ERROR_API_PAYLOAD_EMPTY
+    "InvalidAction" -> ERROR_API_INVALID_ACTION
+    "VersionNotFound" -> ERROR_API_UPDATE_NOT_FOUND
+    "InvalidDeviceIdUserCode" -> ERROR_API_INVALID_DEVICEID_USERCODE
+    "InvalidPairToken" -> ERROR_API_INVALID_PAIRTOKEN
+    "InvalidBrowserId" -> ERROR_API_INVALID_BROWSERID
+    "InvalidDeviceId" -> ERROR_API_INVALID_DEVICEID
+    "InvalidDeviceIdBrowserId" -> ERROR_API_INVALID_DEVICEID_BROWSERID
+    "HelpCategoryNotFound" -> ERROR_API_HELP_CATEGORY_NOT_FOUND
+    else -> ERROR_API_EXCEPTION
+}
+fun Throwable.toApiError(tag: String) = ApiError.fromThrowable(tag, this)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/TextExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/TextExtensions.kt
new file mode 100644
index 00000000..ebfb1410
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/TextExtensions.kt
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.content.ClipData
+import android.content.ClipboardManager
+import android.content.Context
+import android.graphics.Typeface
+import android.text.Spannable
+import android.text.SpannableString
+import android.text.SpannableStringBuilder
+import android.text.style.CharacterStyle
+import android.text.style.ForegroundColorSpan
+import android.text.style.StrikethroughSpan
+import android.text.style.StyleSpan
+import androidx.annotation.PluralsRes
+import androidx.annotation.StringRes
+import com.mikepenz.materialdrawer.holder.StringHolder
+
+fun CharSequence?.isNotNullNorEmpty(): Boolean {
+    return this != null && this.isNotEmpty()
+}
+
+fun CharSequence?.isNotNullNorBlank(): Boolean {
+    return this != null && this.isNotBlank()
+}
+
+/**
+ * `   The quick BROWN_fox Jumps OveR THE       LAZy-DOG.   `
+ *
+ * converts to
+ *
+ * `The Quick Brown_fox Jumps Over The Lazy-Dog.`
+ */
+fun String?.fixName(): String {
+    return this?.fixWhiteSpaces()?.toProperCase() ?: ""
+}
+
+/**
+ * `The quick BROWN_fox Jumps OveR THE       LAZy-DOG.`
+ *
+ * converts to
+ *
+ * `The Quick Brown_fox Jumps Over The       Lazy-Dog.`
+ */
+fun String.toProperCase(): String = changeStringCase(this)
+
+/**
+ * `John Smith` -> `Smith John`
+ *
+ * `JOHN SMith` -> `SMith JOHN`
+ */
+fun String.swapFirstLastName(): String {
+    return this.split(" ").let {
+        if (it.size > 1)
+            it[1]+" "+it[0]
+        else
+            it[0]
+    }
+}
+
+fun String.splitName(): Pair<String, String>? {
+    return this.split(" ").let {
+        if (it.size >= 2) Pair(it[0], it[1])
+        else null
+    }
+}
+
+fun changeStringCase(s: String): String {
+    val delimiters = " '-/"
+    val sb = StringBuilder()
+    var capNext = true
+    for (ch in s.toCharArray()) {
+        var c = ch
+        c = if (capNext)
+            Character.toUpperCase(c)
+        else
+            Character.toLowerCase(c)
+        sb.append(c)
+        capNext = delimiters.indexOf(c) >= 0
+    }
+    return sb.toString()
+}
+
+fun buildFullName(firstName: String?, lastName: String?): String {
+    return "$firstName $lastName".fixName()
+}
+
+fun String.getShortName(): String {
+    return split(" ").let {
+        if (it.size > 1)
+            "${it[0]} ${it[1][0]}."
+        else
+            it[0]
+    }
+}
+
+/**
+ * "John Smith"             -> "JS"
+ *
+ * "JOHN SMith"             -> "JS"
+ *
+ * "John"                   -> "J"
+ *
+ * "John "                  -> "J"
+ *
+ * "John     Smith      "   -> "JS"
+ *
+ * " "                      -> ""
+ *
+ * "  "                     -> ""
+ */
+fun String?.getNameInitials(): String {
+    if (this.isNullOrBlank()) return ""
+    return this.uppercase().fixWhiteSpaces().split(" ").take(2).map { it[0] }.joinToString("")
+}
+
+operator fun MatchResult.get(group: Int): String {
+    if (group >= groupValues.size)
+        return ""
+    return groupValues[group]
+}
+
+fun String.fixWhiteSpaces() = buildString(length) {
+    var wasWhiteSpace = true
+    for (c in this@fixWhiteSpaces) {
+        if (c.isWhitespace()) {
+            if (!wasWhiteSpace) {
+                append(c)
+                wasWhiteSpace = true
+            }
+        } else {
+            append(c)
+            wasWhiteSpace = false
+        }
+    }
+}.trimEnd()
+
+fun CharSequence?.asColoredSpannable(colorInt: Int): Spannable {
+    val spannable = SpannableString(this)
+    spannable.setSpan(ForegroundColorSpan(colorInt), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+    return spannable
+}
+fun CharSequence?.asStrikethroughSpannable(): Spannable {
+    val spannable = SpannableString(this)
+    spannable.setSpan(StrikethroughSpan(), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+    return spannable
+}
+fun CharSequence?.asItalicSpannable(): Spannable {
+    val spannable = SpannableString(this)
+    spannable.setSpan(StyleSpan(Typeface.ITALIC), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+    return spannable
+}
+fun CharSequence?.asBoldSpannable(): Spannable {
+    val spannable = SpannableString(this)
+    spannable.setSpan(StyleSpan(Typeface.BOLD), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+    return spannable
+}
+fun CharSequence.asSpannable(
+    vararg spans: CharacterStyle,
+    substring: CharSequence? = null,
+    ignoreCase: Boolean = false,
+    ignoreDiacritics: Boolean = false
+): Spannable {
+    val spannable = SpannableString(this)
+    substring?.let { substr ->
+        val string = if (ignoreDiacritics)
+            this.cleanDiacritics()
+        else
+            this
+        val search = if (ignoreDiacritics)
+            substr.cleanDiacritics()
+        else
+            substr.toString()
+
+        var index = 0
+        do {
+            index = string.indexOf(
+                string = search,
+                startIndex = index,
+                ignoreCase = ignoreCase
+            )
+
+            if (index >= 0) {
+                spans.forEach {
+                    spannable.setSpan(
+                        CharacterStyle.wrap(it),
+                        index,
+                        index + substring.length,
+                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
+                    )
+                }
+                index += substring.length.coerceAtLeast(1)
+            }
+        } while (index >= 0)
+
+    } ?: spans.forEach {
+        spannable.setSpan(it, 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+    }
+    return spannable
+}
+
+fun CharSequence.cleanDiacritics(): String {
+    val nameClean = StringBuilder()
+    forEach {
+        val ch = when (it) {
+            'ż' -> 'z'
+            'ó' -> 'o'
+            'ł' -> 'l'
+            'ć' -> 'c'
+            'ę' -> 'e'
+            'ś' -> 's'
+            'ą' -> 'a'
+            'ź' -> 'z'
+            'ń' -> 'n'
+            else -> it
+        }
+        nameClean.append(ch)
+    }
+    return nameClean.toString()
+}
+
+operator fun StringBuilder.plusAssign(str: String?) {
+    this.append(str)
+}
+
+val String.firstLettersName: String
+    get() {
+        var nameShort = ""
+        this.split(" ").forEach {
+            if (it.isBlank())
+                return@forEach
+            nameShort += it[0].lowercase()
+        }
+        return nameShort
+    }
+
+fun CharSequence.replaceSpanned(oldValue: String, newValue: CharSequence, ignoreCase: Boolean = false): CharSequence {
+    var seq = this
+    var index = seq.indexOf(oldValue, ignoreCase = ignoreCase)
+    while (index != -1) {
+        val sb = SpannableStringBuilder()
+        sb.appendRange(seq, 0, index)
+        sb.append(newValue)
+        sb.appendRange(seq, index + oldValue.length, seq.length)
+        seq = sb
+        index = seq.indexOf(oldValue, startIndex = index + 1, ignoreCase = ignoreCase)
+    }
+    return seq
+}
+
+fun SpannableStringBuilder.replaceSpan(spanClass: Class<*>, prefix: CharSequence, suffix: CharSequence): SpannableStringBuilder {
+    getSpans(0, length, spanClass).forEach {
+        val spanStart = getSpanStart(it)
+        insert(spanStart, prefix)
+        val spanEnd = getSpanEnd(it)
+        insert(spanEnd, suffix)
+    }
+    return this
+}
+
+fun SpannableStringBuilder.appendText(text: CharSequence): SpannableStringBuilder {
+    append(text)
+    return this
+}
+fun SpannableStringBuilder.appendSpan(text: CharSequence, what: Any, flags: Int): SpannableStringBuilder {
+    val start: Int = length
+    append(text)
+    setSpan(what, start, length, flags)
+    return this
+}
+
+fun joinNotNullStrings(delimiter: String = "", vararg parts: String?): String {
+    var first = true
+    val sb = StringBuilder()
+    for (part in parts) {
+        if (part == null)
+            continue
+        if (!first)
+            sb += delimiter
+        first = false
+        sb += part
+    }
+    return sb.toString()
+}
+
+fun String.notEmptyOrNull(): String? {
+    return if (isEmpty())
+        null
+    else
+        this
+}
+
+fun Context.plural(@PluralsRes resId: Int, value: Int): String = resources.getQuantityString(resId, value, value)
+
+fun String.copyToClipboard(context: Context) {
+    val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
+    val clipData = ClipData.newPlainText("Tekst", this)
+    clipboard.setPrimaryClip(clipData)
+}
+
+fun ByteArray.toHexString() = joinToString("") { "%02x".format(it) }
+
+fun CharSequence.getWordBounds(position: Int, onlyInWord: Boolean = false): Pair<Int, Int>? {
+    if (length == 0)
+        return null
+
+    // only if cursor between letters
+    if (onlyInWord) {
+        if (position < 1)
+            return null
+        if (position == length)
+            return null
+
+        val charBefore = this[position - 1]
+        if (!charBefore.isLetterOrDigit())
+            return null
+        val charAfter = this[position]
+        if (!charAfter.isLetterOrDigit())
+            return null
+    }
+
+    var rangeStart = substring(0 until position).indexOfLast { !it.isLetterOrDigit() }
+    if (rangeStart == -1) // no whitespace, set to first index
+        rangeStart = 0
+    else // cut the leading whitespace
+        rangeStart += 1
+
+    var rangeEnd = substring(position).indexOfFirst { !it.isLetterOrDigit() }
+    if (rangeEnd == -1) // no whitespace, set to last index
+        rangeEnd = length
+    else // append the substring offset
+        rangeEnd += position
+
+    if (!onlyInWord && rangeStart == rangeEnd)
+        return null
+    return rangeStart to rangeEnd
+}
+
+fun Int.toStringHolder() = StringHolder(this)
+fun CharSequence.toStringHolder() = StringHolder(this)
+
+fun @receiver:StringRes Int.resolveString(context: Context) = context.getString(this)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/TimeExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/TimeExtensions.kt
new file mode 100644
index 00000000..114a5a40
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/TimeExtensions.kt
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.content.Context
+import im.wangchao.mhttp.Response
+import pl.szczodrzynski.edziennik.R
+import pl.szczodrzynski.edziennik.utils.models.Time
+import java.text.SimpleDateFormat
+import java.util.*
+
+const val MINUTE = 60L
+const val HOUR = 60L*MINUTE
+const val DAY = 24L*HOUR
+const val WEEK = 7L*DAY
+const val MONTH = 30L*DAY
+const val YEAR = 365L*DAY
+const val MS = 1000L
+
+fun currentTimeUnix() = System.currentTimeMillis() / 1000
+
+fun Response?.getUnixDate(): Long {
+    val rfcDate = this?.headers()?.get("date") ?: return currentTimeUnix()
+    val pattern = "EEE, dd MMM yyyy HH:mm:ss Z"
+    val format = SimpleDateFormat(pattern, Locale.ENGLISH)
+    return (format.parse(rfcDate)?.time ?: 0) / 1000
+}
+
+fun Long.formatDate(format: String = "yyyy-MM-dd HH:mm:ss"): String = SimpleDateFormat(format).format(this)
+
+operator fun Time?.compareTo(other: Time?): Int {
+    if (this == null && other == null)
+        return 0
+    if (this == null)
+        return -1
+    if (other == null)
+        return 1
+    return this.compareTo(other)
+}
+
+fun Context.timeTill(time: Int, delimiter: String = " ", countInSeconds: Boolean = false): String {
+    val parts = mutableListOf<Pair<Int, Int>>()
+
+    val hours = time / 3600
+    val minutes = (time - hours*3600) / 60
+    val seconds = time - minutes*60 - hours*3600
+
+    if (!countInSeconds) {
+        var prefixAdded = false
+        if (hours > 0) {
+            if (!prefixAdded) parts += R.plurals.time_till_text to hours
+            prefixAdded = true
+            parts += R.plurals.time_till_hours to hours
+        }
+        if (minutes > 0) {
+            if (!prefixAdded) parts += R.plurals.time_till_text to minutes
+            prefixAdded = true
+            parts += R.plurals.time_till_minutes to minutes
+        }
+        if (hours == 0 && minutes < 10) {
+            if (!prefixAdded) parts += R.plurals.time_till_text to seconds
+            parts += R.plurals.time_till_seconds to seconds
+        }
+    } else {
+        parts += R.plurals.time_till_text to time
+        parts += R.plurals.time_till_seconds to time
+    }
+
+    return parts.joinToString(delimiter) { resources.getQuantityString(it.first, it.second, it.second) }
+}
+
+fun Context.timeLeft(time: Int, delimiter: String = " ", countInSeconds: Boolean = false): String {
+    val parts = mutableListOf<Pair<Int, Int>>()
+
+    val hours = time / 3600
+    val minutes = (time - hours*3600) / 60
+    val seconds = time - minutes*60 - hours*3600
+
+    if (!countInSeconds) {
+        var prefixAdded = false
+        if (hours > 0) {
+            if (!prefixAdded) parts += R.plurals.time_left_text to hours
+            prefixAdded = true
+            parts += R.plurals.time_left_hours to hours
+        }
+        if (minutes > 0) {
+            if (!prefixAdded) parts += R.plurals.time_left_text to minutes
+            prefixAdded = true
+            parts += R.plurals.time_left_minutes to minutes
+        }
+        if (hours == 0 && minutes < 10) {
+            if (!prefixAdded) parts += R.plurals.time_left_text to seconds
+            parts += R.plurals.time_left_seconds to seconds
+        }
+    } else {
+        parts += R.plurals.time_left_text to time
+        parts += R.plurals.time_left_seconds to time
+    }
+
+    return parts.joinToString(delimiter) { resources.getQuantityString(it.first, it.second, it.second) }
+}
+
+fun Context.getSyncInterval(interval: Int): String {
+    val hours = interval / 60 / 60
+    val minutes = interval / 60 % 60
+    val hoursText = if (hours > 0)
+        plural(R.plurals.time_till_hours, hours)
+    else
+        null
+    val minutesText = if (minutes > 0)
+        plural(R.plurals.time_till_minutes, minutes)
+    else
+        ""
+    return hoursText?.plus(" $minutesText") ?: minutesText
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/ViewExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/ViewExtensions.kt
new file mode 100644
index 00000000..3a0468ef
--- /dev/null
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/ViewExtensions.kt
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
+ */
+
+package pl.szczodrzynski.edziennik.ext
+
+import android.content.Context
+import android.content.res.Resources
+import android.graphics.Rect
+import android.view.View
+import android.view.WindowManager
+import android.widget.*
+import androidx.annotation.StringRes
+import androidx.recyclerview.widget.RecyclerView
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+import androidx.viewpager.widget.ViewPager
+import com.google.android.material.button.MaterialButton
+
+fun TextView.setText(@StringRes resid: Int, vararg formatArgs: Any) {
+    text = context.getString(resid, *formatArgs)
+}
+
+@Suppress("UNCHECKED_CAST")
+inline fun <T : View> T.onClick(crossinline onClickListener: (v: T) -> Unit) {
+    setOnClickListener { v: View ->
+        onClickListener(v as T)
+    }
+}
+
+@Suppress("UNCHECKED_CAST")
+inline fun <T : View> T.onLongClick(crossinline onLongClickListener: (v: T) -> Boolean) {
+    setOnLongClickListener { v: View ->
+        onLongClickListener(v as T)
+    }
+}
+
+@Suppress("UNCHECKED_CAST")
+inline fun <T : CompoundButton> T.onChange(crossinline onChangeListener: (v: T, isChecked: Boolean) -> Unit) {
+    setOnCheckedChangeListener { buttonView, isChecked ->
+        onChangeListener(buttonView as T, isChecked)
+    }
+}
+
+@Suppress("UNCHECKED_CAST")
+inline fun <T : MaterialButton> T.onChange(crossinline onChangeListener: (v: T, isChecked: Boolean) -> Unit) {
+    clearOnCheckedChangeListeners()
+    addOnCheckedChangeListener { buttonView, isChecked ->
+        onChangeListener(buttonView as T, isChecked)
+    }
+}
+
+fun View.attachToastHint(stringRes: Int) = onLongClick {
+    Toast.makeText(it.context, stringRes, Toast.LENGTH_SHORT).show()
+    true
+}
+
+fun View.detachToastHint() = setOnLongClickListener(null)
+
+/**
+ * Convert a value in dp to pixels.
+ */
+val Int.dp: Int
+    get() = (this * Resources.getSystem().displayMetrics.density).toInt()
+/**
+ * Convert a value in pixels to dp.
+ */
+val Int.px: Int
+    get() = (this / Resources.getSystem().displayMetrics.density).toInt()
+
+fun View.findParentById(targetId: Int): View? {
+    if (id == targetId) {
+        return this
+    }
+    val viewParent = this.parent ?: return null
+    if (viewParent is View) {
+        return viewParent.findParentById(targetId)
+    }
+    return null
+}
+
+fun CheckBox.trigger() { isChecked = !isChecked }
+
+inline fun RadioButton.setOnSelectedListener(crossinline listener: (buttonView: CompoundButton) -> Unit)
+        = setOnCheckedChangeListener { buttonView, isChecked -> if (isChecked) listener(buttonView) }
+
+fun TextView.getTextPosition(range: IntRange): Rect {
+    val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
+
+    // Initialize global value
+    var parentTextViewRect = Rect()
+
+    // Initialize values for the computing of clickedText position
+    //val completeText = parentTextView.text as SpannableString
+    val textViewLayout = this.layout
+
+    val startOffsetOfClickedText = range.first//completeText.getSpanStart(clickedText)
+    val endOffsetOfClickedText = range.last//completeText.getSpanEnd(clickedText)
+    var startXCoordinatesOfClickedText = textViewLayout.getPrimaryHorizontal(startOffsetOfClickedText)
+    var endXCoordinatesOfClickedText = textViewLayout.getPrimaryHorizontal(endOffsetOfClickedText)
+
+    // Get the rectangle of the clicked text
+    val currentLineStartOffset = textViewLayout.getLineForOffset(startOffsetOfClickedText)
+    val currentLineEndOffset = textViewLayout.getLineForOffset(endOffsetOfClickedText)
+    val keywordIsInMultiLine = currentLineStartOffset != currentLineEndOffset
+    textViewLayout.getLineBounds(currentLineStartOffset, parentTextViewRect)
+
+    // Update the rectangle position to his real position on screen
+    val parentTextViewLocation = intArrayOf(0, 0)
+    this.getLocationOnScreen(parentTextViewLocation)
+
+    val parentTextViewTopAndBottomOffset = (parentTextViewLocation[1] - this.scrollY + this.compoundPaddingTop)
+    parentTextViewRect.top += parentTextViewTopAndBottomOffset
+    parentTextViewRect.bottom += parentTextViewTopAndBottomOffset
+
+    // In the case of multi line text, we have to choose what rectangle take
+    if (keywordIsInMultiLine) {
+        val screenHeight = windowManager.defaultDisplay.height
+        val dyTop = parentTextViewRect.top
+        val dyBottom = screenHeight - parentTextViewRect.bottom
+        val onTop = dyTop > dyBottom
+
+        if (onTop) {
+            endXCoordinatesOfClickedText = textViewLayout.getLineRight(currentLineStartOffset);
+        } else {
+            parentTextViewRect = Rect()
+            textViewLayout.getLineBounds(currentLineEndOffset, parentTextViewRect);
+            parentTextViewRect.top += parentTextViewTopAndBottomOffset;
+            parentTextViewRect.bottom += parentTextViewTopAndBottomOffset;
+            startXCoordinatesOfClickedText = textViewLayout.getLineLeft(currentLineEndOffset);
+        }
+    }
+
+    parentTextViewRect.left += (
+            parentTextViewLocation[0] +
+                    startXCoordinatesOfClickedText +
+                    this.compoundPaddingLeft -
+                    this.scrollX
+            ).toInt()
+    parentTextViewRect.right = (
+            parentTextViewRect.left +
+                    endXCoordinatesOfClickedText -
+                    startXCoordinatesOfClickedText
+            ).toInt()
+
+    return parentTextViewRect
+}
+
+inline fun ViewPager.addOnPageSelectedListener(crossinline block: (position: Int) -> Unit) = addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
+    override fun onPageScrollStateChanged(state: Int) {}
+    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
+    override fun onPageSelected(position: Int) { block(position) }
+})
+
+val SwipeRefreshLayout.onScrollListener: RecyclerView.OnScrollListener
+    get() = object : RecyclerView.OnScrollListener() {
+        override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
+            if (recyclerView.canScrollVertically(-1))
+                this@onScrollListener.isEnabled = false
+            if (!recyclerView.canScrollVertically(-1) && newState == RecyclerView.SCROLL_STATE_IDLE)
+                this@onScrollListener.isEnabled = true
+        }
+    }
+
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/sync/SyncWorker.kt b/app/src/main/java/pl/szczodrzynski/edziennik/sync/SyncWorker.kt
index 05a03fbc..3a2a5f40 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/sync/SyncWorker.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/sync/SyncWorker.kt
@@ -5,7 +5,7 @@ import android.content.Context
 import androidx.work.*
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
-import pl.szczodrzynski.edziennik.formatDate
+import pl.szczodrzynski.edziennik.ext.formatDate
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.util.concurrent.TimeUnit
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/sync/UpdateWorker.kt b/app/src/main/java/pl/szczodrzynski/edziennik/sync/UpdateWorker.kt
index c574e9c8..5325d533 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/sync/UpdateWorker.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/sync/UpdateWorker.kt
@@ -18,6 +18,9 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.Update
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ext.concat
+import pl.szczodrzynski.edziennik.ext.formatDate
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import java.util.concurrent.TimeUnit
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/sync/WorkerUtils.kt b/app/src/main/java/pl/szczodrzynski/edziennik/sync/WorkerUtils.kt
index 0eaa65eb..e8266a64 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/sync/WorkerUtils.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/sync/WorkerUtils.kt
@@ -11,8 +11,8 @@ import androidx.work.WorkManager
 import androidx.work.impl.WorkManagerImpl
 import org.greenrobot.eventbus.EventBus
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.MINUTE
-import pl.szczodrzynski.edziennik.formatDate
+import pl.szczodrzynski.edziennik.ext.MINUTE
+import pl.szczodrzynski.edziennik.ext.formatDate
 import pl.szczodrzynski.edziennik.utils.Utils
 
 object WorkerUtils {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/AgendaFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/AgendaFragment.kt
index 949e36cc..a13b9b02 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/AgendaFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2020-1-25
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda
+package pl.szczodrzynski.edziennik.ui.agenda
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -26,9 +26,8 @@ import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.FragmentAgendaCalendarBinding
 import pl.szczodrzynski.edziennik.databinding.FragmentAgendaDefaultBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.agenda.AgendaConfigDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.day.DayDialog
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.AgendaConfigDialog
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
 import pl.szczodrzynski.edziennik.utils.Themes
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragmentDefault.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/AgendaFragmentDefault.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragmentDefault.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/AgendaFragmentDefault.kt
index 68240e0b..be01c222 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragmentDefault.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/AgendaFragmentDefault.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda
+package pl.szczodrzynski.edziennik.ui.agenda
 
 import android.util.SparseIntArray
 import android.widget.AbsListView
@@ -21,18 +21,17 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
 import pl.szczodrzynski.edziennik.databinding.FragmentAgendaDefaultBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.day.DayDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.lessonchange.LessonChangeDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence.TeacherAbsenceDialog
-import pl.szczodrzynski.edziennik.ui.modules.agenda.event.AgendaEvent
-import pl.szczodrzynski.edziennik.ui.modules.agenda.event.AgendaEventGroup
-import pl.szczodrzynski.edziennik.ui.modules.agenda.event.AgendaEventGroupRenderer
-import pl.szczodrzynski.edziennik.ui.modules.agenda.event.AgendaEventRenderer
-import pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchanges.LessonChangesEvent
-import pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchanges.LessonChangesEventRenderer
-import pl.szczodrzynski.edziennik.ui.modules.agenda.teacherabsence.TeacherAbsenceEvent
-import pl.szczodrzynski.edziennik.ui.modules.agenda.teacherabsence.TeacherAbsenceEventRenderer
-import pl.szczodrzynski.edziennik.ui.modules.event.EventDetailsDialog
+import pl.szczodrzynski.edziennik.ui.agenda.event.AgendaEvent
+import pl.szczodrzynski.edziennik.ui.agenda.event.AgendaEventGroup
+import pl.szczodrzynski.edziennik.ui.agenda.event.AgendaEventGroupRenderer
+import pl.szczodrzynski.edziennik.ui.agenda.event.AgendaEventRenderer
+import pl.szczodrzynski.edziennik.ui.agenda.lessonchanges.LessonChangesDialog
+import pl.szczodrzynski.edziennik.ui.agenda.lessonchanges.LessonChangesEvent
+import pl.szczodrzynski.edziennik.ui.agenda.lessonchanges.LessonChangesEventRenderer
+import pl.szczodrzynski.edziennik.ui.agenda.teacherabsence.TeacherAbsenceDialog
+import pl.szczodrzynski.edziennik.ui.agenda.teacherabsence.TeacherAbsenceEvent
+import pl.szczodrzynski.edziennik.ui.agenda.teacherabsence.TeacherAbsenceEventRenderer
+import pl.szczodrzynski.edziennik.ui.event.EventDetailsDialog
 import pl.szczodrzynski.edziennik.utils.models.Date
 import java.util.*
 
@@ -149,7 +148,7 @@ class AgendaFragmentDefault(
 
                     when (event) {
                         is AgendaEvent -> EventDetailsDialog(activity, event.event)
-                        is LessonChangesEvent -> LessonChangeDialog(activity, app.profileId, date)
+                        is LessonChangesEvent -> LessonChangesDialog(activity, app.profileId, date)
                         is TeacherAbsenceEvent -> TeacherAbsenceDialog(
                             activity,
                             app.profileId,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/BaseEvent.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/BaseEvent.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/BaseEvent.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/BaseEvent.kt
index 62569504..3f28ca40 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/BaseEvent.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/BaseEvent.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-9.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda
+package pl.szczodrzynski.edziennik.ui.agenda
 
 import com.github.tibolte.agendacalendarview.models.CalendarEvent
 import com.github.tibolte.agendacalendarview.models.IDayItem
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/day/DayDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/DayDialog.kt
similarity index 88%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/day/DayDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/DayDialog.kt
index 55850a0e..af5a4c04 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/day/DayDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/DayDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.day
+package pl.szczodrzynski.edziennik.ui.agenda
 
 import android.view.View
 import androidx.appcompat.app.AlertDialog
@@ -14,15 +14,18 @@ import kotlinx.coroutines.*
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.databinding.DialogDayBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.lessonchange.LessonChangeDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence.TeacherAbsenceDialog
-import pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchanges.LessonChangesEvent
-import pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchanges.LessonChangesEventRenderer
-import pl.szczodrzynski.edziennik.ui.modules.agenda.teacherabsence.TeacherAbsenceEvent
-import pl.szczodrzynski.edziennik.ui.modules.agenda.teacherabsence.TeacherAbsenceEventRenderer
-import pl.szczodrzynski.edziennik.ui.modules.event.EventDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.event.EventListAdapter
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
+import pl.szczodrzynski.edziennik.ext.ifNotEmpty
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.agenda.lessonchanges.LessonChangesDialog
+import pl.szczodrzynski.edziennik.ui.agenda.lessonchanges.LessonChangesEvent
+import pl.szczodrzynski.edziennik.ui.agenda.lessonchanges.LessonChangesEventRenderer
+import pl.szczodrzynski.edziennik.ui.agenda.teacherabsence.TeacherAbsenceDialog
+import pl.szczodrzynski.edziennik.ui.agenda.teacherabsence.TeacherAbsenceEvent
+import pl.szczodrzynski.edziennik.ui.agenda.teacherabsence.TeacherAbsenceEventRenderer
+import pl.szczodrzynski.edziennik.ui.event.EventDetailsDialog
+import pl.szczodrzynski.edziennik.ui.event.EventListAdapter
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
@@ -124,7 +127,7 @@ class DayDialog(
             )
 
             b.lessonChangesFrame.onClick {
-                LessonChangeDialog(
+                LessonChangesDialog(
                     activity,
                     profileId,
                     date,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEvent.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEvent.kt
similarity index 76%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEvent.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEvent.kt
index e6ba6e23..ebff08f9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEvent.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEvent.kt
@@ -2,10 +2,10 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.event
+package pl.szczodrzynski.edziennik.ui.agenda.event
 
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.ui.modules.agenda.BaseEvent
+import pl.szczodrzynski.edziennik.ui.agenda.BaseEvent
 
 class AgendaEvent(
     val event: EventFull,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventGroup.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventGroup.kt
similarity index 81%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventGroup.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventGroup.kt
index 3ef4eb47..cccfb292 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventGroup.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventGroup.kt
@@ -2,9 +2,9 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.event
+package pl.szczodrzynski.edziennik.ui.agenda.event
 
-import pl.szczodrzynski.edziennik.ui.modules.agenda.BaseEvent
+import pl.szczodrzynski.edziennik.ui.agenda.BaseEvent
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class AgendaEventGroup(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventGroupRenderer.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventGroupRenderer.kt
similarity index 86%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventGroupRenderer.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventGroupRenderer.kt
index 2a1f9af8..59d15cbe 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventGroupRenderer.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventGroupRenderer.kt
@@ -2,15 +2,15 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.event
+package pl.szczodrzynski.edziennik.ui.agenda.event
 
 import android.view.View
 import androidx.core.view.isVisible
 import com.github.tibolte.agendacalendarview.render.EventRenderer
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.AgendaWrappedGroupBinding
-import pl.szczodrzynski.edziennik.resolveAttr
-import pl.szczodrzynski.edziennik.setTintColor
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ext.setTintColor
 import pl.szczodrzynski.edziennik.utils.Colors
 
 class AgendaEventGroupRenderer : EventRenderer<AgendaEventGroup>() {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventRenderer.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventRenderer.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventRenderer.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventRenderer.kt
index 2e857cd3..31eb6730 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/event/AgendaEventRenderer.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/event/AgendaEventRenderer.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.event
+package pl.szczodrzynski.edziennik.ui.agenda.event
 
 import android.annotation.SuppressLint
 import android.view.View
@@ -14,9 +14,9 @@ import com.mikepenz.iconics.view.IconicsTextView
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.AgendaWrappedEventBinding
 import pl.szczodrzynski.edziennik.databinding.AgendaWrappedEventCompactBinding
-import pl.szczodrzynski.edziennik.join
-import pl.szczodrzynski.edziennik.resolveAttr
-import pl.szczodrzynski.edziennik.setTintColor
+import pl.szczodrzynski.edziennik.ext.join
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ext.setTintColor
 import pl.szczodrzynski.edziennik.utils.Colors
 import pl.szczodrzynski.edziennik.utils.managers.EventManager
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/lessonchange/LessonChangeAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesAdapter.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/lessonchange/LessonChangeAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesAdapter.kt
index b15803ed..4712e073 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/lessonchange/LessonChangeAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-19.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.lessonchange
+package pl.szczodrzynski.edziennik.ui.agenda.lessonchanges
 
 import android.content.Context
 import android.graphics.PorterDuff
@@ -11,16 +11,17 @@ import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.core.view.updateLayoutParams
 import androidx.recyclerview.widget.RecyclerView
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
 import pl.szczodrzynski.edziennik.databinding.TimetableLessonBinding
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.navlib.getColorFromAttr
 
-class LessonChangeAdapter(
+class LessonChangesAdapter(
         val context: Context,
         private val onItemClick: ((lesson: LessonFull) -> Unit)? = null
-) : RecyclerView.Adapter<LessonChangeAdapter.ViewHolder>() {
+) : RecyclerView.Adapter<LessonChangesAdapter.ViewHolder>() {
 
     var items = listOf<LessonFull>()
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/lessonchange/LessonChangeDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesDialog.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/lessonchange/LessonChangeDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesDialog.kt
index 78d40e68..8fd2b454 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/lessonchange/LessonChangeDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesDialog.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.dialogs.lessonchange
+package pl.szczodrzynski.edziennik.ui.agenda.lessonchanges
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -8,11 +8,11 @@ import kotlinx.coroutines.*
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.DialogLessonChangeListBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.timetable.LessonDetailsDialog
+import pl.szczodrzynski.edziennik.ui.timetable.LessonDetailsDialog
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
 
-class LessonChangeDialog(
+class LessonChangesDialog(
         val activity: AppCompatActivity,
         val profileId: Int,
         private val defaultDate: Date,
@@ -54,7 +54,7 @@ class LessonChangeDialog(
             app.db.timetableDao().getChangesForDateNow(profileId, defaultDate)
         }
 
-        val adapter = LessonChangeAdapter(
+        val adapter = LessonChangesAdapter(
                 activity,
                 onItemClick = {
                     LessonDetailsDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchanges/LessonChangesEvent.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesEvent.kt
similarity index 79%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchanges/LessonChangesEvent.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesEvent.kt
index b38d8829..c011af59 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchanges/LessonChangesEvent.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesEvent.kt
@@ -2,9 +2,9 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchanges
+package pl.szczodrzynski.edziennik.ui.agenda.lessonchanges
 
-import pl.szczodrzynski.edziennik.ui.modules.agenda.BaseEvent
+import pl.szczodrzynski.edziennik.ui.agenda.BaseEvent
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class LessonChangesEvent(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchanges/LessonChangesEventRenderer.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesEventRenderer.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchanges/LessonChangesEventRenderer.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesEventRenderer.kt
index 5f66cc27..2ef4aecc 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchanges/LessonChangesEventRenderer.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/lessonchanges/LessonChangesEventRenderer.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchanges
+package pl.szczodrzynski.edziennik.ui.agenda.lessonchanges
 
 import android.view.View
 import androidx.core.view.isVisible
@@ -10,8 +10,8 @@ import com.github.tibolte.agendacalendarview.render.EventRenderer
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.AgendaCounterItemBinding
 import pl.szczodrzynski.edziennik.databinding.AgendaWrappedCounterBinding
-import pl.szczodrzynski.edziennik.resolveAttr
-import pl.szczodrzynski.edziennik.setTintColor
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ext.setTintColor
 import pl.szczodrzynski.edziennik.utils.Colors
 
 class LessonChangesEventRenderer : EventRenderer<LessonChangesEvent>() {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceAdapter.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceAdapter.kt
index 443d4734..89cbf3ee 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceAdapter.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence
+package pl.szczodrzynski.edziennik.ui.agenda.teacherabsence
 
 import android.content.Context
 import android.view.LayoutInflater
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceDialog.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceDialog.kt
index 7ffab515..a4f527ff 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceDialog.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence
+package pl.szczodrzynski.edziennik.ui.agenda.teacherabsence
 
 import android.view.View
 import androidx.appcompat.app.AlertDialog
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/teacherabsence/TeacherAbsenceEvent.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceEvent.kt
similarity index 75%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/teacherabsence/TeacherAbsenceEvent.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceEvent.kt
index b0b01f50..d9defda1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/teacherabsence/TeacherAbsenceEvent.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceEvent.kt
@@ -2,9 +2,9 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.teacherabsence
+package pl.szczodrzynski.edziennik.ui.agenda.teacherabsence
 
-import pl.szczodrzynski.edziennik.ui.modules.agenda.BaseEvent
+import pl.szczodrzynski.edziennik.ui.agenda.BaseEvent
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class TeacherAbsenceEvent(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/teacherabsence/TeacherAbsenceEventRenderer.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceEventRenderer.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/teacherabsence/TeacherAbsenceEventRenderer.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceEventRenderer.kt
index 8d70f941..7d87acfa 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/teacherabsence/TeacherAbsenceEventRenderer.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/agenda/teacherabsence/TeacherAbsenceEventRenderer.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.agenda.teacherabsence
+package pl.szczodrzynski.edziennik.ui.agenda.teacherabsence
 
 import android.view.View
 import androidx.core.view.isVisible
@@ -10,7 +10,7 @@ import com.github.tibolte.agendacalendarview.render.EventRenderer
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.AgendaCounterItemBinding
 import pl.szczodrzynski.edziennik.databinding.AgendaWrappedCounterBinding
-import pl.szczodrzynski.edziennik.setTintColor
+import pl.szczodrzynski.edziennik.ext.setTintColor
 import pl.szczodrzynski.edziennik.utils.Colors
 
 class TeacherAbsenceEventRenderer : EventRenderer<TeacherAbsenceEvent>() {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsAdapter.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/announcements/AnnouncementsAdapter.java
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsAdapter.java
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/announcements/AnnouncementsAdapter.java
index ee88da07..73156558 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsAdapter.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/announcements/AnnouncementsAdapter.java
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.announcements;
+package pl.szczodrzynski.edziennik.ui.announcements;
 
 import android.content.Context;
 import android.graphics.Bitmap;
@@ -18,7 +18,7 @@ import java.util.List;
 import pl.szczodrzynski.edziennik.R;
 import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull;
 import pl.szczodrzynski.edziennik.databinding.RowAnnouncementsItemBinding;
-import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesUtils;
+import pl.szczodrzynski.edziennik.ui.messages.MessagesUtils;
 
 public class AnnouncementsAdapter extends RecyclerView.Adapter<AnnouncementsAdapter.ViewHolder> {
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/announcements/AnnouncementsFragment.java
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsFragment.java
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/announcements/AnnouncementsFragment.java
index d8cdbc2c..c9c1032b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsFragment.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/announcements/AnnouncementsFragment.java
@@ -1,4 +1,8 @@
-package pl.szczodrzynski.edziennik.ui.modules.announcements;
+package pl.szczodrzynski.edziennik.ui.announcements;
+
+import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE;
+import static pl.szczodrzynski.edziennik.data.db.entity.LoginStore.LOGIN_TYPE_LIBRUS;
+import static pl.szczodrzynski.edziennik.data.db.entity.Metadata.TYPE_ANNOUNCEMENT;
 
 import android.os.AsyncTask;
 import android.os.Bundle;
@@ -33,10 +37,6 @@ import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration;
 import pl.szczodrzynski.edziennik.utils.Themes;
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem;
 
-import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE;
-import static pl.szczodrzynski.edziennik.data.db.entity.LoginStore.LOGIN_TYPE_LIBRUS;
-import static pl.szczodrzynski.edziennik.data.db.entity.Metadata.TYPE_ANNOUNCEMENT;
-
 public class AnnouncementsFragment extends Fragment {
 
     private App app = null;
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceAdapter.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceAdapter.kt
index 0dcae97e..6daaebcd 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance
+package pl.szczodrzynski.edziennik.ui.attendance
 
 import android.animation.ObjectAnimator
 import android.view.LayoutInflater
@@ -18,11 +18,11 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
-import pl.szczodrzynski.edziennik.startCoroutineTimer
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.*
-import pl.szczodrzynski.edziennik.ui.modules.attendance.viewholder.*
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.attendance.models.*
+import pl.szczodrzynski.edziennik.ui.attendance.viewholder.*
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 import kotlin.coroutines.CoroutineContext
 
 class AttendanceAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceBar.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceBar.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceBar.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceBar.kt
index 70be9256..f8dee4ce 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceBar.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceBar.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-1.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance
+package pl.szczodrzynski.edziennik.ui.attendance
 
 import android.annotation.SuppressLint
 import android.content.Context
@@ -10,7 +10,7 @@ import android.graphics.*
 import android.text.TextPaint
 import android.util.AttributeSet
 import android.view.View
-import pl.szczodrzynski.edziennik.dp
+import pl.szczodrzynski.edziennik.ext.dp
 import pl.szczodrzynski.edziennik.utils.Colors
 import kotlin.math.roundToInt
 
@@ -69,7 +69,7 @@ class AttendanceBar : View {
     override fun onDraw(canvas: Canvas?) {
         canvas ?: return
 
-        val sum = attendancesList.sumBy { it.count }
+        val sum = attendancesList.sumOf { it.count }
         if (sum == 0) {
             return
         }
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceDetailsDialog.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceDetailsDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceDetailsDialog.kt
index 5ee6bdc3..257360ec 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceDetailsDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceDetailsDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-9.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance
+package pl.szczodrzynski.edziennik.ui.attendance
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -15,7 +15,7 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
 import pl.szczodrzynski.edziennik.databinding.AttendanceDetailsDialogBinding
-import pl.szczodrzynski.edziennik.setTintColor
+import pl.szczodrzynski.edziennik.ext.setTintColor
 import pl.szczodrzynski.edziennik.utils.BetterLink
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceFragment.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceFragment.kt
index 194f36d2..ac07d944 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance
+package pl.szczodrzynski.edziennik.ui.attendance
 
 import android.os.AsyncTask
 import android.os.Bundle
@@ -15,11 +15,15 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.MainActivity
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.databinding.AttendanceFragmentBinding
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.addOnPageSelectedListener
+import pl.szczodrzynski.edziennik.ui.base.lazypager.FragmentLazyPagerAdapter
 import pl.szczodrzynski.edziennik.ui.dialogs.settings.AttendanceConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.FragmentLazyPagerAdapter
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
 import kotlin.coroutines.CoroutineContext
@@ -81,7 +85,7 @@ class AttendanceFragment : Fragment(), CoroutineScope {
             pageSelection = app.config.forProfile().attendance.attendancePageSelection
 
         val pagerAdapter = FragmentLazyPagerAdapter(
-                fragmentManager ?: return,
+            parentFragmentManager,
                 b.refreshLayout,
                 listOf(
                         AttendanceSummaryFragment() to getString(R.string.attendance_tab_summary),
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceListFragment.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceListFragment.kt
index 523dd09c..faec3261 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceListFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance
+package pl.szczodrzynski.edziennik.ui.attendance
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -17,13 +17,13 @@ import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
 import pl.szczodrzynski.edziennik.databinding.AttendanceListFragmentBinding
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
-import pl.szczodrzynski.edziennik.startCoroutineTimer
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceDayRange
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceMonth
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceTypeGroup
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSubject
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceDayRange
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceMonth
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceTypeGroup
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSubject
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
 
@@ -179,12 +179,12 @@ class AttendanceListFragment : LazyFragment(), CoroutineScope {
                         .sortedBy { it.first }
                         .toMap()
 
-                val totalCount = month.typeCountMap.entries.sumBy {
+                val totalCount = month.typeCountMap.entries.sumOf {
                     if (!it.key.isCounted || it.key.baseType == Attendance.TYPE_UNKNOWN)
                         0
                     else it.value
                 }
-                val presenceCount = month.typeCountMap.entries.sumBy {
+                val presenceCount = month.typeCountMap.entries.sumOf {
                     when (it.key.baseType) {
                         Attendance.TYPE_PRESENT,
                             Attendance.TYPE_PRESENT_CUSTOM,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceSummaryFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceSummaryFragment.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceSummaryFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceSummaryFragment.kt
index 39282325..91a4bfda 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceSummaryFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceSummaryFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance
+package pl.szczodrzynski.edziennik.ui.attendance
 
 import android.graphics.Color
 import android.os.Bundle
@@ -24,10 +24,14 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
 import pl.szczodrzynski.edziennik.databinding.AttendanceSummaryFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceFragment.Companion.VIEW_SUMMARY
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceSubject
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSubject
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceFragment.Companion.VIEW_SUMMARY
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceSubject
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSubject
 import pl.szczodrzynski.edziennik.utils.models.Date
 import java.text.DecimalFormat
 import kotlin.coroutines.CoroutineContext
@@ -177,7 +181,7 @@ class AttendanceSummaryFragment : LazyFragment(), CoroutineScope {
                         subjectName = it.value.firstOrNull()?.subjectLongName ?: "",
                         items = it.value.toMutableList()
                 ) }
-                .sortedBy { it.subjectName.toLowerCase() }
+                .sortedBy { it.subjectName.lowercase() }
 
         var totalCountSum = 0
         var presenceCountSum = 0
@@ -189,12 +193,12 @@ class AttendanceSummaryFragment : LazyFragment(), CoroutineScope {
                     .sortedBy { it.first }
                     .toMap()
 
-            val totalCount = subject.typeCountMap.entries.sumBy {
+            val totalCount = subject.typeCountMap.entries.sumOf {
                 if (!it.key.isCounted || it.key.baseType == Attendance.TYPE_UNKNOWN)
                     0
                 else it.value
             }
-            val presenceCount = subject.typeCountMap.entries.sumBy {
+            val presenceCount = subject.typeCountMap.entries.sumOf {
                 when (it.key.baseType) {
                     Attendance.TYPE_PRESENT,
                     Attendance.TYPE_PRESENT_CUSTOM,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceView.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceView.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceView.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceView.kt
index dfe20eda..02be63ad 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceView.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/AttendanceView.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance
+package pl.szczodrzynski.edziennik.ui.attendance
 
 import android.annotation.SuppressLint
 import android.content.Context
@@ -17,8 +17,8 @@ import androidx.appcompat.widget.AppCompatTextView
 import androidx.core.graphics.ColorUtils
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.setTintColor
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.setTintColor
 import pl.szczodrzynski.edziennik.utils.managers.AttendanceManager
 
 class AttendanceView : AppCompatTextView {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceCount.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceCount.kt
similarity index 84%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceCount.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceCount.kt
index c2595885..787c10e3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceCount.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceCount.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.models
+package pl.szczodrzynski.edziennik.ui.attendance.models
 
 class AttendanceCount {
     var normalSum = 0f
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceDayRange.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceDayRange.kt
similarity index 81%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceDayRange.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceDayRange.kt
index e993d785..a3815861 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceDayRange.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceDayRange.kt
@@ -2,11 +2,11 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.models
+package pl.szczodrzynski.edziennik.ui.attendance.models
 
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 data class AttendanceDayRange(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceEmpty.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceEmpty.kt
similarity index 54%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceEmpty.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceEmpty.kt
index 46877f63..82a8a5be 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceEmpty.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceEmpty.kt
@@ -2,6 +2,6 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.models
+package pl.szczodrzynski.edziennik.ui.attendance.models
 
 class AttendanceEmpty
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceMonth.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceMonth.kt
similarity index 83%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceMonth.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceMonth.kt
index c6d14914..a51af848 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceMonth.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceMonth.kt
@@ -2,12 +2,12 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.models
+package pl.szczodrzynski.edziennik.ui.attendance.models
 
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.AttendanceType
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
 
 data class AttendanceMonth(
         val year: Int,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceSubject.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceSubject.kt
similarity index 83%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceSubject.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceSubject.kt
index b56cd62a..db5f34a1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceSubject.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceSubject.kt
@@ -2,12 +2,12 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.models
+package pl.szczodrzynski.edziennik.ui.attendance.models
 
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.AttendanceType
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
 
 data class AttendanceSubject(
         val subjectId: Long,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceTypeGroup.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceTypeGroup.kt
similarity index 82%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceTypeGroup.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceTypeGroup.kt
index d6b431ec..a6399456 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/models/AttendanceTypeGroup.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/models/AttendanceTypeGroup.kt
@@ -2,12 +2,12 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.models
+package pl.szczodrzynski.edziennik.ui.attendance.models
 
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.AttendanceType
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
 
 data class AttendanceTypeGroup(
         val type: AttendanceType,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/AttendanceViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/AttendanceViewHolder.kt
similarity index 78%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/AttendanceViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/AttendanceViewHolder.kt
index 3e7a1d32..e030b288 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/AttendanceViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/AttendanceViewHolder.kt
@@ -2,25 +2,23 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.viewholder
+package pl.szczodrzynski.edziennik.ui.attendance.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.view.ContextThemeWrapper
 import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.concat
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
 import pl.szczodrzynski.edziennik.databinding.AttendanceItemAttendanceBinding
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceDayRange
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceMonth
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.utils.Themes
+import pl.szczodrzynski.edziennik.ext.concat
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceDayRange
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceMonth
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 import pl.szczodrzynski.edziennik.utils.models.Week
 
 class AttendanceViewHolder(
@@ -34,7 +32,6 @@ class AttendanceViewHolder(
 
     override fun onBind(activity: AppCompatActivity, app: App, item: AttendanceFull, position: Int, adapter: AttendanceAdapter) {
         val manager = app.attendanceManager
-        val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
 
         val bullet = " • "
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/DayRangeViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/DayRangeViewHolder.kt
similarity index 82%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/DayRangeViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/DayRangeViewHolder.kt
index b42d5e16..ef0647bb 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/DayRangeViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/DayRangeViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.viewholder
+package pl.szczodrzynski.edziennik.ui.attendance.viewholder
 
 import android.view.LayoutInflater
 import android.view.View
@@ -14,14 +14,14 @@ import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.concat
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.databinding.AttendanceItemDayRangeBinding
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter.Companion.STATE_CLOSED
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceView
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceDayRange
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ext.concat
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter.Companion.STATE_CLOSED
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceView
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceDayRange
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 import pl.szczodrzynski.edziennik.utils.Themes
 
 class DayRangeViewHolder(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/EmptyViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/EmptyViewHolder.kt
similarity index 73%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/EmptyViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/EmptyViewHolder.kt
index 37fe635c..0a0786d6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/EmptyViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/EmptyViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.viewholder
+package pl.szczodrzynski.edziennik.ui.attendance.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -10,9 +10,9 @@ import androidx.appcompat.app.AppCompatActivity
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.AttendanceItemEmptyBinding
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceEmpty
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceEmpty
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 
 class EmptyViewHolder(
         inflater: LayoutInflater,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/MonthViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/MonthViewHolder.kt
similarity index 83%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/MonthViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/MonthViewHolder.kt
index 71c139ac..f9afd2f3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/MonthViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/MonthViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.viewholder
+package pl.szczodrzynski.edziennik.ui.attendance.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -13,14 +13,19 @@ import androidx.appcompat.view.ContextThemeWrapper
 import androidx.core.view.isInvisible
 import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.databinding.AttendanceItemMonthBinding
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter.Companion.STATE_CLOSED
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceView
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceMonth
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ext.concat
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter.Companion.STATE_CLOSED
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceView
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceMonth
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 import pl.szczodrzynski.edziennik.utils.Themes
 import pl.szczodrzynski.edziennik.utils.models.Date
 
@@ -57,7 +62,6 @@ class MonthViewHolder(
 
         b.previewContainer.removeAllViews()
 
-        val sum = item.typeCountMap.entries.sumBy { it.value }.toFloat()
         item.typeCountMap.forEach { (type, count) ->
             val layout = LinearLayout(contextWrapper)
             val attendance = Attendance(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/SubjectViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/SubjectViewHolder.kt
similarity index 71%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/SubjectViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/SubjectViewHolder.kt
index e439111d..a7e5e562 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/SubjectViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/SubjectViewHolder.kt
@@ -2,23 +2,21 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.viewholder
+package pl.szczodrzynski.edziennik.ui.attendance.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.view.ContextThemeWrapper
 import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.AttendanceItemSubjectBinding
-import pl.szczodrzynski.edziennik.setText
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter.Companion.STATE_CLOSED
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceSubject
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.utils.Themes
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter.Companion.STATE_CLOSED
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceSubject
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 
 class SubjectViewHolder(
         inflater: LayoutInflater,
@@ -31,7 +29,6 @@ class SubjectViewHolder(
 
     override fun onBind(activity: AppCompatActivity, app: App, item: AttendanceSubject, position: Int, adapter: AttendanceAdapter) {
         val manager = app.attendanceManager
-        val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
 
         b.title.text = item.subjectName
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/TypeViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/TypeViewHolder.kt
similarity index 80%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/TypeViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/TypeViewHolder.kt
index a2f8b689..6719c3a6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/viewholder/TypeViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/attendance/viewholder/TypeViewHolder.kt
@@ -2,23 +2,21 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-8.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.attendance.viewholder
+package pl.szczodrzynski.edziennik.ui.attendance.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.view.ContextThemeWrapper
 import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.concat
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.databinding.AttendanceItemTypeBinding
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.attendance.models.AttendanceTypeGroup
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.utils.Themes
+import pl.szczodrzynski.edziennik.ext.concat
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.attendance.models.AttendanceTypeGroup
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class TypeViewHolder(
@@ -32,7 +30,6 @@ class TypeViewHolder(
 
     override fun onBind(activity: AppCompatActivity, app: App, item: AttendanceTypeGroup, position: Int, adapter: AttendanceAdapter) {
         val manager = app.attendanceManager
-        val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
 
         val type = item.type
         b.title.text = type.typeName
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/BuildInvalidActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/BuildInvalidActivity.kt
similarity index 91%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/BuildInvalidActivity.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/base/BuildInvalidActivity.kt
index 766c79ad..5aa6a84a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/BuildInvalidActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/BuildInvalidActivity.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-27.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.base
+package pl.szczodrzynski.edziennik.ui.base
 
 import android.graphics.Color
 import android.os.Bundle
@@ -10,7 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
 import androidx.core.view.isVisible
 import com.mikepenz.iconics.utils.colorInt
 import pl.szczodrzynski.edziennik.databinding.ActivityBuildInvalidBinding
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.onClick
 import pl.szczodrzynski.edziennik.utils.Themes
 
 class BuildInvalidActivity : AppCompatActivity() {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/CrashActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/CrashActivity.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/CrashActivity.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/base/CrashActivity.kt
index bd892fd4..5a209020 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/CrashActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/CrashActivity.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.base
+package pl.szczodrzynski.edziennik.ui.base
 
 import android.content.ClipData
 import android.content.ClipboardManager
@@ -20,6 +20,7 @@ import pl.szczodrzynski.edziennik.data.api.ERROR_APP_CRASH
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.api.szkolny.request.ErrorReportRequest
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.resolveColor
 import pl.szczodrzynski.edziennik.utils.Themes.appTheme
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import kotlin.coroutines.CoroutineContext
@@ -82,7 +83,7 @@ class CrashActivity : AppCompatActivity(), CoroutineScope {
 
                 Toast.makeText(app, getString(R.string.crash_report_sent), Toast.LENGTH_SHORT).show()
                 reportButton.isEnabled = false
-                reportButton.setTextColor(resources.getColor(android.R.color.darker_gray))
+                reportButton.setTextColor(android.R.color.darker_gray.resolveColor(this@CrashActivity))
             }
         }
 
@@ -115,7 +116,7 @@ class CrashActivity : AppCompatActivity(), CoroutineScope {
         content = content.replace(packageName.toRegex(), "<font color='#4caf50'>$packageName</font>")
         content = content.replace("\n".toRegex(), "<br>")
         contentPlain += "\n" + Build.MANUFACTURER + "\n" + Build.BRAND + "\n" + Build.MODEL + "\n" + Build.DEVICE + "\n"
-        if (app.profile != null && app.profile.registration == Profile.REGISTRATION_ENABLED) {
+        if (app.profile.registration == Profile.REGISTRATION_ENABLED) {
             contentPlain += "U: " + app.profile.userCode + "\nS: " + app.profile.studentNameLong + "\n"
         }
         contentPlain += BuildConfig.VERSION_NAME + " " + BuildConfig.BUILD_TYPE
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/MainSnackbar.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/MainSnackbar.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/MainSnackbar.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/base/MainSnackbar.kt
index 362ffe9b..93e340b3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/MainSnackbar.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/MainSnackbar.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-22.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.base
+package pl.szczodrzynski.edziennik.ui.base
 
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/FragmentLazyPagerAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/FragmentLazyPagerAdapter.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/FragmentLazyPagerAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/FragmentLazyPagerAdapter.kt
index bc794073..91159270 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/FragmentLazyPagerAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/FragmentLazyPagerAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.base.lazypager
+package pl.szczodrzynski.edziennik.ui.base.lazypager
 
 import androidx.fragment.app.FragmentManager
 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyFragment.kt
index b5f26172..dd00436a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.base.lazypager
+package pl.szczodrzynski.edziennik.ui.base.lazypager
 
 import android.os.Bundle
 import androidx.fragment.app.Fragment
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyPagerAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyPagerAdapter.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyPagerAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyPagerAdapter.kt
index b70de59e..383d0c6f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyPagerAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyPagerAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.base.lazypager
+package pl.szczodrzynski.edziennik.ui.base.lazypager
 
 import android.util.SparseBooleanArray
 import androidx.core.util.set
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyViewPager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyViewPager.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyViewPager.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyViewPager.kt
index 45337990..2026d974 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/base/lazypager/LazyViewPager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/base/lazypager/LazyViewPager.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.base.lazypager
+package pl.szczodrzynski.edziennik.ui.base.lazypager
 
 import android.content.Context
 import android.util.AttributeSet
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/BehaviourFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/behaviour/BehaviourFragment.java
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/BehaviourFragment.java
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/behaviour/BehaviourFragment.java
index d0b46f4a..ea388d00 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/BehaviourFragment.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/behaviour/BehaviourFragment.java
@@ -1,4 +1,7 @@
-package pl.szczodrzynski.edziennik.ui.modules.behaviour;
+package pl.szczodrzynski.edziennik.ui.behaviour;
+
+import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE;
+import static pl.szczodrzynski.edziennik.data.db.entity.Metadata.TYPE_NOTICE;
 
 import android.graphics.Color;
 import android.os.AsyncTask;
@@ -32,9 +35,6 @@ import pl.szczodrzynski.edziennik.databinding.FragmentBehaviourBinding;
 import pl.szczodrzynski.edziennik.utils.Themes;
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem;
 
-import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE;
-import static pl.szczodrzynski.edziennik.data.db.entity.Metadata.TYPE_NOTICE;
-
 public class BehaviourFragment extends Fragment {
 
     private App app = null;
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/behaviour/NoticesAdapter.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/behaviour/NoticesAdapter.kt
index 61ac01f1..e37b7ed9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/behaviour/NoticesAdapter.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.behaviour
+package pl.szczodrzynski.edziennik.ui.behaviour
 
 import android.content.Context
 import android.graphics.PorterDuff
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/captcha/LibrusCaptchaDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/captcha/LibrusCaptchaDialog.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/captcha/LibrusCaptchaDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/captcha/LibrusCaptchaDialog.kt
index e502ef28..be53e004 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/captcha/LibrusCaptchaDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/captcha/LibrusCaptchaDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-15.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.captcha
+package pl.szczodrzynski.edziennik.ui.captcha
 
 import android.graphics.drawable.Drawable
 import android.view.View
@@ -15,7 +15,7 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.RecaptchaViewBinding
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.onClick
 import kotlin.coroutines.CoroutineContext
 
 class LibrusCaptchaDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/captcha/RecaptchaDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/captcha/RecaptchaDialog.kt
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/captcha/RecaptchaDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/captcha/RecaptchaDialog.kt
index 427ca44c..81fd82af 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/captcha/RecaptchaDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/captcha/RecaptchaDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-15.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.captcha
+package pl.szczodrzynski.edziennik.ui.captcha
 
 import android.graphics.Bitmap
 import android.graphics.BitmapFactory
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/DebugFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/DebugFragment.java
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/DebugFragment.java
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/DebugFragment.java
index 62d5462b..6ff081db 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/DebugFragment.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/DebugFragment.java
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-3.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug;
+package pl.szczodrzynski.edziennik.ui.debug;
 
 import android.os.Bundle;
 import android.util.Log;
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabFragment.kt
similarity index 89%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabFragment.kt
index f7c8952d..93acec1e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-3.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug
+package pl.szczodrzynski.edziennik.ui.debug
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -14,9 +14,9 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
-import pl.szczodrzynski.edziennik.addOnPageSelectedListener
 import pl.szczodrzynski.edziennik.databinding.TemplateFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.FragmentLazyPagerAdapter
+import pl.szczodrzynski.edziennik.ext.addOnPageSelectedListener
+import pl.szczodrzynski.edziennik.ui.base.lazypager.FragmentLazyPagerAdapter
 import kotlin.coroutines.CoroutineContext
 
 class LabFragment : Fragment(), CoroutineScope {
@@ -49,7 +49,7 @@ class LabFragment : Fragment(), CoroutineScope {
         if (!isAdded) return
 
         val pagerAdapter = FragmentLazyPagerAdapter(
-                fragmentManager ?: return,
+            parentFragmentManager,
                 b.refreshLayout,
                 listOf(
                         LabPageFragment() to "click me",
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabJsonAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabJsonAdapter.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabJsonAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabJsonAdapter.kt
index a4a332c5..8d605885 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabJsonAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabJsonAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug
+package pl.szczodrzynski.edziennik.ui.debug
 
 import android.animation.ObjectAnimator
 import android.view.LayoutInflater
@@ -20,15 +20,15 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.ui.modules.debug.models.LabJsonArray
-import pl.szczodrzynski.edziennik.ui.modules.debug.models.LabJsonElement
-import pl.szczodrzynski.edziennik.ui.modules.debug.models.LabJsonObject
-import pl.szczodrzynski.edziennik.ui.modules.debug.viewholder.JsonArrayViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.debug.viewholder.JsonElementViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.debug.viewholder.JsonObjectViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.debug.viewholder.JsonSubObjectViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ui.debug.models.LabJsonArray
+import pl.szczodrzynski.edziennik.ui.debug.models.LabJsonElement
+import pl.szczodrzynski.edziennik.ui.debug.models.LabJsonObject
+import pl.szczodrzynski.edziennik.ui.debug.viewholder.JsonArrayViewHolder
+import pl.szczodrzynski.edziennik.ui.debug.viewholder.JsonElementViewHolder
+import pl.szczodrzynski.edziennik.ui.debug.viewholder.JsonObjectViewHolder
+import pl.szczodrzynski.edziennik.ui.debug.viewholder.JsonSubObjectViewHolder
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 import kotlin.coroutines.CoroutineContext
 
 class LabJsonAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabPageFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabPageFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabPageFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabPageFragment.kt
index 19598af5..9dddfd00 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabPageFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabPageFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug
+package pl.szczodrzynski.edziennik.ui.debug
 
 import android.os.Bundle
 import android.os.Process
@@ -18,8 +18,9 @@ import kotlinx.coroutines.launch
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.config.Config
 import pl.szczodrzynski.edziennik.databinding.LabFragmentBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.profile.ProfileRemoveDialog
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.dialogs.ProfileRemoveDialog
 import pl.szczodrzynski.edziennik.utils.TextInputDropDown
 import pl.szczodrzynski.fslogin.decode
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabProfileFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabProfileFragment.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabProfileFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabProfileFragment.kt
index f4b03f55..995f3133 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/LabProfileFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabProfileFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug
+package pl.szczodrzynski.edziennik.ui.debug
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -18,8 +18,10 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.databinding.TemplateListPageFragmentBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.input
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ext.input
+import pl.szczodrzynski.edziennik.ext.set
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
 
@@ -166,7 +168,7 @@ class LabProfileFragment : LazyFragment(), CoroutineScope {
             json.add("App.profile", app.gson.toJsonTree(app.profile))
             json.add("App.profile.studentData", app.profile.studentData)
             json.add("App.profile.loginStore", loginStore?.data ?: JsonObject())
-            json.add("App.config", JsonParser().parse(app.gson.toJson(app.config.values.toSortedMap())))
+            json.add("App.config", JsonParser.parseString(app.gson.toJson(app.config.values.toSortedMap())))
         }
         adapter.items = LabJsonAdapter.expand(json, 0)
         adapter.notifyDataSetChanged()
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonArray.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonArray.kt
similarity index 68%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonArray.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonArray.kt
index a606e238..e4cbbf65 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonArray.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonArray.kt
@@ -2,11 +2,11 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug.models
+package pl.szczodrzynski.edziennik.ui.debug.models
 
 import com.google.gson.JsonArray
 import com.google.gson.JsonElement
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
 
 data class LabJsonArray(
         val key: String,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonElement.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonElement.kt
similarity index 77%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonElement.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonElement.kt
index e0e0e686..3592168c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonElement.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonElement.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug.models
+package pl.szczodrzynski.edziennik.ui.debug.models
 
 import com.google.gson.JsonElement
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonObject.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonObject.kt
similarity index 71%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonObject.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonObject.kt
index 43a69201..e67e609e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/models/LabJsonObject.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/models/LabJsonObject.kt
@@ -2,11 +2,11 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug.models
+package pl.szczodrzynski.edziennik.ui.debug.models
 
 import com.google.gson.JsonElement
 import com.google.gson.JsonObject
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
 
 data class LabJsonObject(
         val key: String,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonArrayViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonArrayViewHolder.kt
similarity index 73%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonArrayViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonArrayViewHolder.kt
index 56645c28..967ab5cf 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonArrayViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonArrayViewHolder.kt
@@ -2,23 +2,21 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug.viewholder
+package pl.szczodrzynski.edziennik.ui.debug.viewholder
 
 import android.annotation.SuppressLint
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.view.ContextThemeWrapper
 import androidx.core.view.isInvisible
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.LabItemObjectBinding
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.debug.LabJsonAdapter
-import pl.szczodrzynski.edziennik.ui.modules.debug.models.LabJsonArray
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.utils.Themes
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.debug.LabJsonAdapter
+import pl.szczodrzynski.edziennik.ui.debug.models.LabJsonArray
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 
 class JsonArrayViewHolder(
         inflater: LayoutInflater,
@@ -31,8 +29,6 @@ class JsonArrayViewHolder(
 
     @SuppressLint("SetTextI18n")
     override fun onBind(activity: AppCompatActivity, app: App, item: LabJsonArray, position: Int, adapter: LabJsonAdapter) {
-        val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
-
         b.root.setPadding(item.level * 8.dp + 8.dp, 8.dp, 8.dp, 8.dp)
 
         b.type.text = "Array"
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonElementViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonElementViewHolder.kt
similarity index 77%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonElementViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonElementViewHolder.kt
index 20b1c2c8..0e80d109 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonElementViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonElementViewHolder.kt
@@ -2,22 +2,21 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug.viewholder
+package pl.szczodrzynski.edziennik.ui.debug.viewholder
 
 import android.annotation.SuppressLint
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.view.ContextThemeWrapper
 import androidx.recyclerview.widget.RecyclerView
 import com.google.gson.JsonNull
 import com.google.gson.JsonPrimitive
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.LabItemElementBinding
-import pl.szczodrzynski.edziennik.ui.modules.debug.LabJsonAdapter
-import pl.szczodrzynski.edziennik.ui.modules.debug.models.LabJsonElement
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.utils.Themes
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.debug.LabJsonAdapter
+import pl.szczodrzynski.edziennik.ui.debug.models.LabJsonElement
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 
 class JsonElementViewHolder(
         inflater: LayoutInflater,
@@ -30,8 +29,6 @@ class JsonElementViewHolder(
 
     @SuppressLint("SetTextI18n")
     override fun onBind(activity: AppCompatActivity, app: App, item: LabJsonElement, position: Int, adapter: LabJsonAdapter) {
-        val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
-
         b.root.setPadding(item.level * 8.dp + 8.dp, 8.dp, 8.dp, 8.dp)
 
         b.type.text = when (item.jsonElement) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonObjectViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonObjectViewHolder.kt
similarity index 73%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonObjectViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonObjectViewHolder.kt
index b4de8efe..847f19d5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonObjectViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonObjectViewHolder.kt
@@ -2,23 +2,21 @@
  * Copyright (c) Kuba Szczodrzyński 2020-5-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug.viewholder
+package pl.szczodrzynski.edziennik.ui.debug.viewholder
 
 import android.annotation.SuppressLint
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.view.ContextThemeWrapper
 import androidx.core.view.isInvisible
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.LabItemObjectBinding
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.debug.LabJsonAdapter
-import pl.szczodrzynski.edziennik.ui.modules.debug.models.LabJsonObject
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.utils.Themes
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.debug.LabJsonAdapter
+import pl.szczodrzynski.edziennik.ui.debug.models.LabJsonObject
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 
 class JsonObjectViewHolder(
         inflater: LayoutInflater,
@@ -31,8 +29,6 @@ class JsonObjectViewHolder(
 
     @SuppressLint("SetTextI18n")
     override fun onBind(activity: AppCompatActivity, app: App, item: LabJsonObject, position: Int, adapter: LabJsonAdapter) {
-        val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
-
         b.root.setPadding(item.level * 8.dp + 8.dp, 8.dp, 8.dp, 8.dp)
 
         b.type.text = "Object"
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonSubObjectViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonSubObjectViewHolder.kt
similarity index 67%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonSubObjectViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonSubObjectViewHolder.kt
index dbc71ca2..3b9e2699 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/debug/viewholder/JsonSubObjectViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/viewholder/JsonSubObjectViewHolder.kt
@@ -2,22 +2,20 @@
  * Copyright (c) Kuba Szczodrzyński 2021-2-26.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.debug.viewholder
+package pl.szczodrzynski.edziennik.ui.debug.viewholder
 
 import android.annotation.SuppressLint
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.view.ContextThemeWrapper
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.LabItemSubObjectBinding
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceAdapter
-import pl.szczodrzynski.edziennik.ui.modules.debug.LabJsonAdapter
-import pl.szczodrzynski.edziennik.ui.modules.debug.models.LabJsonObject
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.utils.Themes
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceAdapter
+import pl.szczodrzynski.edziennik.ui.debug.LabJsonAdapter
+import pl.szczodrzynski.edziennik.ui.debug.models.LabJsonObject
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 
 class JsonSubObjectViewHolder(
     inflater: LayoutInflater,
@@ -30,8 +28,6 @@ class JsonSubObjectViewHolder(
 
     @SuppressLint("SetTextI18n")
     override fun onBind(activity: AppCompatActivity, app: App, item: LabJsonObject, position: Int, adapter: LabJsonAdapter) {
-        val contextWrapper = ContextThemeWrapper(activity, Themes.appTheme)
-
         b.root.setPadding(item.level * 8.dp + 8.dp, 8.dp, 8.dp, 8.dp)
 
         b.type.text = "Object"
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/BellSyncDialog.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/BellSyncDialog.kt
index ab1b1f8f..eb3b85cb 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/BellSyncDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2019-12-20
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.bell
+package pl.szczodrzynski.edziennik.ui.dialogs
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -15,7 +15,8 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.DialogBellSyncBinding
-import pl.szczodrzynski.edziennik.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ext.resolveDrawable
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import pl.szczodrzynski.edziennik.utils.models.Time
 import kotlin.coroutines.CoroutineContext
 
@@ -86,7 +87,7 @@ class BellSyncDialog(
         }
 
         if (Time.diff(Time.getNow(), bellTime) > Time(2, 0, 0)) { // Easter egg ^^
-            b.bellSyncButton.setImageDrawable(app.resources.getDrawable(R.drawable.ic_bell_wtf)) // wtf
+            b.bellSyncButton.setImageDrawable(R.drawable.ic_bell_wtf.resolveDrawable(app)) // wtf
         }
 
         launch {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncTimeChooseDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/BellSyncTimeChooseDialog.kt
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncTimeChooseDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/BellSyncTimeChooseDialog.kt
index 4116ab83..e43100a8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncTimeChooseDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/BellSyncTimeChooseDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2019-12-20
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.bell
+package pl.szczodrzynski.edziennik.ui.dialogs
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/changelog/ChangelogDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ChangelogDialog.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/changelog/ChangelogDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ChangelogDialog.kt
index aab73a69..9436c3d6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/changelog/ChangelogDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ChangelogDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.changelog
+package pl.szczodrzynski.edziennik.ui.dialogs
 
 import android.os.Build
 import android.widget.ScrollView
@@ -15,7 +15,7 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.dp
+import pl.szczodrzynski.edziennik.ext.dp
 import pl.szczodrzynski.edziennik.utils.BetterLinkMovementMethod
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/profile/ProfileRemoveDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ProfileRemoveDialog.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/profile/ProfileRemoveDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ProfileRemoveDialog.kt
index 7071f00d..dfb3e95e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/profile/ProfileRemoveDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ProfileRemoveDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-13.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.profile
+package pl.szczodrzynski.edziennik.ui.dialogs
 
 import android.widget.Toast
 import androidx.appcompat.app.AlertDialog
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/QrScannerDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/QrScannerDialog.kt
index d02f5a3f..7d7727fe 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/QrScannerDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/QrScannerDialog.kt
@@ -13,7 +13,7 @@ import kotlinx.coroutines.Job
 import me.dm7.barcodescanner.zxing.ZXingScannerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.dp
+import pl.szczodrzynski.edziennik.ext.dp
 import kotlin.coroutines.CoroutineContext
 
 class QrScannerDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/agenda/AgendaConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AgendaConfigDialog.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/agenda/AgendaConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AgendaConfigDialog.kt
index 150d7d65..4e0bc99d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/agenda/AgendaConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AgendaConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.agenda
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -11,7 +11,7 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.data.db.entity.Profile.Companion.REGISTRATION_ENABLED
 import pl.szczodrzynski.edziennik.databinding.DialogConfigAgendaBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.sync.RegistrationConfigDialog
+import pl.szczodrzynski.edziennik.ext.onChange
 import java.util.*
 
 class AgendaConfigDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AttendanceConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AttendanceConfigDialog.kt
index e7d66ed5..f59ee5c0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AttendanceConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AttendanceConfigDialog.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) Kuba Szczodrzyński 2020-5-4.
+ * Copyright (c) Kuba Szczodrzyński 2021-10-17.
  */
 
 package pl.szczodrzynski.edziennik.ui.dialogs.settings
@@ -12,7 +12,7 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.AttendanceConfigDialogBinding
-import pl.szczodrzynski.edziennik.onChange
+import pl.szczodrzynski.edziennik.ext.onChange
 
 class AttendanceConfigDialog(
         val activity: AppCompatActivity,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/BellSyncConfigDialog.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/BellSyncConfigDialog.kt
index 13dcb6f9..50fb7378 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/bell/BellSyncConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/BellSyncConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-20.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.bell
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import android.widget.TextView
 import android.widget.Toast
@@ -16,6 +16,7 @@ import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.ext.onClick
 import pl.szczodrzynski.edziennik.utils.models.Time
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/grade/GradesConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/GradesConfigDialog.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/grade/GradesConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/GradesConfigDialog.kt
index 20325447..fbfd0634 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/grade/GradesConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/GradesConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2020-1-16
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.grade
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import android.annotation.SuppressLint
 import androidx.appcompat.app.AlertDialog
@@ -12,6 +12,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import it.sephiroth.android.library.numberpicker.doOnStopTrackingTouch
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.databinding.DialogConfigGradesBinding
+import pl.szczodrzynski.edziennik.ext.join
+import pl.szczodrzynski.edziennik.ext.onChange
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setOnSelectedListener
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.COLOR_MODE_DEFAULT
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.COLOR_MODE_WEIGHTED
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.ORDER_BY_DATE_DESC
@@ -111,7 +115,7 @@ class GradesConfigDialog(
                 b.dontCountGradesText
                         .text
                         ?.toString()
-                        ?.toLowerCase(Locale.getDefault())
+                        ?.lowercase()
                         ?.replace(", ", ",")
         )
         profileConfig.dontCountEnabled = b.dontCountGrades.isChecked
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/MessagesConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/MessagesConfigDialog.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/MessagesConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/MessagesConfigDialog.kt
index e42bf61f..722f416c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/MessagesConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/MessagesConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-14.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/NotificationFilterDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/NotificationFilterDialog.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/NotificationFilterDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/NotificationFilterDialog.kt
index ad31c02d..0b82fccb 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/NotificationFilterDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/NotificationFilterDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-21.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.sync
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -13,7 +13,7 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Notification
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.onClick
 import kotlin.coroutines.CoroutineContext
 
 // TODO refactor dialog to allow configuring other profiles
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/profile/ProfileConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/ProfileConfigDialog.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/profile/ProfileConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/ProfileConfigDialog.kt
index e9204090..e3e922a7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/profile/ProfileConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/ProfileConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.profile
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import android.content.res.ColorStateList
 import androidx.appcompat.app.AlertDialog
@@ -16,6 +16,10 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.DialogProfileConfigBinding
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.onChange
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ui.dialogs.ProfileRemoveDialog
 import kotlin.coroutines.CoroutineContext
 
 class ProfileConfigDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/QuietHoursConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/QuietHoursConfigDialog.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/QuietHoursConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/QuietHoursConfigDialog.kt
index 5c933e20..1319b540 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/QuietHoursConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/QuietHoursConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-20.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.sync
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/RegistrationConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/RegistrationConfigDialog.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/RegistrationConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/RegistrationConfigDialog.kt
index 4a309536..f5b45320 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/RegistrationConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/RegistrationConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-15.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.sync
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/home/StudentNumberDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/StudentNumberDialog.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/home/StudentNumberDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/StudentNumberDialog.kt
index 3f3f8176..a4da704e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/home/StudentNumberDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/StudentNumberDialog.kt
@@ -2,14 +2,14 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-24.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.home
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import android.text.InputType
 import androidx.appcompat.app.AppCompatActivity
 import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.ui.dialogs.input
+import pl.szczodrzynski.edziennik.ext.input
 
 class StudentNumberDialog(
         val activity: AppCompatActivity,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/SyncIntervalDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/SyncIntervalDialog.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/SyncIntervalDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/SyncIntervalDialog.kt
index 6f4f027b..9a38d6a1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/SyncIntervalDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/SyncIntervalDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-20.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.sync
+package pl.szczodrzynski.edziennik.ui.dialogs.settings
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -11,6 +11,9 @@ import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.ext.HOUR
+import pl.szczodrzynski.edziennik.ext.MINUTE
+import pl.szczodrzynski.edziennik.ext.getSyncInterval
 import kotlin.coroutines.CoroutineContext
 
 class SyncIntervalDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/RegisterUnavailableDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/RegisterUnavailableDialog.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/RegisterUnavailableDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/RegisterUnavailableDialog.kt
index 10853812..5c0971c2 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/RegisterUnavailableDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/RegisterUnavailableDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-9-3.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs
+package pl.szczodrzynski.edziennik.ui.dialogs.sync
 
 import android.text.method.LinkMovementMethod
 import android.view.LayoutInflater
@@ -18,7 +18,7 @@ import pl.szczodrzynski.edziennik.BuildConfig
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.RegisterAvailabilityStatus
 import pl.szczodrzynski.edziennik.databinding.DialogRegisterUnavailableBinding
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.onClick
 import pl.szczodrzynski.edziennik.utils.Utils
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ServerMessageDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/ServerMessageDialog.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ServerMessageDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/ServerMessageDialog.kt
index cebc4e04..8cbe4430 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/ServerMessageDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/ServerMessageDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-1-19.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs
+package pl.szczodrzynski.edziennik.ui.dialogs.sync
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/SyncViewListDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/SyncViewListDialog.kt
index 96a72cb5..35636eb6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/SyncViewListDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/SyncViewListDialog.kt
@@ -14,7 +14,7 @@ import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.databinding.DialogLessonDetailsBinding
-import pl.szczodrzynski.edziennik.ui.modules.messages.list.MessagesFragment
+import pl.szczodrzynski.edziennik.ui.messages.list.MessagesFragment
 import kotlin.coroutines.CoroutineContext
 
 class SyncViewListDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/UpdateAvailableDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/UpdateAvailableDialog.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/UpdateAvailableDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/UpdateAvailableDialog.kt
index 3c54dc92..93b392aa 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/UpdateAvailableDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/sync/UpdateAvailableDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-9-3.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs
+package pl.szczodrzynski.edziennik.ui.dialogs.sync
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -12,6 +12,8 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.Update
+import pl.szczodrzynski.edziennik.ext.Intent
+import pl.szczodrzynski.edziennik.ext.setMessage
 import pl.szczodrzynski.edziennik.sync.UpdateDownloaderService
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorDetailsDialog.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorDetailsDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorDetailsDialog.kt
index 32ec46b9..b1a02b5f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorDetailsDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorDetailsDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.error
+package pl.szczodrzynski.edziennik.ui.error
 
 import android.widget.Toast
 import androidx.appcompat.app.AlertDialog
@@ -12,6 +12,7 @@ import kotlinx.coroutines.*
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
+import pl.szczodrzynski.edziennik.ext.*
 import kotlin.coroutines.CoroutineContext
 
 class ErrorDetailsDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorDialog.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorDialog.kt
index bf0ff712..20f47522 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-13.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.error
+package pl.szczodrzynski.edziennik.ui.error
 
 import android.util.Log
 import androidx.appcompat.app.AlertDialog
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorSnackbar.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorSnackbar.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorSnackbar.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorSnackbar.kt
index be715f4d..0057eabd 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/error/ErrorSnackbar.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/error/ErrorSnackbar.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-13.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.error
+package pl.szczodrzynski.edziennik.ui.error
 
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventDetailsDialog.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventDetailsDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventDetailsDialog.kt
index 1b23d45e..d3dde62d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventDetailsDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventDetailsDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.event
+package pl.szczodrzynski.edziennik.ui.event
 
 import android.content.ActivityNotFoundException
 import android.content.Intent
@@ -24,7 +24,8 @@ import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
 import pl.szczodrzynski.edziennik.databinding.DialogEventDetailsBinding
-import pl.szczodrzynski.edziennik.ui.modules.timetable.TimetableFragment
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.timetable.TimetableFragment
 import pl.szczodrzynski.edziennik.utils.BetterLink
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventListAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventListAdapter.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventListAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventListAdapter.kt
index 40de3145..a7df3c95 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventListAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventListAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2019-11-30
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.event
+package pl.szczodrzynski.edziennik.ui.event
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -13,8 +13,8 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
-import pl.szczodrzynski.edziennik.startCoroutineTimer
-import pl.szczodrzynski.edziennik.ui.modules.search.SearchableAdapter
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.search.SearchableAdapter
 import kotlin.coroutines.CoroutineContext
 
 class EventListAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventManualDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventManualDialog.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventManualDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventManualDialog.kt
index 51557351..aa0f7aae 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventManualDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventManualDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.event
+package pl.szczodrzynski.edziennik.ui.event
 
 import android.view.View
 import android.widget.Toast
@@ -30,9 +30,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.*
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
 import pl.szczodrzynski.edziennik.databinding.DialogEventManualV2Binding
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.ui.dialogs.StyledTextDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.sync.RegistrationConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.views.TimeDropdown.Companion.DISPLAY_LESSONS
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.RegistrationConfigDialog
+import pl.szczodrzynski.edziennik.ui.views.TimeDropdown.Companion.DISPLAY_LESSONS
 import pl.szczodrzynski.edziennik.utils.Anim
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import pl.szczodrzynski.edziennik.utils.managers.TextStylingManager.HtmlMode.SIMPLE
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventViewHolder.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventViewHolder.kt
index 8aff06dc..8170f335 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/event/EventViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventViewHolder.kt
@@ -2,17 +2,19 @@
  * Copyright (c) Kuba Szczodrzyński 2021-10-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.event
+package pl.szczodrzynski.edziennik.ui.event
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
 import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
 import pl.szczodrzynski.edziennik.databinding.EventListItemBinding
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Week
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/feedback/FeedbackActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/feedback/FeedbackActivity.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/feedback/FeedbackActivity.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/feedback/FeedbackActivity.kt
index fb751e3a..d27b4dd0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/feedback/FeedbackActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/feedback/FeedbackActivity.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.feedback
+package pl.szczodrzynski.edziennik.ui.feedback
 
 import android.os.Bundle
 import android.view.MenuItem
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/feedback/FeedbackFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/feedback/FeedbackFragment.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/feedback/FeedbackFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/feedback/FeedbackFragment.kt
index 3c33be8d..c9089c45 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/feedback/FeedbackFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/feedback/FeedbackFragment.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.feedback
+package pl.szczodrzynski.edziennik.ui.feedback
 
 import android.content.BroadcastReceiver
 import android.graphics.Bitmap
@@ -25,12 +25,12 @@ import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.crc16
 import pl.szczodrzynski.edziennik.data.api.events.FeedbackMessageEvent
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage
 import pl.szczodrzynski.edziennik.databinding.FragmentFeedbackBinding
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.crc16
+import pl.szczodrzynski.edziennik.ext.onClick
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.Utils.openUrl
 import java.util.*
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/grade/GradeDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradeDetailsDialog.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/grade/GradeDetailsDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradeDetailsDialog.kt
index a42f9e2f..0e8c9063 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/grade/GradeDetailsDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradeDetailsDialog.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.dialogs.grade
+package pl.szczodrzynski.edziennik.ui.grades
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -11,9 +11,9 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
 import pl.szczodrzynski.edziennik.databinding.DialogGradeDetailsBinding
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.setTintColor
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setTintColor
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.GradesConfigDialog
 import pl.szczodrzynski.edziennik.utils.BetterLink
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradeView.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradeView.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradeView.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradeView.kt
index b80ad2ac..e9f35c16 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradeView.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradeView.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-1.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades
+package pl.szczodrzynski.edziennik.ui.grades
 
 import android.annotation.SuppressLint
 import android.content.Context
@@ -23,9 +23,9 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_PROPOSED
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_FINAL
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_PROPOSED
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.resolveAttr
-import pl.szczodrzynski.edziennik.setTintColor
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ext.setTintColor
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager
 
 class GradeView : AppCompatTextView {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradesAdapter.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradesAdapter.kt
index 086f073d..ae8dca9c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradesAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades
+package pl.szczodrzynski.edziennik.ui.grades
 
 import android.animation.ObjectAnimator
 import android.view.LayoutInflater
@@ -17,10 +17,10 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.startCoroutineTimer
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.*
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.*
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.grades.models.*
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.*
 import kotlin.coroutines.CoroutineContext
 
 class GradesAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradesListFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradesListFragment.kt
index 63c935ff..2ab6c069 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/GradesListFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades
+package pl.szczodrzynski.edziennik.ui.grades
 
 import android.os.AsyncTask
 import android.os.Bundle
@@ -22,12 +22,12 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata.TYPE_GRADE
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
 import pl.szczodrzynski.edziennik.databinding.GradesListFragmentBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.grade.GradeDetailsDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.grade.GradesConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesAverages
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSemester
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesStats
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSubject
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.GradesConfigDialog
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesAverages
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSemester
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesStats
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSubject
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/editor/GradesEditorAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/editor/GradesEditorAdapter.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/editor/GradesEditorAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/editor/GradesEditorAdapter.kt
index df9faad5..22a7b7e8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/editor/GradesEditorAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/editor/GradesEditorAdapter.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.grades.editor
+package pl.szczodrzynski.edziennik.ui.grades.editor
 
 import android.content.Context
 import android.graphics.PorterDuff
@@ -14,7 +14,7 @@ import com.daimajia.swipe.SwipeLayout
 import com.mikepenz.iconics.view.IconicsImageView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.ui.modules.grades.editor.GradesEditorFragment.Companion.modifyGradeChooser
+import pl.szczodrzynski.edziennik.ui.grades.editor.GradesEditorFragment.Companion.modifyGradeChooser
 import pl.szczodrzynski.edziennik.utils.Colors.gradeNameToColor
 import java.text.DecimalFormat
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/editor/GradesEditorFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/editor/GradesEditorFragment.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/editor/GradesEditorFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/editor/GradesEditorFragment.kt
index 2d90f4f9..ac235249 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/editor/GradesEditorFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/editor/GradesEditorFragment.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.grades.editor
+package pl.szczodrzynski.edziennik.ui.grades.editor
 
 import android.graphics.PorterDuff
 import android.graphics.PorterDuffColorFilter
@@ -15,7 +15,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.databinding.FragmentGradesEditorBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.input
+import pl.szczodrzynski.edziennik.ext.getFloat
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.input
 import pl.szczodrzynski.edziennik.utils.Colors
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.YEAR_1_AVG_2_AVG
 import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.YEAR_1_AVG_2_SEM
@@ -106,7 +109,7 @@ class GradesEditorFragment : Fragment() {
                         continue
                     }
                     var weight = editorGrade.weight
-                    if (config.dontCountEnabled && config.dontCountGrades.contains(editorGrade.name.toLowerCase().trim())) {
+                    if (config.dontCountEnabled && config.dontCountGrades.contains(editorGrade.name.lowercase().trim())) {
                         weight = 0f
                     }
                     val value = editorGrade.value * weight
@@ -171,7 +174,7 @@ class GradesEditorFragment : Fragment() {
         averageSemester = 0f
         for (editorGrade in editorGrades) {
             var weight = editorGrade.weight
-            if (config.dontCountEnabled && config.dontCountGrades.contains(editorGrade.name.toLowerCase().trim())) {
+            if (config.dontCountEnabled && config.dontCountGrades.contains(editorGrade.name.lowercase().trim())) {
                 weight = 0f
             }
             val value = editorGrade.value * weight
@@ -213,7 +216,7 @@ class GradesEditorFragment : Fragment() {
                             continue
                         }
                         var weight = grade.weight
-                        if (config.dontCountEnabled && config.dontCountGrades.contains(grade.name.toLowerCase().trim())) {
+                        if (config.dontCountEnabled && config.dontCountGrades.contains(grade.name.lowercase().trim())) {
                             weight = 0f
                         }
                         val value = grade.value * weight
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/ExpandableItemModel.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/ExpandableItemModel.kt
similarity index 56%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/ExpandableItemModel.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/ExpandableItemModel.kt
index 20cb3ffc..39b2a08c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/ExpandableItemModel.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/ExpandableItemModel.kt
@@ -2,9 +2,9 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.models
+package pl.szczodrzynski.edziennik.ui.grades.models
 
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter.Companion.STATE_CLOSED
+import pl.szczodrzynski.edziennik.ui.grades.GradesAdapter.Companion.STATE_CLOSED
 
 abstract class ExpandableItemModel<T>(open val items: MutableList<T>) {
     open var level: Int = 3
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesAverages.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesAverages.kt
similarity index 84%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesAverages.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesAverages.kt
index 185710d1..551f145c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesAverages.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesAverages.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-1.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.models
+package pl.szczodrzynski.edziennik.ui.grades.models
 
 class GradesAverages {
     var normalSum = 0f
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesEmpty.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesEmpty.kt
similarity index 55%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesEmpty.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesEmpty.kt
index 4b726f3f..3b80e741 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesEmpty.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesEmpty.kt
@@ -2,6 +2,6 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-1.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.models
+package pl.szczodrzynski.edziennik.ui.grades.models
 
 class GradesEmpty
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesSemester.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesSemester.kt
similarity index 88%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesSemester.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesSemester.kt
index e8e107ad..51f063df 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesSemester.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesSemester.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.models
+package pl.szczodrzynski.edziennik.ui.grades.models
 
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesStats.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesStats.kt
similarity index 89%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesStats.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesStats.kt
index 76833b45..26041dcd 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesStats.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesStats.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-3.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.models
+package pl.szczodrzynski.edziennik.ui.grades.models
 
 class GradesStats {
     var normalSem1 = 0f
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesSubject.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesSubject.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesSubject.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesSubject.kt
index a61abc0d..c1495815 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/models/GradesSubject.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/models/GradesSubject.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.models
+package pl.szczodrzynski.edziennik.ui.grades.models
 
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/BindableViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/BindableViewHolder.kt
similarity index 81%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/BindableViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/BindableViewHolder.kt
index 6dd83384..caa5605b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/BindableViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/BindableViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.viewholder
+package pl.szczodrzynski.edziennik.ui.grades.viewholder
 
 import androidx.appcompat.app.AppCompatActivity
 import pl.szczodrzynski.edziennik.App
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/EmptyViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/EmptyViewHolder.kt
similarity index 79%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/EmptyViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/EmptyViewHolder.kt
index ec0eb8ba..866eda04 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/EmptyViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/EmptyViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-1.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.viewholder
+package pl.szczodrzynski.edziennik.ui.grades.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -10,8 +10,8 @@ import androidx.appcompat.app.AppCompatActivity
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.GradesItemEmptyBinding
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesEmpty
+import pl.szczodrzynski.edziennik.ui.grades.GradesAdapter
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesEmpty
 
 class EmptyViewHolder(
     inflater: LayoutInflater,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/GradeViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/GradeViewHolder.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/GradeViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/GradeViewHolder.kt
index 2af79ba3..b8cab8b7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/GradeViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/GradeViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.viewholder
+package pl.szczodrzynski.edziennik.ui.grades.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -13,8 +13,8 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
 import pl.szczodrzynski.edziennik.databinding.GradesItemGradeBinding
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSubject
+import pl.szczodrzynski.edziennik.ui.grades.GradesAdapter
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSubject
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class GradeViewHolder(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/SemesterViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/SemesterViewHolder.kt
similarity index 87%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/SemesterViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/SemesterViewHolder.kt
index 5686a37f..7f05d78d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/SemesterViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/SemesterViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.viewholder
+package pl.szczodrzynski.edziennik.ui.grades.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -12,10 +12,10 @@ import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.GradesItemSemesterBinding
-import pl.szczodrzynski.edziennik.setText
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSemester
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSubject
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.grades.GradesAdapter
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSemester
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSubject
 
 class SemesterViewHolder(
     inflater: LayoutInflater,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/StatsViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/StatsViewHolder.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/StatsViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/StatsViewHolder.kt
index 532ade84..37a32ef5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/StatsViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/StatsViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-3.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.viewholder
+package pl.szczodrzynski.edziennik.ui.grades.viewholder
 
 import android.content.Context
 import android.view.LayoutInflater
@@ -14,10 +14,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.GradesItemStatsBinding
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.ui.dialogs.grade.GradesConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradesAdapter
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesStats
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.GradesConfigDialog
+import pl.szczodrzynski.edziennik.ui.grades.GradesAdapter
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesStats
 import java.text.DecimalFormat
 
 class StatsViewHolder(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/SubjectViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/SubjectViewHolder.kt
similarity index 91%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/SubjectViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/SubjectViewHolder.kt
index 58015a0a..eb6cf25e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/viewholder/SubjectViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/grades/viewholder/SubjectViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-29.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.grades.viewholder
+package pl.szczodrzynski.edziennik.ui.grades.viewholder
 
 import android.text.TextUtils
 import android.view.LayoutInflater
@@ -16,12 +16,16 @@ import androidx.appcompat.view.ContextThemeWrapper
 import androidx.core.view.get
 import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.GradesItemSubjectBinding
-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
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSubject
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.grades.GradeView
+import pl.szczodrzynski.edziennik.ui.grades.GradesAdapter
+import pl.szczodrzynski.edziennik.ui.grades.GradesAdapter.Companion.STATE_CLOSED
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSubject
 import pl.szczodrzynski.edziennik.utils.Themes
 
 class SubjectViewHolder(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CardItemTouchHelperCallback.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/CardItemTouchHelperCallback.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CardItemTouchHelperCallback.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/CardItemTouchHelperCallback.kt
index 7cfb3c2f..d1a0aa49 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CardItemTouchHelperCallback.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/CardItemTouchHelperCallback.kt
@@ -2,14 +2,14 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 import androidx.recyclerview.widget.ItemTouchHelper
 import androidx.recyclerview.widget.ItemTouchHelper.*
 import androidx.recyclerview.widget.RecyclerView
 import com.google.android.material.card.MaterialCardView
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment.Companion.removeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment.Companion.swapCards
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment.Companion.removeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment.Companion.swapCards
 import pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
 
 class CardItemTouchHelperCallback(private val cardAdapter: HomeCardAdapter, private val refreshLayout: SwipeRefreshLayoutNoIndicator?) : ItemTouchHelper.Callback() {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CounterActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/CounterActivity.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CounterActivity.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/CounterActivity.kt
index 868b330f..f50374ee 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CounterActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/CounterActivity.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2019-12-21
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 import android.os.Bundle
 import androidx.appcompat.app.AppCompatActivity
@@ -15,7 +15,11 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
 import pl.szczodrzynski.edziennik.databinding.ActivityCounterBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.bell.BellSyncTimeChooseDialog
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ext.timeLeft
+import pl.szczodrzynski.edziennik.ext.timeTill
+import pl.szczodrzynski.edziennik.ui.dialogs.BellSyncTimeChooseDialog
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCard.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCard.kt
index 2c7894ce..af59bbb6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 interface HomeCard {
     companion object {
@@ -30,4 +30,4 @@ interface HomeCard {
 
     fun bind(position: Int, holder: HomeCardAdapter.ViewHolder)
     fun unbind(position: Int, holder: HomeCardAdapter.ViewHolder)
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCardAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCardAdapter.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCardAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCardAdapter.kt
index 05ba72b6..3e3df7f2 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCardAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCardAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 import android.annotation.SuppressLint
 import android.view.LayoutInflater
@@ -48,4 +48,4 @@ class HomeCardAdapter(var items: MutableList<HomeCard>) : RecyclerView.Adapter<R
             }*/
         }
     }
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCardModel.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCardModel.kt
similarity index 70%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCardModel.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCardModel.kt
index bc577713..40c688a1 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeCardModel.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeCardModel.kt
@@ -2,11 +2,11 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-2.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 import java.io.Serializable
 
 data class HomeCardModel(
         val profileId: Int,
         val cardId: Int
-) : Serializable
\ No newline at end of file
+) : Serializable
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeConfigDialog.kt
similarity index 87%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeConfigDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeConfigDialog.kt
index 268bf211..bae682f2 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeConfigDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeConfigDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-11.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -10,10 +10,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard.Companion.CARD_EVENTS
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard.Companion.CARD_GRADES
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard.Companion.CARD_LUCKY_NUMBER
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard.Companion.CARD_TIMETABLE
+import pl.szczodrzynski.edziennik.ui.home.HomeCard.Companion.CARD_EVENTS
+import pl.szczodrzynski.edziennik.ui.home.HomeCard.Companion.CARD_GRADES
+import pl.szczodrzynski.edziennik.ui.home.HomeCard.Companion.CARD_LUCKY_NUMBER
+import pl.szczodrzynski.edziennik.ui.home.HomeCard.Companion.CARD_TIMETABLE
 import kotlin.collections.set
 
 class HomeConfigDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeDummyCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeDummyCard.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeDummyCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeDummyCard.kt
index 1f6904d2..3963c60b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeDummyCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeDummyCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 import android.widget.TextView
 import androidx.core.view.plusAssign
@@ -12,7 +12,7 @@ import kotlinx.coroutines.Job
 import kotlinx.coroutines.launch
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
-import pl.szczodrzynski.edziennik.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import kotlin.coroutines.CoroutineContext
 
 class HomeDummyCard(override val id: Int) : HomeCard, CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeFragment.kt
index 5d5cbc45..5c875c9f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/HomeFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home
+package pl.szczodrzynski.edziennik.ui.home
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -21,11 +21,15 @@ import androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate
 import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial.Icon
 import eu.szkolny.font.SzkolnyFont
 import kotlinx.coroutines.*
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.BuildConfig
+import pl.szczodrzynski.edziennik.MainActivity
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.databinding.FragmentHomeBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.home.StudentNumberDialog
-import pl.szczodrzynski.edziennik.ui.modules.home.cards.*
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.StudentNumberDialog
+import pl.szczodrzynski.edziennik.ui.home.cards.*
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
 import kotlin.coroutines.CoroutineContext
@@ -134,8 +138,6 @@ class HomeFragment : Fragment(), CoroutineScope {
             b.refreshLayout.isEnabled = scrollY == 0
         }
 
-        val showUnified = false
-
         val cards = app.config.forProfile().ui.homeCards.filter { it.profileId == app.profile.id }.toMutableList()
         if (cards.isEmpty()) {
             cards += listOf(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeArchiveCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeArchiveCard.kt
similarity index 87%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeArchiveCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeArchiveCard.kt
index 17fc89e4..73fc5610 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeArchiveCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeArchiveCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-8-25.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -14,9 +14,13 @@ import kotlinx.coroutines.*
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.CardHomeArchiveBinding
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setMessage
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import kotlin.coroutines.CoroutineContext
 
 class HomeArchiveCard(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeAvailabilityCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeAvailabilityCard.kt
similarity index 86%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeAvailabilityCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeAvailabilityCard.kt
index 411d3aef..d91cfaac 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeAvailabilityCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeAvailabilityCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-9-3.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.view.LayoutInflater
 import android.view.View
@@ -18,12 +18,16 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.CardHomeAvailabilityBinding
+import pl.szczodrzynski.edziennik.ext.Intent
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setText
 import pl.szczodrzynski.edziennik.sync.UpdateDownloaderService
-import pl.szczodrzynski.edziennik.ui.dialogs.RegisterUnavailableDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.UpdateAvailableDialog
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ui.dialogs.sync.RegisterUnavailableDialog
+import pl.szczodrzynski.edziennik.ui.dialogs.sync.UpdateAvailableDialog
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeDebugCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeDebugCard.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeDebugCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeDebugCard.kt
index 3fde41ab..080ae143 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeDebugCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeDebugCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-22.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.appwidget.AppWidgetManager
 import android.content.ComponentName
@@ -25,12 +25,12 @@ import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.CardHomeDebugBinding
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.ui.dialogs.captcha.LibrusCaptchaDialog
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ui.captcha.LibrusCaptchaDialog
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import pl.szczodrzynski.edziennik.ui.widgets.WidgetConfigActivity
 import pl.szczodrzynski.edziennik.ui.widgets.luckynumber.WidgetLuckyNumberProvider
 import pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeEventsCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeEventsCard.kt
similarity index 87%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeEventsCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeEventsCard.kt
index f92e86b8..c3601f2b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeEventsCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeEventsCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-28.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.view.LayoutInflater
 import android.view.View
@@ -20,14 +20,14 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.CardHomeEventsBinding
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.ui.modules.event.EventDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.event.EventListAdapter
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ui.event.EventDetailsDialog
+import pl.szczodrzynski.edziennik.ui.event.EventListAdapter
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeGradesCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeGradesCard.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeGradesCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeGradesCard.kt
index f1c3373e..0b0386a4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeGradesCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeGradesCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2019-11-29
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.graphics.Typeface
 import android.os.Build
@@ -29,11 +29,11 @@ import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.data.db.entity.Subject
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
 import pl.szczodrzynski.edziennik.databinding.CardHomeGradesBinding
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.ui.modules.grades.GradeView
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ui.grades.GradeView
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.ItemGradesSubjectModel
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeLuckyNumberCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeLuckyNumberCard.kt
similarity index 85%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeLuckyNumberCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeLuckyNumberCard.kt
index 31611e48..7efec925 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeLuckyNumberCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeLuckyNumberCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-24.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.view.LayoutInflater
 import android.view.ViewGroup.LayoutParams.MATCH_PARENT
@@ -15,13 +15,18 @@ import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import kotlinx.coroutines.launch
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.MainActivity
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.CardHomeLuckyNumberBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.home.StudentNumberDialog
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.StudentNumberDialog
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
 
@@ -58,7 +63,7 @@ class HomeLuckyNumberCard(
             R.string.home_lucky_number_details_click_to_set
         else
             R.string.home_lucky_number_details
-        b.subText.setText(subTextRes, profile.name ?: "", profile.studentNumber)
+        b.subText.setText(subTextRes, profile.name, profile.studentNumber)
 
         app.db.luckyNumberDao().getNearestFuture(profile.id, today).observe(fragment, Observer { luckyNumber ->
             val isYours = luckyNumber?.number == profile.studentNumber
@@ -99,7 +104,7 @@ class HomeLuckyNumberCard(
                     R.string.home_lucky_number_details_click_to_set
                 else
                     R.string.home_lucky_number_details
-                b.subText.setText(newSubTextRes, profile.name ?: "", profile.studentNumber)
+                b.subText.setText(newSubTextRes, profile.name, profile.studentNumber)
             })
         }
     }}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTemplateCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeTemplateCard.kt
similarity index 83%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTemplateCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeTemplateCard.kt
index 0bb2e881..5cc7b77c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTemplateCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeTemplateCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-22.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -17,11 +17,11 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.CardHomeTemplateBinding
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import kotlin.coroutines.CoroutineContext
 
 class HomeTemplateCard(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeTimetableCard.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeTimetableCard.kt
index d1a30053..f4bd6e47 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/home/cards/HomeTimetableCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-24.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.home.cards
+package pl.szczodrzynski.edziennik.ui.home.cards
 
 import android.content.Intent
 import android.os.Bundle
@@ -29,11 +29,12 @@ import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
 import pl.szczodrzynski.edziennik.databinding.CardHomeTimetableBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.bell.BellSyncTimeChooseDialog
-import pl.szczodrzynski.edziennik.ui.modules.home.CounterActivity
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCard
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardAdapter
-import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.dialogs.BellSyncTimeChooseDialog
+import pl.szczodrzynski.edziennik.ui.home.CounterActivity
+import pl.szczodrzynski.edziennik.ui.home.HomeCard
+import pl.szczodrzynski.edziennik.ui.home.HomeCardAdapter
+import pl.szczodrzynski.edziennik.ui.home.HomeFragment
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import pl.szczodrzynski.edziennik.utils.models.Week
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkDate.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkDate.kt
similarity index 66%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkDate.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkDate.kt
index d923c5a1..a66fed71 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkDate.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkDate.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.homework
+package pl.szczodrzynski.edziennik.ui.homework
 
 class HomeworkDate {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkFragment.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkFragment.kt
index 54763fe7..09e23956 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.homework
+package pl.szczodrzynski.edziennik.ui.homework
 
 import android.os.AsyncTask
 import android.os.Bundle
@@ -16,12 +16,16 @@ import eu.szkolny.font.SzkolnyFont
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.MainActivity
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.databinding.HomeworkFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.FragmentLazyPagerAdapter
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.addOnPageSelectedListener
+import pl.szczodrzynski.edziennik.ui.base.lazypager.FragmentLazyPagerAdapter
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
 import kotlin.coroutines.CoroutineContext
@@ -74,7 +78,7 @@ class HomeworkFragment : Fragment(), CoroutineScope {
                 }))
 
         val pagerAdapter = FragmentLazyPagerAdapter(
-                fragmentManager ?: return,
+            parentFragmentManager,
                 b.refreshLayout,
                 listOf(
                         HomeworkListFragment().apply {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkListFragment.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkListFragment.kt
index 8c1e8b7e..db1c9f58 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/homework/HomeworkListFragment.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.homework
+package pl.szczodrzynski.edziennik.ui.homework
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -13,10 +13,12 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.databinding.HomeworkListFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
-import pl.szczodrzynski.edziennik.ui.modules.event.EventDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.event.EventListAdapter
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.event.EventDetailsDialog
+import pl.szczodrzynski.edziennik.ui.event.EventListAdapter
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/intro/ChangelogIntroActivity.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/intro/ChangelogIntroActivity.java
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/intro/ChangelogIntroActivity.java
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/intro/ChangelogIntroActivity.java
index 0c60efbd..f5632876 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/intro/ChangelogIntroActivity.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/intro/ChangelogIntroActivity.java
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.intro;
+package pl.szczodrzynski.edziennik.ui.intro;
 
 import android.os.Build;
 import android.os.Bundle;
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/intro/FragmentSlideMod.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/intro/FragmentSlideMod.java
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/intro/FragmentSlideMod.java
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/intro/FragmentSlideMod.java
index 1d3cfb92..47bf2a48 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/intro/FragmentSlideMod.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/intro/FragmentSlideMod.java
@@ -22,22 +22,23 @@
  * SOFTWARE.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.intro;
+package pl.szczodrzynski.edziennik.ui.intro;
 
 import android.content.Context;
 import android.os.Build;
 import android.os.Bundle;
-import androidx.annotation.ColorRes;
-import androidx.annotation.LayoutRes;
-import androidx.annotation.StringRes;
-import androidx.annotation.StyleRes;
-import androidx.fragment.app.Fragment;
-import androidx.appcompat.view.ContextThemeWrapper;
 import android.text.Html;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.annotation.ColorRes;
+import androidx.annotation.LayoutRes;
+import androidx.annotation.StringRes;
+import androidx.annotation.StyleRes;
+import androidx.appcompat.view.ContextThemeWrapper;
+import androidx.fragment.app.Fragment;
+
 import com.heinrichreimersoftware.materialintro.app.ButtonCtaFragment;
 import com.heinrichreimersoftware.materialintro.app.SlideFragment;
 import com.heinrichreimersoftware.materialintro.slide.ButtonCtaSlide;
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginActivity.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginActivity.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginActivity.kt
index 32446605..1f8fb442 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginActivity.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.app.Activity
 import android.os.Bundle
@@ -19,7 +19,7 @@ import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.databinding.LoginActivityBinding
-import pl.szczodrzynski.edziennik.ui.modules.error.ErrorSnackbar
+import pl.szczodrzynski.edziennik.ui.error.ErrorSnackbar
 import kotlin.coroutines.CoroutineContext
 
 class LoginActivity : AppCompatActivity(), CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginChooserAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginChooserAdapter.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginChooserAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginChooserAdapter.kt
index 704e660a..e2e02a05 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginChooserAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginChooserAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.view.LayoutInflater
 import android.view.View
@@ -14,10 +14,10 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.login.viewholder.ModeViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.login.viewholder.RegisterViewHolder
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ui.login.viewholder.ModeViewHolder
+import pl.szczodrzynski.edziennik.ui.login.viewholder.RegisterViewHolder
 import kotlin.coroutines.CoroutineContext
 
 class LoginChooserAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginChooserFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginChooserFragment.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginChooserFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginChooserFragment.kt
index c69d3ec2..0b22dca0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginChooserFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginChooserFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.animation.ValueAnimator
 import android.annotation.SuppressLint
@@ -26,8 +26,9 @@ import kotlinx.coroutines.*
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.databinding.LoginChooserFragmentBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.RegisterUnavailableDialog
-import pl.szczodrzynski.edziennik.ui.modules.feedback.FeedbackActivity
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.dialogs.sync.RegisterUnavailableDialog
+import pl.szczodrzynski.edziennik.ui.feedback.FeedbackActivity
 import pl.szczodrzynski.edziennik.utils.BetterLinkMovementMethod
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginEggsFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginEggsFragment.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginEggsFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginEggsFragment.kt
index a6b688b2..429fd4fb 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginEggsFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginEggsFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-10-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.annotation.SuppressLint
 import android.os.Build
@@ -24,7 +24,7 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.BuildConfig
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.md5
+import pl.szczodrzynski.edziennik.ext.md5
 import kotlin.coroutines.CoroutineContext
 
 class LoginEggsFragment : Fragment(), CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFinishFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginFinishFragment.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFinishFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginFinishFragment.kt
index 7b2e66b8..e7703dab 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFinishFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginFinishFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.app.Activity
 import android.os.Bundle
@@ -15,6 +15,8 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.databinding.LoginFinishFragmentBinding
+import pl.szczodrzynski.edziennik.ext.Intent
+import pl.szczodrzynski.edziennik.ext.onClick
 import kotlin.coroutines.CoroutineContext
 
 class LoginFinishFragment : Fragment(), CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginFormFragment.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginFormFragment.kt
index 39189a2a..3cbea439 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginFormFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.annotation.SuppressLint
 import android.os.Bundle
@@ -23,6 +23,7 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.databinding.LoginFormCheckboxItemBinding
 import pl.szczodrzynski.edziennik.databinding.LoginFormFieldItemBinding
 import pl.szczodrzynski.edziennik.databinding.LoginFormFragmentBinding
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.navlib.colorAttr
 import java.util.*
 import kotlin.coroutines.CoroutineContext
@@ -174,9 +175,9 @@ class LoginFormFragment : Fragment(), CoroutineScope {
                         text = text.trim()
 
                     if (credential.caseMode == LoginInfo.FormField.CaseMode.UPPER_CASE)
-                        text = text.toUpperCase(Locale.getDefault())
+                        text = text.uppercase()
                     if (credential.caseMode == LoginInfo.FormField.CaseMode.LOWER_CASE)
-                        text = text.toLowerCase(Locale.getDefault())
+                        text = text.lowercase()
 
                     credential.stripTextRegex?.let {
                         text = text.replace(it.toRegex(), "")
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginInfo.kt
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginInfo.kt
index ed72f175..c9a15659 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginInfo.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import androidx.annotation.DrawableRes
 import androidx.annotation.StringRes
@@ -10,7 +10,7 @@ import com.mikepenz.iconics.typeface.IIcon
 import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.*
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.ExpandableItemModel
+import pl.szczodrzynski.edziennik.ui.grades.models.ExpandableItemModel
 import pl.szczodrzynski.fslogin.realm.RealmData
 
 object LoginInfo {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPlatformAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPlatformAdapter.kt
similarity index 89%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPlatformAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPlatformAdapter.kt
index 5bc80f36..7f990514 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPlatformAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPlatformAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -12,8 +12,8 @@ import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.ui.modules.login.viewholder.PlatformViewHolder
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ui.login.viewholder.PlatformViewHolder
 import kotlin.coroutines.CoroutineContext
 
 class LoginPlatformAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPlatformListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPlatformListFragment.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPlatformListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPlatformListFragment.kt
index 988d1bde..8a2bb25d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPlatformListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPlatformListFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -18,6 +18,9 @@ import kotlinx.coroutines.launch
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.databinding.LoginPlatformListFragmentBinding
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPrizeFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPrizeFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPrizeFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPrizeFragment.kt
index f14c6d19..35c57041 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginPrizeFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginPrizeFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-10-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.os.Bundle
 import android.os.Process
@@ -18,7 +18,7 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.LoginPrizeFragmentBinding
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.onClick
 import kotlin.coroutines.CoroutineContext
 import kotlin.system.exitProcess
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginProgressFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginProgressFragment.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginProgressFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginProgressFragment.kt
index aaebbac0..03abbc2b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginProgressFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginProgressFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -28,7 +28,7 @@ import pl.szczodrzynski.edziennik.data.api.events.UserActionRequiredEvent
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.databinding.LoginProgressFragmentBinding
-import pl.szczodrzynski.edziennik.joinNotNullStrings
+import pl.szczodrzynski.edziennik.ext.joinNotNullStrings
 import kotlin.coroutines.CoroutineContext
 import kotlin.math.max
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSummaryAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSummaryAdapter.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSummaryAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSummaryAdapter.kt
index bc9cafbf..f38f4f87 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSummaryAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSummaryAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -14,8 +14,8 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.LoginSummaryItemBinding
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.trigger
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.trigger
 import kotlin.coroutines.CoroutineContext
 
 class LoginSummaryAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSummaryFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSummaryFragment.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSummaryFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSummaryFragment.kt
index ceca8a00..e03bba78 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSummaryFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSummaryFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -16,6 +16,9 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.databinding.LoginSummaryFragmentBinding
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.onChange
+import pl.szczodrzynski.edziennik.ext.onClick
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSyncErrorFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSyncErrorFragment.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSyncErrorFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSyncErrorFragment.kt
index e13130a5..f9d694bd 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSyncErrorFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSyncErrorFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-14.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -15,7 +15,7 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.LoginSyncErrorFragmentBinding
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.onClick
 import kotlin.coroutines.CoroutineContext
 
 class LoginSyncErrorFragment : Fragment(), CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSyncFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSyncFragment.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSyncFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSyncFragment.kt
index 3736e20f..64384bbc 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginSyncFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginSyncFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login
+package pl.szczodrzynski.edziennik.ui.login
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -17,7 +17,8 @@ import kotlinx.coroutines.Job
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.api.events.ApiTaskAllFinishedEvent
 import pl.szczodrzynski.edziennik.data.api.events.ApiTaskErrorEvent
@@ -25,6 +26,9 @@ import pl.szczodrzynski.edziennik.data.api.events.ApiTaskProgressEvent
 import pl.szczodrzynski.edziennik.data.api.events.ApiTaskStartedEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
 import pl.szczodrzynski.edziennik.databinding.LoginSyncFragmentBinding
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.asBoldSpannable
+import pl.szczodrzynski.edziennik.ext.concat
 import kotlin.coroutines.CoroutineContext
 import kotlin.math.roundToInt
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/ModeViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/ModeViewHolder.kt
similarity index 83%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/ModeViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/ModeViewHolder.kt
index 6b0d20b5..c91f18b9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/ModeViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/ModeViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login.viewholder
+package pl.szczodrzynski.edziennik.ui.login.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -12,11 +12,11 @@ import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.LoginChooserModeItemBinding
-import pl.szczodrzynski.edziennik.resolveColor
-import pl.szczodrzynski.edziennik.setTintColor
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginChooserAdapter
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginInfo
+import pl.szczodrzynski.edziennik.ext.resolveColor
+import pl.szczodrzynski.edziennik.ext.setTintColor
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ui.login.LoginChooserAdapter
+import pl.szczodrzynski.edziennik.ui.login.LoginInfo
 
 class ModeViewHolder(
         inflater: LayoutInflater,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/PlatformViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/PlatformViewHolder.kt
similarity index 79%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/PlatformViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/PlatformViewHolder.kt
index 2c08c27e..2a558479 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/PlatformViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/PlatformViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login.viewholder
+package pl.szczodrzynski.edziennik.ui.login.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -12,9 +12,9 @@ import androidx.recyclerview.widget.RecyclerView
 import coil.load
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.LoginPlatformItemBinding
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginInfo
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginPlatformAdapter
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ui.login.LoginInfo
+import pl.szczodrzynski.edziennik.ui.login.LoginPlatformAdapter
 
 class PlatformViewHolder(
         inflater: LayoutInflater,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/RegisterViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/RegisterViewHolder.kt
similarity index 78%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/RegisterViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/RegisterViewHolder.kt
index 921041c8..33f2b75d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/viewholder/RegisterViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/viewholder/RegisterViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.login.viewholder
+package pl.szczodrzynski.edziennik.ui.login.viewholder
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -11,9 +11,9 @@ import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.databinding.LoginChooserItemBinding
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginChooserAdapter
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginInfo
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ui.login.LoginChooserAdapter
+import pl.szczodrzynski.edziennik.ui.login.LoginInfo
 
 class RegisterViewHolder(
         inflater: LayoutInflater,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesUtils.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/MessagesUtils.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesUtils.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/MessagesUtils.kt
index d61604d8..cc5a14d4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesUtils.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/MessagesUtils.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.messages
+package pl.szczodrzynski.edziennik.ui.messages
 
 import android.content.Context
 import android.graphics.Bitmap
@@ -10,8 +10,8 @@ import androidx.core.graphics.ColorUtils
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
-import pl.szczodrzynski.edziennik.fixName
-import pl.szczodrzynski.edziennik.getNameInitials
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.getNameInitials
 import pl.szczodrzynski.edziennik.utils.Colors
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeChipCreator.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeChipCreator.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeChipCreator.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeChipCreator.kt
index bae40587..f2ea8e94 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeChipCreator.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeChipCreator.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-10-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.messages.compose
+package pl.szczodrzynski.edziennik.ui.messages.compose
 
 import android.content.Context
 import android.graphics.drawable.BitmapDrawable
@@ -17,7 +17,8 @@ import com.hootsuite.nachos.chip.ChipSpan
 import com.hootsuite.nachos.chip.ChipSpanChipCreator
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
-import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesUtils
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.messages.MessagesUtils
 import pl.szczodrzynski.edziennik.utils.Colors
 import pl.szczodrzynski.edziennik.utils.Themes
 import pl.szczodrzynski.navlib.elevateSurface
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeChipTokenizer.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeChipTokenizer.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeChipTokenizer.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeChipTokenizer.kt
index 560b0a06..6dfc22f8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeChipTokenizer.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeChipTokenizer.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-10-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.messages.compose
+package pl.szczodrzynski.edziennik.ui.messages.compose
 
 import android.content.Context
 import com.hootsuite.nachos.NachoTextView
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeFragment.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeFragment.kt
index f8aefd1f..8e7bb330 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.messages.compose
+package pl.szczodrzynski.edziennik.ui.messages.compose
 
 import android.annotation.SuppressLint
 import android.os.Bundle
@@ -36,8 +36,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.databinding.MessagesComposeFragmentBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.MessagesConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.messages.list.MessagesFragment
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.DAY
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.MessagesConfigDialog
+import pl.szczodrzynski.edziennik.ui.messages.list.MessagesFragment
 import pl.szczodrzynski.edziennik.utils.DefaultTextStyles
 import pl.szczodrzynski.edziennik.utils.Themes
 import pl.szczodrzynski.edziennik.utils.managers.MessageManager.UIConfig
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeInfo.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeInfo.kt
similarity index 89%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeInfo.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeInfo.kt
index 30b89472..71a0e14d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeInfo.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeInfo.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.messages.compose
+package pl.szczodrzynski.edziennik.ui.messages.compose
 
 class MessagesComposeInfo(
         /**
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeSuggestionAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeSuggestionAdapter.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeSuggestionAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeSuggestionAdapter.kt
index 34a142ea..db5072bc 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/compose/MessagesComposeSuggestionAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/compose/MessagesComposeSuggestionAdapter.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.messages.compose
+package pl.szczodrzynski.edziennik.ui.messages.compose
 
 import android.content.Context
 import android.graphics.Typeface.BOLD
@@ -12,11 +12,11 @@ import android.widget.Filter
 import android.widget.ImageView
 import android.widget.TextView
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.asSpannable
-import pl.szczodrzynski.edziennik.cleanDiacritics
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
-import pl.szczodrzynski.edziennik.resolveAttr
-import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesUtils.getProfileImage
+import pl.szczodrzynski.edziennik.ext.asSpannable
+import pl.szczodrzynski.edziennik.ext.cleanDiacritics
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ui.messages.MessagesUtils.getProfileImage
 import java.util.*
 
 class MessagesComposeSuggestionAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessageViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessageViewHolder.kt
similarity index 86%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessageViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessageViewHolder.kt
index 230992c2..904eb62b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessageViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessageViewHolder.kt
@@ -2,18 +2,23 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-5.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.messages.list
+package pl.szczodrzynski.edziennik.ui.messages.list
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
 import androidx.core.view.isVisible
 import androidx.recyclerview.widget.RecyclerView
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
 import pl.szczodrzynski.edziennik.databinding.MessagesListItemBinding
-import pl.szczodrzynski.edziennik.ui.modules.grades.viewholder.BindableViewHolder
-import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesUtils
+import pl.szczodrzynski.edziennik.ext.attachToastHint
+import pl.szczodrzynski.edziennik.ext.detachToastHint
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ui.grades.viewholder.BindableViewHolder
+import pl.szczodrzynski.edziennik.ui.messages.MessagesUtils
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 class MessageViewHolder(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesAdapter.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesAdapter.kt
index 1061ac86..05bcb5a9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesAdapter.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.messages.list
+package pl.szczodrzynski.edziennik.ui.messages.list
 
 import android.graphics.Typeface
 import android.view.LayoutInflater
@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
-import pl.szczodrzynski.edziennik.ui.modules.search.SearchableAdapter
+import pl.szczodrzynski.edziennik.ui.search.SearchableAdapter
 
 class MessagesAdapter(
     val activity: AppCompatActivity,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesFragment.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesFragment.kt
index faf0e3ee..c839f58b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesFragment.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.messages.list
+package pl.szczodrzynski.edziennik.ui.messages.list
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -12,8 +12,10 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.databinding.MessagesFragmentBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.MessagesConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.FragmentLazyPagerAdapter
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.addOnPageSelectedListener
+import pl.szczodrzynski.edziennik.ui.base.lazypager.FragmentLazyPagerAdapter
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.MessagesConfigDialog
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesListFragment.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesListFragment.kt
index 19190e58..b15f58c9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/list/MessagesListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/list/MessagesListFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-4.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.messages.list
+package pl.szczodrzynski.edziennik.ui.messages.list
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -18,7 +18,10 @@ import pl.szczodrzynski.edziennik.MainActivity.Companion.TARGET_MESSAGES_DETAILS
 import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.databinding.MessagesListFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/single/MessageFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/single/MessageFragment.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/single/MessageFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/single/MessageFragment.kt
index f17c207e..e430e5db 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/single/MessageFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/messages/single/MessageFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-12.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.messages.single
+package pl.szczodrzynski.edziennik.ui.messages.single
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -26,9 +26,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
 import pl.szczodrzynski.edziennik.data.db.entity.LoginStore.Companion.LOGIN_TYPE_IDZIENNIK
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
 import pl.szczodrzynski.edziennik.databinding.MessageFragmentBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.MessagesConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesUtils
-import pl.szczodrzynski.edziennik.ui.modules.messages.list.MessagesFragment
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.MessagesConfigDialog
+import pl.szczodrzynski.edziennik.ui.messages.MessagesUtils
+import pl.szczodrzynski.edziennik.ui.messages.list.MessagesFragment
 import pl.szczodrzynski.edziennik.utils.Anim
 import pl.szczodrzynski.edziennik.utils.BetterLink
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/notifications/NotificationsAdapter.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/notifications/NotificationsAdapter.kt
index 6c0fe067..dfecbfcf 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/notifications/NotificationsAdapter.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.notifications
+package pl.szczodrzynski.edziennik.ui.notifications
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -9,9 +9,11 @@ import com.mikepenz.iconics.utils.colorRes
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Notification
 import pl.szczodrzynski.edziennik.databinding.NotificationsListItemBinding
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/notifications/NotificationsListFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/notifications/NotificationsListFragment.kt
index 7cd9703b..95a1bd70 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/notifications/NotificationsListFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-22.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.notifications
+package pl.szczodrzynski.edziennik.ui.notifications
 
 import android.app.Activity
 import android.content.Intent
@@ -22,6 +22,8 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.databinding.NotificationsListFragmentBinding
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchField.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchField.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchField.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchField.kt
index 00f7b49d..11c322ef 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchField.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchField.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-5.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.search
+package pl.szczodrzynski.edziennik.ui.search
 
 import android.widget.Filter
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchFilter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchFilter.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchFilter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchFilter.kt
index ffbcbf45..a14a01a6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchFilter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchFilter.kt
@@ -2,10 +2,10 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-14.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.search
+package pl.szczodrzynski.edziennik.ui.search
 
 import android.widget.Filter
-import pl.szczodrzynski.edziennik.cleanDiacritics
+import pl.szczodrzynski.edziennik.ext.cleanDiacritics
 import java.util.*
 import kotlin.math.min
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchTextWatcher.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchTextWatcher.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchTextWatcher.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchTextWatcher.kt
index f37b1760..fdf041e4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchTextWatcher.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchTextWatcher.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-14.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.search
+package pl.szczodrzynski.edziennik.ui.search
 
 import android.text.Editable
 import android.text.TextWatcher
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchViewHolder.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchViewHolder.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchViewHolder.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchViewHolder.kt
index 06a38ab7..a9079672 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchViewHolder.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchViewHolder.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-5.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.search
+package pl.szczodrzynski.edziennik.ui.search
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/Searchable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/Searchable.kt
similarity index 91%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/Searchable.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/search/Searchable.kt
index 072d6db5..5c145f86 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/Searchable.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/Searchable.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-10-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.search
+package pl.szczodrzynski.edziennik.ui.search
 
 interface Searchable<in T> : Comparable<Searchable<*>> {
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchableAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchableAdapter.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchableAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchableAdapter.kt
index 7f9cc103..430fdc4d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/search/SearchableAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/search/SearchableAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-10-10.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.search
+package pl.szczodrzynski.edziennik.ui.search
 
 import android.text.SpannableStringBuilder
 import android.text.style.BackgroundColorSpan
@@ -10,7 +10,7 @@ import android.view.LayoutInflater
 import android.view.ViewGroup
 import android.widget.Filterable
 import androidx.recyclerview.widget.RecyclerView
-import pl.szczodrzynski.edziennik.asSpannable
+import pl.szczodrzynski.edziennik.ext.asSpannable
 import pl.szczodrzynski.edziennik.utils.span.BoldSpan
 
 abstract class SearchableAdapter<T : Searchable<T>>(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/MaterialAboutProfileItem.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/MaterialAboutProfileItem.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/MaterialAboutProfileItem.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/MaterialAboutProfileItem.kt
index dfff3246..3e3fb642 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/MaterialAboutProfileItem.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/MaterialAboutProfileItem.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-17.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings
+package pl.szczodrzynski.edziennik.ui.settings
 
 import android.content.Context
 import android.view.View
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/ProfileManagerFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/ProfileManagerFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/ProfileManagerFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/ProfileManagerFragment.kt
index 2ab29917..7ea042c0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/ProfileManagerFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/ProfileManagerFragment.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.settings
+package pl.szczodrzynski.edziennik.ui.settings
 
 import android.os.Bundle
 import android.view.LayoutInflater
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsCard.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsCard.kt
index 36ce3777..b04ee4a8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-17.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings
+package pl.szczodrzynski.edziennik.ui.settings
 
 import com.danielstone.materialaboutlibrary.items.MaterialAboutItem
 import com.danielstone.materialaboutlibrary.model.MaterialAboutCard
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsFragment.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsFragment.kt
index cf7fa625..fca2b49e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-16.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings
+package pl.szczodrzynski.edziennik.ui.settings
 
 import android.content.Context
 import android.os.Bundle
@@ -16,7 +16,7 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
-import pl.szczodrzynski.edziennik.ui.modules.settings.cards.*
+import pl.szczodrzynski.edziennik.ui.settings.cards.*
 import kotlin.coroutines.CoroutineContext
 
 class SettingsFragment : MaterialAboutFragment(), CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsLicenseActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsLicenseActivity.kt
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsLicenseActivity.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsLicenseActivity.kt
index de829d8d..5a4a5e9b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsLicenseActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsLicenseActivity.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.settings
+package pl.szczodrzynski.edziennik.ui.settings
 
 import android.content.Context
 import android.net.Uri
@@ -15,7 +15,7 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
 import com.mikepenz.iconics.utils.colorInt
 import com.mikepenz.iconics.utils.sizeDp
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.resolveColor
+import pl.szczodrzynski.edziennik.ext.resolveColor
 import pl.szczodrzynski.edziennik.utils.Themes
 
 class SettingsLicenseActivity : MaterialAboutActivity() {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsUtil.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsUtil.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsUtil.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsUtil.kt
index a86fe2e3..160ae8b7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsUtil.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsUtil.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-17.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings
+package pl.szczodrzynski.edziennik.ui.settings
 
 import com.danielstone.materialaboutlibrary.items.*
 import com.danielstone.materialaboutlibrary.model.MaterialAboutCard
@@ -13,8 +13,8 @@ import com.mikepenz.iconics.utils.colorInt
 import com.mikepenz.iconics.utils.sizeDp
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.after
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
+import pl.szczodrzynski.edziennik.ext.after
 import pl.szczodrzynski.edziennik.utils.Colors
 import pl.szczodrzynski.edziennik.utils.Themes
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsViewTypeManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsViewTypeManager.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsViewTypeManager.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsViewTypeManager.kt
index 1fb14fcd..560862eb 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsViewTypeManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsViewTypeManager.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-17.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings
+package pl.szczodrzynski.edziennik.ui.settings
 
 import android.content.Context
 import android.view.View
@@ -11,7 +11,7 @@ import com.danielstone.materialaboutlibrary.items.MaterialAboutItem
 import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem.MaterialAboutTitleItemViewHolder
 import com.danielstone.materialaboutlibrary.util.DefaultViewTypeManager
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsViewTypeManager.ItemType.Companion.PROFILE_ITEM
+import pl.szczodrzynski.edziennik.ui.settings.SettingsViewTypeManager.ItemType.Companion.PROFILE_ITEM
 
 class SettingsViewTypeManager : DefaultViewTypeManager() {
     class ItemType {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsAboutCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsAboutCard.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsAboutCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsAboutCard.kt
index f4cc0023..72f95c8a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsAboutCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsAboutCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings.cards
+package pl.szczodrzynski.edziennik.ui.settings.cards
 
 import android.content.Intent
 import android.media.MediaPlayer
@@ -18,13 +18,13 @@ import kotlinx.coroutines.launch
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.BuildConfig
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.after
+import pl.szczodrzynski.edziennik.ext.after
 import pl.szczodrzynski.edziennik.sync.UpdateWorker
-import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsCard
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsLicenseActivity
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsUtil
-import pl.szczodrzynski.edziennik.ui.modules.settings.contributors.ContributorsActivity
+import pl.szczodrzynski.edziennik.ui.dialogs.ChangelogDialog
+import pl.szczodrzynski.edziennik.ui.settings.SettingsCard
+import pl.szczodrzynski.edziennik.ui.settings.SettingsLicenseActivity
+import pl.szczodrzynski.edziennik.ui.settings.SettingsUtil
+import pl.szczodrzynski.edziennik.ui.settings.contributors.ContributorsActivity
 import pl.szczodrzynski.edziennik.utils.Utils
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsProfileCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsProfileCard.kt
similarity index 75%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsProfileCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsProfileCard.kt
index f88a0242..9ae96073 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsProfileCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsProfileCard.kt
@@ -2,16 +2,16 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings.cards
+package pl.szczodrzynski.edziennik.ui.settings.cards
 
 import android.content.Intent
 import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.ui.dialogs.profile.ProfileConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity
-import pl.szczodrzynski.edziennik.ui.modules.settings.MaterialAboutProfileItem
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsCard
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsUtil
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.ProfileConfigDialog
+import pl.szczodrzynski.edziennik.ui.login.LoginActivity
+import pl.szczodrzynski.edziennik.ui.settings.MaterialAboutProfileItem
+import pl.szczodrzynski.edziennik.ui.settings.SettingsCard
+import pl.szczodrzynski.edziennik.ui.settings.SettingsUtil
 
 class SettingsProfileCard(util: SettingsUtil) : SettingsCard(util) {
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsRegisterCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsRegisterCard.kt
similarity index 90%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsRegisterCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsRegisterCard.kt
index 8d3de849..205e2066 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsRegisterCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsRegisterCard.kt
@@ -2,24 +2,19 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings.cards
+package pl.szczodrzynski.edziennik.ui.settings.cards
 
 import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
 import eu.szkolny.font.SzkolnyFont
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.after
 import pl.szczodrzynski.edziennik.data.api.LOGIN_TYPE_LIBRUS
 import pl.szczodrzynski.edziennik.data.db.entity.Profile.Companion.REGISTRATION_ENABLED
-import pl.szczodrzynski.edziennik.ui.dialogs.MessagesConfigDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.agenda.AgendaConfigDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.bell.BellSyncConfigDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.grade.GradesConfigDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.settings.AttendanceConfigDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.sync.RegistrationConfigDialog
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsCard
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsUtil
+import pl.szczodrzynski.edziennik.ext.after
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.*
+import pl.szczodrzynski.edziennik.ui.settings.SettingsCard
+import pl.szczodrzynski.edziennik.ui.settings.SettingsUtil
 
 class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) {
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsSyncCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsSyncCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt
index 1d42b86b..7c5857f6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsSyncCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings.cards
+package pl.szczodrzynski.edziennik.ui.settings.cards
 
 import android.content.Intent
 import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
@@ -13,15 +13,15 @@ import android.provider.Settings
 import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.after
-import pl.szczodrzynski.edziennik.getSyncInterval
+import pl.szczodrzynski.edziennik.ext.after
+import pl.szczodrzynski.edziennik.ext.getSyncInterval
 import pl.szczodrzynski.edziennik.sync.SyncWorker
 import pl.szczodrzynski.edziennik.sync.UpdateWorker
-import pl.szczodrzynski.edziennik.ui.dialogs.sync.NotificationFilterDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.sync.QuietHoursConfigDialog
-import pl.szczodrzynski.edziennik.ui.dialogs.sync.SyncIntervalDialog
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsCard
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsUtil
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.NotificationFilterDialog
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.QuietHoursConfigDialog
+import pl.szczodrzynski.edziennik.ui.dialogs.settings.SyncIntervalDialog
+import pl.szczodrzynski.edziennik.ui.settings.SettingsCard
+import pl.szczodrzynski.edziennik.ui.settings.SettingsUtil
 import pl.szczodrzynski.edziennik.utils.models.Time
 
 class SettingsSyncCard(util: SettingsUtil) : SettingsCard(util) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsThemeCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsThemeCard.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsThemeCard.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsThemeCard.kt
index 1018e92c..e393090a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/cards/SettingsThemeCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsThemeCard.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-3-18.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings.cards
+package pl.szczodrzynski.edziennik.ui.settings.cards
 
 import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
@@ -10,8 +10,8 @@ import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.ui.dialogs.settings.AppLanguageDialog
 import pl.szczodrzynski.edziennik.ui.dialogs.settings.MiniMenuConfigDialog
 import pl.szczodrzynski.edziennik.ui.dialogs.settings.ThemeChooserDialog
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsCard
-import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsUtil
+import pl.szczodrzynski.edziennik.ui.settings.SettingsCard
+import pl.szczodrzynski.edziennik.ui.settings.SettingsUtil
 import pl.szczodrzynski.edziennik.utils.BigNightUtil
 import pl.szczodrzynski.edziennik.utils.Themes
 import pl.szczodrzynski.edziennik.utils.models.Date
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsActivity.kt
similarity index 93%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsActivity.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsActivity.kt
index cc498495..9acbc0b6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsActivity.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.settings.contributors
+package pl.szczodrzynski.edziennik.ui.settings.contributors
 
 import android.os.Bundle
 import android.os.Process
@@ -15,8 +15,11 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.ContributorsResponse
 import pl.szczodrzynski.edziennik.databinding.ContributorsActivityBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.FragmentLazyPagerAdapter
-import pl.szczodrzynski.edziennik.ui.modules.error.ErrorSnackbar
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.onLongClick
+import pl.szczodrzynski.edziennik.ui.base.lazypager.FragmentLazyPagerAdapter
+import pl.szczodrzynski.edziennik.ui.error.ErrorSnackbar
 import kotlin.coroutines.CoroutineContext
 import kotlin.system.exitProcess
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsAdapter.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsAdapter.kt
index 6cb189b9..4fe77a84 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-9-7.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.settings.contributors
+package pl.szczodrzynski.edziennik.ui.settings.contributors
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -14,8 +14,8 @@ import coil.transform.CircleCropTransformation
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.ContributorsResponse
 import pl.szczodrzynski.edziennik.databinding.ContributorsListItemBinding
-import pl.szczodrzynski.edziennik.plural
-import pl.szczodrzynski.edziennik.setText
+import pl.szczodrzynski.edziennik.ext.plural
+import pl.szczodrzynski.edziennik.ext.setText
 import pl.szczodrzynski.edziennik.utils.Utils
 
 class ContributorsAdapter(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsFragment.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsFragment.kt
index 11741a85..d378848a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/contributors/ContributorsFragment.kt
@@ -1,4 +1,4 @@
-package pl.szczodrzynski.edziennik.ui.modules.settings.contributors
+package pl.szczodrzynski.edziennik.ui.settings.contributors
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.ContributorsResponse
 import pl.szczodrzynski.edziennik.databinding.ContributorsListFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 
 class ContributorsFragment : LazyFragment() {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/teachers/TeachersAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersAdapter.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/teachers/TeachersAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersAdapter.kt
index e1702e14..b859ae88 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/teachers/TeachersAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Antoni Czaplicki 2021-10-15.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.teachers
+package pl.szczodrzynski.edziennik.ui.teachers
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -14,8 +14,8 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.databinding.TeacherItemBinding
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
-import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesUtils.getProfileImage
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ui.messages.MessagesUtils.getProfileImage
 import pl.szczodrzynski.edziennik.utils.BetterLink
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/teachers/TeachersListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersListFragment.kt
similarity index 87%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/teachers/TeachersListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersListFragment.kt
index e248f01b..8c24e111 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/teachers/TeachersListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersListFragment.kt
@@ -2,29 +2,24 @@
  * Copyright (c) Antoni Czaplicki 2021-10-15.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.teachers
+package pl.szczodrzynski.edziennik.ui.teachers
 
-import android.app.Activity
-import android.content.Intent
-import android.os.AsyncTask
 import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
-import android.widget.Toast
 import androidx.core.view.isVisible
 import androidx.fragment.app.Fragment
 import androidx.lifecycle.Observer
 import androidx.recyclerview.widget.LinearLayoutManager
-import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.databinding.TeachersListFragmentBinding
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
-import pl.szczodrzynski.edziennik.utils.Utils
-import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
 import kotlin.coroutines.CoroutineContext
 
 class TeachersListFragment : Fragment(), CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateAdapter.kt
similarity index 94%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateAdapter.kt
index fe78396f..7ff8b162 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.template
+package pl.szczodrzynski.edziennik.ui.template
 
 import android.view.LayoutInflater
 import android.view.ViewGroup
@@ -11,9 +11,10 @@ import androidx.recyclerview.widget.RecyclerView
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.db.entity.Notification
 import pl.szczodrzynski.edziennik.databinding.TemplateListItemBinding
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateDialog.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateDialog.kt
index e5d68ebe..17c4e9c3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.template
+package pl.szczodrzynski.edziennik.ui.template
 
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
@@ -13,7 +13,7 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.DialogTemplateBinding
-import pl.szczodrzynski.edziennik.onClick
+import pl.szczodrzynski.edziennik.ext.onClick
 import kotlin.coroutines.CoroutineContext
 
 class TemplateDialog(
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateFragment.kt
similarity index 84%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateFragment.kt
index 8adee96a..0e21a080 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.template
+package pl.szczodrzynski.edziennik.ui.template
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -12,11 +12,15 @@ import androidx.fragment.app.Fragment
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.MainActivity
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.databinding.TemplateFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.FragmentLazyPagerAdapter
-import pl.szczodrzynski.edziennik.ui.modules.homework.HomeworkDate
-import pl.szczodrzynski.edziennik.ui.modules.homework.HomeworkListFragment
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.addOnPageSelectedListener
+import pl.szczodrzynski.edziennik.ui.base.lazypager.FragmentLazyPagerAdapter
+import pl.szczodrzynski.edziennik.ui.homework.HomeworkDate
+import pl.szczodrzynski.edziennik.ui.homework.HomeworkListFragment
 import kotlin.coroutines.CoroutineContext
 
 class TemplateFragment : Fragment(), CoroutineScope {
@@ -48,7 +52,7 @@ class TemplateFragment : Fragment(), CoroutineScope {
         if (!isAdded) return
 
         val pagerAdapter = FragmentLazyPagerAdapter(
-                fragmentManager ?: return,
+            parentFragmentManager,
                 b.refreshLayout,
                 listOf(
                         HomeworkListFragment().apply {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateListFragment.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateListFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateListFragment.kt
index c044c4cf..3bedf547 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateListFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateListFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.template
+package pl.szczodrzynski.edziennik.ui.template
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -17,6 +17,9 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.databinding.TemplateListFragmentBinding
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.onScrollListener
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateListPageFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateListPageFragment.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateListPageFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateListPageFragment.kt
index e2395668..efddb51d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplateListPageFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplateListPageFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.template
+package pl.szczodrzynski.edziennik.ui.template
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -17,9 +17,9 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.databinding.TemplateListPageFragmentBinding
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
-import pl.szczodrzynski.edziennik.startCoroutineTimer
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplatePageFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplatePageFragment.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplatePageFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplatePageFragment.kt
index f2404ea4..860536ce 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplatePageFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplatePageFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.template
+package pl.szczodrzynski.edziennik.ui.template
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -14,7 +14,7 @@ import kotlinx.coroutines.Job
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.databinding.TemplatePageFragmentBinding
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
 import kotlin.coroutines.CoroutineContext
 
 class TemplatePageFragment : LazyFragment(), CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplatePagerAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplatePagerAdapter.kt
similarity index 78%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplatePagerAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplatePagerAdapter.kt
index eaa8ba1d..7cef63ec 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/template/TemplatePagerAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/template/TemplatePagerAdapter.kt
@@ -2,11 +2,11 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-30.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.template
+package pl.szczodrzynski.edziennik.ui.template
 
 import androidx.fragment.app.FragmentManager
 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyPagerAdapter
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyPagerAdapter
 
 class TemplatePagerAdapter(fragmentManager: FragmentManager, swipeRefreshLayout: SwipeRefreshLayout) : LazyPagerAdapter(fragmentManager, swipeRefreshLayout) {
     override fun getPage(position: Int) = TemplatePageFragment()
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/GenerateBlockTimetableDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/GenerateBlockTimetableDialog.kt
similarity index 99%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/GenerateBlockTimetableDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/GenerateBlockTimetableDialog.kt
index 9eefffd0..aaf98941 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/GenerateBlockTimetableDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/GenerateBlockTimetableDialog.kt
@@ -2,13 +2,12 @@
  * Copyright (c) Kacper Ziubryniewicz 2020-1-5
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.timetable
+package pl.szczodrzynski.edziennik.ui.timetable
 
 import android.content.ContentResolver
 import android.content.ContentValues
 import android.content.Intent
 import android.graphics.*
-import android.net.Uri
 import android.os.Build
 import android.os.Environment
 import android.provider.MediaStore
@@ -20,7 +19,6 @@ import android.widget.TextView
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
 import androidx.cardview.widget.CardView
-import androidx.core.content.FileProvider
 import com.google.android.material.datepicker.MaterialDatePicker
 import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import kotlinx.coroutines.*
@@ -35,11 +33,11 @@ import pl.szczodrzynski.edziennik.data.api.events.ApiTaskFinishedEvent
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
 import pl.szczodrzynski.edziennik.databinding.DialogGenerateBlockTimetableBinding
+import pl.szczodrzynski.edziennik.ext.*
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import pl.szczodrzynski.edziennik.utils.models.Week
 import java.io.File
-import java.io.FileOutputStream
 import kotlin.coroutines.CoroutineContext
 import kotlin.math.roundToInt
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/LessonDetailsDialog.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/LessonDetailsDialog.kt
index 5662b1a0..3103ed1c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/LessonDetailsDialog.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-11-11.
  */
 
-package pl.szczodrzynski.edziennik.ui.dialogs.timetable
+package pl.szczodrzynski.edziennik.ui.timetable
 
 import android.content.Intent
 import android.view.View
@@ -24,13 +24,12 @@ import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
 import pl.szczodrzynski.edziennik.databinding.DialogLessonDetailsBinding
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.setText
-import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.event.EventDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.event.EventListAdapter
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
-import pl.szczodrzynski.edziennik.ui.modules.timetable.TimetableFragment
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.attendance.AttendanceDetailsDialog
+import pl.szczodrzynski.edziennik.ui.event.EventDetailsDialog
+import pl.szczodrzynski.edziennik.ui.event.EventListAdapter
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
 import pl.szczodrzynski.edziennik.utils.BetterLink
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import pl.szczodrzynski.edziennik.utils.models.Date
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableDayFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetableDayFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableDayFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetableDayFragment.kt
index 5d13ee86..d0373993 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableDayFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetableDayFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2020-1-6
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.timetable
+package pl.szczodrzynski.edziennik.ui.timetable
 
 import android.os.Bundle
 import android.view.LayoutInflater
@@ -16,15 +16,12 @@ import androidx.core.view.*
 import com.linkedin.android.tachyon.DayView
 import com.linkedin.android.tachyon.DayViewConfig
 import com.mikepenz.iconics.IconicsDrawable
-import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
 import com.mikepenz.iconics.utils.colorInt
 import com.mikepenz.iconics.utils.sizeDp
-import eu.szkolny.font.SzkolnyFont
 import kotlinx.coroutines.*
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
-import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
@@ -32,10 +29,10 @@ import pl.szczodrzynski.edziennik.data.db.full.LessonFull
 import pl.szczodrzynski.edziennik.databinding.TimetableDayFragmentBinding
 import pl.szczodrzynski.edziennik.databinding.TimetableLessonBinding
 import pl.szczodrzynski.edziennik.databinding.TimetableNoTimetableBinding
-import pl.szczodrzynski.edziennik.ui.dialogs.timetable.LessonDetailsDialog
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
-import pl.szczodrzynski.edziennik.ui.modules.timetable.TimetableFragment.Companion.DEFAULT_END_HOUR
-import pl.szczodrzynski.edziennik.ui.modules.timetable.TimetableFragment.Companion.DEFAULT_START_HOUR
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.timetable.TimetableFragment.Companion.DEFAULT_END_HOUR
+import pl.szczodrzynski.edziennik.ui.timetable.TimetableFragment.Companion.DEFAULT_START_HOUR
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
 import java.util.*
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetableFragment.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetableFragment.kt
index 13d3ae2c..dbc5a4de 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetableFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kacper Ziubryniewicz 2020-1-6
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.timetable
+package pl.szczodrzynski.edziennik.ui.timetable
 
 import android.content.BroadcastReceiver
 import android.content.Context
@@ -25,9 +25,8 @@ import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.databinding.FragmentTimetableV2Binding
-import pl.szczodrzynski.edziennik.getSchoolYearConstrains
-import pl.szczodrzynski.edziennik.ui.dialogs.timetable.GenerateBlockTimetableDialog
-import pl.szczodrzynski.edziennik.ui.modules.event.EventManualDialog
+import pl.szczodrzynski.edziennik.ext.getSchoolYearConstrains
+import pl.szczodrzynski.edziennik.ui.event.EventManualDialog
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
 import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
@@ -128,7 +127,7 @@ class TimetableFragment : Fragment(), CoroutineScope {
             return@launch
 
         val pagerAdapter = TimetablePagerAdapter(
-                fragmentManager ?: return@launch,
+            parentFragmentManager,
                 items,
                 startHour,
                 endHour
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetablePagerAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetablePagerAdapter.kt
similarity index 87%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetablePagerAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetablePagerAdapter.kt
index 289860ac..fb8cf88a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetablePagerAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/TimetablePagerAdapter.kt
@@ -2,12 +2,12 @@
  * Copyright (c) Kacper Ziubryniewicz 2020-1-6
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.timetable
+package pl.szczodrzynski.edziennik.ui.timetable
 
 import android.os.Bundle
 import androidx.fragment.app.FragmentManager
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
-import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyPagerAdapter
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyFragment
+import pl.szczodrzynski.edziennik.ui.base.lazypager.LazyPagerAdapter
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Week
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentAdapter.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentAdapter.kt
index 5712207c..b7cbf698 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-1.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.view.LayoutInflater
@@ -22,8 +22,8 @@ import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Event
 import pl.szczodrzynski.edziennik.data.db.entity.Message
 import pl.szczodrzynski.edziennik.databinding.AttachmentListItemBinding
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.onLongClick
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.onLongClick
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.navlib.colorAttr
 import kotlin.coroutines.CoroutineContext
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentsView.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentsView.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentsView.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentsView.kt
index 59131672..7e2bc5af 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentsView.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentsView.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-4-1.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.os.Bundle
@@ -18,8 +18,8 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.api.events.AttachmentGetEvent
-import pl.szczodrzynski.edziennik.get
-import pl.szczodrzynski.edziennik.isNotNullNorEmpty
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import pl.szczodrzynski.edziennik.utils.Utils
 import java.io.File
@@ -161,7 +161,7 @@ class AttachmentsView @JvmOverloads constructor(
                 // get the download url before updating file name
                 val fileUrl = attachment.name.substringAfter(":", missingDelimiterValue = "")
                 // update file name with the downloaded one
-                attachment.name = File(event.fileName).name
+                attachment.name = File(event.fileName ?: return).name
                 // save the download url back
                 if (fileUrl != "")
                     attachment.name += ":$fileUrl"
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/DateDropdown.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/DateDropdown.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/DateDropdown.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/DateDropdown.kt
index 6c96c352..a2a86d6b 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/DateDropdown.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/DateDropdown.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.content.ContextWrapper
@@ -16,7 +16,7 @@ import kotlinx.coroutines.withContext
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.AppDb
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
-import pl.szczodrzynski.edziennik.observeOnce
+import pl.szczodrzynski.edziennik.ext.observeOnce
 import pl.szczodrzynski.edziennik.utils.TextInputDropDown
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Week
@@ -56,7 +56,6 @@ class DateDropdown : TextInputDropDown {
 
     suspend fun loadItems() {
         val date = Date.getToday()
-        val today = date.value
         var weekDay = date.weekDay
 
         val dates = withContext(Dispatchers.Default) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/EventTypeDropdown.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/EventTypeDropdown.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/EventTypeDropdown.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/EventTypeDropdown.kt
index 878264c6..f61ec9a4 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/EventTypeDropdown.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/EventTypeDropdown.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2021-4-14.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.util.AttributeSet
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/SubjectDropdown.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/SubjectDropdown.kt
similarity index 97%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/SubjectDropdown.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/SubjectDropdown.kt
index 4285ec7d..cc2f0f83 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/SubjectDropdown.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/SubjectDropdown.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.content.ContextWrapper
@@ -13,10 +13,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.withContext
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.crc16
 import pl.szczodrzynski.edziennik.data.db.AppDb
 import pl.szczodrzynski.edziennik.data.db.entity.Subject
-import pl.szczodrzynski.edziennik.ui.dialogs.input
+import pl.szczodrzynski.edziennik.ext.crc16
+import pl.szczodrzynski.edziennik.ext.input
 import pl.szczodrzynski.edziennik.utils.TextInputDropDown
 
 class SubjectDropdown : TextInputDropDown {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TeacherDropdown.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TeacherDropdown.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TeacherDropdown.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TeacherDropdown.kt
index 23053359..c67011a2 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TeacherDropdown.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TeacherDropdown.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.util.AttributeSet
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TeamDropdown.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TeamDropdown.kt
similarity index 98%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TeamDropdown.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TeamDropdown.kt
index b5eee0ac..2a395d14 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TeamDropdown.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TeamDropdown.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-3-7.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.util.AttributeSet
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TimeDropdown.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TimeDropdown.kt
similarity index 96%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TimeDropdown.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TimeDropdown.kt
index afecaf7e..51a22d88 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/TimeDropdown.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/TimeDropdown.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2020-2-23.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.views
+package pl.szczodrzynski.edziennik.ui.views
 
 import android.content.Context
 import android.content.ContextWrapper
@@ -17,6 +17,10 @@ import pl.szczodrzynski.edziennik.data.db.AppDb
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
+import pl.szczodrzynski.edziennik.ext.asItalicSpannable
+import pl.szczodrzynski.edziennik.ext.asStrikethroughSpannable
+import pl.szczodrzynski.edziennik.ext.concat
+import pl.szczodrzynski.edziennik.ext.listOfNotEmpty
 import pl.szczodrzynski.edziennik.utils.TextInputDropDown
 import pl.szczodrzynski.edziennik.utils.models.Date
 import pl.szczodrzynski.edziennik.utils.models.Time
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/webpush/WebPushBrowserAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/webpush/WebPushBrowserAdapter.kt
similarity index 92%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/webpush/WebPushBrowserAdapter.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/webpush/WebPushBrowserAdapter.kt
index 72d9a963..5ad04fcb 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/webpush/WebPushBrowserAdapter.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/webpush/WebPushBrowserAdapter.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-19.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.webpush
+package pl.szczodrzynski.edziennik.ui.webpush
 
 import android.content.Context
 import android.view.LayoutInflater
@@ -12,8 +12,8 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.WebPushResponse
 import pl.szczodrzynski.edziennik.databinding.WebPushBrowserItemBinding
-import pl.szczodrzynski.edziennik.onClick
-import pl.szczodrzynski.edziennik.setText
+import pl.szczodrzynski.edziennik.ext.onClick
+import pl.szczodrzynski.edziennik.ext.setText
 
 class WebPushBrowserAdapter(
         val context: Context,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/webpush/WebPushFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/webpush/WebPushFragment.kt
similarity index 95%
rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/webpush/WebPushFragment.kt
rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/webpush/WebPushFragment.kt
index 0996c518..81e503e9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/webpush/WebPushFragment.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/webpush/WebPushFragment.kt
@@ -2,7 +2,7 @@
  * Copyright (c) Kuba Szczodrzyński 2019-12-19.
  */
 
-package pl.szczodrzynski.edziennik.ui.modules.webpush
+package pl.szczodrzynski.edziennik.ui.webpush
 
 import android.annotation.SuppressLint
 import android.os.Bundle
@@ -19,6 +19,8 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.WebPushResponse
 import pl.szczodrzynski.edziennik.databinding.WebPushFragmentBinding
+import pl.szczodrzynski.edziennik.ext.crc32
+import pl.szczodrzynski.edziennik.ext.onClick
 import pl.szczodrzynski.edziennik.ui.dialogs.QrScannerDialog
 import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
 import kotlin.coroutines.CoroutineContext
@@ -61,14 +63,14 @@ class WebPushFragment : Fragment(), CoroutineScope {
         b.scanQrCode.onClick {
             manager.requestCameraPermission(activity, R.string.permissions_qr_scanner) {
                 QrScannerDialog(activity, {
-                    b.tokenEditText.setText(it.crc32().toString(36).toUpperCase())
+                    b.tokenEditText.setText(it.crc32().toString(36).uppercase())
                     pairBrowser(browserId = it)
                 })
             }
         }
 
         b.tokenAccept.onClick {
-            val pairToken = b.tokenEditText.text.toString().toUpperCase()
+            val pairToken = b.tokenEditText.text.toString().uppercase()
             if (!"[0-9A-Z]{3,13}".toRegex().matches(pairToken)) {
                 b.tokenLayout.error = app.getString(R.string.web_push_token_invalid)
                 return@onClick
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/LessonDialogActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/LessonDialogActivity.kt
index 7a8f78ac..bfcfc1c7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/LessonDialogActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/LessonDialogActivity.kt
@@ -13,7 +13,7 @@ import androidx.appcompat.app.AppCompatActivity
 import kotlinx.coroutines.*
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
-import pl.szczodrzynski.edziennik.ui.dialogs.timetable.LessonDetailsDialog
+import pl.szczodrzynski.edziennik.ui.timetable.LessonDetailsDialog
 import pl.szczodrzynski.edziennik.utils.Themes
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/WidgetConfigActivity.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/WidgetConfigActivity.java
index 5902f22e..028bb482 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/WidgetConfigActivity.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/WidgetConfigActivity.java
@@ -4,6 +4,8 @@
 
 package pl.szczodrzynski.edziennik.ui.widgets;
 
+import static pl.szczodrzynski.edziennik.ext.DataExtensionsKt.filterOutArchived;
+
 import android.app.Activity;
 import android.app.WallpaperManager;
 import android.appwidget.AppWidgetManager;
@@ -33,8 +35,6 @@ import pl.szczodrzynski.edziennik.ui.widgets.luckynumber.WidgetLuckyNumberProvid
 import pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider;
 import pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider;
 
-import static pl.szczodrzynski.edziennik.ExtensionsKt.filterOutArchived;
-
 public class WidgetConfigActivity extends Activity {
 
     public static final String TAG = "WidgetConfigActivity";
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/luckynumber/WidgetLuckyNumberProvider.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/luckynumber/WidgetLuckyNumberProvider.kt
index 3dfa12f6..e6332115 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/luckynumber/WidgetLuckyNumberProvider.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/luckynumber/WidgetLuckyNumberProvider.kt
@@ -15,7 +15,7 @@ import android.widget.RemoteViews
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.MainActivity
 import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.getJsonObject
+import pl.szczodrzynski.edziennik.ext.getJsonObject
 import pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.models.Date
@@ -42,10 +42,7 @@ class WidgetLuckyNumberProvider : AppWidgetProvider() {
             val views = getRemoteViews(app, config)
 
             val today = Date.getToday()
-            val todayValue = today.value
-
             val tomorrow = Date.getToday().stepForward(0, 0, 1)
-            val tomorrowValue = tomorrow.value
 
             val profile = app.db.profileDao().getByIdNow(config.profileId)
             val luckyNumber = app.db.luckyNumberDao().getNearestFutureNow(config.profileId, today)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsFactory.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsFactory.kt
index 1b6d58e0..587837a8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsFactory.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsFactory.kt
@@ -11,8 +11,13 @@ import android.widget.AdapterView
 import android.widget.RemoteViews
 import android.widget.RemoteViewsService
 import com.google.gson.JsonParser
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Notification
+import pl.szczodrzynski.edziennik.ext.getInt
+import pl.szczodrzynski.edziennik.ext.getLong
+import pl.szczodrzynski.edziennik.ext.getNotificationTitle
+import pl.szczodrzynski.edziennik.ext.getString
 import pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig
 import pl.szczodrzynski.edziennik.utils.models.Date
 
@@ -51,7 +56,7 @@ class WidgetNotificationsFactory(val app: App, val config: WidgetConfig) : Remot
                     getString("profileName"),
                     getInt("posted") == 1,
                     getInt("viewId"),
-                    getString("extras")?.let { JsonParser().parse(it).asJsonObject },
+                    getString("extras")?.let { JsonParser.parseString(it).asJsonObject },
                     getLong("addedDate") ?: System.currentTimeMillis()
             )
         } ?: return views
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt
index a0bf3b00..b2ac08d7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt
@@ -17,7 +17,11 @@ import com.mikepenz.iconics.IconicsDrawable
 import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
 import com.mikepenz.iconics.utils.colorInt
 import com.mikepenz.iconics.utils.sizeDp
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.MainActivity
+import pl.szczodrzynski.edziennik.R
+import pl.szczodrzynski.edziennik.ext.Bundle
+import pl.szczodrzynski.edziennik.ext.getJsonObject
 import pl.szczodrzynski.edziennik.receivers.SzkolnyReceiver
 import pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java
index 01fda6d9..960daef7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java
@@ -33,8 +33,8 @@ import com.mikepenz.iconics.utils.IconicsDrawableExtensionsKt;
 import java.util.List;
 
 import kotlin.Unit;
-import pl.szczodrzynski.edziennik.ExtensionsKt;
 import pl.szczodrzynski.edziennik.R;
+import pl.szczodrzynski.edziennik.ext.TextExtensionsKt;
 import pl.szczodrzynski.edziennik.utils.models.Date;
 import pl.szczodrzynski.edziennik.utils.models.ItemWidgetTimetableModel;
 import pl.szczodrzynski.edziennik.utils.models.Time;
@@ -309,17 +309,17 @@ public class WidgetTimetableFactory implements RemoteViewsService.RemoteViewsFac
 
             views.setViewVisibility(R.id.widgetTimetableOldSubjectName, View.GONE);
             if (lesson.lessonChange) {
-                views.setTextViewText(R.id.widgetTimetableSubjectName, ExtensionsKt.asItalicSpannable(lesson.subjectName));
+                views.setTextViewText(R.id.widgetTimetableSubjectName, TextExtensionsKt.asItalicSpannable(lesson.subjectName));
                 if (lesson.lessonChangeNoClassroom) {
-                    views.setTextViewText(R.id.widgetTimetableClassroomName, ExtensionsKt.asStrikethroughSpannable(lesson.classroomName));
+                    views.setTextViewText(R.id.widgetTimetableClassroomName, TextExtensionsKt.asStrikethroughSpannable(lesson.classroomName));
                 }
                 else {
-                    views.setTextViewText(R.id.widgetTimetableClassroomName, ExtensionsKt.asItalicSpannable(lesson.classroomName));
+                    views.setTextViewText(R.id.widgetTimetableClassroomName, TextExtensionsKt.asItalicSpannable(lesson.classroomName));
                 }
             }
             else if (lesson.lessonCancelled) {
-                views.setTextViewText(R.id.widgetTimetableSubjectName, ExtensionsKt.asStrikethroughSpannable(lesson.subjectName));
-                views.setTextViewText(R.id.widgetTimetableClassroomName, ExtensionsKt.asStrikethroughSpannable(lesson.classroomName));
+                views.setTextViewText(R.id.widgetTimetableSubjectName, TextExtensionsKt.asStrikethroughSpannable(lesson.subjectName));
+                views.setTextViewText(R.id.widgetTimetableClassroomName, TextExtensionsKt.asStrikethroughSpannable(lesson.classroomName));
             }
             else {
                 views.setTextViewText(R.id.widgetTimetableSubjectName, lesson.subjectName);
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt
index 7482a065..8c87ad30 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt
@@ -29,6 +29,8 @@ import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson.Companion.TYPE_NO_LESSONS
+import pl.szczodrzynski.edziennik.ext.filterOutArchived
+import pl.szczodrzynski.edziennik.ext.getJsonObject
 import pl.szczodrzynski.edziennik.ui.widgets.LessonDialogActivity
 import pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig
 import pl.szczodrzynski.edziennik.utils.models.Date
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/BetterLink.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/BetterLink.kt
index 6a5306bf..0665704d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/BetterLink.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/BetterLink.kt
@@ -24,6 +24,10 @@ import androidx.appcompat.view.menu.MenuPopupHelper
 import androidx.core.widget.addTextChangedListener
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.Regexes
+import pl.szczodrzynski.edziennik.ext.Intent
+import pl.szczodrzynski.edziennik.ext.copyToClipboard
+import pl.szczodrzynski.edziennik.ext.get
+import pl.szczodrzynski.edziennik.ext.getTextPosition
 import pl.szczodrzynski.edziennik.utils.models.Date
 
 @SuppressLint("RestrictedApi")
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/html/BetterHtml.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/html/BetterHtml.kt
index 206dacf7..1be6264c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/html/BetterHtml.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/html/BetterHtml.kt
@@ -15,9 +15,9 @@ import android.text.style.*
 import androidx.appcompat.widget.AppCompatEditText
 import androidx.core.graphics.ColorUtils
 import androidx.core.text.HtmlCompat
-import pl.szczodrzynski.edziennik.dp
-import pl.szczodrzynski.edziennik.getWordBounds
-import pl.szczodrzynski.edziennik.resolveAttr
+import pl.szczodrzynski.edziennik.ext.dp
+import pl.szczodrzynski.edziennik.ext.getWordBounds
+import pl.szczodrzynski.edziennik.ext.resolveAttr
 import pl.szczodrzynski.edziennik.utils.span.*
 import pl.szczodrzynski.navlib.blendColors
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AttendanceManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AttendanceManager.kt
index 77af40ed..fa62e695 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AttendanceManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AttendanceManager.kt
@@ -14,7 +14,7 @@ import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.data.db.entity.Attendance
 import pl.szczodrzynski.edziennik.data.db.entity.AttendanceType
 import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull
-import pl.szczodrzynski.edziennik.startCoroutineTimer
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import kotlin.coroutines.CoroutineContext
 
 class AttendanceManager(val app: App) : CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AvailabilityManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AvailabilityManager.kt
index 0c93468e..83d579d8 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AvailabilityManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/AvailabilityManager.kt
@@ -6,13 +6,13 @@ package pl.szczodrzynski.edziennik.utils.managers
 
 import pl.szczodrzynski.edziennik.App
 import pl.szczodrzynski.edziennik.BuildConfig
-import pl.szczodrzynski.edziennik.currentTimeUnix
 import pl.szczodrzynski.edziennik.data.api.*
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
 import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
 import pl.szczodrzynski.edziennik.data.api.szkolny.response.RegisterAvailabilityStatus
 import pl.szczodrzynski.edziennik.data.db.entity.Profile
-import pl.szczodrzynski.edziennik.toApiError
+import pl.szczodrzynski.edziennik.ext.currentTimeUnix
+import pl.szczodrzynski.edziennik.ext.toApiError
 
 class AvailabilityManager(val app: App) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/BuildManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/BuildManager.kt
index ab126826..1c1e2dbe 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/BuildManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/BuildManager.kt
@@ -13,7 +13,8 @@ import kotlinx.coroutines.*
 import okhttp3.Request
 import pl.szczodrzynski.edziennik.*
 import pl.szczodrzynski.edziennik.data.api.szkolny.interceptor.Signing
-import pl.szczodrzynski.edziennik.ui.modules.base.BuildInvalidActivity
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.base.BuildInvalidActivity
 import pl.szczodrzynski.edziennik.utils.Utils
 import pl.szczodrzynski.edziennik.utils.Utils.d
 import java.time.Instant
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/EventManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/EventManager.kt
index a16175f4..98c88835 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/EventManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/EventManager.kt
@@ -14,8 +14,13 @@ import com.mikepenz.iconics.view.IconicsTextView
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.full.EventFull
+import pl.szczodrzynski.edziennik.ext.concat
+import pl.szczodrzynski.edziennik.ext.join
+import pl.szczodrzynski.edziennik.ext.resolveColor
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import kotlin.coroutines.CoroutineContext
 
 class EventManager(val app: App) : CoroutineScope {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/GradesManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/GradesManager.kt
index 61ea5ad2..26dc5a03 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/GradesManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/GradesManager.kt
@@ -8,15 +8,17 @@ import android.content.Context
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Grade
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_NORMAL
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_POINT_AVG
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_POINT_SUM
 import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_FINAL
 import pl.szczodrzynski.edziennik.data.db.full.GradeFull
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesAverages
-import pl.szczodrzynski.edziennik.ui.modules.grades.models.GradesSemester
+import pl.szczodrzynski.edziennik.ext.*
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesAverages
+import pl.szczodrzynski.edziennik.ui.grades.models.GradesSemester
 import java.text.DecimalFormat
 import kotlin.coroutines.CoroutineContext
 import kotlin.math.floor
@@ -118,7 +120,7 @@ class GradesManager(val app: App) : CoroutineScope {
     fun getGradeWeight(dontCountEnabled: Boolean, dontCountGrades: List<String>, grade: Grade): Float {
         if (!dontCountEnabled)
             return grade.weight
-        if (grade.name.toLowerCase().trim() in dontCountGrades)
+        if (grade.name.lowercase().trim() in dontCountGrades)
             return 0f
         return grade.weight
     }
@@ -151,7 +153,7 @@ class GradesManager(val app: App) : CoroutineScope {
                 }
             type == TYPE_NORMAL && defColor -> grade.color and 0xffffff
             type in TYPE_NORMAL..TYPE_YEAR_FINAL -> {
-                when (grade.name.toLowerCase()) {
+                when (grade.name.lowercase()) {
                     "+", "++", "+++" -> 0x4caf50
                     "0", "-", "-,", "-,-,", "np", "np.", "npnp", "np,", "np,np,", "bs", "nk", "bz" -> 0xff7043
                     "1-", "1", "f", "ng" -> 0xff0000
@@ -179,7 +181,7 @@ class GradesManager(val app: App) : CoroutineScope {
      * the specified [name].
      */
     fun getGradeValue(name: String): Float {
-        return when (name.toLowerCase()) {
+        return when (name.lowercase()) {
             "1-" -> 0.75f
             "1" -> 1.00f
             "1+" -> 1.50f
@@ -209,7 +211,7 @@ class GradesManager(val app: App) : CoroutineScope {
     }
 
     fun getGradeNumberName(name: String): String {
-        return when(name.toLowerCase()){
+        return when(name.lowercase()){
             "niedostateczny", "f" -> "1"
             "niedostateczny plus", "f+" -> "1+"
             "niedostateczny minus", "f-" -> "1-"
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/MessageManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/MessageManager.kt
index f421cc74..b6946207 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/MessageManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/MessageManager.kt
@@ -22,7 +22,11 @@ import pl.szczodrzynski.edziennik.data.db.entity.MessageRecipient
 import pl.szczodrzynski.edziennik.data.db.entity.Metadata
 import pl.szczodrzynski.edziennik.data.db.entity.Teacher
 import pl.szczodrzynski.edziennik.data.db.full.MessageFull
-import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesUtils
+import pl.szczodrzynski.edziennik.ext.appendSpan
+import pl.szczodrzynski.edziennik.ext.appendText
+import pl.szczodrzynski.edziennik.ext.fixName
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ui.messages.MessagesUtils
 import pl.szczodrzynski.edziennik.utils.TextInputKeyboardEdit
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import pl.szczodrzynski.edziennik.utils.managers.TextStylingManager.HtmlMode.ORIGINAL
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TextStylingManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TextStylingManager.kt
index 516792db..74e7d2f0 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TextStylingManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TextStylingManager.kt
@@ -20,6 +20,9 @@ import com.google.android.material.button.MaterialButton
 import com.google.android.material.button.MaterialButtonToggleGroup
 import com.mikepenz.iconics.typeface.IIcon
 import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.ext.attachToastHint
+import pl.szczodrzynski.edziennik.ext.hasSet
+import pl.szczodrzynski.edziennik.ext.replaceSpan
 import pl.szczodrzynski.edziennik.utils.TextInputKeyboardEdit
 import pl.szczodrzynski.edziennik.utils.html.BetterHtml
 import pl.szczodrzynski.edziennik.utils.managers.TextStylingManager.HtmlMode.*
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TimetableManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TimetableManager.kt
index 7a5e89fe..14a49fa6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TimetableManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/TimetableManager.kt
@@ -11,9 +11,14 @@ import android.widget.TextView
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.db.entity.Lesson
 import pl.szczodrzynski.edziennik.data.db.full.LessonFull
+import pl.szczodrzynski.edziennik.ext.resolveAttr
+import pl.szczodrzynski.edziennik.ext.setText
+import pl.szczodrzynski.edziennik.ext.setTintColor
+import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
 import pl.szczodrzynski.navlib.getColorFromAttr
 import kotlin.coroutines.CoroutineContext
 
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/UserActionManager.kt b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/UserActionManager.kt
index 5145ad3a..0e96b689 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/UserActionManager.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/managers/UserActionManager.kt
@@ -10,12 +10,16 @@ import android.content.Context
 import androidx.appcompat.app.AppCompatActivity
 import androidx.core.app.NotificationCompat
 import org.greenrobot.eventbus.EventBus
-import pl.szczodrzynski.edziennik.*
+import pl.szczodrzynski.edziennik.App
+import pl.szczodrzynski.edziennik.MainActivity
+import pl.szczodrzynski.edziennik.R
 import pl.szczodrzynski.edziennik.data.api.ERROR_CAPTCHA_LIBRUS_PORTAL
 import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
 import pl.szczodrzynski.edziennik.data.api.events.UserActionRequiredEvent
 import pl.szczodrzynski.edziennik.data.api.models.ApiError
-import pl.szczodrzynski.edziennik.ui.dialogs.captcha.LibrusCaptchaDialog
+import pl.szczodrzynski.edziennik.ext.Intent
+import pl.szczodrzynski.edziennik.ext.JsonObject
+import pl.szczodrzynski.edziennik.ui.captcha.LibrusCaptchaDialog
 
 class UserActionManager(val app: App) {
     companion object {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/models/Date.java b/app/src/main/java/pl/szczodrzynski/edziennik/utils/models/Date.java
index ebc4570c..eb239ca9 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/models/Date.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/models/Date.java
@@ -10,8 +10,8 @@ import java.util.Calendar;
 import java.util.Locale;
 import java.util.TimeZone;
 
-import pl.szczodrzynski.edziennik.ExtensionsKt;
 import pl.szczodrzynski.edziennik.R;
+import pl.szczodrzynski.edziennik.ext.TextExtensionsKt;
 
 public class Date implements Comparable<Date> {
     public int year = 0;
@@ -325,7 +325,7 @@ public class Date implements Comparable<Date> {
             else if (dayDiff == 2) {
                 return context.getString(R.string.the_day_after);
             }
-            return context.getString(R.string.in_format, ExtensionsKt.plural(context, R.plurals.time_till_days, Math.abs(dayDiff)));
+            return context.getString(R.string.in_format, TextExtensionsKt.plural(context, R.plurals.time_till_days, Math.abs(dayDiff)));
         }
         else if (dayDiff < 0) {
             if (dayDiff == -1) {
@@ -334,7 +334,7 @@ public class Date implements Comparable<Date> {
             else if (dayDiff == -2) {
                 return context.getString(R.string.the_day_before);
             }
-            return context.getString(R.string.ago_format, ExtensionsKt.plural(context, R.plurals.time_till_days, Math.abs(dayDiff)));
+            return context.getString(R.string.ago_format, TextExtensionsKt.plural(context, R.plurals.time_till_days, Math.abs(dayDiff)));
         }
         return context.getString(R.string.today);
     }
diff --git a/app/src/main/res/layout/attendance_fragment.xml b/app/src/main/res/layout/attendance_fragment.xml
index d83601f0..48fb1aa5 100644
--- a/app/src/main/res/layout/attendance_fragment.xml
+++ b/app/src/main/res/layout/attendance_fragment.xml
@@ -26,7 +26,7 @@
                 app:tabSelectedTextColor="?colorPrimary"
                 app:tabTextColor="?android:textColorPrimary" />
 
-            <pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyViewPager
+            <pl.szczodrzynski.edziennik.ui.base.lazypager.LazyViewPager
                 android:id="@+id/viewPager"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/attendance_item_attendance.xml b/app/src/main/res/layout/attendance_item_attendance.xml
index 5362b4a6..8ca3f486 100644
--- a/app/src/main/res/layout/attendance_item_attendance.xml
+++ b/app/src/main/res/layout/attendance_item_attendance.xml
@@ -22,7 +22,7 @@
         android:orientation="horizontal"
         android:paddingVertical="8dp">
 
-        <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceView
+        <pl.szczodrzynski.edziennik.ui.attendance.AttendanceView
             android:id="@+id/attendanceView"
             android:layout_width="36dp"
             android:layout_height="36dp"
diff --git a/app/src/main/res/layout/attendance_item_month.xml b/app/src/main/res/layout/attendance_item_month.xml
index f3dcb13d..cc0ad938 100644
--- a/app/src/main/res/layout/attendance_item_month.xml
+++ b/app/src/main/res/layout/attendance_item_month.xml
@@ -70,7 +70,7 @@
                 tools:src="@android:drawable/ic_menu_more" />
         </LinearLayout>
 
-        <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceBar
+        <pl.szczodrzynski.edziennik.ui.attendance.AttendanceBar
             android:id="@+id/attendanceBar"
             android:layout_width="match_parent"
             android:layout_height="20dp"
@@ -96,7 +96,7 @@
                     android:layout_height="wrap_content"
                     android:paddingTop="8dp">
 
-                    <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceView
+                    <pl.szczodrzynski.edziennik.ui.attendance.AttendanceView
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         tools:background="@drawable/bg_rounded_4dp"
diff --git a/app/src/main/res/layout/attendance_item_subject.xml b/app/src/main/res/layout/attendance_item_subject.xml
index d1fb9ce8..46b2807e 100644
--- a/app/src/main/res/layout/attendance_item_subject.xml
+++ b/app/src/main/res/layout/attendance_item_subject.xml
@@ -70,7 +70,7 @@
                 tools:src="@android:drawable/ic_menu_more" />
         </LinearLayout>
 
-        <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceBar
+        <pl.szczodrzynski.edziennik.ui.attendance.AttendanceBar
             android:id="@+id/attendanceBar"
             android:layout_width="match_parent"
             android:layout_height="12dp"
diff --git a/app/src/main/res/layout/attendance_item_type.xml b/app/src/main/res/layout/attendance_item_type.xml
index 682660a6..40f85b96 100644
--- a/app/src/main/res/layout/attendance_item_type.xml
+++ b/app/src/main/res/layout/attendance_item_type.xml
@@ -31,7 +31,7 @@
                 android:layout_height="wrap_content"
                 android:gravity="center_horizontal">
 
-                <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceView
+                <pl.szczodrzynski.edziennik.ui.attendance.AttendanceView
                     android:id="@+id/type"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/attendance_summary_fragment.xml b/app/src/main/res/layout/attendance_summary_fragment.xml
index cce5e3ec..83cfb0f4 100644
--- a/app/src/main/res/layout/attendance_summary_fragment.xml
+++ b/app/src/main/res/layout/attendance_summary_fragment.xml
@@ -87,7 +87,7 @@
                         android:visibility="invisible"
                         tools:visibility="visible" />
 
-                    <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceBar
+                    <pl.szczodrzynski.edziennik.ui.attendance.AttendanceBar
                         android:id="@+id/attendanceBar"
                         android:layout_width="0dp"
                         android:layout_height="20dp"
@@ -115,7 +115,7 @@
                             android:layout_height="wrap_content"
                             android:paddingBottom="8dp">
 
-                            <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceView
+                            <pl.szczodrzynski.edziennik.ui.attendance.AttendanceView
                                 android:layout_width="wrap_content"
                                 android:layout_height="wrap_content"
                                 tools:background="@drawable/bg_rounded_4dp"
diff --git a/app/src/main/res/layout/contributors_activity.xml b/app/src/main/res/layout/contributors_activity.xml
index a9d8a452..fa54100d 100644
--- a/app/src/main/res/layout/contributors_activity.xml
+++ b/app/src/main/res/layout/contributors_activity.xml
@@ -112,7 +112,7 @@
                 </com.google.android.material.appbar.CollapsingToolbarLayout>
             </com.google.android.material.appbar.AppBarLayout>
 
-            <pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyViewPager
+            <pl.szczodrzynski.edziennik.ui.base.lazypager.LazyViewPager
                 android:id="@+id/viewPager"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/dialog_event_details.xml b/app/src/main/res/layout/dialog_event_details.xml
index 051adfc6..7e8d610c 100644
--- a/app/src/main/res/layout/dialog_event_details.xml
+++ b/app/src/main/res/layout/dialog_event_details.xml
@@ -201,7 +201,7 @@
                 android:text="@string/dialog_event_details_attachments"
                 android:textAppearance="@style/NavView.TextView.Helper" />
 
-            <pl.szczodrzynski.edziennik.ui.modules.views.AttachmentsView
+            <pl.szczodrzynski.edziennik.ui.views.AttachmentsView
                 android:id="@+id/attachmentsFragment"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"/>
diff --git a/app/src/main/res/layout/dialog_event_manual_v2.xml b/app/src/main/res/layout/dialog_event_manual_v2.xml
index 0490d391..e8451616 100644
--- a/app/src/main/res/layout/dialog_event_manual_v2.xml
+++ b/app/src/main/res/layout/dialog_event_manual_v2.xml
@@ -25,7 +25,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:hint="@string/dialog_event_manual_date">
-            <pl.szczodrzynski.edziennik.ui.modules.views.DateDropdown
+            <pl.szczodrzynski.edziennik.ui.views.DateDropdown
                 android:id="@+id/dateDropdown"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -39,7 +39,7 @@
             android:layout_height="wrap_content"
             android:layout_marginTop="8dp"
             android:hint="@string/dialog_event_manual_time">
-            <pl.szczodrzynski.edziennik.ui.modules.views.TimeDropdown
+            <pl.szczodrzynski.edziennik.ui.views.TimeDropdown
                 android:id="@+id/timeDropdown"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -56,7 +56,7 @@
             android:layout_marginTop="8dp"
             android:hint="@string/dialog_event_manual_team">
 
-            <pl.szczodrzynski.edziennik.ui.modules.views.TeamDropdown
+            <pl.szczodrzynski.edziennik.ui.views.TeamDropdown
                 android:id="@+id/teamDropdown"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -94,7 +94,7 @@
                 android:layout_weight="1"
                 android:hint="@string/dialog_event_manual_type">
 
-                <pl.szczodrzynski.edziennik.ui.modules.views.EventTypeDropdown
+                <pl.szczodrzynski.edziennik.ui.views.EventTypeDropdown
                     android:id="@+id/typeDropdown"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
@@ -169,7 +169,7 @@
                 android:layout_marginTop="8dp"
                 android:hint="@string/dialog_event_manual_subject">
 
-                <pl.szczodrzynski.edziennik.ui.modules.views.SubjectDropdown
+                <pl.szczodrzynski.edziennik.ui.views.SubjectDropdown
                     android:id="@+id/subjectDropdown"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
@@ -184,7 +184,7 @@
                 android:layout_marginTop="8dp"
                 android:hint="@string/dialog_event_manual_teacher">
 
-                <pl.szczodrzynski.edziennik.ui.modules.views.TeacherDropdown
+                <pl.szczodrzynski.edziennik.ui.views.TeacherDropdown
                     android:id="@+id/teacherDropdown"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/dialog_lesson_details.xml b/app/src/main/res/layout/dialog_lesson_details.xml
index a304c641..7b4d3d6e 100644
--- a/app/src/main/res/layout/dialog_lesson_details.xml
+++ b/app/src/main/res/layout/dialog_lesson_details.xml
@@ -307,7 +307,7 @@
                 android:gravity="center_vertical"
                 android:orientation="horizontal">
 
-                <pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceView
+                <pl.szczodrzynski.edziennik.ui.attendance.AttendanceView
                     android:id="@+id/attendanceView"
                     android:layout_width="36dp"
                     android:layout_height="36dp"
diff --git a/app/src/main/res/layout/fragment_debug.xml b/app/src/main/res/layout/fragment_debug.xml
index bf27e110..f87bd64a 100644
--- a/app/src/main/res/layout/fragment_debug.xml
+++ b/app/src/main/res/layout/fragment_debug.xml
@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context=".ui.modules.debug.DebugFragment">
+    tools:context=".ui.debug.DebugFragment">
 
     <!-- TODO: Update blank fragment layout -->
     <com.google.android.material.textfield.TextInputLayout
diff --git a/app/src/main/res/layout/fragment_timetable_v2.xml b/app/src/main/res/layout/fragment_timetable_v2.xml
index af7995d2..85f18695 100644
--- a/app/src/main/res/layout/fragment_timetable_v2.xml
+++ b/app/src/main/res/layout/fragment_timetable_v2.xml
@@ -40,7 +40,7 @@
                         app:rtl_tabTextAppearance="@style/rtl_RecyclerTabLayout.Tab" />
                 </com.google.android.material.appbar.AppBarLayout>
 
-                <pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyViewPager
+                <pl.szczodrzynski.edziennik.ui.base.lazypager.LazyViewPager
                     android:id="@+id/viewPager"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/grades_item_grade.xml b/app/src/main/res/layout/grades_item_grade.xml
index 1ff1f0b0..383d56d1 100644
--- a/app/src/main/res/layout/grades_item_grade.xml
+++ b/app/src/main/res/layout/grades_item_grade.xml
@@ -13,7 +13,7 @@
         android:orientation="horizontal"
         android:paddingVertical="8dp">
 
-        <pl.szczodrzynski.edziennik.ui.modules.grades.GradeView
+        <pl.szczodrzynski.edziennik.ui.grades.GradeView
             android:id="@+id/gradeName"
             android:layout_width="40dp"
             android:layout_height="40dp"
diff --git a/app/src/main/res/layout/grades_item_semester.xml b/app/src/main/res/layout/grades_item_semester.xml
index 939e4c1f..8419adf0 100644
--- a/app/src/main/res/layout/grades_item_semester.xml
+++ b/app/src/main/res/layout/grades_item_semester.xml
@@ -60,7 +60,7 @@
             tools:text1="suma: 175 pkt"
             tools:text2="średnia: 4,78" />
 
-        <pl.szczodrzynski.edziennik.ui.modules.grades.GradeView
+        <pl.szczodrzynski.edziennik.ui.grades.GradeView
             android:id="@+id/proposedGrade"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -68,7 +68,7 @@
             tools:layout_marginRight="5dp"
             tools:visibility="visible" />
 
-        <pl.szczodrzynski.edziennik.ui.modules.grades.GradeView
+        <pl.szczodrzynski.edziennik.ui.grades.GradeView
             android:id="@+id/finalGrade"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/homework_fragment.xml b/app/src/main/res/layout/homework_fragment.xml
index 9a015c15..d80df010 100644
--- a/app/src/main/res/layout/homework_fragment.xml
+++ b/app/src/main/res/layout/homework_fragment.xml
@@ -26,7 +26,7 @@
                 app:tabSelectedTextColor="?colorPrimary"
                 app:tabTextColor="?android:textColorPrimary" />
 
-            <pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyViewPager
+            <pl.szczodrzynski.edziennik.ui.base.lazypager.LazyViewPager
                 android:id="@+id/viewPager"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/lab_fragment.xml b/app/src/main/res/layout/lab_fragment.xml
index d0756d7f..f1dd0188 100644
--- a/app/src/main/res/layout/lab_fragment.xml
+++ b/app/src/main/res/layout/lab_fragment.xml
@@ -35,7 +35,7 @@
                 app:tabSelectedTextColor="?colorPrimary"
                 app:tabTextColor="?android:textColorPrimary" />-->
 
-            <!--<pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyViewPager
+            <!--<pl.szczodrzynski.edziennik.ui.base.lazypager.LazyViewPager
                 android:id="@+id/viewPager"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/message_fragment.xml b/app/src/main/res/layout/message_fragment.xml
index 7687cc4c..d80bd546 100644
--- a/app/src/main/res/layout/message_fragment.xml
+++ b/app/src/main/res/layout/message_fragment.xml
@@ -188,7 +188,7 @@
                     android:text="Załączniki:"
                     android:textAppearance="@style/NavView.TextView.Subtitle" />
 
-                <pl.szczodrzynski.edziennik.ui.modules.views.AttachmentsView
+                <pl.szczodrzynski.edziennik.ui.views.AttachmentsView
                     android:id="@+id/attachmentsFragment"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/messages_fragment.xml b/app/src/main/res/layout/messages_fragment.xml
index b09dc1f5..b7d7cbe8 100644
--- a/app/src/main/res/layout/messages_fragment.xml
+++ b/app/src/main/res/layout/messages_fragment.xml
@@ -26,7 +26,7 @@
                 app:tabSelectedTextColor="?colorPrimary"
                 app:tabTextColor="?android:textColorPrimary" />
 
-            <pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyViewPager
+            <pl.szczodrzynski.edziennik.ui.base.lazypager.LazyViewPager
                 android:id="@+id/viewPager"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/template_fragment.xml b/app/src/main/res/layout/template_fragment.xml
index 9a015c15..d80df010 100644
--- a/app/src/main/res/layout/template_fragment.xml
+++ b/app/src/main/res/layout/template_fragment.xml
@@ -26,7 +26,7 @@
                 app:tabSelectedTextColor="?colorPrimary"
                 app:tabTextColor="?android:textColorPrimary" />
 
-            <pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyViewPager
+            <pl.szczodrzynski.edziennik.ui.base.lazypager.LazyViewPager
                 android:id="@+id/viewPager"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
diff --git a/app/src/main/res/navigation/nav_login.xml b/app/src/main/res/navigation/nav_login.xml
index 6fb5e503..abf27d73 100644
--- a/app/src/main/res/navigation/nav_login.xml
+++ b/app/src/main/res/navigation/nav_login.xml
@@ -10,7 +10,7 @@
 
     <fragment
         android:id="@+id/loginChooserFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginChooserFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginChooserFragment"
         android:label="LoginChooserFragment">
         <action
             android:id="@+id/action_loginChooserFragment_to_loginPlatformListFragment"
@@ -26,7 +26,7 @@
     <!-- eggs -->
     <fragment
         android:id="@+id/loginEggsFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginEggsFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginEggsFragment"
         android:label="LoginEggsFragment">
         <action
             android:id="@+id/action_loginEggsFragment_to_loginPrizeFragment"
@@ -34,12 +34,12 @@
     </fragment>
     <fragment
         android:id="@+id/loginPrizeFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginPrizeFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginPrizeFragment"
         android:label="LoginPrizeFragment">
     </fragment>
     <fragment
         android:id="@+id/loginPlatformListFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginPlatformListFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginPlatformListFragment"
         android:label="LoginPlatformListFragment">
         <action
             android:id="@+id/action_loginPlatformListFragment_to_loginFormFragment"
@@ -47,7 +47,7 @@
     </fragment>
     <fragment
         android:id="@+id/loginFormFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginFormFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginFormFragment"
         android:label="LoginFormFragment">
         <action
             android:id="@+id/action_loginFormFragment_to_loginProgressFragment"
@@ -55,7 +55,7 @@
     </fragment>
     <fragment
         android:id="@+id/loginProgressFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginProgressFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginProgressFragment"
         android:label="LoginProgressFragment">
         <action
             android:id="@+id/action_loginProgressFragment_to_loginSummaryFragment2"
@@ -63,7 +63,7 @@
     </fragment>
     <fragment
         android:id="@+id/loginSummaryFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginSummaryFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginSummaryFragment"
         android:label="LoginSummaryFragment">
         <action
             android:id="@+id/action_loginSummaryFragment_to_loginChooserFragment"
@@ -74,7 +74,7 @@
     </fragment>
     <fragment
         android:id="@+id/loginSyncFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginSyncFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginSyncFragment"
         android:label="LoginSyncFragment">
         <action
             android:id="@+id/action_loginSyncFragment_to_loginSyncErrorFragment2"
@@ -85,7 +85,7 @@
     </fragment>
     <fragment
         android:id="@+id/loginSyncErrorFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginSyncErrorFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginSyncErrorFragment"
         android:label="LoginSyncErrorFragment">
         <action
             android:id="@+id/action_loginSyncErrorFragment_to_loginFinishFragment2"
@@ -93,6 +93,6 @@
     </fragment>
     <fragment
         android:id="@+id/loginFinishFragment"
-        android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginFinishFragment"
+        android:name="pl.szczodrzynski.edziennik.ui.login.LoginFinishFragment"
         android:label="LoginFinishFragment" />
 </navigation>