Skip to content

Commit

Permalink
Refactor to make types parcelable
Browse files Browse the repository at this point in the history
  • Loading branch information
ComradeVanti committed Jun 25, 2021
1 parent 42f6bd4 commit 5eb47fa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
buildscript {
ext.kotlin_version = '1.5.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
}
}

Expand Down
3 changes: 2 additions & 1 deletion oscexchange/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-parcelize'
}
apply plugin: 'kotlin-android'

android {
compileSdkVersion 30
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ac.at.fhstp.digitech.oscexchange

import android.os.Parcelable
import kotlinx.parcelize.Parcelize
import java.util.*
import java.util.regex.Pattern

Expand All @@ -8,7 +10,9 @@ import java.util.regex.Pattern
*
* @see OSCAddress.tryCreate
*/
class OSCAddress private constructor(@PublicApi val value: String?) {
@Parcelize
class OSCAddress private constructor(@PublicApi val value: String?) :
Parcelable {
companion object {
/**
* The pattern used to validate OSCAddresses
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package ac.at.fhstp.digitech.oscexchange

import ac.at.fhstp.digitech.oscexchange.errors.OSCPortOpeningException
import android.os.Parcelable
import com.illposed.osc.transport.udp.OSCPortIn
import com.illposed.osc.transport.udp.OSCPortOut
import kotlinx.parcelize.Parcelize
import java.net.InetSocketAddress

/**
* Contains information about a pair of devices that communicate over OSC
*/
@Parcelize
class OSCDevicePair @PublicApi constructor(
/**
* The address of this device
Expand All @@ -17,7 +20,7 @@ class OSCDevicePair @PublicApi constructor(
* The address of the other device
*/
@PublicApi val remote: InetSocketAddress
) {
) : Parcelable {

fun tryOpenInPort() =
try {
Expand Down

0 comments on commit 5eb47fa

Please sign in to comment.