Implement better image selection strategy
This commit is contained in:
parent
a6a7c2271a
commit
4164bf36f6
19 changed files with 161 additions and 89 deletions
|
|
@ -17,7 +17,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfo;
|
|||
import org.schabi.newpipe.util.Localization;
|
||||
|
||||
import java.util.List;
|
||||
import org.schabi.newpipe.util.image.PicassoHelper;
|
||||
import org.schabi.newpipe.util.image.ImageStrategy;
|
||||
|
||||
import icepick.State;
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ public class DescriptionFragment extends BaseDescriptionFragment {
|
|||
addMetadataItem(inflater, layout, true, R.string.metadata_host,
|
||||
streamInfo.getHost());
|
||||
addMetadataItem(inflater, layout, true, R.string.metadata_thumbnail_url,
|
||||
PicassoHelper.choosePreferredImage(streamInfo.getThumbnails()));
|
||||
ImageStrategy.choosePreferredImage(streamInfo.getThumbnails()));
|
||||
}
|
||||
|
||||
private void addPrivacyMetadataItem(final LayoutInflater inflater, final LinearLayout layout) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import org.schabi.newpipe.extractor.stream.Description;
|
|||
import org.schabi.newpipe.fragments.detail.BaseDescriptionFragment;
|
||||
import org.schabi.newpipe.util.DeviceUtils;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
import org.schabi.newpipe.util.image.PicassoHelper;
|
||||
import org.schabi.newpipe.util.image.ImageStrategy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -101,8 +101,8 @@ public class ChannelAboutFragment extends BaseDescriptionFragment {
|
|||
}
|
||||
|
||||
addMetadataItem(inflater, layout, true, R.string.metadata_avatar_url,
|
||||
PicassoHelper.choosePreferredImage(channelInfo.getAvatars()));
|
||||
ImageStrategy.choosePreferredImage(channelInfo.getAvatars()));
|
||||
addMetadataItem(inflater, layout, true, R.string.metadata_banner_url,
|
||||
PicassoHelper.choosePreferredImage(channelInfo.getBanners()));
|
||||
ImageStrategy.choosePreferredImage(channelInfo.getBanners()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import org.schabi.newpipe.util.ExtractorHelper;
|
|||
import org.schabi.newpipe.util.Localization;
|
||||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
import org.schabi.newpipe.util.StateSaver;
|
||||
import org.schabi.newpipe.util.image.ImageStrategy;
|
||||
import org.schabi.newpipe.util.image.PicassoHelper;
|
||||
import org.schabi.newpipe.util.ThemeHelper;
|
||||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
|
|
@ -147,7 +148,7 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
|
||||
setTitle(name);
|
||||
binding.channelTitleView.setText(name);
|
||||
if (!PicassoHelper.shouldLoadImages()) {
|
||||
if (!ImageStrategy.shouldLoadImages()) {
|
||||
// do not waste space for the banner if it is not going to be loaded
|
||||
binding.channelBannerImage.setImageDrawable(null);
|
||||
}
|
||||
|
|
@ -354,7 +355,7 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
channel.setServiceId(info.getServiceId());
|
||||
channel.setUrl(info.getUrl());
|
||||
channel.setData(info.getName(),
|
||||
PicassoHelper.choosePreferredImage(info.getAvatars()),
|
||||
ImageStrategy.choosePreferredImage(info.getAvatars()),
|
||||
info.getDescription(),
|
||||
info.getSubscriberCount());
|
||||
channelSubscription = null;
|
||||
|
|
@ -578,7 +579,7 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
currentInfo = result;
|
||||
setInitialData(result.getServiceId(), result.getOriginalUrl(), result.getName());
|
||||
|
||||
if (PicassoHelper.shouldLoadImages() && !result.getBanners().isEmpty()) {
|
||||
if (ImageStrategy.shouldLoadImages() && !result.getBanners().isEmpty()) {
|
||||
PicassoHelper.loadBanner(result.getBanners()).tag(PICASSO_CHANNEL_TAG)
|
||||
.into(binding.channelBannerImage);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue