fixed app crash, added an easter egg

This commit is contained in:
Odweta
2024-10-16 22:19:36 +02:00
parent a046e5a000
commit d9c296f80e
14 changed files with 66 additions and 22 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
<bytecodeTargetLevel target="21" />
</component>
</project>
+1
View File
@@ -4,6 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>
+1 -1
View File
@@ -12,7 +12,7 @@ android {
minSdk = 28
targetSdk = 34
versionCode = 1
versionName = "1.0.8"
versionName = "1.0.9"
}
buildTypes {
@@ -21,6 +21,8 @@ import android.widget.Space
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.marginLeft
import androidx.core.view.setMargins
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
@@ -251,6 +253,7 @@ class DayFragment : Fragment() {
handler.removeCallbacksAndMessages(null)
}
@SuppressLint("UseCompatLoadingForDrawables")
private fun createDayView(day: Day, rootLayout: LinearLayout, resources: Resources) {
val customFont = context?.let { ResourcesCompat.getFont(it, R.font.roboto) }
@@ -435,10 +438,25 @@ class DayFragment : Fragment() {
namePlaceLL.addView(subjectPlaceTextView)
}
namePlaceLL.setPadding(30, 15, 0, 15)
namePlaceLL.setPadding(30, 15, 20, 15)
subjectLayout.addView(namePlaceLL)
if (subj.teacher == "Jindřich Svoboda") {
val img = ImageView(requireContext())
img.setImageDrawable(resources.getDrawable(R.drawable.spock))
val frameLayout2 = FrameLayout(requireContext())
val layoutParams2 = LinearLayout.LayoutParams(
100,
120,
)
frameLayout2.foregroundGravity = Gravity.CENTER
frameLayout2.layoutParams = layoutParams2
frameLayout2.addView(img)
subjectLayout.addView(frameLayout2)
}
val params = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT
@@ -125,7 +125,7 @@ class MarksFragment : Fragment() {
LinearLayout.LayoutParams.WRAP_CONTENT
)
params.setMargins(20, 0, 20, 0)
params.height = 210
params.height = 160
markRoot.layoutParams = params
markRoot.gravity = Gravity.CENTER_VERTICAL
@@ -159,8 +159,9 @@ class MarksFragment : Fragment() {
val subjectTextView = TextView(requireContext())
subjectTextView.text = marks[0].subject.uppercase()
subjectTextView.setPadding(20, 20, 20, 20)
subjectTextView.setAutoSizeTextTypeUniformWithConfiguration(65, 85, 1, 0)
//subjectTextView.setPadding(20, 20, 20, 20)
//subjectTextView.setAutoSizeTextTypeUniformWithConfiguration(65, 85, 1, 0)
subjectTextView.textSize = resources.getDimension(R.dimen.text_size_subject_number) / resources.displayMetrics.scaledDensity
subjectTextView.setTextColor(
ContextCompat.getColor(
requireContext(),
@@ -172,7 +173,7 @@ class MarksFragment : Fragment() {
val fl2 = FrameLayout(requireContext())
fl2.layoutParams = LinearLayout.LayoutParams(
210,
160,
FrameLayout.LayoutParams.MATCH_PARENT,
)
fl2.addView(subjectTextView)
@@ -187,8 +188,9 @@ class MarksFragment : Fragment() {
"-"
}
avgTextView.text = text
avgTextView.setAutoSizeTextTypeUniformWithConfiguration(65, 85, 1, 0)
avgTextView.setPadding(20, 20, 20, 20)
//avgTextView.setPadding(20, 20, 20, 20)
//avgTextView.setAutoSizeTextTypeUniformWithConfiguration(65, 85, 1, 0)
avgTextView.textSize = resources.getDimension(R.dimen.text_size_subject_number) / resources.displayMetrics.scaledDensity
avgTextView.gravity = Gravity.CENTER // Center text vertically
avgTextView.setTypeface(customFont, Typeface.NORMAL)
avgTextView.setTextColor(
@@ -200,7 +202,7 @@ class MarksFragment : Fragment() {
val frameLayout = FrameLayout(requireContext())
frameLayout.layoutParams = LinearLayout.LayoutParams(
210,
160,
FrameLayout.LayoutParams.MATCH_PARENT,
)
frameLayout.addView(avgTextView)
@@ -249,7 +251,8 @@ class MarksFragment : Fragment() {
}
marksTextView.text = markString
marksTextView.setPadding(20, 20, 20, 20)
marksTextView.setAutoSizeTextTypeUniformWithConfiguration(45, 65, 1, 0)
//marksTextView.setAutoSizeTextTypeUniformWithConfiguration(45, 65, 1, 0)
marksTextView.textSize = resources.getDimension(R.dimen.text_size_mark) / resources.displayMetrics.scaledDensity
marksTextView.setTextColor(
ContextCompat.getColor(
requireContext(),
@@ -124,7 +124,8 @@ class MarksOneSubjectFragment : DialogFragment() {
// e.g. average in that subject, hours per week maybe idk
val subjectDetailsLL = LinearLayout(requireContext())
subjectDetailsLL.orientation = LinearLayout.HORIZONTAL
subjectDetailsLL.setPadding(20, 20, 20, 20)
subjectDetailsLL.gravity = Gravity.CENTER_VERTICAL
subjectDetailsLL.setPadding(40, 40, 40, 40)
subjectDetailsLL.background = bg
val params = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
@@ -141,9 +142,7 @@ class MarksOneSubjectFragment : DialogFragment() {
val wholeNameTV = TextView(requireContext())
// index by the abbrev and get the name (if null just fallback to the abbrev)
wholeNameTV.text = Vars.subjectNameMap[marks[0].subject] ?: marks[0].subject
wholeNameTV.textSize = 28f
wholeNameTV.gravity = Gravity.CENTER
wholeNameTV.setPadding(20, 30, 10, 30)
wholeNameTV.gravity = Gravity.CENTER_VERTICAL
wholeNameTV.setTypeface(customFont, Typeface.BOLD)
wholeNameTV.setTextColor(
ContextCompat.getColor(
@@ -162,9 +161,13 @@ class MarksOneSubjectFragment : DialogFragment() {
avgTV.textAlignment = View.TEXT_ALIGNMENT_TEXT_END
avgTV.layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT
LinearLayout.LayoutParams.WRAP_CONTENT
)
avgTV.setPadding(30, 30, 30, 30)
if (wholeNameTV.text.length < 15) {
wholeNameTV.textSize = 28f
} else {
wholeNameTV.textSize = 24f
}
avgTV.setTextColor(
ContextCompat.getColor(
requireContext(),
@@ -145,7 +145,8 @@ class Util {
var sum = 0f
var len = 0
for (mark in marks) {
val marksCopy = marks.toList()
for (mark in marksCopy) {
len += 1
if (mark.grade !in "0123456789") {
marks.remove(mark)
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

@@ -10,6 +10,7 @@
<dimen name="text_size_subject_teacher">15sp</dimen>
<dimen name="text_size_day_end">28sp</dimen>
<dimen name="text_size_toolbar">26sp</dimen>
<dimen name="text_size_mark">26sp</dimen>
<dimen name="design_bottom_navigation_text_size" tools:override="true">15sp</dimen>
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">15sp</dimen>
</resources>
+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.6.0" apply false
id("com.android.application") version "8.7.1" 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.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists