Skip to content

Commit ddaafb6

Browse files
committed
Adress new requested changes
1 parent a744775 commit ddaafb6

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

app/src/main/java/org/schabi/newpipe/util/NewPipeTextViewHelper.java

+4-24
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,10 @@ private NewPipeTextViewHelper() {
3131
* {@link TextView standard TextViews} are supported).
3232
*/
3333
public static void shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
34-
if (!(textView instanceof NewPipeEditText)) {
35-
final CharSequence textViewText;
36-
if (textView instanceof NewPipeTextView) {
37-
final NewPipeTextView newPipeTextView = (NewPipeTextView) textView;
38-
textViewText = newPipeTextView.getText();
39-
} else {
40-
textViewText = textView.getText();
41-
}
42-
43-
final CharSequence selectedText = getSelectedText(textView, textViewText);
44-
shareSelectedTextIfNotNullAndNotEmpty(textView, selectedText);
45-
46-
final Spannable spannable = (textViewText instanceof Spannable)
47-
? (Spannable) textViewText : null;
48-
if (spannable != null) {
49-
Selection.setSelection(spannable, textView.getSelectionEnd());
50-
}
51-
} else {
52-
final NewPipeEditText editText = (NewPipeEditText) textView;
53-
final Spannable text = editText.getText();
54-
55-
final CharSequence selectedText = getSelectedText(textView, text);
56-
shareSelectedTextIfNotNullAndNotEmpty(textView, selectedText);
57-
Selection.setSelection(text, editText.getSelectionEnd());
34+
final CharSequence textViewText = textView.getText();
35+
shareSelectedTextIfNotNullAndNotEmpty(textView, getSelectedText(textView, textViewText));
36+
if (textViewText instanceof Spannable) {
37+
Selection.setSelection((Spannable) textViewText, textView.getSelectionEnd());
5838
}
5939
}
6040

0 commit comments

Comments
 (0)