@@ -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