Enable log copy on long press

This commit is contained in:
2dust
2026-01-11 11:24:02 +08:00
parent 3ad6464595
commit 183391b6e3
2 changed files with 7 additions and 2 deletions
@@ -6,6 +6,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.v2ray.ang.AppConfig
import com.v2ray.ang.databinding.ItemRecyclerLogcatBinding
import com.v2ray.ang.util.Utils
class LogcatRecyclerAdapter(val activity: LogcatActivity) : RecyclerView.Adapter<LogcatRecyclerAdapter.MainViewHolder>() {
private var mActivity: LogcatActivity = activity
@@ -24,6 +25,11 @@ class LogcatRecyclerAdapter(val activity: LogcatActivity) : RecyclerView.Adapter
holder.itemSubSettingBinding.logTag.text = content.first().split("(", limit = 2).first().trim()
holder.itemSubSettingBinding.logContent.text = if (content.count() > 1) content.last().trim() else ""
}
holder.itemView.setOnLongClickListener {
Utils.setClipboard(mActivity, log)
true
}
} catch (e: Exception) {
Log.e(AppConfig.TAG, "Error binding log view data", e)
}
@@ -229,8 +229,7 @@ class SettingsActivity : BaseActivity() {
fun traverse(group: androidx.preference.PreferenceGroup) {
for (i in 0 until group.preferenceCount) {
val p = group.getPreference(i)
when (p) {
when (val p = group.getPreference(i)) {
is androidx.preference.PreferenceGroup -> traverse(p)
else -> updateSummary(p)
}