Skip to content

Commit

Permalink
Adress requested changes and remove an unused return value in NewPipe…
Browse files Browse the repository at this point in the history
…TextViewHelper
  • Loading branch information
AudricV committed Oct 2, 2021
1 parent f38cf53 commit 5eee81d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ private NewPipeTextViewHelper() {
* @param textView the {@link TextView} on which sharing the selected text. It should be a
* {@link NewPipeTextView} or a {@link NewPipeEditText} (even if
* {@link TextView standard TextViews} are supported).
*
* @return true if no exceptions occurred when getting the selected text, sharing it and
* deselecting it, otherwise an exception
*/
public static boolean shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
public static void shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
if (!(textView instanceof NewPipeEditText)) {
final CharSequence textViewText;
if (textView instanceof NewPipeTextView) {
Expand All @@ -59,8 +56,6 @@ public static boolean shareSelectedTextWithShareUtils(@NonNull final TextView te
shareSelectedTextIfNotNullAndNotEmpty(textView, selectedText);
Selection.setSelection(text, editText.getSelectionEnd());
}

return true;
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatEditText;

import org.schabi.newpipe.util.NewPipeTextViewHelper;
import org.schabi.newpipe.util.external_communication.ShareUtils;

import static org.schabi.newpipe.util.NewPipeTextViewHelper.shareSelectedTextWithShareUtils;

/**
* An {@link AppCompatEditText} which uses {@link ShareUtils#shareText(Context, String, String)}
* when sharing selected text by using the {@code Share} command of the floating actions.
Expand Down Expand Up @@ -38,7 +37,8 @@ public NewPipeEditText(@NonNull final Context context,
@Override
public boolean onTextContextMenuItem(final int id) {
if (id == android.R.id.shareText) {
return shareSelectedTextWithShareUtils(this);
NewPipeTextViewHelper.shareSelectedTextWithShareUtils(this);
return true;
}
return super.onTextContextMenuItem(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

import org.schabi.newpipe.util.NewPipeTextViewHelper;
import org.schabi.newpipe.util.external_communication.ShareUtils;

import static org.schabi.newpipe.util.NewPipeTextViewHelper.shareSelectedTextWithShareUtils;

/**
* An {@link AppCompatTextView} which uses {@link ShareUtils#shareText(Context, String, String)}
* when sharing selected text by using the {@code Share} command of the floating actions.
Expand Down Expand Up @@ -38,7 +37,8 @@ public NewPipeTextView(@NonNull final Context context,
@Override
public boolean onTextContextMenuItem(final int id) {
if (id == android.R.id.shareText) {
return shareSelectedTextWithShareUtils(this);
NewPipeTextViewHelper.shareSelectedTextWithShareUtils(this);
return true;
}
return super.onTextContextMenuItem(id);
}
Expand Down

0 comments on commit 5eee81d

Please sign in to comment.