mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2025-04-04 06:13:34 +03:00
Update Proxy.kt
This commit is contained in:
parent
e15477cc04
commit
a134afbbd4
1 changed files with 15 additions and 15 deletions
|
@ -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
|
||||
|
@ -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),
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue