Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #557 from TCA-Team/pfent/fixBugs
Browse files Browse the repository at this point in the history
Fix a couple of bugs, that happened with the kotlin conversion
  • Loading branch information
kordianbruck authored Nov 8, 2017
2 parents 583481e + 0c3235f commit 235c360
Show file tree
Hide file tree
Showing 36 changed files with 170 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_item_detail, container, false);

RecyclerView recyclerView;
LinearLayoutManager layoutManager;
try (Cursor studyRoomCursor = new StudyRoomGroupManager(getActivity()).getStudyRoomsFromDb(mStudyRoomGroupId)) {
recyclerView = rootView.findViewById(R.id.fragment_item_detail_recyclerview);
recyclerView.setAdapter(new StudyRoomAdapter(studyRoomCursor));
}
layoutManager = new LinearLayoutManager(getContext());
Cursor studyRoomCursor = new StudyRoomGroupManager(getActivity()).getStudyRoomsFromDb(mStudyRoomGroupId);
RecyclerView recyclerView = rootView.findViewById(R.id.fragment_item_detail_recyclerview);
recyclerView.setAdapter(new StudyRoomAdapter(studyRoomCursor));

LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ package de.tum.`in`.tumcampusapp.models.cafeteria
* @param latitude Coordinates of the cafeteria
* @param longitude Coordinates of the cafeteria
*/
data class Cafeteria(val id: Int, val name: String, val address: String, val latitude: Double, val longitude: Double) : Comparable<Cafeteria> {
data class Cafeteria(var id: Int = -1,
var name: String = "",
var address: String = "",
var latitude: Double = -1.0,
var longitude: Double = -1.0) : Comparable<Cafeteria> {

// Used for ordering cafeterias
var distance: Float = 0.toFloat()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ import java.util.*
* @param typeNr Type ID
* @param name Menu name
*/
data class CafeteriaMenu(val id: Int, val cafeteriaId: Int, val date: Date?, val typeShort: String?, val typeLong: String?, val typeNr: Int, val name: String?)
data class CafeteriaMenu(var id: Int = -1,
var cafeteriaId: Int = -1,
var date: Date? = null,
var typeShort: String = "",
var typeLong: String = "",
var typeNr: Int = -1,
var name: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ package de.tum.`in`.tumcampusapp.models.cafeteria
* @param remark Additional information, e.g. Tel: 089-11111
* @param url Location URL, e.g. http://stud.ub.uni-muenchen.de/
*/
data class Location(val id: Int, val category: String, val name: String, val address: String, val room: String, val transport: String, val hours: String, val remark: String, val url: String)
data class Location(var id: Int = -1,
var category: String = "",
var name: String = "",
var address: String = "",
var room: String = "",
var transport: String = "",
var hours: String = "",
var remark: String = "",
var url: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package de.tum.`in`.tumcampusapp.models.efa

import java.util.concurrent.TimeUnit

data class Departure(val servingLine: String, val direction: String, val symbol: String, val countDown: Int, val departureTime: Long) {
data class Departure(var servingLine: String = "",
var direction: String = "",
var symbol: String = "",
var countDown: Int = -1,
var departureTime: Long = -1) {

/**
* Calculates the countDown with the real departure time and the current time
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package de.tum.`in`.tumcampusapp.models.efa

data class StationResult(var station: String = "", var id: String = "", var quality: Int = 0) {
data class StationResult(var station: String = "",
var id: String = "",
var quality: Int = 0) {

override fun toString(): String = station
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import java.util.*
* @param useLocation Whether this widgets station is determined by the current location
* @param autoReload If widget should update automatically, otherwise a button-press is required
*/
class WidgetDepartures(station: String = "", stationId: String = "", var useLocation: Boolean = false, var autoReload: Boolean = false, var departures: MutableList<Departure> = ArrayList()) {
class WidgetDepartures(station: String = "",
stationId: String = "",
var useLocation: Boolean = false,
var autoReload: Boolean = false,
var departures: MutableList<Departure> = ArrayList()) {

private var lastLoad: Long = 0
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.io.Serializable
/**
* Used for parsing the GCM json payload for the 'alert' type
*/
data class GCMAlert(var silent: Boolean) : Serializable {
data class GCMAlert(var silent: Boolean = true) : Serializable {
companion object {
private const val serialVersionUID = 3906290674499996501L
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import java.io.Serializable
/**
* Used for parsing the GCM json payload for the 'chat' type
*/
data class GCMChat(var room: Int = 0, var member: Int = 0, var message: Int = 0) : Serializable {
data class GCMChat(var room: Int = 0,
var member: Int = 0,
var message: Int = 0) : Serializable {
companion object {
private const val serialVersionUID = -3920974316634829667L
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ package de.tum.`in`.tumcampusapp.models.gcm

import java.io.Serializable

data class GCMNotification(var notification: Int = 0, var type: Int = 0, var location: GCMNotificationLocation = GCMNotificationLocation(), var title: String = "",
var description: String = "", var signature: String = "", var created: String = "") : Serializable {
data class GCMNotification(var notification: Int = 0,
var type: Int = 0,
var location: GCMNotificationLocation = GCMNotificationLocation(),
var title: String = "",
var description: String = "",
var signature: String = "",
var created: String = "") : Serializable {
companion object {
private const val serialVersionUID = 8643117662605459731L
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package de.tum.`in`.tumcampusapp.models.gcm

import java.io.Serializable

data class GCMNotificationLocation(var location: Int = 0, var name: String = "", var lon: Double = .0, var lat: Double = .0, var radius: Int = 0) :
data class GCMNotificationLocation(var location: Int = 0,
var name: String = "",
var lon: Double = .0,
var lat: Double = .0,
var radius: Int = 0) :
Serializable {
fun getRadius(): Double = radius.toDouble()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import java.io.Serializable
/**
* Used for parsing the GCM json payload for the 'update' type
*/
data class GCMUpdate(var packageVersion: Int = 0, var sdkVersion: Int = 0, var releaseDate: String = "", var lowestVersion: Int = 0) : Serializable {
data class GCMUpdate(var packageVersion: Int = 0,
var sdkVersion: Int = 0,
var releaseDate: String = "",
var lowestVersion: Int = 0) : Serializable {
companion object {
private const val serialVersionUID = -4597228673980239217L
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import de.tum.`in`.tumcampusapp.adapters.SimpleStickyListHeadersAdapter
/**
* The model used to display contact infromation in barrier free page
*/
data class BarrierfreeContact(val name: String?, val telephone: String, val email: String, val faculty: String, val tumID: String) :
data class BarrierfreeContact(var name: String = "",
var telephone: String = "",
var email: String = "",
var faculty: String = "",
var tumID: String = "") :
SimpleStickyListHeadersAdapter.SimpleStickyListItem {

val isValid: Boolean
get() = name != null && name != "null"
get() = name != ""

val isHavingTumID: Boolean
get() = !(tumID == "null" || tumID == "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import de.tum.`in`.tumcampusapp.adapters.SimpleStickyListHeadersAdapter
/**
* The model used to display more infromation in barrier free page
*/
data class BarrierfreeMoreInfo(val title: String, val category: String, val url: String) : SimpleStickyListHeadersAdapter.SimpleStickyListItem {
data class BarrierfreeMoreInfo(var title: String = "",
var category: String = "",
var url: String = "") : SimpleStickyListHeadersAdapter.SimpleStickyListItem {

override fun getHeadName() = category

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ import de.tum.`in`.tumcampusapp.auxiliary.NetUtils
import de.tum.`in`.tumcampusapp.trace.G
import de.tum.`in`.tumcampusapp.trace.Util

data class BugReport(val packageName: String, val packageVersion: String, val packageVersionCode: String, val phoneModel: String,
val androidVersion: String, val networkWifi: String, val networkMobile: String, val gps: String, val screenWidth: String,
val screenHeight: String, val screenOrientation: String, val screenDpi: String, val log: String, val stacktrace: String) {
data class BugReport(var packageName: String = "",
var packageVersion: String = "",
var packageVersionCode: String = "",
var phoneModel: String = "",
var androidVersion: String = "",
var networkWifi: String = "",
var networkMobile: String = "",
var gps: String = "",
var screenWidth: String = "",
var screenHeight: String = "",
var screenOrientation: String = "",
var screenDpi: String = "",
var log: String = "",
var stacktrace: String = "") {

companion object {
fun getBugReport(c: Context, stacktrace: String, log: String): BugReport {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package de.tum.`in`.tumcampusapp.models.tumcabe

data class BuildingsToGps(val id: String, val latitude: String, val longitude: String)
data class BuildingsToGps(var id: String = "",
var latitude: String = "",
var longitude: String = "")
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package de.tum.`in`.tumcampusapp.models.tumcabe

data class ChatPublicKey(var key: String?)
data class ChatPublicKey(var key: String = "")
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.`in`.tumcampusapp.models.tumcabe

data class ChatRoom(var name: String?) {
data class ChatRoom(var name: String = "") {
var id: Int = 0

var members = -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import java.math.BigInteger
import java.security.SecureRandom
import java.util.*

data class ChatVerification(var signature: String = "", var date: String = "", var rand: String = "", var member: Int = 0, var data: Any? = null) {
data class ChatVerification(var signature: String = "",
var date: String = "",
var rand: String = "",
var member: Int = 0,
var data: Any? = null) {
companion object {
@Throws(NoPrivateKey::class)
fun getChatVerification(c: Context, member: ChatMember): ChatVerification {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ import de.tum.`in`.tumcampusapp.adapters.SimpleStickyListHeadersAdapter
/**
* Presents the faculty model that is used in fetching the facultyData from server
*/
data class Curriculum(var curriculum: String?, var category: String?, var name: String?, var url: String?) :
data class Curriculum(var curriculum: String = "",
var category: String = "",
var name: String = "",
var url: String = "") :
Comparable<Curriculum>, SimpleStickyListHeadersAdapter.SimpleStickyListItem {

override fun getHeadName(): String = category!![0].toUpperCase() + category!!.substring(1, category!!.length)
override fun getHeadName(): String = category[0].toUpperCase() + category.substring(1, category.length)

override fun getHeaderId() = category

override fun compareTo(other: Curriculum): Int =
if (category == other.category) {
name!!.compareTo(other.name!!)
name.compareTo(other.name)
} else {
category!!.compareTo(other.category!!)
category.compareTo(other.category)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import java.math.BigInteger
import java.security.SecureRandom
import java.util.*

data class DeviceRegister(val signature: String, val date: String, val rand: String, val device: String, val publicKey: String, val member: ChatMember?) {
data class DeviceRegister(var signature: String = "",
var date: String = "",
var rand: String = "",
var device: String = "",
var publicKey: String = "",
var member: ChatMember? = null) {
companion object {
@Throws(NoPrivateKey::class)
fun getDeviceRegister(c: Context, publickey: String, member: ChatMember?): DeviceRegister {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import android.content.Context
import de.tum.`in`.tumcampusapp.auxiliary.AuthenticationManager
import de.tum.`in`.tumcampusapp.exceptions.NoPrivateKey

data class DeviceUploadGcmToken(val verification: DeviceVerification, val token: String, val signature: String) {
data class DeviceUploadGcmToken(var verification: DeviceVerification? = null,
var token: String = "",
var signature: String = "") {
companion object {
@Throws(NoPrivateKey::class)
fun getDeviceUploadGcmToken(c: Context, token: String): DeviceUploadGcmToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import java.math.BigInteger
import java.security.SecureRandom
import java.util.*

data class DeviceVerification(val signature: String, val date: String, val rand: String, val device: String) {
data class DeviceVerification(var signature: String = "",
var date: String = "",
var rand: String = "",
var device: String = "") {
companion object {
@Throws(NoPrivateKey::class)
fun getDeviceVerification(c: Context): DeviceVerification {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ package de.tum.`in`.tumcampusapp.models.tumcabe
* Presents the faculty model that is used in fetching the facultyData from server
* @param faculty the id of the faculty
*/
data class Faculty(var faculty: String, var name: String)
data class Faculty(var faculty: String = "",
var name: String = "")
16 changes: 14 additions & 2 deletions app/src/main/java/de/tum/in/tumcampusapp/models/tumcabe/Kino.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ import java.util.*
* @param created Created
* @param link Link
*/
data class Kino(val id: String, val title: String, val year: String, val runtime: String, val genre: String, val director: String, val actors: String,
val rating: String, val description: String, val cover: String, val trailer: String, val date: Date, val created: Date, val link: String)
data class Kino(var id: String = "",
var title: String = "",
var year: String = "",
var runtime: String = "",
var genre: String = "",
var director: String = "",
var actors: String = "",
var rating: String = "",
var description: String = "",
var cover: String = "",
var trailer: String = "",
var date: Date = Date(),
var created: Date = Date(),
var link: String = "")

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ import java.util.*
* @param date Date
* @param created Creation date
*/
data class News(val id: String, val title: String, val link: String, val src: String, val image: String, val date: Date, val created: Date)
data class News(var id: String = "",
var title: String = "",
var link: String = "",
var src: String = "",
var image: String = "",
var date: Date = Date(),
var created: Date = Date())
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package de.tum.`in`.tumcampusapp.models.tumcabe

data class RoomFinderCoordinate(var utm_zone: String, var utm_easting: String, var utm_northing: String)
data class RoomFinderCoordinate(var utm_zone: String = "",
var utm_easting: String = "",
var utm_northing: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ package de.tum.`in`.tumcampusapp.models.tumcabe
/**
* This class is used as a model for maps in Roomfinder retrofit request.
*/
data class RoomFinderMap(var map_id: String = "", var description: String = "")
data class RoomFinderMap(var map_id: String = "",
var description: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import java.io.Serializable
* This class is used as a model for rooms in Roomfinder retrofit request.
* @param name This is the campus name
*/
data class RoomFinderRoom(val campus: String, val address: String, val info: String, val arch_id: String, val room_id: String,
private val name: String?) : SimpleStickyListItem, Serializable {
data class RoomFinderRoom(var campus: String = "",
var address: String = "",
var info: String = "",
var arch_id: String = "",
var room_id: String = "",
private val name: String = "") : SimpleStickyListItem, Serializable {

fun getName(): String =
if (name == null || name == "null")
if (name == "null")
""
else
name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package de.tum.`in`.tumcampusapp.models.tumcabe

data class RoomFinderSchedule(val start: String, val end: String, val event_id: Long, val title: String)
data class RoomFinderSchedule(var start: String = "",
var end: String = "",
var event_id: Long = -1,
var title: String = "")
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package de.tum.`in`.tumcampusapp.models.tumcabe

data class Statistics(val data: String)
data class Statistics(var data: String = "")
Loading

0 comments on commit 235c360

Please sign in to comment.