Skip to content

Commit

Permalink
Update Proxy.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Malus-risus authored Dec 22, 2024
1 parent e15477c commit a134afb
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions core/src/main/java/com/github/kr328/clash/core/model/Proxy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.github.kr328.clash.core.model

import android.os.Parcel
import android.os.Parcelable
import com.github.kr328.clash.core.util.Parcelizer
import kotlinx.serialization.Serializable

@Serializable
Expand All @@ -11,16 +10,14 @@ data class Proxy(
val title: String,
val subtitle: String,
val type: Type,
val delay: Int,
val delay: Int = 0 // Default value if applicable
) : Parcelable {
@Suppress("unused")
enum class Type(val group: Boolean) {
Direct(false),
Reject(false),
RejectDrop(false),
Compatible(false),
Pass(false),

Shadowsocks(false),
ShadowsocksR(false),
Snell(false),
Expand All @@ -36,32 +33,35 @@ data class Proxy(
Dns(false),
Ssh(false),
Mieru(false),


Relay(true),
Selector(true),
Fallback(true),
URLTest(true),
LoadBalance(true),

Unknown(false);
}

override fun writeToParcel(parcel: Parcel, flags: Int) {
Parcelizer.encodeToParcel(serializer(), parcel, this)
parcel.writeString(name)
parcel.writeString(title)
parcel.writeString(subtitle)
parcel.writeString(type.name)
parcel.writeInt(delay)
}

override fun describeContents(): Int {
return 0
}
override fun describeContents(): Int = 0

companion object CREATOR : Parcelable.Creator<Proxy> {
override fun createFromParcel(parcel: Parcel): Proxy {
return Parcelizer.decodeFromParcel(serializer(), parcel)
return Proxy(
name = parcel.readString()!!,
title = parcel.readString()!!,
subtitle = parcel.readString()!!,
type = Type.valueOf(parcel.readString()!!),
delay = parcel.readInt()
)
}

override fun newArray(size: Int): Array<Proxy?> {
return arrayOfNulls(size)
}
override fun newArray(size: Int): Array<Proxy?> = arrayOfNulls(size)
}
}

0 comments on commit a134afb

Please sign in to comment.