mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 10:54:36 -06:00
[UI] Always show event subject dropdown for university school.
This commit is contained in:
parent
aaa3b8626e
commit
12c0c6f2ec
@ -156,6 +156,7 @@ dependencies {
|
|||||||
implementation "androidx.navigation:navigation-fragment-ktx:2.5.2"
|
implementation "androidx.navigation:navigation-fragment-ktx:2.5.2"
|
||||||
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
||||||
implementation "androidx.room:room-runtime:2.4.3"
|
implementation "androidx.room:room-runtime:2.4.3"
|
||||||
|
implementation "androidx.room:room-ktx:2.4.3"
|
||||||
implementation "androidx.work:work-runtime-ktx:2.7.1"
|
implementation "androidx.work:work-runtime-ktx:2.7.1"
|
||||||
kapt "androidx.room:room-compiler:2.4.3"
|
kapt "androidx.room:room-compiler:2.4.3"
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ data class AppData(
|
|||||||
val lessonHeight: Int,
|
val lessonHeight: Int,
|
||||||
val enableMarkAsReadAnnouncements: Boolean,
|
val enableMarkAsReadAnnouncements: Boolean,
|
||||||
val enableNoticePoints: Boolean,
|
val enableNoticePoints: Boolean,
|
||||||
|
val eventManualShowSubjectDropdown: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class EventType(
|
data class EventType(
|
||||||
|
@ -28,6 +28,9 @@ interface ProfileDao {
|
|||||||
@Query("SELECT * FROM profiles WHERE profileId = :profileId")
|
@Query("SELECT * FROM profiles WHERE profileId = :profileId")
|
||||||
fun getByIdNow(profileId: Int): Profile?
|
fun getByIdNow(profileId: Int): Profile?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM profiles WHERE profileId = :profileId")
|
||||||
|
suspend fun getByIdSuspend(profileId: Int): Profile?
|
||||||
|
|
||||||
@get:Query("SELECT * FROM profiles WHERE profileId >= 0 ORDER BY profileId")
|
@get:Query("SELECT * FROM profiles WHERE profileId >= 0 ORDER BY profileId")
|
||||||
val all: LiveData<List<Profile>>
|
val all: LiveData<List<Profile>>
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import android.content.Context
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
@ -161,3 +162,12 @@ val SwipeRefreshLayout.onScrollListener: RecyclerView.OnScrollListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun View.removeFromParent() {
|
||||||
|
(parent as? ViewGroup)?.removeView(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun View.appendView(child: View) {
|
||||||
|
val parent = parent as? ViewGroup ?: return
|
||||||
|
val index = parent.indexOfChild(this)
|
||||||
|
parent.addView(child, index + 1)
|
||||||
|
}
|
||||||
|
@ -19,7 +19,9 @@ import kotlinx.coroutines.withContext
|
|||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.R
|
import pl.szczodrzynski.edziennik.R
|
||||||
|
import pl.szczodrzynski.edziennik.config.AppData
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
|
import pl.szczodrzynski.edziennik.data.api.edziennik.EdziennikTask
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.ApiTaskAllFinishedEvent
|
import pl.szczodrzynski.edziennik.data.api.events.ApiTaskAllFinishedEvent
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.ApiTaskErrorEvent
|
import pl.szczodrzynski.edziennik.data.api.events.ApiTaskErrorEvent
|
||||||
@ -35,9 +37,11 @@ import pl.szczodrzynski.edziennik.data.db.full.EventFull
|
|||||||
import pl.szczodrzynski.edziennik.data.db.full.LessonFull
|
import pl.szczodrzynski.edziennik.data.db.full.LessonFull
|
||||||
import pl.szczodrzynski.edziennik.databinding.DialogEventManualV2Binding
|
import pl.szczodrzynski.edziennik.databinding.DialogEventManualV2Binding
|
||||||
import pl.szczodrzynski.edziennik.ext.JsonObject
|
import pl.szczodrzynski.edziennik.ext.JsonObject
|
||||||
|
import pl.szczodrzynski.edziennik.ext.appendView
|
||||||
import pl.szczodrzynski.edziennik.ext.getStudentData
|
import pl.szczodrzynski.edziennik.ext.getStudentData
|
||||||
import pl.szczodrzynski.edziennik.ext.onChange
|
import pl.szczodrzynski.edziennik.ext.onChange
|
||||||
import pl.szczodrzynski.edziennik.ext.onClick
|
import pl.szczodrzynski.edziennik.ext.onClick
|
||||||
|
import pl.szczodrzynski.edziennik.ext.removeFromParent
|
||||||
import pl.szczodrzynski.edziennik.ext.setText
|
import pl.szczodrzynski.edziennik.ext.setText
|
||||||
import pl.szczodrzynski.edziennik.ext.setTintColor
|
import pl.szczodrzynski.edziennik.ext.setTintColor
|
||||||
import pl.szczodrzynski.edziennik.ui.dialogs.base.BindingDialog
|
import pl.szczodrzynski.edziennik.ui.dialogs.base.BindingDialog
|
||||||
@ -117,6 +121,15 @@ class EventManualDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun onShow() {
|
override suspend fun onShow() {
|
||||||
|
val data = withContext(Dispatchers.IO) {
|
||||||
|
val profile = app.db.profileDao().getByIdSuspend(profileId) ?: return@withContext null
|
||||||
|
AppData.get(profile.loginStoreType)
|
||||||
|
}
|
||||||
|
if (data?.uiConfig?.eventManualShowSubjectDropdown == true) {
|
||||||
|
b.subjectDropdownLayout.removeFromParent()
|
||||||
|
b.timeDropdownLayout.appendView(b.subjectDropdownLayout)
|
||||||
|
}
|
||||||
|
|
||||||
b.showMore.onClick { // TODO iconics is broken
|
b.showMore.onClick { // TODO iconics is broken
|
||||||
it.apply {
|
it.apply {
|
||||||
refreshDrawableState()
|
refreshDrawableState()
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/mainLayout"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -34,6 +35,7 @@
|
|||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/timeDropdownLayout"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.Dense"
|
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.Dense"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -163,6 +165,7 @@
|
|||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/subjectDropdownLayout"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
"uiConfig": {
|
"uiConfig": {
|
||||||
"lessonHeight": 60,
|
"lessonHeight": 60,
|
||||||
"enableMarkAsReadAnnouncements": true,
|
"enableMarkAsReadAnnouncements": true,
|
||||||
"enableNoticePoints": false
|
"enableNoticePoints": false,
|
||||||
|
"eventManualShowSubjectDropdown": false
|
||||||
},
|
},
|
||||||
"eventTypes": [
|
"eventTypes": [
|
||||||
{
|
{
|
||||||
@ -89,7 +90,8 @@
|
|||||||
"timetableTrimHourRange": true
|
"timetableTrimHourRange": true
|
||||||
},
|
},
|
||||||
"uiConfig": {
|
"uiConfig": {
|
||||||
"lessonHeight": 45
|
"lessonHeight": 45,
|
||||||
|
"eventManualShowSubjectDropdown": true
|
||||||
},
|
},
|
||||||
"eventTypes": [
|
"eventTypes": [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user