show subscriber count on player page

This commit is contained in:
ThetaDev 2022-09-28 14:25:19 +02:00 committed by Stypox
parent 1d53389ca9
commit 86ee94eb04
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
3 changed files with 25 additions and 8 deletions

View File

@ -1561,9 +1561,9 @@ public final class VideoDetailFragment
binding.detailSubChannelThumbnailView.setVisibility(View.GONE); binding.detailSubChannelThumbnailView.setVisibility(View.GONE);
if (!isEmpty(info.getSubChannelName())) { if (!isEmpty(info.getSubChannelName())) {
displayBothUploaderAndSubChannel(info); displayBothUploaderAndSubChannel(info, activity);
} else if (!isEmpty(info.getUploaderName())) { } else if (!isEmpty(info.getUploaderName())) {
displayUploaderAsSubChannel(info); displayUploaderAsSubChannel(info, activity);
} else { } else {
binding.detailUploaderTextView.setVisibility(View.GONE); binding.detailUploaderTextView.setVisibility(View.GONE);
binding.detailUploaderThumbnailView.setVisibility(View.GONE); binding.detailUploaderThumbnailView.setVisibility(View.GONE);
@ -1676,23 +1676,42 @@ public final class VideoDetailFragment
noVideoStreams ? R.drawable.ic_headset_shadow : R.drawable.ic_play_arrow_shadow); noVideoStreams ? R.drawable.ic_headset_shadow : R.drawable.ic_play_arrow_shadow);
} }
private void displayUploaderAsSubChannel(final StreamInfo info) { private void displayUploaderAsSubChannel(final StreamInfo info, final Context context) {
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.detailUploaderTextView.setVisibility(View.GONE);
if (info.getUploaderSubscriberCount() > -1) {
binding.detailUploaderTextView.setText(
Localization.shortSubscriberCount(context, info.getUploaderSubscriberCount()));
binding.detailUploaderTextView.setVisibility(View.VISIBLE);
} else {
binding.detailUploaderTextView.setVisibility(View.GONE);
}
} }
private void displayBothUploaderAndSubChannel(final StreamInfo info) { private void displayBothUploaderAndSubChannel(final StreamInfo info, final Context context) {
binding.detailSubChannelTextView.setText(info.getSubChannelName()); binding.detailSubChannelTextView.setText(info.getSubChannelName());
binding.detailSubChannelTextView.setVisibility(View.VISIBLE); binding.detailSubChannelTextView.setVisibility(View.VISIBLE);
binding.detailSubChannelTextView.setSelected(true); binding.detailSubChannelTextView.setSelected(true);
binding.detailSubChannelThumbnailView.setVisibility(View.VISIBLE); binding.detailSubChannelThumbnailView.setVisibility(View.VISIBLE);
final StringBuilder subText = new StringBuilder();
if (!isEmpty(info.getUploaderName())) { if (!isEmpty(info.getUploaderName())) {
binding.detailUploaderTextView.setText( subText.append(
String.format(getString(R.string.video_detail_by), info.getUploaderName())); String.format(getString(R.string.video_detail_by), info.getUploaderName()));
}
if (info.getUploaderSubscriberCount() > -1) {
if (subText.length() > 0) {
subText.append(Localization.DOT_SEPARATOR);
}
subText.append(
Localization.shortSubscriberCount(context, info.getUploaderSubscriberCount()));
}
if (subText.length() > 0) {
binding.detailUploaderTextView.setText(subText);
binding.detailUploaderTextView.setVisibility(View.VISIBLE); binding.detailUploaderTextView.setVisibility(View.VISIBLE);
binding.detailUploaderTextView.setSelected(true); binding.detailUploaderTextView.setSelected(true);
} else { } else {

View File

@ -321,7 +321,6 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_detail_uploader_text_size" android:textSize="@dimen/video_item_detail_uploader_text_size"
android:textStyle="bold"
tools:ignore="RtlHardcoded" tools:ignore="RtlHardcoded"
tools:text="Uploader" /> tools:text="Uploader" />
</LinearLayout> </LinearLayout>

View File

@ -308,7 +308,6 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_detail_uploader_text_size" android:textSize="@dimen/video_item_detail_uploader_text_size"
android:textStyle="bold"
tools:ignore="RtlHardcoded" tools:ignore="RtlHardcoded"
tools:text="Uploader" /> tools:text="Uploader" />