Archived
TODO implement custom Chrome tabs
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.denizk0461.studip.data
|
||||
|
||||
import com.denizk0461.studip.model.StudIPEvent
|
||||
|
||||
object DummyData {
|
||||
|
||||
val events: Array<StudIPEvent> = arrayOf(
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.denizk0461.studip.data
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "events")
|
||||
data class StudIPEvent(
|
||||
@PrimaryKey val id: Int,
|
||||
val title: String, // the name of the event
|
||||
val lecturer: String, // the lecturer(s)
|
||||
val room: String, // the room the event takes place in
|
||||
val day: Int, // 0 = Monday, 1 = Tuesday, 2 = Wednesday, 3 = Thursday, 4 = Friday
|
||||
val timeslotStart: Int, // 0 = 08:15, 1 = 10:15, 2 = 12:15, 3 = 14:15, 4 = 16:15, 5 = 18:15
|
||||
val timeslots: Int, // the amount of timeslots the course takes place over (1 timeslot = 90min)
|
||||
) {
|
||||
|
||||
@Ignore private val timeSlotStartTimes: List<String> = listOf("08:15", "10:15", "12:15", "14:15", "16:15", "18:15")
|
||||
@Ignore private val timeSlotEndTimes: List<String> = listOf("09:45", "11:45", "13:45", "15:45", "17:45", "19:45")
|
||||
|
||||
@Ignore val timeslot: String =
|
||||
"${timeSlotStartTimes[timeslotStart]} – ${timeSlotEndTimes[timeslotStart + timeslots - 1]}"
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as StudIPEvent
|
||||
|
||||
if (title != other.title) return false
|
||||
if (!lecturer.contentEquals(other.lecturer)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id
|
||||
result = 31 * result + title.hashCode()
|
||||
result = 31 * result + lecturer.hashCode()
|
||||
result = 31 * result + room.hashCode()
|
||||
result = 31 * result + day
|
||||
result = 31 * result + timeslotStart
|
||||
result = 31 * result + timeslots
|
||||
result = 31 * result + timeSlotStartTimes.hashCode()
|
||||
result = 31 * result + timeSlotEndTimes.hashCode()
|
||||
result = 31 * result + timeslot.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.denizk0461.studip.data
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
|
||||
class StudIPScraper : WebViewClient() {
|
||||
|
||||
fun parse(context: Context) {
|
||||
|
||||
// val res = Jsoup.connect("https://elearning.uni-bremen.de/index.php?again=yes")
|
||||
// .data("loginname", "deniz7", "password", "xSh4d0wZ3r0_+nbrmn")
|
||||
// .method(Connection.Method.POST)
|
||||
// .execute()
|
||||
// val doc = Jsoup.connect("https://elearning.uni-bremen.de/dispatch.php/calendar/schedule").get()
|
||||
// Log.d("HELLO", doc.toString())
|
||||
}
|
||||
|
||||
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
||||
super.onPageStarted(view, url, favicon)
|
||||
|
||||
}
|
||||
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user