2014-07-03 07:48:39 +02:00
|
|
|
package org.mariotaku.twidere.view;
|
|
|
|
|
|
|
|
import android.content.Context;
|
2015-04-22 16:19:26 +02:00
|
|
|
import android.support.v7.widget.AppCompatTextView;
|
2015-04-19 16:47:24 +02:00
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.Spannable;
|
2014-07-03 07:48:39 +02:00
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
2015-05-02 14:55:16 +02:00
|
|
|
import org.mariotaku.twidere.text.SafeSpannableString;
|
|
|
|
import org.mariotaku.twidere.text.SafeSpannableStringBuilder;
|
|
|
|
|
2015-05-15 20:01:26 +02:00
|
|
|
public class StatusTextView extends HandleSpanClickTextView {
|
2015-01-18 17:15:38 +01:00
|
|
|
|
|
|
|
public StatusTextView(final Context context) {
|
2015-04-19 16:47:24 +02:00
|
|
|
this(context, null);
|
2015-01-18 17:15:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public StatusTextView(final Context context, final AttributeSet attrs) {
|
2015-04-19 16:47:24 +02:00
|
|
|
this(context, attrs, 0);
|
2015-01-18 17:15:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public StatusTextView(final Context context, final AttributeSet attrs, final int defStyle) {
|
|
|
|
super(context, attrs, defStyle);
|
2015-04-19 16:47:24 +02:00
|
|
|
setEditableFactory(new SafeEditableFactory());
|
|
|
|
setSpannableFactory(new SafeSpannableFactory());
|
2015-01-18 17:15:38 +01:00
|
|
|
}
|
|
|
|
|
2015-04-19 16:47:24 +02:00
|
|
|
private class SafeEditableFactory extends Editable.Factory {
|
|
|
|
@Override
|
|
|
|
public Editable newEditable(CharSequence source) {
|
|
|
|
return new SafeSpannableStringBuilder(source);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private class SafeSpannableFactory extends Spannable.Factory {
|
|
|
|
@Override
|
|
|
|
public Spannable newSpannable(CharSequence source) {
|
|
|
|
return new SafeSpannableString(source);
|
|
|
|
}
|
|
|
|
}
|
2014-07-03 07:48:39 +02:00
|
|
|
}
|