forked from github/szkolny
[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")
|
||||
kapt project(":codegen")
|
||||
|
||||
implementation 'com.google.android:flexbox:2.0.1'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -168,7 +168,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
db.profileDao().firstId?.let { profileLoadById(it) }
|
||||
}
|
||||
|
||||
devMode = "f054761fbdb6a238" == deviceId || BuildConfig.DEBUG
|
||||
devMode = BuildConfig.DEBUG
|
||||
|
||||
Signing.getCert(this)
|
||||
|
||||
|
@ -518,7 +518,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_help_circle_outline)
|
||||
.withOnClickListener(View.OnClickListener { loadTarget(TARGET_FEEDBACK) })
|
||||
)
|
||||
if (App.devMode) {
|
||||
if (App.debugMode) {
|
||||
bottomSheet += BottomSheetPrimaryItem(false)
|
||||
.withTitle(R.string.menu_debug)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_android_studio)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
||||
|
||||
import android.text.Html
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.jsoup.Jsoup
|
||||
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")
|
||||
|
||||
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.attachmentNames = mutableListOf()
|
||||
|
@ -192,6 +192,13 @@ class EventDetailsDialog(
|
||||
}
|
||||
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
|
||||
BetterLink.attach(b.topic) {
|
||||
|
@ -78,7 +78,7 @@ class LessonDetailsDialog(
|
||||
)
|
||||
}
|
||||
|
||||
if (App.devMode)
|
||||
if (App.debugMode)
|
||||
b.lessonId.visibility = View.VISIBLE
|
||||
|
||||
update()
|
||||
|
@ -45,7 +45,7 @@ class ErrorDetailsDialog(
|
||||
listOf(
|
||||
it.getStringReason(activity).asBoldSpannable().asColoredSpannable(R.attr.colorOnBackground.resolveAttr(activity)),
|
||||
activity.getString(R.string.error_unknown_format, it.errorCode, it.tag),
|
||||
if (App.devMode)
|
||||
if (App.debugMode)
|
||||
it.throwable?.stackTraceString ?: it.throwable?.localizedMessage
|
||||
else
|
||||
it.throwable?.localizedMessage
|
||||
|
@ -49,28 +49,29 @@ class GradeView : AppCompatTextView {
|
||||
|
||||
val gradeColor = manager.getGradeColor(grade)
|
||||
|
||||
text = if (periodGradesTextual)
|
||||
when (grade.type) {
|
||||
text = when {
|
||||
periodGradesTextual -> when (grade.type) {
|
||||
TYPE_SEMESTER1_PROPOSED, TYPE_SEMESTER2_PROPOSED -> context.getString(
|
||||
R.string.grade_semester_proposed_format,
|
||||
gradeName
|
||||
R.string.grade_semester_proposed_format,
|
||||
gradeName
|
||||
)
|
||||
TYPE_SEMESTER1_FINAL, TYPE_SEMESTER2_FINAL -> context.getString(
|
||||
R.string.grade_semester_final_format,
|
||||
gradeName
|
||||
R.string.grade_semester_final_format,
|
||||
gradeName
|
||||
)
|
||||
TYPE_YEAR_PROPOSED -> context.getString(
|
||||
R.string.grade_year_proposed_format,
|
||||
gradeName
|
||||
R.string.grade_year_proposed_format,
|
||||
gradeName
|
||||
)
|
||||
TYPE_YEAR_FINAL -> context.getString(
|
||||
R.string.grade_year_final_format,
|
||||
gradeName
|
||||
R.string.grade_year_final_format,
|
||||
gradeName
|
||||
)
|
||||
else -> gradeName
|
||||
}
|
||||
else
|
||||
gradeName
|
||||
gradeName.isBlank() -> " "
|
||||
else -> gradeName
|
||||
}
|
||||
|
||||
setTextColor(when (grade.type) {
|
||||
TYPE_SEMESTER1_PROPOSED,
|
||||
|
@ -1217,7 +1217,7 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
})
|
||||
.build());*/
|
||||
|
||||
if (App.Companion.getDevMode()) {
|
||||
if (App.Companion.getDebugMode()) {
|
||||
items.add(new MaterialAboutActionItem.Builder()
|
||||
.text(R.string.settings_about_crash_text)
|
||||
.subText(R.string.settings_about_crash_subtext)
|
||||
|
@ -4,10 +4,14 @@
|
||||
-->
|
||||
|
||||
<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>
|
||||
<import type="android.view.View"/>
|
||||
<import type="pl.szczodrzynski.edziennik.App"/>
|
||||
<variable
|
||||
name="appCompanion"
|
||||
type="pl.szczodrzynski.edziennik.App.Companion" />
|
||||
<variable
|
||||
name="event"
|
||||
type="pl.szczodrzynski.edziennik.data.db.full.EventFull" />
|
||||
@ -196,57 +200,68 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:orientation="horizontal">
|
||||
app:flexWrap="wrap"
|
||||
app:justifyContent="flex_end">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/checkDoneButton"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:minWidth="0dp"
|
||||
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:textSize="20sp"
|
||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/editButton"
|
||||
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"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:text="\uFC92"
|
||||
android:textSize="20sp"
|
||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/saveInCalendarButton"
|
||||
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"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:text="\uFB09"
|
||||
android:textSize="20sp"
|
||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/goToTimetableButton"
|
||||
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"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:text="\uFCDA"
|
||||
android:textSize="20sp"
|
||||
android:fontFamily="@font/community_material_font_v3_5_95_1" />
|
||||
</LinearLayout>
|
||||
android:textSize="20sp" />
|
||||
|
||||
<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>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</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="dialog_event_details_body">Treść</string>
|
||||
<string name="dialog_event_details_attachments">Załączniki</string>
|
||||
<string name="hint_download_again">Pobierz ponownie</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user