更新主页服务器地址ipv6隐藏效果 (#3615)

* Update MainRecyclerAdapter.kt

* Update MainRecyclerAdapter.kt
This commit is contained in:
aaa8806
2024-09-28 14:52:03 +08:00
committed by GitHub
parent 2d0ab355d6
commit f5b74ecd78
@@ -84,10 +84,12 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
}
}
// 替换服务器地址的'.'之后的内容为'***',例如将'1.23.45.67'替换为'1.23.45.***'
val modifiedServer = profile.server?.split('.')?.dropLast(1)?.joinToString(".", postfix = ".***")
val strState = "$modifiedServer : ${profile.serverPort}"
// 隐藏主页服务器地址为xxx:xxx:***/xxx.xxx.xxx.***
val strState = "${profile.server?.let {
if (it.contains(":"))
it.split(":").take(2).joinToString(":") + ":***"
else
it.split('.').dropLast(1).joinToString(".", postfix = ".***") }} : ${profile.serverPort}"
holder.itemMainBinding.tvStatistics.text = strState