Move TextLinkifier computation out of main thread
This commit is contained in:
parent
e44495af9a
commit
2f181dfc16
4 changed files with 92 additions and 63 deletions
|
|
@ -1229,19 +1229,20 @@ public final class VideoDetailFragment
|
|||
return;
|
||||
}
|
||||
|
||||
if (description.getType() == Description.HTML) {
|
||||
TextLinkifier.createLinksFromHtmlBlock(requireContext(), description.getContent(),
|
||||
videoDescriptionView, HtmlCompat.FROM_HTML_MODE_LEGACY);
|
||||
videoDescriptionView.setVisibility(View.VISIBLE);
|
||||
} else if (description.getType() == Description.MARKDOWN) {
|
||||
TextLinkifier.createLinksFromMarkdownText(requireContext(), description.getContent(),
|
||||
videoDescriptionView);
|
||||
videoDescriptionView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
//== Description.PLAIN_TEXT
|
||||
TextLinkifier.createLinksFromPlainText(requireContext(), description.getContent(),
|
||||
videoDescriptionView);
|
||||
videoDescriptionView.setVisibility(View.VISIBLE);
|
||||
switch (description.getType()) {
|
||||
case Description.HTML:
|
||||
disposables.add(TextLinkifier.createLinksFromHtmlBlock(requireContext(),
|
||||
description.getContent(), videoDescriptionView,
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
break;
|
||||
case Description.MARKDOWN:
|
||||
disposables.add(TextLinkifier.createLinksFromMarkdownText(requireContext(),
|
||||
description.getContent(), videoDescriptionView));
|
||||
break;
|
||||
case Description.PLAIN_TEXT: default:
|
||||
disposables.add(TextLinkifier.createLinksFromPlainText(requireContext(),
|
||||
description.getContent(), videoDescriptionView));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1557,8 +1558,8 @@ public final class VideoDetailFragment
|
|||
prepareDescription(info.getDescription());
|
||||
updateProgressInfo(info);
|
||||
initThumbnailViews(info);
|
||||
showMetaInfoInTextView(info.getMetaInfo(), detailMetaInfoTextView, detailMetaInfoSeparator);
|
||||
|
||||
disposables.add(showMetaInfoInTextView(info.getMetaInfo(), detailMetaInfoTextView,
|
||||
detailMetaInfoSeparator));
|
||||
|
||||
if (player == null || player.isStopped()) {
|
||||
updateOverlayData(info.getName(), info.getUploaderName(), info.getThumbnailUrl());
|
||||
|
|
|
|||
|
|
@ -280,8 +280,8 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||
|
||||
handleSearchSuggestion();
|
||||
|
||||
showMetaInfoInTextView(metaInfo == null ? null : Arrays.asList(metaInfo),
|
||||
metaInfoTextView, metaInfoSeparator);
|
||||
disposables.add(showMetaInfoInTextView(metaInfo == null ? null : Arrays.asList(metaInfo),
|
||||
metaInfoTextView, metaInfoSeparator));
|
||||
|
||||
if (suggestionDisposable == null || suggestionDisposable.isDisposed()) {
|
||||
initSuggestionObserver();
|
||||
|
|
@ -1002,11 +1002,11 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||
// List<MetaInfo> cannot be bundled without creating some containers
|
||||
metaInfo = new MetaInfo[result.getMetaInfo().size()];
|
||||
metaInfo = result.getMetaInfo().toArray(metaInfo);
|
||||
disposables.add(showMetaInfoInTextView(result.getMetaInfo(), metaInfoTextView,
|
||||
metaInfoSeparator));
|
||||
|
||||
handleSearchSuggestion();
|
||||
|
||||
showMetaInfoInTextView(result.getMetaInfo(), metaInfoTextView, metaInfoSeparator);
|
||||
|
||||
lastSearchedString = searchString;
|
||||
nextPage = result.getNextPage();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue