Browse Source

code clean up

pull/46/head
Jannik 2 years ago
parent
commit
62a62049c3
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 2
      app/build.gradle
  2. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  3. 8
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/QISPOSParser.kt
  4. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt
  5. 4
      app/src/main/java/org/mosad/seil0/projectlaogai/util/DataTypes.kt
  6. 20
      app/src/main/res/layouts/activities/layout/activity_onboarding.xml
  7. 9
      app/src/main/res/layouts/fragments/layout/fragment_mensa.xml
  8. 8
      app/src/main/res/layouts/fragments/layout/fragment_on_course.xml
  9. 8
      app/src/main/res/layouts/fragments/layout/fragment_on_welcome.xml

2
app/build.gradle

@ -62,7 +62,7 @@ dependencies {
implementation 'com.afollestad.material-dialogs:bottomsheets:3.3.0'
implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0'
implementation 'org.apache.commons:commons-lang3:3.10'
implementation 'org.apache.commons:commons-lang3:3.11'
implementation 'org.jsoup:jsoup:1.13.1'
testImplementation 'junit:junit:4.13'

2
app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt

@ -88,7 +88,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
nav_view.setNavigationItemSelectedListener(this)
// based on the inent we get, call readBalance or open a Fragment
// based on the intent we get, call readBalance or open a Fragment
when (intent.action) {
NfcAdapter.ACTION_TECH_DISCOVERED -> NFCMensaCard.readBalance(intent, this)
"org.mosad.seil0.projectlaogai.fragments.MensaFragment" -> activeFragment = MensaFragment()

8
app/src/main/java/org/mosad/seil0/projectlaogai/controller/QISPOSParser.kt

@ -32,7 +32,7 @@ import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import org.mosad.seil0.projectlaogai.R
import org.mosad.seil0.projectlaogai.controller.preferences.EncryptedPreferences
import org.mosad.seil0.projectlaogai.util.gradeSubject
import org.mosad.seil0.projectlaogai.util.GradeSubject
import java.security.KeyStore
import java.security.cert.CertificateFactory
import java.security.cert.X509Certificate
@ -84,8 +84,8 @@ class QISPOSParser(val context: Context) {
* parse the html from readGrades()
* @return a SortedMap, each entry is a semester, each semester has a ArrayList with subjects
*/
fun parseGrades(): SortedMap<String, ArrayList<gradeSubject>> {
val gradesMap = HashMap<String, ArrayList<gradeSubject>>()
fun parseGrades(): SortedMap<String, ArrayList<GradeSubject>> {
val gradesMap = HashMap<String, ArrayList<GradeSubject>>()
val gradesListHtml = readGrades()
gradesListHtml?.select("table > tbody > tr")?.forEach {
@ -93,7 +93,7 @@ class QISPOSParser(val context: Context) {
// only real subjects will be selected
if(row.size >= 6 && row[0].text().length >=7) {
val subject = gradeSubject(
val subject = GradeSubject(
id = row[0].text(),
name = row[1].text(),
semester = row[2].text(),

2
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt

@ -23,7 +23,6 @@
package org.mosad.seil0.projectlaogai.fragments
import android.os.Bundle
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -33,7 +32,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.mosad.seil0.projectlaogai.MainActivity
import org.mosad.seil0.projectlaogai.R
import org.mosad.seil0.projectlaogai.controller.cache.CacheController
import org.mosad.seil0.projectlaogai.controller.cache.CacheController.Companion.mensaMenu

4
app/src/main/java/org/mosad/seil0/projectlaogai/util/DataTypes.kt

@ -104,12 +104,12 @@ data class Lesson(
val lessonRemark: String
)
data class TimetableDay(val timeslots: Array<ArrayList<Lesson>> = Array(6) { ArrayList<Lesson>() })
data class TimetableDay(val timeslots: Array<ArrayList<Lesson>> = Array(6) { ArrayList() })
data class TimetableWeek(val weekIndex: Int = 0, val weekNumberYear: Int = 0, val days: Array<TimetableDay> = Array(6) { TimetableDay() })
// data classes for the qispos part
data class gradeSubject(val id: String = "", val name: String = "", val semester: String = "", val grade: String = "", val credits: String = "")
data class GradeSubject(val id: String = "", val name: String = "", val semester: String = "", val grade: String = "", val credits: String = "")
// TCoR
data class TimetableWeekTCoR(val days: Array<TimetableDay> = Array(6) { TimetableDay() })

20
app/src/main/res/layouts/activities/layout/activity_onboarding.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_height="match_parent">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
@ -12,13 +12,13 @@
</androidx.viewpager.widget.ViewPager>
<LinearLayout
android:id="@+id/linLayout_Dots"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal"></LinearLayout>
android:id="@+id/linLayout_Dots"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal" />
<View
android:id="@+id/view"

9
app/src/main/res/layouts/fragments/layout/fragment_mensa.xml

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.MensaFragment"
android:background="?themePrimary">
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.MensaFragment"
android:background="?themePrimary">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/refreshLayout_Mensa"

8
app/src/main/res/layouts/fragments/layout/fragment_on_course.xml

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

8
app/src/main/res/layouts/fragments/layout/fragment_on_welcome.xml

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close