Separate imageListToDbUrl from choosePreferredImage
imageListToDbUrl should be used if the URL is going to be saved to the database, to avoid saving nothing in case at the moment of saving the user preference is to not show images.
This commit is contained in:
parent
37af2c87e8
commit
87dca0f7ec
9 changed files with 96 additions and 40 deletions
|
|
@ -61,7 +61,6 @@ import org.schabi.newpipe.util.OnClickGesture
|
|||
import org.schabi.newpipe.util.ServiceHelper
|
||||
import org.schabi.newpipe.util.ThemeHelper.getGridSpanCountChannels
|
||||
import org.schabi.newpipe.util.external_communication.ShareUtils
|
||||
import org.schabi.newpipe.util.image.ImageStrategy
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
|
@ -342,8 +341,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
|||
val actions = DialogInterface.OnClickListener { _, i ->
|
||||
when (i) {
|
||||
0 -> ShareUtils.shareText(
|
||||
requireContext(), selectedItem.name, selectedItem.url,
|
||||
ImageStrategy.choosePreferredImage(selectedItem.thumbnails)
|
||||
requireContext(), selectedItem.name, selectedItem.url, selectedItem.thumbnails
|
||||
)
|
||||
1 -> ShareUtils.openUrlInBrowser(requireContext(), selectedItem.url)
|
||||
2 -> deleteChannel(selectedItem)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class SubscriptionManager(context: Context) {
|
|||
Completable.fromRunnable {
|
||||
it.setData(
|
||||
info.name,
|
||||
ImageStrategy.choosePreferredImage(info.avatars),
|
||||
ImageStrategy.imageListToDbUrl(info.avatars),
|
||||
info.description,
|
||||
info.subscriberCount
|
||||
)
|
||||
|
|
@ -105,7 +105,7 @@ class SubscriptionManager(context: Context) {
|
|||
} else if (info is ChannelInfo) {
|
||||
subscriptionEntity.setData(
|
||||
info.name,
|
||||
ImageStrategy.choosePreferredImage(info.avatars),
|
||||
ImageStrategy.imageListToDbUrl(info.avatars),
|
||||
info.description,
|
||||
info.subscriberCount
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue