Move description to a tab alongside related streams and comments
This commit is contained in:
parent
78a9811fe3
commit
a314f55a17
|
@ -35,7 +35,7 @@ public abstract class BaseFragment extends Fragment {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(final Context context) {
|
public void onAttach(@NonNull final Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
activity = (AppCompatActivity) context;
|
activity = (AppCompatActivity) context;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public abstract class BaseFragment extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(final View rootView, final Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
||||||
super.onViewCreated(rootView, savedInstanceState);
|
super.onViewCreated(rootView, savedInstanceState);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "onViewCreated() called with: "
|
Log.d(TAG, "onViewCreated() called with: "
|
||||||
|
@ -73,7 +73,7 @@ public abstract class BaseFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(final Bundle outState) {
|
public void onSaveInstanceState(@NonNull final Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
Icepick.saveInstanceState(this, outState);
|
Icepick.saveInstanceState(this, outState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC
|
||||||
private TextView errorTextView;
|
private TextView errorTextView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(final View rootView, final Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
||||||
super.onViewCreated(rootView, savedInstanceState);
|
super.onViewCreated(rootView, savedInstanceState);
|
||||||
doInitialLoadLogic();
|
doInitialLoadLogic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
package org.schabi.newpipe.fragments.detail;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.text.HtmlCompat;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.BaseFragment;
|
||||||
|
import org.schabi.newpipe.databinding.FragmentDescriptionBinding;
|
||||||
|
import org.schabi.newpipe.extractor.stream.Description;
|
||||||
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||||
|
import org.schabi.newpipe.util.Localization;
|
||||||
|
import org.schabi.newpipe.util.TextLinkifier;
|
||||||
|
|
||||||
|
import icepick.State;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
|
||||||
|
import static android.text.TextUtils.isEmpty;
|
||||||
|
|
||||||
|
public class DescriptionFragment extends BaseFragment {
|
||||||
|
|
||||||
|
@State
|
||||||
|
StreamInfo streamInfo = null;
|
||||||
|
@Nullable
|
||||||
|
Disposable descriptionDisposable = null;
|
||||||
|
|
||||||
|
public DescriptionFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionFragment(final StreamInfo streamInfo) {
|
||||||
|
this.streamInfo = streamInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
|
@Nullable final ViewGroup container,
|
||||||
|
@Nullable final Bundle savedInstanceState) {
|
||||||
|
final FragmentDescriptionBinding binding =
|
||||||
|
FragmentDescriptionBinding.inflate(inflater, container, false);
|
||||||
|
if (streamInfo != null) {
|
||||||
|
setupUploadDate(binding.detailUploadDateView);
|
||||||
|
setupDescription(binding.detailDescriptionView);
|
||||||
|
}
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (descriptionDisposable != null) {
|
||||||
|
descriptionDisposable.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupUploadDate(final TextView uploadDateTextView) {
|
||||||
|
if (streamInfo.getUploadDate() != null) {
|
||||||
|
uploadDateTextView.setText(Localization
|
||||||
|
.localizeUploadDate(activity, streamInfo.getUploadDate().offsetDateTime()));
|
||||||
|
} else {
|
||||||
|
uploadDateTextView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupDescription(final TextView descriptionTextView) {
|
||||||
|
final Description description = streamInfo.getDescription();
|
||||||
|
if (description == null || isEmpty(description.getContent())
|
||||||
|
|| description == Description.emptyDescription) {
|
||||||
|
descriptionTextView.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (description.getType()) {
|
||||||
|
case Description.HTML:
|
||||||
|
descriptionDisposable = TextLinkifier.createLinksFromHtmlBlock(requireContext(),
|
||||||
|
description.getContent(), descriptionTextView,
|
||||||
|
HtmlCompat.FROM_HTML_MODE_LEGACY);
|
||||||
|
break;
|
||||||
|
case Description.MARKDOWN:
|
||||||
|
descriptionDisposable = TextLinkifier.createLinksFromMarkdownText(requireContext(),
|
||||||
|
description.getContent(), descriptionTextView);
|
||||||
|
break;
|
||||||
|
case Description.PLAIN_TEXT: default:
|
||||||
|
descriptionDisposable = TextLinkifier.createLinksFromPlainText(requireContext(),
|
||||||
|
description.getContent(), descriptionTextView);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,6 @@ import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.text.HtmlCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
@ -61,14 +60,12 @@ import org.schabi.newpipe.extractor.ServiceList;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
||||||
import org.schabi.newpipe.extractor.stream.AudioStream;
|
import org.schabi.newpipe.extractor.stream.AudioStream;
|
||||||
import org.schabi.newpipe.extractor.stream.Description;
|
|
||||||
import org.schabi.newpipe.extractor.stream.Stream;
|
import org.schabi.newpipe.extractor.stream.Stream;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamType;
|
import org.schabi.newpipe.extractor.stream.StreamType;
|
||||||
import org.schabi.newpipe.extractor.stream.VideoStream;
|
import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||||
import org.schabi.newpipe.fragments.BackPressable;
|
import org.schabi.newpipe.fragments.BackPressable;
|
||||||
import org.schabi.newpipe.fragments.BaseStateFragment;
|
import org.schabi.newpipe.fragments.BaseStateFragment;
|
||||||
import org.schabi.newpipe.fragments.EmptyFragment;
|
|
||||||
import org.schabi.newpipe.fragments.list.comments.CommentsFragment;
|
import org.schabi.newpipe.fragments.list.comments.CommentsFragment;
|
||||||
import org.schabi.newpipe.fragments.list.videos.RelatedVideosFragment;
|
import org.schabi.newpipe.fragments.list.videos.RelatedVideosFragment;
|
||||||
import org.schabi.newpipe.ktx.AnimationType;
|
import org.schabi.newpipe.ktx.AnimationType;
|
||||||
|
@ -97,9 +94,7 @@ import org.schabi.newpipe.util.Localization;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
import org.schabi.newpipe.util.PermissionHelper;
|
import org.schabi.newpipe.util.PermissionHelper;
|
||||||
import org.schabi.newpipe.util.ShareUtils;
|
import org.schabi.newpipe.util.ShareUtils;
|
||||||
import org.schabi.newpipe.util.TextLinkifier;
|
|
||||||
import org.schabi.newpipe.util.ThemeHelper;
|
import org.schabi.newpipe.util.ThemeHelper;
|
||||||
import org.schabi.newpipe.views.LargeTextMovementMethod;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -150,7 +145,7 @@ public final class VideoDetailFragment
|
||||||
|
|
||||||
private static final String COMMENTS_TAB_TAG = "COMMENTS";
|
private static final String COMMENTS_TAB_TAG = "COMMENTS";
|
||||||
private static final String RELATED_TAB_TAG = "NEXT VIDEO";
|
private static final String RELATED_TAB_TAG = "NEXT VIDEO";
|
||||||
private static final String EMPTY_TAB_TAG = "EMPTY TAB";
|
private static final String DESCRIPTION_TAB_TAG = "DESCRIPTION TAB";
|
||||||
|
|
||||||
private boolean showRelatedStreams;
|
private boolean showRelatedStreams;
|
||||||
private boolean showComments;
|
private boolean showComments;
|
||||||
|
@ -570,21 +565,16 @@ public final class VideoDetailFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleTitleAndDescription() {
|
private void toggleTitleAndDescription() {
|
||||||
if (binding.detailDescriptionRootLayout.getVisibility() == View.VISIBLE) {
|
if (binding.detailSecondaryControlPanel.getVisibility() == View.GONE) {
|
||||||
binding.detailVideoTitleView.setMaxLines(1);
|
|
||||||
binding.detailDescriptionRootLayout.setVisibility(View.GONE);
|
|
||||||
binding.detailDescriptionView.setFocusable(false);
|
|
||||||
binding.detailToggleDescriptionView.setImageResource(
|
|
||||||
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_more));
|
|
||||||
binding.detailSecondaryControlPanel.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
binding.detailVideoTitleView.setMaxLines(10);
|
binding.detailVideoTitleView.setMaxLines(10);
|
||||||
binding.detailDescriptionRootLayout.setVisibility(View.VISIBLE);
|
|
||||||
binding.detailDescriptionView.setFocusable(true);
|
|
||||||
binding.detailDescriptionView.setMovementMethod(new LargeTextMovementMethod());
|
|
||||||
binding.detailToggleDescriptionView.setImageResource(
|
binding.detailToggleDescriptionView.setImageResource(
|
||||||
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_less));
|
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_less));
|
||||||
binding.detailSecondaryControlPanel.setVisibility(View.VISIBLE);
|
binding.detailSecondaryControlPanel.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
binding.detailVideoTitleView.setMaxLines(1);
|
||||||
|
binding.detailToggleDescriptionView.setImageResource(
|
||||||
|
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_more));
|
||||||
|
binding.detailSecondaryControlPanel.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,10 +918,8 @@ public final class VideoDetailFragment
|
||||||
pageAdapter.addFragment(new Fragment(), RELATED_TAB_TAG);
|
pageAdapter.addFragment(new Fragment(), RELATED_TAB_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pageAdapter.getCount() == 0) {
|
//temp empty fragment. will be updated in handleResult
|
||||||
pageAdapter.addFragment(new EmptyFragment(), EMPTY_TAB_TAG);
|
pageAdapter.addFragment(new Fragment(), DESCRIPTION_TAB_TAG);
|
||||||
}
|
|
||||||
|
|
||||||
pageAdapter.notifyDataSetUpdate();
|
pageAdapter.notifyDataSetUpdate();
|
||||||
|
|
||||||
if (pageAdapter.getCount() < 2) {
|
if (pageAdapter.getCount() < 2) {
|
||||||
|
@ -1153,29 +1141,6 @@ public final class VideoDetailFragment
|
||||||
binding.playerPlaceholder.requestLayout();
|
binding.playerPlaceholder.requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareDescription(final Description description) {
|
|
||||||
if (description == null || isEmpty(description.getContent())
|
|
||||||
|| description == Description.emptyDescription) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (description.getType()) {
|
|
||||||
case Description.HTML:
|
|
||||||
disposables.add(TextLinkifier.createLinksFromHtmlBlock(requireContext(),
|
|
||||||
description.getContent(), binding.detailDescriptionView,
|
|
||||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
|
||||||
break;
|
|
||||||
case Description.MARKDOWN:
|
|
||||||
disposables.add(TextLinkifier.createLinksFromMarkdownText(requireContext(),
|
|
||||||
description.getContent(), binding.detailDescriptionView));
|
|
||||||
break;
|
|
||||||
case Description.PLAIN_TEXT: default:
|
|
||||||
disposables.add(TextLinkifier.createLinksFromPlainText(requireContext(),
|
|
||||||
description.getContent(), binding.detailDescriptionView));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ViewTreeObserver.OnPreDrawListener preDrawListener =
|
private final ViewTreeObserver.OnPreDrawListener preDrawListener =
|
||||||
new ViewTreeObserver.OnPreDrawListener() {
|
new ViewTreeObserver.OnPreDrawListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1348,7 +1313,6 @@ public final class VideoDetailFragment
|
||||||
binding.detailVideoTitleView.setMaxLines(1);
|
binding.detailVideoTitleView.setMaxLines(1);
|
||||||
animate(binding.detailVideoTitleView, true, 0);
|
animate(binding.detailVideoTitleView, true, 0);
|
||||||
|
|
||||||
binding.detailDescriptionRootLayout.setVisibility(View.GONE);
|
|
||||||
binding.detailToggleDescriptionView.setVisibility(View.GONE);
|
binding.detailToggleDescriptionView.setVisibility(View.GONE);
|
||||||
binding.detailTitleRootLayout.setClickable(false);
|
binding.detailTitleRootLayout.setClickable(false);
|
||||||
binding.detailSecondaryControlPanel.setVisibility(View.GONE);
|
binding.detailSecondaryControlPanel.setVisibility(View.GONE);
|
||||||
|
@ -1379,7 +1343,6 @@ public final class VideoDetailFragment
|
||||||
if (binding.relatedStreamsLayout == null) { //phone
|
if (binding.relatedStreamsLayout == null) { //phone
|
||||||
pageAdapter.updateItem(RELATED_TAB_TAG,
|
pageAdapter.updateItem(RELATED_TAB_TAG,
|
||||||
RelatedVideosFragment.getInstance(info));
|
RelatedVideosFragment.getInstance(info));
|
||||||
pageAdapter.notifyDataSetUpdate();
|
|
||||||
} else { //tablet
|
} else { //tablet
|
||||||
getChildFragmentManager().beginTransaction()
|
getChildFragmentManager().beginTransaction()
|
||||||
.replace(R.id.relatedStreamsLayout,
|
.replace(R.id.relatedStreamsLayout,
|
||||||
|
@ -1389,6 +1352,10 @@ public final class VideoDetailFragment
|
||||||
player != null && player.isFullscreen() ? View.GONE : View.VISIBLE);
|
player != null && player.isFullscreen() ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pageAdapter.updateItem(DESCRIPTION_TAB_TAG,
|
||||||
|
new DescriptionFragment(info));
|
||||||
|
pageAdapter.notifyDataSetUpdate();
|
||||||
|
|
||||||
animate(binding.detailThumbnailPlayButton, true, 200);
|
animate(binding.detailThumbnailPlayButton, true, 200);
|
||||||
binding.detailVideoTitleView.setText(title);
|
binding.detailVideoTitleView.setText(title);
|
||||||
|
|
||||||
|
@ -1397,7 +1364,7 @@ public final class VideoDetailFragment
|
||||||
} else if (!isEmpty(info.getUploaderName())) {
|
} else if (!isEmpty(info.getUploaderName())) {
|
||||||
displayUploaderAsSubChannel(info);
|
displayUploaderAsSubChannel(info);
|
||||||
} else {
|
} else {
|
||||||
binding.detailUploadDateView.setVisibility(View.GONE);
|
binding.detailUploaderTextView.setVisibility(View.GONE);
|
||||||
binding.detailUploaderThumbnailView.setVisibility(View.GONE);
|
binding.detailUploaderThumbnailView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1465,23 +1432,12 @@ public final class VideoDetailFragment
|
||||||
binding.detailDurationView.setVisibility(View.GONE);
|
binding.detailDurationView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.detailDescriptionView.setVisibility(View.GONE);
|
|
||||||
binding.detailTitleRootLayout.setClickable(true);
|
binding.detailTitleRootLayout.setClickable(true);
|
||||||
binding.detailToggleDescriptionView.setImageResource(
|
binding.detailToggleDescriptionView.setImageResource(
|
||||||
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_more));
|
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_more));
|
||||||
binding.detailToggleDescriptionView.setVisibility(View.VISIBLE);
|
binding.detailToggleDescriptionView.setVisibility(View.VISIBLE);
|
||||||
binding.detailDescriptionRootLayout.setVisibility(View.GONE);
|
|
||||||
binding.detailSecondaryControlPanel.setVisibility(View.GONE);
|
binding.detailSecondaryControlPanel.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (info.getUploadDate() != null) {
|
|
||||||
binding.detailUploadDateView.setText(Localization
|
|
||||||
.localizeUploadDate(activity, info.getUploadDate().offsetDateTime()));
|
|
||||||
binding.detailUploadDateView.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
binding.detailUploadDateView.setText(null);
|
|
||||||
binding.detailUploadDateView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
sortedVideoStreams = ListHelper.getSortedStreamVideosList(
|
sortedVideoStreams = ListHelper.getSortedStreamVideosList(
|
||||||
activity,
|
activity,
|
||||||
info.getVideoStreams(),
|
info.getVideoStreams(),
|
||||||
|
@ -1489,7 +1445,6 @@ public final class VideoDetailFragment
|
||||||
false);
|
false);
|
||||||
selectedVideoStreamIndex = ListHelper
|
selectedVideoStreamIndex = ListHelper
|
||||||
.getDefaultResolutionIndex(activity, sortedVideoStreams);
|
.getDefaultResolutionIndex(activity, sortedVideoStreams);
|
||||||
prepareDescription(info.getDescription());
|
|
||||||
updateProgressInfo(info);
|
updateProgressInfo(info);
|
||||||
initThumbnailViews(info);
|
initThumbnailViews(info);
|
||||||
disposables.add(showMetaInfoInTextView(info.getMetaInfo(), binding.detailMetaInfoTextView,
|
disposables.add(showMetaInfoInTextView(info.getMetaInfo(), binding.detailMetaInfoTextView,
|
||||||
|
@ -1535,7 +1490,7 @@ public final class VideoDetailFragment
|
||||||
binding.detailSubChannelTextView.setText(info.getUploaderName());
|
binding.detailSubChannelTextView.setText(info.getUploaderName());
|
||||||
binding.detailSubChannelTextView.setVisibility(View.VISIBLE);
|
binding.detailSubChannelTextView.setVisibility(View.VISIBLE);
|
||||||
binding.detailSubChannelTextView.setSelected(true);
|
binding.detailSubChannelTextView.setSelected(true);
|
||||||
binding.detailUploadDateView.setVisibility(View.GONE);
|
binding.detailUploaderTextView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayBothUploaderAndSubChannel(final StreamInfo info) {
|
private void displayBothUploaderAndSubChannel(final StreamInfo info) {
|
||||||
|
@ -1546,12 +1501,12 @@ public final class VideoDetailFragment
|
||||||
binding.detailSubChannelThumbnailView.setVisibility(View.VISIBLE);
|
binding.detailSubChannelThumbnailView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (!isEmpty(info.getUploaderName())) {
|
if (!isEmpty(info.getUploaderName())) {
|
||||||
binding.detailUploadDateView.setText(
|
binding.detailUploaderTextView.setText(
|
||||||
String.format(getString(R.string.video_detail_by), info.getUploaderName()));
|
String.format(getString(R.string.video_detail_by), info.getUploaderName()));
|
||||||
binding.detailUploadDateView.setVisibility(View.VISIBLE);
|
binding.detailUploaderTextView.setVisibility(View.VISIBLE);
|
||||||
binding.detailUploadDateView.setSelected(true);
|
binding.detailUploaderTextView.setSelected(true);
|
||||||
} else {
|
} else {
|
||||||
binding.detailUploadDateView.setVisibility(View.GONE);
|
binding.detailUploaderTextView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(final Context context) {
|
public void onAttach(@NonNull final Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
|
||||||
if (infoListAdapter == null) {
|
if (infoListAdapter == null) {
|
||||||
|
@ -186,7 +186,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(final Bundle bundle) {
|
public void onSaveInstanceState(@NonNull final Bundle bundle) {
|
||||||
super.onSaveInstanceState(bundle);
|
super.onSaveInstanceState(bundle);
|
||||||
if (useDefaultStateSaving) {
|
if (useDefaultStateSaving) {
|
||||||
savedState = StateSaver
|
savedState = StateSaver
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(final Context context) {
|
public void onAttach(@NonNull final Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
subscriptionManager = new SubscriptionManager(activity);
|
subscriptionManager = new SubscriptionManager(activity);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(final View rootView, final Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
||||||
super.onViewCreated(rootView, savedInstanceState);
|
super.onViewCreated(rootView, savedInstanceState);
|
||||||
channelBinding = FragmentChannelBinding.bind(rootView);
|
channelBinding = FragmentChannelBinding.bind(rootView);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.schabi.newpipe.fragments.list.comments;
|
package org.schabi.newpipe.fragments.list.comments;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -37,11 +36,6 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
|
||||||
// LifeCycle
|
// LifeCycle
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(final Context context) {
|
|
||||||
super.onAttach(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
|
@ -52,9 +46,7 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
if (disposables != null) {
|
disposables.clear();
|
||||||
disposables.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -196,7 +196,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(final Context context) {
|
public void onAttach(@NonNull final Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
|
||||||
suggestionListAdapter = new SuggestionListAdapter(activity);
|
suggestionListAdapter = new SuggestionListAdapter(activity);
|
||||||
|
@ -226,7 +226,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(final View rootView, final Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
||||||
super.onViewCreated(rootView, savedInstanceState);
|
super.onViewCreated(rootView, savedInstanceState);
|
||||||
showSearchOnStart();
|
showSearchOnStart();
|
||||||
initSearchListeners();
|
initSearchListeners();
|
||||||
|
@ -390,7 +390,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(final Bundle bundle) {
|
public void onSaveInstanceState(@NonNull final Bundle bundle) {
|
||||||
searchString = searchEditText != null
|
searchString = searchEditText != null
|
||||||
? searchEditText.getText().toString()
|
? searchEditText.getText().toString()
|
||||||
: searchString;
|
: searchString;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInf
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(final Context context) {
|
public void onAttach(@NonNull final Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(final Bundle outState) {
|
public void onSaveInstanceState(@NonNull final Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putSerializable(INFO_KEY, relatedStreamInfo);
|
outState.putSerializable(INFO_KEY, relatedStreamInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,7 +510,8 @@
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="@dimen/detail_control_padding"
|
android:paddingHorizontal="@dimen/detail_control_padding"
|
||||||
|
android:paddingBottom="@dimen/detail_control_padding"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
@ -588,53 +589,6 @@
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:background="?attr/separator_color" />
|
android:background="?attr/separator_color" />
|
||||||
|
|
||||||
<!--DESCRIPTIONS-->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/detail_description_root_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:descendantFocusability="afterDescendants"
|
|
||||||
android:focusable="true"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_upload_date_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textSize="@dimen/video_item_detail_upload_date_text_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
tools:text="Published on Oct 2, 2009" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_description_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginTop="3dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:focusable="false"
|
|
||||||
android:nextFocusUp="@+id/detail_control_panel"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:textSize="@dimen/video_item_detail_description_text_size"
|
|
||||||
tools:text="Description Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ultricies ex. Integer sit amet sodales risus. Duis non mi et urna pretium bibendum." />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:background="?attr/separator_color" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/detail_upload_date_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textSize="@dimen/video_item_detail_upload_date_text_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="Published on Oct 2, 2009" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/detail_description_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
android:textSize="@dimen/video_item_detail_description_text_size"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/detail_upload_date_view"
|
||||||
|
app:layout_constraintVertical_bias="0.0"
|
||||||
|
tools:text="Description Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ultricies ex. Integer sit amet sodales risus. Duis non mi et urna pretium bibendum." />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
|
@ -493,7 +493,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="@dimen/detail_control_padding"
|
android:paddingHorizontal="@dimen/detail_control_padding"
|
||||||
|
android:paddingBottom="@dimen/detail_control_padding"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
@ -571,49 +572,6 @@
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:background="?attr/separator_color" />
|
android:background="?attr/separator_color" />
|
||||||
|
|
||||||
<!--DESCRIPTIONS-->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/detail_description_root_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_upload_date_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textSize="@dimen/video_item_detail_upload_date_text_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
tools:text="Published on Oct 2, 2009" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_description_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginTop="3dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:textSize="@dimen/video_item_detail_description_text_size"
|
|
||||||
tools:text="Description Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ultricies ex. Integer sit amet sodales risus. Duis non mi et urna pretium bibendum." />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:background="?attr/separator_color" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue