fixed app crash (buffer overflow)

This commit is contained in:
Odweta
2024-03-08 18:15:25 +01:00
parent abcb2ab381
commit 6c8b0dc527
8 changed files with 155 additions and 12 deletions
+123
View File
@@ -0,0 +1,123 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>
+5
View File
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
+1 -1
View File
@@ -5,7 +5,7 @@
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#JAVA_HOME" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>
@@ -58,7 +58,6 @@ class CalWeekFragment : Fragment() {
super.onPageSelected(position)
if (viewPager.isLaidOut) {
Vars.selectedDay = position
Log.d("debug", Vars.selectedDay.toString())
}
}
})
@@ -1,5 +1,6 @@
package com.odweta.solon
import android.util.Log
import org.json.JSONObject
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
@@ -110,15 +111,17 @@ class Parsing {
}
for (subj in subjectJSONList) {
Log.d("debug", subj.toString())
// for each subject in one particular day
val subject = Subject()
val kind = subj.getJSONObject("hourKind").get("id")
val type = subj.getJSONObject("hourType").get("id")
if (
(type == "SUPLOVANA") ||
(type != "SUPLOVANI" && type != "ROZVRH")
) {
if (type == "SUPLOVANA") {
continue
}
if (type != "SUPLOVANI" && type != "ROZVRH") {
when (kind) {
"ZRUSENI_VYUKY_ROZVRH" -> {
subject.name = subj.get("title").toString()
@@ -232,14 +235,17 @@ class Parsing {
} else {
auxSubjects.add(subjects[i])
while ((auxSubjects[auxSubjects.size - 1].number.toInt() + 1).toString() != subjects[i + 1].number) {
var previous = auxSubjects[auxSubjects.size - 1].number.toInt() + 1
val next = subjects[i + 1].number.toInt()
while (previous < next) {
auxSubjects.add(
Subject.freeSubject(
(auxSubjects[auxSubjects.size - 1].number.toInt() + 1).toString(),
"",
""
previous.toString(),
subjects[i-1].end,
subjects[i+1].start
)
)
previous += 1
}
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.2.2" apply false
id("com.android.application") version "8.3.0" apply false
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
}
+1 -1
View File
@@ -1,6 +1,6 @@
#Sun Jan 07 18:04:36 GMT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists