Enable log copy on long press
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user