Handle case where subscribers count is not available
This commit is contained in:
parent
43674ae80a
commit
07256e2e34
|
@ -33,15 +33,14 @@ import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfo;
|
import org.schabi.newpipe.extractor.channel.ChannelInfo;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
|
||||||
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
||||||
import org.schabi.newpipe.info_list.InfoItemDialog;
|
import org.schabi.newpipe.info_list.InfoItemDialog;
|
||||||
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
||||||
|
import org.schabi.newpipe.local.subscription.SubscriptionService;
|
||||||
import org.schabi.newpipe.player.playqueue.ChannelPlayQueue;
|
import org.schabi.newpipe.player.playqueue.ChannelPlayQueue;
|
||||||
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
||||||
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
|
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.local.subscription.SubscriptionService;
|
|
||||||
import org.schabi.newpipe.util.AnimationUtils;
|
import org.schabi.newpipe.util.AnimationUtils;
|
||||||
import org.schabi.newpipe.util.ExtractorHelper;
|
import org.schabi.newpipe.util.ExtractorHelper;
|
||||||
import org.schabi.newpipe.util.ImageDisplayConstants;
|
import org.schabi.newpipe.util.ImageDisplayConstants;
|
||||||
|
@ -422,10 +421,12 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
imageLoader.displayImage(result.getAvatarUrl(), headerAvatarView,
|
imageLoader.displayImage(result.getAvatarUrl(), headerAvatarView,
|
||||||
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
|
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
|
||||||
|
|
||||||
if (result.getSubscriberCount() != -1) {
|
|
||||||
headerSubscribersTextView.setText(Localization.localizeSubscribersCount(activity, result.getSubscriberCount()));
|
|
||||||
headerSubscribersTextView.setVisibility(View.VISIBLE);
|
headerSubscribersTextView.setVisibility(View.VISIBLE);
|
||||||
} else headerSubscribersTextView.setVisibility(View.GONE);
|
if (result.getSubscriberCount() >= 0) {
|
||||||
|
headerSubscribersTextView.setText(Localization.localizeSubscribersCount(activity, result.getSubscriberCount()));
|
||||||
|
} else {
|
||||||
|
headerSubscribersTextView.setText(R.string.subscribers_count_not_available);
|
||||||
|
}
|
||||||
|
|
||||||
if (menuRssButton != null) menuRssButton.setVisible(!TextUtils.isEmpty(result.getFeedUrl()));
|
if (menuRssButton != null) menuRssButton.setVisible(!TextUtils.isEmpty(result.getFeedUrl()));
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
android:layout_below="@+id/channel_title_view"
|
android:layout_below="@+id/channel_title_view"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="left|center"
|
android:gravity="left|center"
|
||||||
android:lines="1"
|
android:maxLines="2"
|
||||||
android:textSize="@dimen/channel_subscribers_text_size"
|
android:textSize="@dimen/channel_subscribers_text_size"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:ignore="RtlHardcoded"
|
tools:ignore="RtlHardcoded"
|
||||||
|
|
|
@ -249,6 +249,7 @@
|
||||||
<item quantity="one">%s subscriber</item>
|
<item quantity="one">%s subscriber</item>
|
||||||
<item quantity="other">%s subscribers</item>
|
<item quantity="other">%s subscribers</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
<string name="subscribers_count_not_available">Subscribers count not available</string>
|
||||||
|
|
||||||
<string name="no_views">No views</string>
|
<string name="no_views">No views</string>
|
||||||
<plurals name="views">
|
<plurals name="views">
|
||||||
|
|
Loading…
Reference in New Issue