fixed status TextView URL line break

This commit is contained in:
Mariotaku Lee 2017-05-17 14:57:52 +08:00
parent e8518de639
commit f431d67a10
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 7 additions and 35 deletions

View File

@ -26,7 +26,7 @@ import android.support.v13.view.inputmethod.InputContentInfoCompat
import android.support.v4.os.BuildCompat import android.support.v4.os.BuildCompat
import android.text.InputType import android.text.InputType
import android.text.Selection import android.text.Selection
import android.text.method.ArrowKeyMovementMethod import android.text.method.BaseMovementMethod
import android.text.method.MovementMethod import android.text.method.MovementMethod
import android.util.AttributeSet import android.util.AttributeSet
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -65,7 +65,7 @@ class ComposeEditText(
} }
override fun getDefaultMovementMethod(): MovementMethod { override fun getDefaultMovementMethod(): MovementMethod {
return ArrowKeyMovementMethod.getInstance() return BaseMovementMethod()
} }
override fun onAttachedToWindow() { override fun onAttachedToWindow() {

View File

@ -21,10 +21,10 @@ package org.mariotaku.twidere.view
import android.content.Context import android.content.Context
import android.text.Spannable import android.text.Spannable
import android.text.method.BaseMovementMethod
import android.text.method.MovementMethod import android.text.method.MovementMethod
import android.text.style.ClickableSpan import android.text.style.ClickableSpan
import android.util.AttributeSet import android.util.AttributeSet
import android.view.KeyEvent
import android.view.MotionEvent import android.view.MotionEvent
import android.widget.TextView import android.widget.TextView
import org.mariotaku.chameleon.view.ChameleonTextView import org.mariotaku.chameleon.view.ChameleonTextView
@ -34,11 +34,10 @@ import org.mariotaku.twidere.extension.setupEmojiFactory
* Returns true when not clicking links * Returns true when not clicking links
* Created by mariotaku on 15/11/20. * Created by mariotaku on 15/11/20.
*/ */
class TimelineContentTextView @JvmOverloads constructor( class TimelineContentTextView(
context: Context, context: Context,
attrs: AttributeSet? = null, attrs: AttributeSet? = null
defStyle: Int = 0 ) : ChameleonTextView(context, attrs) {
) : ChameleonTextView(context, attrs, defStyle) {
init { init {
setupEmojiFactory() setupEmojiFactory()
@ -85,33 +84,13 @@ class TimelineContentTextView @JvmOverloads constructor(
} }
} }
internal class InternalMovementMethod : MovementMethod { internal class InternalMovementMethod : BaseMovementMethod() {
private var targetSpan: ClickableSpan? = null private var targetSpan: ClickableSpan? = null
override fun initialize(widget: TextView, text: Spannable) { override fun initialize(widget: TextView, text: Spannable) {
} }
override fun onKeyDown(widget: TextView, text: Spannable, keyCode: Int, keyEvent: KeyEvent): Boolean {
return false
}
override fun onKeyUp(widget: TextView, text: Spannable, keyCode: Int, keyEvent: KeyEvent): Boolean {
return false
}
override fun onKeyOther(widget: TextView, text: Spannable, keyEvent: KeyEvent): Boolean {
return false
}
override fun onTakeFocus(widget: TextView, text: Spannable, direction: Int) {
}
override fun onTrackballEvent(widget: TextView, text: Spannable, event: MotionEvent): Boolean {
return false
}
override fun onTouchEvent(widget: TextView, text: Spannable, event: MotionEvent): Boolean { override fun onTouchEvent(widget: TextView, text: Spannable, event: MotionEvent): Boolean {
when (event.actionMasked) { when (event.actionMasked) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
@ -139,12 +118,5 @@ class TimelineContentTextView @JvmOverloads constructor(
return targetSpan != null return targetSpan != null
} }
override fun onGenericMotionEvent(widget: TextView, text: Spannable, event: MotionEvent): Boolean {
return false
}
override fun canSelectArbitrarily(): Boolean {
return false
}
} }
} }