Skip to content

Commit a744775

Browse files
committed
Adress requested changes and remove an unused return value in NewPipeTextViewHelper
1 parent 50b85a7 commit a744775

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ private NewPipeTextViewHelper() {
2929
* @param textView the {@link TextView} on which sharing the selected text. It should be a
3030
* {@link NewPipeTextView} or a {@link NewPipeEditText} (even if
3131
* {@link TextView standard TextViews} are supported).
32-
*
33-
* @return true if no exceptions occurred when getting the selected text, sharing it and
34-
* deselecting it, otherwise an exception
3532
*/
36-
public static boolean shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
33+
public static void shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
3734
if (!(textView instanceof NewPipeEditText)) {
3835
final CharSequence textViewText;
3936
if (textView instanceof NewPipeTextView) {
@@ -59,8 +56,6 @@ public static boolean shareSelectedTextWithShareUtils(@NonNull final TextView te
5956
shareSelectedTextIfNotNullAndNotEmpty(textView, selectedText);
6057
Selection.setSelection(text, editText.getSelectionEnd());
6158
}
62-
63-
return true;
6459
}
6560

6661
@Nullable

app/src/main/java/org/schabi/newpipe/views/NewPipeEditText.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
import androidx.annotation.Nullable;
88
import androidx.appcompat.widget.AppCompatEditText;
99

10+
import org.schabi.newpipe.util.NewPipeTextViewHelper;
1011
import org.schabi.newpipe.util.external_communication.ShareUtils;
1112

12-
import static org.schabi.newpipe.util.NewPipeTextViewHelper.shareSelectedTextWithShareUtils;
13-
1413
/**
1514
* An {@link AppCompatEditText} which uses {@link ShareUtils#shareText(Context, String, String)}
1615
* when sharing selected text by using the {@code Share} command of the floating actions.
@@ -38,7 +37,8 @@ public NewPipeEditText(@NonNull final Context context,
3837
@Override
3938
public boolean onTextContextMenuItem(final int id) {
4039
if (id == android.R.id.shareText) {
41-
return shareSelectedTextWithShareUtils(this);
40+
NewPipeTextViewHelper.shareSelectedTextWithShareUtils(this);
41+
return true;
4242
}
4343
return super.onTextContextMenuItem(id);
4444
}

app/src/main/java/org/schabi/newpipe/views/NewPipeTextView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
import androidx.annotation.Nullable;
88
import androidx.appcompat.widget.AppCompatTextView;
99

10+
import org.schabi.newpipe.util.NewPipeTextViewHelper;
1011
import org.schabi.newpipe.util.external_communication.ShareUtils;
1112

12-
import static org.schabi.newpipe.util.NewPipeTextViewHelper.shareSelectedTextWithShareUtils;
13-
1413
/**
1514
* An {@link AppCompatTextView} which uses {@link ShareUtils#shareText(Context, String, String)}
1615
* when sharing selected text by using the {@code Share} command of the floating actions.
@@ -38,7 +37,8 @@ public NewPipeTextView(@NonNull final Context context,
3837
@Override
3938
public boolean onTextContextMenuItem(final int id) {
4039
if (id == android.R.id.shareText) {
41-
return shareSelectedTextWithShareUtils(this);
40+
NewPipeTextViewHelper.shareSelectedTextWithShareUtils(this);
41+
return true;
4242
}
4343
return super.onTextContextMenuItem(id);
4444
}

0 commit comments

Comments
 (0)