Adress new requested changes
This commit is contained in:
parent
a744775fe7
commit
ddaafb68c8
|
@ -31,30 +31,10 @@ public final class NewPipeTextViewHelper {
|
||||||
* {@link TextView standard TextViews} are supported).
|
* {@link TextView standard TextViews} are supported).
|
||||||
*/
|
*/
|
||||||
public static void shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
|
public static void shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
|
||||||
if (!(textView instanceof NewPipeEditText)) {
|
final CharSequence textViewText = textView.getText();
|
||||||
final CharSequence textViewText;
|
shareSelectedTextIfNotNullAndNotEmpty(textView, getSelectedText(textView, textViewText));
|
||||||
if (textView instanceof NewPipeTextView) {
|
if (textViewText instanceof Spannable) {
|
||||||
final NewPipeTextView newPipeTextView = (NewPipeTextView) textView;
|
Selection.setSelection((Spannable) textViewText, textView.getSelectionEnd());
|
||||||
textViewText = newPipeTextView.getText();
|
|
||||||
} else {
|
|
||||||
textViewText = textView.getText();
|
|
||||||
}
|
|
||||||
|
|
||||||
final CharSequence selectedText = getSelectedText(textView, textViewText);
|
|
||||||
shareSelectedTextIfNotNullAndNotEmpty(textView, selectedText);
|
|
||||||
|
|
||||||
final Spannable spannable = (textViewText instanceof Spannable)
|
|
||||||
? (Spannable) textViewText : null;
|
|
||||||
if (spannable != null) {
|
|
||||||
Selection.setSelection(spannable, textView.getSelectionEnd());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final NewPipeEditText editText = (NewPipeEditText) textView;
|
|
||||||
final Spannable text = editText.getText();
|
|
||||||
|
|
||||||
final CharSequence selectedText = getSelectedText(textView, text);
|
|
||||||
shareSelectedTextIfNotNullAndNotEmpty(textView, selectedText);
|
|
||||||
Selection.setSelection(text, editText.getSelectionEnd());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue