Fixed crash in TextView drag drop.

This commit is contained in:
Koen J
2025-10-06 12:58:02 +02:00
parent d659ecc518
commit 7cad4fbe07
2 changed files with 26 additions and 1 deletions
@@ -0,0 +1,25 @@
package com.futo.platformplayer.views.behavior
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import com.futo.platformplayer.logging.Logger
class SafeTextView : AppCompatTextView {
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}
override fun performLongClick(): Boolean {
try {
return super.performLongClick()
} catch (e: IllegalStateException) {
Logger.w(TAG, "Swallowed exception", e)
return false
}
}
companion object {
private const val TAG = "SafeTextView"
}
}
@@ -26,7 +26,7 @@
app:layout_constraintTop_toBottomOf="@id/topbar"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
<com.futo.platformplayer.views.behavior.SafeTextView
android:id="@+id/text_description"
android:layout_width="match_parent"
android:layout_height="match_parent"