mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 19:12:45 +01:00
Merge pull request #5946 from Stypox/metadata
Show content metadata below the description
This commit is contained in:
commit
63c9308f59
@ -4,23 +4,38 @@ import android.os.Bundle;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
import androidx.appcompat.widget.TooltipCompat;
|
||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
|
|
||||||
|
import com.google.android.material.chip.Chip;
|
||||||
|
|
||||||
import org.schabi.newpipe.BaseFragment;
|
import org.schabi.newpipe.BaseFragment;
|
||||||
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.databinding.FragmentDescriptionBinding;
|
import org.schabi.newpipe.databinding.FragmentDescriptionBinding;
|
||||||
|
import org.schabi.newpipe.databinding.ItemMetadataBinding;
|
||||||
|
import org.schabi.newpipe.databinding.ItemMetadataTagsBinding;
|
||||||
import org.schabi.newpipe.extractor.stream.Description;
|
import org.schabi.newpipe.extractor.stream.Description;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
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.ShareUtils;
|
||||||
import org.schabi.newpipe.util.TextLinkifier;
|
import org.schabi.newpipe.util.TextLinkifier;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import icepick.State;
|
import icepick.State;
|
||||||
import io.reactivex.rxjava3.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
|
||||||
import static android.text.TextUtils.isEmpty;
|
import static android.text.TextUtils.isEmpty;
|
||||||
|
import static org.schabi.newpipe.extractor.stream.StreamExtractor.NO_AGE_LIMIT;
|
||||||
|
import static org.schabi.newpipe.extractor.utils.Utils.isBlank;
|
||||||
|
|
||||||
public class DescriptionFragment extends BaseFragment {
|
public class DescriptionFragment extends BaseFragment {
|
||||||
|
|
||||||
@ -28,6 +43,7 @@ public class DescriptionFragment extends BaseFragment {
|
|||||||
StreamInfo streamInfo = null;
|
StreamInfo streamInfo = null;
|
||||||
@Nullable
|
@Nullable
|
||||||
Disposable descriptionDisposable = null;
|
Disposable descriptionDisposable = null;
|
||||||
|
FragmentDescriptionBinding binding;
|
||||||
|
|
||||||
public DescriptionFragment() {
|
public DescriptionFragment() {
|
||||||
}
|
}
|
||||||
@ -40,11 +56,11 @@ public class DescriptionFragment extends BaseFragment {
|
|||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
final FragmentDescriptionBinding binding =
|
binding = FragmentDescriptionBinding.inflate(inflater, container, false);
|
||||||
FragmentDescriptionBinding.inflate(inflater, container, false);
|
|
||||||
if (streamInfo != null) {
|
if (streamInfo != null) {
|
||||||
setupUploadDate(binding.detailUploadDateView);
|
setupUploadDate();
|
||||||
setupDescription(binding.detailDescriptionView);
|
setupDescription();
|
||||||
|
setupMetadata(inflater, binding.detailMetadataLayout);
|
||||||
}
|
}
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
@ -57,37 +73,197 @@ public class DescriptionFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupUploadDate(final TextView uploadDateTextView) {
|
|
||||||
|
private void setupUploadDate() {
|
||||||
if (streamInfo.getUploadDate() != null) {
|
if (streamInfo.getUploadDate() != null) {
|
||||||
uploadDateTextView.setText(Localization
|
binding.detailUploadDateView.setText(Localization
|
||||||
.localizeUploadDate(activity, streamInfo.getUploadDate().offsetDateTime()));
|
.localizeUploadDate(activity, streamInfo.getUploadDate().offsetDateTime()));
|
||||||
} else {
|
} else {
|
||||||
uploadDateTextView.setVisibility(View.GONE);
|
binding.detailUploadDateView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDescription(final TextView descriptionTextView) {
|
|
||||||
|
private void setupDescription() {
|
||||||
final Description description = streamInfo.getDescription();
|
final Description description = streamInfo.getDescription();
|
||||||
if (description == null || isEmpty(description.getContent())
|
if (description == null || isEmpty(description.getContent())
|
||||||
|| description == Description.emptyDescription) {
|
|| description == Description.emptyDescription) {
|
||||||
descriptionTextView.setText("");
|
binding.detailDescriptionView.setVisibility(View.GONE);
|
||||||
|
binding.detailSelectDescriptionButton.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start with disabled state. This also loads description content (!)
|
||||||
|
disableDescriptionSelection();
|
||||||
|
|
||||||
|
binding.detailSelectDescriptionButton.setOnClickListener(v -> {
|
||||||
|
if (binding.detailDescriptionNoteView.getVisibility() == View.VISIBLE) {
|
||||||
|
disableDescriptionSelection();
|
||||||
|
} else {
|
||||||
|
// enable selection only when button is clicked to prevent flickering
|
||||||
|
enableDescriptionSelection();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableDescriptionSelection() {
|
||||||
|
binding.detailDescriptionNoteView.setVisibility(View.VISIBLE);
|
||||||
|
binding.detailDescriptionView.setTextIsSelectable(true);
|
||||||
|
|
||||||
|
final String buttonLabel = getString(R.string.description_select_disable);
|
||||||
|
binding.detailSelectDescriptionButton.setContentDescription(buttonLabel);
|
||||||
|
TooltipCompat.setTooltipText(binding.detailSelectDescriptionButton, buttonLabel);
|
||||||
|
binding.detailSelectDescriptionButton.setImageResource(R.drawable.ic_close);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void disableDescriptionSelection() {
|
||||||
|
// show description content again, otherwise some links are not clickable
|
||||||
|
loadDescriptionContent();
|
||||||
|
|
||||||
|
binding.detailDescriptionNoteView.setVisibility(View.GONE);
|
||||||
|
binding.detailDescriptionView.setTextIsSelectable(false);
|
||||||
|
|
||||||
|
final String buttonLabel = getString(R.string.description_select_enable);
|
||||||
|
binding.detailSelectDescriptionButton.setContentDescription(buttonLabel);
|
||||||
|
TooltipCompat.setTooltipText(binding.detailSelectDescriptionButton, buttonLabel);
|
||||||
|
binding.detailSelectDescriptionButton.setImageResource(R.drawable.ic_select_all);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadDescriptionContent() {
|
||||||
|
final Description description = streamInfo.getDescription();
|
||||||
switch (description.getType()) {
|
switch (description.getType()) {
|
||||||
case Description.HTML:
|
case Description.HTML:
|
||||||
descriptionDisposable = TextLinkifier.createLinksFromHtmlBlock(requireContext(),
|
descriptionDisposable = TextLinkifier.createLinksFromHtmlBlock(requireContext(),
|
||||||
description.getContent(), descriptionTextView,
|
description.getContent(), binding.detailDescriptionView,
|
||||||
HtmlCompat.FROM_HTML_MODE_LEGACY);
|
HtmlCompat.FROM_HTML_MODE_LEGACY);
|
||||||
break;
|
break;
|
||||||
case Description.MARKDOWN:
|
case Description.MARKDOWN:
|
||||||
descriptionDisposable = TextLinkifier.createLinksFromMarkdownText(requireContext(),
|
descriptionDisposable = TextLinkifier.createLinksFromMarkdownText(requireContext(),
|
||||||
description.getContent(), descriptionTextView);
|
description.getContent(), binding.detailDescriptionView);
|
||||||
break;
|
break;
|
||||||
case Description.PLAIN_TEXT: default:
|
case Description.PLAIN_TEXT: default:
|
||||||
descriptionDisposable = TextLinkifier.createLinksFromPlainText(requireContext(),
|
descriptionDisposable = TextLinkifier.createLinksFromPlainText(requireContext(),
|
||||||
description.getContent(), descriptionTextView);
|
description.getContent(), binding.detailDescriptionView);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setupMetadata(final LayoutInflater inflater,
|
||||||
|
final LinearLayout layout) {
|
||||||
|
addMetadataItem(inflater, layout, false,
|
||||||
|
R.string.metadata_category, streamInfo.getCategory());
|
||||||
|
|
||||||
|
addTagsMetadataItem(inflater, layout);
|
||||||
|
|
||||||
|
addMetadataItem(inflater, layout, false,
|
||||||
|
R.string.metadata_licence, streamInfo.getLicence());
|
||||||
|
|
||||||
|
addPrivacyMetadataItem(inflater, layout);
|
||||||
|
|
||||||
|
if (streamInfo.getAgeLimit() != NO_AGE_LIMIT) {
|
||||||
|
addMetadataItem(inflater, layout, false,
|
||||||
|
R.string.metadata_age_limit, String.valueOf(streamInfo.getAgeLimit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (streamInfo.getLanguageInfo() != null) {
|
||||||
|
addMetadataItem(inflater, layout, false,
|
||||||
|
R.string.metadata_language, streamInfo.getLanguageInfo().getDisplayLanguage());
|
||||||
|
}
|
||||||
|
|
||||||
|
addMetadataItem(inflater, layout, true,
|
||||||
|
R.string.metadata_support, streamInfo.getSupportInfo());
|
||||||
|
addMetadataItem(inflater, layout, true,
|
||||||
|
R.string.metadata_host, streamInfo.getHost());
|
||||||
|
addMetadataItem(inflater, layout, true,
|
||||||
|
R.string.metadata_thumbnail_url, streamInfo.getThumbnailUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMetadataItem(final LayoutInflater inflater,
|
||||||
|
final LinearLayout layout,
|
||||||
|
final boolean linkifyContent,
|
||||||
|
@StringRes final int type,
|
||||||
|
@Nullable final String content) {
|
||||||
|
if (isBlank(content)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ItemMetadataBinding itemBinding
|
||||||
|
= ItemMetadataBinding.inflate(inflater, layout, false);
|
||||||
|
|
||||||
|
itemBinding.metadataTypeView.setText(type);
|
||||||
|
itemBinding.metadataTypeView.setOnLongClickListener(v -> {
|
||||||
|
ShareUtils.copyToClipboard(requireContext(), content);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (linkifyContent) {
|
||||||
|
TextLinkifier.createLinksFromPlainText(requireContext(),
|
||||||
|
content, itemBinding.metadataContentView);
|
||||||
|
} else {
|
||||||
|
itemBinding.metadataContentView.setText(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
layout.addView(itemBinding.getRoot());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTagsMetadataItem(final LayoutInflater inflater, final LinearLayout layout) {
|
||||||
|
if (streamInfo.getTags() != null && !streamInfo.getTags().isEmpty()) {
|
||||||
|
final ItemMetadataTagsBinding itemBinding
|
||||||
|
= ItemMetadataTagsBinding.inflate(inflater, layout, false);
|
||||||
|
|
||||||
|
final List<String> tags = new ArrayList<>(streamInfo.getTags());
|
||||||
|
Collections.sort(tags);
|
||||||
|
for (final String tag : tags) {
|
||||||
|
final Chip chip = (Chip) inflater.inflate(R.layout.chip,
|
||||||
|
itemBinding.metadataTagsChips, false);
|
||||||
|
chip.setText(tag);
|
||||||
|
chip.setOnClickListener(this::onTagClick);
|
||||||
|
chip.setOnLongClickListener(this::onTagLongClick);
|
||||||
|
itemBinding.metadataTagsChips.addView(chip);
|
||||||
|
}
|
||||||
|
|
||||||
|
layout.addView(itemBinding.getRoot());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onTagClick(final View chip) {
|
||||||
|
if (getParentFragment() != null) {
|
||||||
|
NavigationHelper.openSearchFragment(getParentFragment().getParentFragmentManager(),
|
||||||
|
streamInfo.getServiceId(), ((Chip) chip).getText().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean onTagLongClick(final View chip) {
|
||||||
|
ShareUtils.copyToClipboard(requireContext(), ((Chip) chip).getText().toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPrivacyMetadataItem(final LayoutInflater inflater, final LinearLayout layout) {
|
||||||
|
if (streamInfo.getPrivacy() != null) {
|
||||||
|
@StringRes final int contentRes;
|
||||||
|
switch (streamInfo.getPrivacy()) {
|
||||||
|
case PUBLIC:
|
||||||
|
contentRes = R.string.metadata_privacy_public;
|
||||||
|
break;
|
||||||
|
case UNLISTED:
|
||||||
|
contentRes = R.string.metadata_privacy_unlisted;
|
||||||
|
break;
|
||||||
|
case PRIVATE:
|
||||||
|
contentRes = R.string.metadata_privacy_private;
|
||||||
|
break;
|
||||||
|
case INTERNAL:
|
||||||
|
contentRes = R.string.metadata_privacy_internal;
|
||||||
|
break;
|
||||||
|
case OTHER: default:
|
||||||
|
contentRes = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contentRes != 0) {
|
||||||
|
addMetadataItem(inflater, layout, false,
|
||||||
|
R.string.metadata_privacy, getString(contentRes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
10
app/src/main/res/drawable-night/ic_select_all.xml
Normal file
10
app/src/main/res/drawable-night/ic_select_all.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="#ffffff">
|
||||||
|
<path
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:pathData="M3,5h2L5,3c-1.1,0 -2,0.9 -2,2zM3,13h2v-2L3,11v2zM7,21h2v-2L7,19v2zM3,9h2L5,7L3,7v2zM13,3h-2v2h2L13,3zM19,3v2h2c0,-1.1 -0.9,-2 -2,-2zM5,21v-2L3,19c0,1.1 0.9,2 2,2zM3,17h2v-2L3,15v2zM9,3L7,3v2h2L9,3zM11,21h2v-2h-2v2zM19,13h2v-2h-2v2zM19,21c1.1,0 2,-0.9 2,-2h-2v2zM19,9h2L21,7h-2v2zM19,17h2v-2h-2v2zM15,21h2v-2h-2v2zM15,5h2L17,3h-2v2zM7,17h10L17,7L7,7v10zM9,9h6v6L9,15L9,9z"/>
|
||||||
|
</vector>
|
10
app/src/main/res/drawable/ic_select_all.xml
Normal file
10
app/src/main/res/drawable/ic_select_all.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="#000000">
|
||||||
|
<path
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:pathData="M3,5h2L5,3c-1.1,0 -2,0.9 -2,2zM3,13h2v-2L3,11v2zM7,21h2v-2L7,19v2zM3,9h2L5,7L3,7v2zM13,3h-2v2h2L13,3zM19,3v2h2c0,-1.1 -0.9,-2 -2,-2zM5,21v-2L3,19c0,1.1 0.9,2 2,2zM3,17h2v-2L3,15v2zM9,3L7,3v2h2L9,3zM11,21h2v-2h-2v2zM19,13h2v-2h-2v2zM19,21c1.1,0 2,-0.9 2,-2h-2v2zM19,9h2L21,7h-2v2zM19,17h2v-2h-2v2zM15,21h2v-2h-2v2zM15,5h2L17,3h-2v2zM7,17h10L17,7L7,7v10zM9,9h6v6L9,15L9,9z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/layout/chip.xml
Normal file
9
app/src/main/res/layout/chip.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- This is used to inflate a chip with a Material theme, otherwise it would crash -->
|
||||||
|
<!-- Theme.MaterialComponents.DayNight is used to guarantee auto day/night switching -->
|
||||||
|
<com.google.android.material.chip.Chip xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/Theme.MaterialComponents.DayNight.Bridge"
|
||||||
|
tools:text="I'm a correctly themed chip!" />
|
@ -2,14 +2,15 @@
|
|||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
|
||||||
android:scrollbars="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:scrollbars="vertical">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/detail_upload_date_view"
|
android:id="@+id/detail_upload_date_view"
|
||||||
@ -17,32 +18,83 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textSize="@dimen/video_item_detail_upload_date_text_size"
|
android:textSize="@dimen/video_item_detail_upload_date_text_size"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@+id/detail_select_description_button"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Published on Oct 2, 2009" />
|
tools:text="Published on Oct 2, 2009" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/detail_select_description_button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="@string/description_select_enable"
|
||||||
|
android:focusable="true"
|
||||||
|
android:padding="5dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/barrier"
|
||||||
|
app:layout_constraintDimensionRatio="1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_select_all" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Barrier
|
||||||
|
android:id="@+id/barrier"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:barrierAllowsGoneWidgets="false"
|
||||||
|
app:barrierDirection="top"
|
||||||
|
app:constraint_referenced_ids="detail_description_note_view,detail_description_view" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/detail_description_view"
|
android:id="@+id/detail_description_note_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:gravity="center"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:text="@string/description_select_note"
|
||||||
android:textIsSelectable="true"
|
android:textSize="12sp"
|
||||||
android:textSize="@dimen/video_item_detail_description_text_size"
|
android:textStyle="italic"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_upload_date_view"
|
app:layout_constraintTop_toBottomOf="@+id/detail_upload_date_view"
|
||||||
app:layout_constraintVertical_bias="0.0"
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/detail_description_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textSize="@dimen/video_item_detail_description_text_size"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/detail_description_note_view"
|
||||||
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." />
|
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." />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/detail_metadata_layout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/detail_description_view" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
42
app/src/main/res/layout/item_metadata.xml
Normal file
42
app/src/main/res/layout/item_metadata.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:paddingBottom="6dp">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/guideline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.23" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/metadata_type_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical|end"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="Licence" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/metadata_content_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
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>
|
46
app/src/main/res/layout/item_metadata_tags.xml
Normal file
46
app/src/main/res/layout/item_metadata_tags.xml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/guideline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.23" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical|end"
|
||||||
|
android:text="@string/metadata_tags"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="-8dp"
|
||||||
|
android:layout_marginBottom="-8dp"
|
||||||
|
android:fadeScrollbars="false"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<com.google.android.material.chip.ChipGroup
|
||||||
|
android:id="@+id/metadata_tags_chips"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="@style/TextAppearance.MaterialComponents.Chip"
|
||||||
|
app:singleLine="true" />
|
||||||
|
</HorizontalScrollView>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -716,4 +716,20 @@
|
|||||||
<string name="night_theme_summary">Select your favorite night theme — %s</string>
|
<string name="night_theme_summary">Select your favorite night theme — %s</string>
|
||||||
<string name="select_night_theme_toast">You can select your favorite night theme below</string>
|
<string name="select_night_theme_toast">You can select your favorite night theme below</string>
|
||||||
<string name="download_has_started">Download has started</string>
|
<string name="download_has_started">Download has started</string>
|
||||||
|
<string name="description_select_note">You can now select text inside the description. Note that the page may flicker and links may not be clickable while in selection mode.</string>
|
||||||
|
<string name="description_select_enable">Enable selecting text in the description</string>
|
||||||
|
<string name="description_select_disable">Disable selecting text in the description</string>
|
||||||
|
<string name="metadata_category">Category</string>
|
||||||
|
<string name="metadata_tags">Tags</string>
|
||||||
|
<string name="metadata_licence">Licence</string>
|
||||||
|
<string name="metadata_privacy">Privacy</string>
|
||||||
|
<string name="metadata_age_limit">Age limit</string>
|
||||||
|
<string name="metadata_language">Language</string>
|
||||||
|
<string name="metadata_support">Support</string>
|
||||||
|
<string name="metadata_host">Host</string>
|
||||||
|
<string name="metadata_thumbnail_url">Thumbnail URL</string>
|
||||||
|
<string name="metadata_privacy_public">Public</string>
|
||||||
|
<string name="metadata_privacy_unlisted">Unlisted</string>
|
||||||
|
<string name="metadata_privacy_private">Private</string>
|
||||||
|
<string name="metadata_privacy_internal">Internal</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user