Skip to content

Commit

Permalink
Merge pull request #9173 from Theta-Dev/video-sub-count
Browse files Browse the repository at this point in the history
Show subscriber count on video details page
  • Loading branch information
Stypox authored Dec 4, 2022
2 parents 3bb5187 + 0df6967 commit a6f57a8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1561,9 +1561,9 @@ public void handleResult(@NonNull final StreamInfo info) {
binding.detailSubChannelThumbnailView.setVisibility(View.GONE);

if (!isEmpty(info.getSubChannelName())) {
displayBothUploaderAndSubChannel(info);
displayBothUploaderAndSubChannel(info, activity);
} else if (!isEmpty(info.getUploaderName())) {
displayUploaderAsSubChannel(info);
displayUploaderAsSubChannel(info, activity);
} else {
binding.detailUploaderTextView.setVisibility(View.GONE);
binding.detailUploaderThumbnailView.setVisibility(View.GONE);
Expand Down Expand Up @@ -1676,23 +1676,42 @@ public void handleResult(@NonNull final StreamInfo info) {
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.setVisibility(View.VISIBLE);
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.setVisibility(View.VISIBLE);
binding.detailSubChannelTextView.setSelected(true);

binding.detailSubChannelThumbnailView.setVisibility(View.VISIBLE);

final StringBuilder subText = new StringBuilder();
if (!isEmpty(info.getUploaderName())) {
binding.detailUploaderTextView.setText(
subText.append(
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.setSelected(true);
} else {
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout-large-land/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,7 @@
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_detail_uploader_text_size"
android:textStyle="bold"
tools:ignore="RtlHardcoded"
tools:text="Uploader" />
</LinearLayout>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,7 @@
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_detail_uploader_text_size"
android:textStyle="bold"
tools:ignore="RtlHardcoded"
tools:text="Uploader" />

Expand Down

0 comments on commit a6f57a8

Please sign in to comment.