1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Create text subpackage in util

This commit is contained in:
Stypox 2023-01-15 11:51:07 +01:00
parent cdd5e89b86
commit 22c201be39
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
14 changed files with 23 additions and 25 deletions

View File

@ -29,7 +29,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.external_communication.ShareUtils; import org.schabi.newpipe.util.external_communication.ShareUtils;
import org.schabi.newpipe.util.external_communication.TextLinkifier; import org.schabi.newpipe.util.text.TextLinkifier;
import icepick.State; import icepick.State;
import io.reactivex.rxjava3.disposables.CompositeDisposable; import io.reactivex.rxjava3.disposables.CompositeDisposable;

View File

@ -20,13 +20,13 @@ import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.comments.CommentsInfoItem; import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
import org.schabi.newpipe.info_list.InfoItemBuilder; import org.schabi.newpipe.info_list.InfoItemBuilder;
import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.util.CommentTextOnTouchListener; import org.schabi.newpipe.util.text.CommentTextOnTouchListener;
import org.schabi.newpipe.util.DeviceUtils; import org.schabi.newpipe.util.DeviceUtils;
import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.PicassoHelper; import org.schabi.newpipe.util.PicassoHelper;
import org.schabi.newpipe.util.external_communication.ShareUtils; import org.schabi.newpipe.util.external_communication.ShareUtils;
import org.schabi.newpipe.util.external_communication.TimestampExtractor; import org.schabi.newpipe.util.text.TimestampExtractor;
import java.util.Objects; import java.util.Objects;

View File

@ -51,7 +51,7 @@ import org.schabi.newpipe.extractor.search.SearchInfo;
import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor; import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor;
import org.schabi.newpipe.util.external_communication.TextLinkifier; import org.schabi.newpipe.util.text.TextLinkifier;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;

View File

@ -1,6 +1,6 @@
package org.schabi.newpipe.util; package org.schabi.newpipe.util.text;
import static org.schabi.newpipe.util.TouchUtils.getOffsetForHorizontalLine; import static org.schabi.newpipe.util.text.TouchUtils.getOffsetForHorizontalLine;
import android.text.Selection; import android.text.Selection;
import android.text.Spannable; import android.text.Spannable;
@ -12,7 +12,6 @@ import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import org.schabi.newpipe.util.external_communication.ShareUtils; import org.schabi.newpipe.util.external_communication.ShareUtils;
import org.schabi.newpipe.util.external_communication.InternalUrlsHandler;
import io.reactivex.rxjava3.disposables.CompositeDisposable; import io.reactivex.rxjava3.disposables.CompositeDisposable;

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.util.external_communication; package org.schabi.newpipe.util.text;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
@ -7,7 +7,7 @@ import androidx.annotation.NonNull;
import org.schabi.newpipe.extractor.Info; import org.schabi.newpipe.extractor.Info;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.views.LongPressClickableSpan; import org.schabi.newpipe.util.external_communication.ShareUtils;
final class HashtagLongPressClickableSpan extends LongPressClickableSpan { final class HashtagLongPressClickableSpan extends LongPressClickableSpan {

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.util.external_communication; package org.schabi.newpipe.util.text;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.views; package org.schabi.newpipe.util.text;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.view.View; import android.view.View;

View File

@ -1,6 +1,6 @@
package org.schabi.newpipe.views; package org.schabi.newpipe.util.text;
import static org.schabi.newpipe.util.TouchUtils.getOffsetForHorizontalLine; import static org.schabi.newpipe.util.text.TouchUtils.getOffsetForHorizontalLine;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.util.external_communication; package org.schabi.newpipe.util.text;
import android.content.Context; import android.content.Context;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
@ -15,8 +15,7 @@ import androidx.core.text.HtmlCompat;
import org.schabi.newpipe.extractor.Info; import org.schabi.newpipe.extractor.Info;
import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.views.LongPressClickableSpan; import org.schabi.newpipe.util.external_communication.ShareUtils;
import org.schabi.newpipe.views.LongPressLinkMovementMethod;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -88,8 +87,7 @@ public final class TextLinkifier {
@NonNull final CompositeDisposable disposables) { @NonNull final CompositeDisposable disposables) {
textView.setAutoLinkMask(Linkify.WEB_URLS); textView.setAutoLinkMask(Linkify.WEB_URLS);
textView.setText(plainTextBlock, TextView.BufferType.SPANNABLE); textView.setText(plainTextBlock, TextView.BufferType.SPANNABLE);
changeIntentsOfDescriptionLinks(textView, textView.getText(), relatedInfo, disposables changeIntentsOfDescriptionLinks(textView, textView.getText(), relatedInfo, disposables);
);
} }
/** /**

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.util.external_communication; package org.schabi.newpipe.util.text;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;

View File

@ -1,6 +1,6 @@
package org.schabi.newpipe.util.external_communication; package org.schabi.newpipe.util.text;
import static org.schabi.newpipe.util.external_communication.InternalUrlsHandler.playOnPopup; import static org.schabi.newpipe.util.text.InternalUrlsHandler.playOnPopup;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
@ -10,7 +10,7 @@ import androidx.annotation.NonNull;
import org.schabi.newpipe.extractor.ServiceList; import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.views.LongPressClickableSpan; import org.schabi.newpipe.util.external_communication.ShareUtils;
import io.reactivex.rxjava3.disposables.CompositeDisposable; import io.reactivex.rxjava3.disposables.CompositeDisposable;

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.util; package org.schabi.newpipe.util.text;
import android.text.Layout; import android.text.Layout;
import android.view.MotionEvent; import android.view.MotionEvent;

View File

@ -1,11 +1,11 @@
package org.schabi.newpipe.util.external_communication; package org.schabi.newpipe.util.text;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.schabi.newpipe.views.LongPressClickableSpan; import org.schabi.newpipe.util.external_communication.ShareUtils;
import io.reactivex.rxjava3.disposables.CompositeDisposable; import io.reactivex.rxjava3.disposables.CompositeDisposable;

View File

@ -3,6 +3,7 @@ package org.schabi.newpipe.util.external_communication;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.schabi.newpipe.util.text.TimestampExtractor;
import java.time.Duration; import java.time.Duration;
import java.util.Arrays; import java.util.Arrays;