mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-02-07 08:34:37 +01:00
[API/Librus] Fix HTML to string conversion in homework. Add force download homework button in debug mode.
This commit is contained in:
parent
f6dcbb6594
commit
7f0aea29cd
@ -196,6 +196,8 @@ dependencies {
|
|||||||
|
|
||||||
implementation project(":annotation")
|
implementation project(":annotation")
|
||||||
kapt project(":codegen")
|
kapt project(":codegen")
|
||||||
|
|
||||||
|
implementation 'com.google.android:flexbox:2.0.1'
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -168,7 +168,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
db.profileDao().firstId?.let { profileLoadById(it) }
|
db.profileDao().firstId?.let { profileLoadById(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
devMode = "f054761fbdb6a238" == deviceId || BuildConfig.DEBUG
|
devMode = BuildConfig.DEBUG
|
||||||
|
|
||||||
Signing.getCert(this)
|
Signing.getCert(this)
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
|
|||||||
.withIcon(CommunityMaterial.Icon2.cmd_help_circle_outline)
|
.withIcon(CommunityMaterial.Icon2.cmd_help_circle_outline)
|
||||||
.withOnClickListener(View.OnClickListener { loadTarget(TARGET_FEEDBACK) })
|
.withOnClickListener(View.OnClickListener { loadTarget(TARGET_FEEDBACK) })
|
||||||
)
|
)
|
||||||
if (App.devMode) {
|
if (App.debugMode) {
|
||||||
bottomSheet += BottomSheetPrimaryItem(false)
|
bottomSheet += BottomSheetPrimaryItem(false)
|
||||||
.withTitle(R.string.menu_debug)
|
.withTitle(R.string.menu_debug)
|
||||||
.withIcon(CommunityMaterial.Icon.cmd_android_studio)
|
.withIcon(CommunityMaterial.Icon.cmd_android_studio)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
||||||
|
|
||||||
|
import android.text.Html
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
@ -22,7 +23,7 @@ class LibrusSynergiaGetHomework(override val data: DataLibrus,
|
|||||||
val table = doc.select("table.decorated tbody > tr")
|
val table = doc.select("table.decorated tbody > tr")
|
||||||
|
|
||||||
event.topic = table[1].select("td")[1].text()
|
event.topic = table[1].select("td")[1].text()
|
||||||
event.homeworkBody = table[5].select("td")[1].text()
|
event.homeworkBody = Html.fromHtml(table[5].select("td")[1].html()).toString()
|
||||||
|
|
||||||
event.attachmentIds = mutableListOf()
|
event.attachmentIds = mutableListOf()
|
||||||
event.attachmentNames = mutableListOf()
|
event.attachmentNames = mutableListOf()
|
||||||
|
@ -192,6 +192,13 @@ class EventDetailsDialog(
|
|||||||
}
|
}
|
||||||
b.goToTimetableButton.attachToastHint(R.string.hint_go_to_timetable)
|
b.goToTimetableButton.attachToastHint(R.string.hint_go_to_timetable)
|
||||||
|
|
||||||
|
// RE-DOWNLOAD
|
||||||
|
b.downloadButton.isVisible = App.debugMode
|
||||||
|
b.downloadButton.onClick {
|
||||||
|
EdziennikTask.eventGet(event.profileId, event).enqueue(activity)
|
||||||
|
}
|
||||||
|
b.downloadButton.attachToastHint(R.string.hint_download_again)
|
||||||
|
|
||||||
|
|
||||||
b.topic.text = event.topic
|
b.topic.text = event.topic
|
||||||
BetterLink.attach(b.topic) {
|
BetterLink.attach(b.topic) {
|
||||||
|
@ -78,7 +78,7 @@ class LessonDetailsDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App.devMode)
|
if (App.debugMode)
|
||||||
b.lessonId.visibility = View.VISIBLE
|
b.lessonId.visibility = View.VISIBLE
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
@ -45,7 +45,7 @@ class ErrorDetailsDialog(
|
|||||||
listOf(
|
listOf(
|
||||||
it.getStringReason(activity).asBoldSpannable().asColoredSpannable(R.attr.colorOnBackground.resolveAttr(activity)),
|
it.getStringReason(activity).asBoldSpannable().asColoredSpannable(R.attr.colorOnBackground.resolveAttr(activity)),
|
||||||
activity.getString(R.string.error_unknown_format, it.errorCode, it.tag),
|
activity.getString(R.string.error_unknown_format, it.errorCode, it.tag),
|
||||||
if (App.devMode)
|
if (App.debugMode)
|
||||||
it.throwable?.stackTraceString ?: it.throwable?.localizedMessage
|
it.throwable?.stackTraceString ?: it.throwable?.localizedMessage
|
||||||
else
|
else
|
||||||
it.throwable?.localizedMessage
|
it.throwable?.localizedMessage
|
||||||
|
@ -49,28 +49,29 @@ class GradeView : AppCompatTextView {
|
|||||||
|
|
||||||
val gradeColor = manager.getGradeColor(grade)
|
val gradeColor = manager.getGradeColor(grade)
|
||||||
|
|
||||||
text = if (periodGradesTextual)
|
text = when {
|
||||||
when (grade.type) {
|
periodGradesTextual -> when (grade.type) {
|
||||||
TYPE_SEMESTER1_PROPOSED, TYPE_SEMESTER2_PROPOSED -> context.getString(
|
TYPE_SEMESTER1_PROPOSED, TYPE_SEMESTER2_PROPOSED -> context.getString(
|
||||||
R.string.grade_semester_proposed_format,
|
R.string.grade_semester_proposed_format,
|
||||||
gradeName
|
gradeName
|
||||||
)
|
)
|
||||||
TYPE_SEMESTER1_FINAL, TYPE_SEMESTER2_FINAL -> context.getString(
|
TYPE_SEMESTER1_FINAL, TYPE_SEMESTER2_FINAL -> context.getString(
|
||||||
R.string.grade_semester_final_format,
|
R.string.grade_semester_final_format,
|
||||||
gradeName
|
gradeName
|
||||||
)
|
)
|
||||||
TYPE_YEAR_PROPOSED -> context.getString(
|
TYPE_YEAR_PROPOSED -> context.getString(
|
||||||
R.string.grade_year_proposed_format,
|
R.string.grade_year_proposed_format,
|
||||||
gradeName
|
gradeName
|
||||||
)
|
)
|
||||||
TYPE_YEAR_FINAL -> context.getString(
|
TYPE_YEAR_FINAL -> context.getString(
|
||||||
R.string.grade_year_final_format,
|
R.string.grade_year_final_format,
|
||||||
gradeName
|
gradeName
|
||||||
)
|
)
|
||||||
else -> gradeName
|
else -> gradeName
|
||||||
}
|
}
|
||||||
else
|
gradeName.isBlank() -> " "
|
||||||
gradeName
|
else -> gradeName
|
||||||
|
}
|
||||||
|
|
||||||
setTextColor(when (grade.type) {
|
setTextColor(when (grade.type) {
|
||||||
TYPE_SEMESTER1_PROPOSED,
|
TYPE_SEMESTER1_PROPOSED,
|
||||||
|
@ -1217,7 +1217,7 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
|||||||
})
|
})
|
||||||
.build());*/
|
.build());*/
|
||||||
|
|
||||||
if (App.Companion.getDevMode()) {
|
if (App.Companion.getDebugMode()) {
|
||||||
items.add(new MaterialAboutActionItem.Builder()
|
items.add(new MaterialAboutActionItem.Builder()
|
||||||
.text(R.string.settings_about_crash_text)
|
.text(R.string.settings_about_crash_text)
|
||||||
.subText(R.string.settings_about_crash_subtext)
|
.subText(R.string.settings_about_crash_subtext)
|
||||||
|
@ -4,10 +4,14 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<data>
|
<data>
|
||||||
<import type="android.view.View"/>
|
<import type="android.view.View"/>
|
||||||
<import type="pl.szczodrzynski.edziennik.App"/>
|
<import type="pl.szczodrzynski.edziennik.App"/>
|
||||||
|
<variable
|
||||||
|
name="appCompanion"
|
||||||
|
type="pl.szczodrzynski.edziennik.App.Companion" />
|
||||||
<variable
|
<variable
|
||||||
name="event"
|
name="event"
|
||||||
type="pl.szczodrzynski.edziennik.data.db.full.EventFull" />
|
type="pl.szczodrzynski.edziennik.data.db.full.EventFull" />
|
||||||
@ -196,57 +200,68 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:background="@drawable/divider"/>
|
android:background="@drawable/divider"/>
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.flexbox.FlexboxLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
app:flexWrap="wrap"
|
||||||
android:orientation="horizontal">
|
app:justifyContent="flex_end">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/checkDoneButton"
|
android:id="@+id/checkDoneButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
android:minWidth="0dp"
|
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
android:fontFamily="@font/community_material_font_v3_5_95_1"
|
||||||
|
android:minWidth="0dp"
|
||||||
android:text="\uFCE1"
|
android:text="\uFCE1"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp" />
|
||||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/editButton"
|
android:id="@+id/editButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
|
android:fontFamily="@font/community_material_font_v3_5_95_1"
|
||||||
android:minWidth="0dp"
|
android:minWidth="0dp"
|
||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
||||||
android:text="\uFC92"
|
android:text="\uFC92"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp" />
|
||||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/saveInCalendarButton"
|
android:id="@+id/saveInCalendarButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
|
android:fontFamily="@font/community_material_font_v3_5_95_1"
|
||||||
android:minWidth="0dp"
|
android:minWidth="0dp"
|
||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
||||||
android:text="\uFB09"
|
android:text="\uFB09"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp" />
|
||||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/goToTimetableButton"
|
android:id="@+id/goToTimetableButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
|
android:fontFamily="@font/community_material_font_v3_5_95_1"
|
||||||
android:minWidth="0dp"
|
android:minWidth="0dp"
|
||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
||||||
android:text="\uFCDA"
|
android:text="\uFCDA"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp" />
|
||||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
|
||||||
</LinearLayout>
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/downloadButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:fontFamily="@font/community_material_font_v3_5_95_1"
|
||||||
|
android:minWidth="0dp"
|
||||||
|
android:text="\uFB6B"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
</com.google.android.flexbox.FlexboxLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -1285,4 +1285,5 @@
|
|||||||
<string name="event_mark_as_done_text">Czy chcesz oznaczyć to zadanie jako wykonane?\n\nNie będzie ono się wyświetlać na stronie głównej oraz w aktualnych zadaniach domowych. Będzie wciąż dostępne w Terminarzu.</string>
|
<string name="event_mark_as_done_text">Czy chcesz oznaczyć to zadanie jako wykonane?\n\nNie będzie ono się wyświetlać na stronie głównej oraz w aktualnych zadaniach domowych. Będzie wciąż dostępne w Terminarzu.</string>
|
||||||
<string name="dialog_event_details_body">Treść</string>
|
<string name="dialog_event_details_body">Treść</string>
|
||||||
<string name="dialog_event_details_attachments">Załączniki</string>
|
<string name="dialog_event_details_attachments">Załączniki</string>
|
||||||
|
<string name="hint_download_again">Pobierz ponownie</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user