From 702cd7d0d254bd44234754e44b58456eb4abbd77 Mon Sep 17 00:00:00 2001 From: F0x1d Date: Thu, 12 Feb 2026 00:35:00 +0300 Subject: [PATCH] fix: crash details text selection crash --- .../logfox/core/ui/view/NoDragTextView.kt | 23 +++++++++++++++++++ .../res/layout/fragment_crash_details.xml | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 core/ui/view/src/main/kotlin/com/f0x1d/logfox/core/ui/view/NoDragTextView.kt diff --git a/core/ui/view/src/main/kotlin/com/f0x1d/logfox/core/ui/view/NoDragTextView.kt b/core/ui/view/src/main/kotlin/com/f0x1d/logfox/core/ui/view/NoDragTextView.kt new file mode 100644 index 00000000..76bcda14 --- /dev/null +++ b/core/ui/view/src/main/kotlin/com/f0x1d/logfox/core/ui/view/NoDragTextView.kt @@ -0,0 +1,23 @@ +package com.f0x1d.logfox.core.ui.view + +import android.content.Context +import android.util.AttributeSet +import android.view.DragEvent +import androidx.appcompat.widget.AppCompatTextView + +class NoDragTextView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = android.R.attr.textViewStyle, +) : AppCompatTextView(context, attrs, defStyleAttr) { + + // https://github.com/F0x1d/LogFox/issues/216 + override fun onDragEvent(event: DragEvent?): Boolean = false + + override fun performLongClick(): Boolean = try { + super.performLongClick() + } catch (_: IllegalStateException) { + // Drag shadow dimensions must be positive + true + } +} diff --git a/feature/crashes/presentation/src/main/res/layout/fragment_crash_details.xml b/feature/crashes/presentation/src/main/res/layout/fragment_crash_details.xml index ebd47938..bd22f887 100644 --- a/feature/crashes/presentation/src/main/res/layout/fragment_crash_details.xml +++ b/feature/crashes/presentation/src/main/res/layout/fragment_crash_details.xml @@ -152,7 +152,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/actions_card"> - -