mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2026-05-16 04:52:39 +02:00
Subgroup sub image url, ImageVariable default error icon on fail to load
This commit is contained in:
+2
@@ -256,6 +256,8 @@ class SubscriptionGroupFragment : MainFragment() {
|
|||||||
val sub = StateSubscriptions.instance.getSubscription(sub) ?: StateSubscriptions.instance.getSubscriptionOther(sub);
|
val sub = StateSubscriptions.instance.getSubscription(sub) ?: StateSubscriptions.instance.getSubscriptionOther(sub);
|
||||||
if(sub != null && sub.channel.thumbnail != null) {
|
if(sub != null && sub.channel.thumbnail != null) {
|
||||||
g.image = ImageVariable.fromUrl(sub.channel.thumbnail!!);
|
g.image = ImageVariable.fromUrl(sub.channel.thumbnail!!);
|
||||||
|
if(g.image != null)
|
||||||
|
g.image!!.subscriptionUrl = sub.channel.url;
|
||||||
g.image?.setImageView(_imageGroup);
|
g.image?.setImageView(_imageGroup);
|
||||||
g.image?.setImageView(_imageGroupBackground);
|
g.image?.setImageView(_imageGroupBackground);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.widget.ImageView
|
|||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.futo.platformplayer.PresetImages
|
import com.futo.platformplayer.PresetImages
|
||||||
import com.futo.platformplayer.R
|
import com.futo.platformplayer.R
|
||||||
|
import com.futo.platformplayer.logging.Logger
|
||||||
import kotlinx.serialization.Contextual
|
import kotlinx.serialization.Contextual
|
||||||
import kotlinx.serialization.Transient
|
import kotlinx.serialization.Transient
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -18,7 +19,8 @@ data class ImageVariable(
|
|||||||
@Transient
|
@Transient
|
||||||
@Contextual
|
@Contextual
|
||||||
private val bitmap: Bitmap? = null,
|
private val bitmap: Bitmap? = null,
|
||||||
val presetName: String? = null) {
|
val presetName: String? = null,
|
||||||
|
var subscriptionUrl: String? = null) {
|
||||||
|
|
||||||
@SuppressLint("DiscouragedApi")
|
@SuppressLint("DiscouragedApi")
|
||||||
fun setImageView(imageView: ImageView, fallbackResId: Int = -1) {
|
fun setImageView(imageView: ImageView, fallbackResId: Int = -1) {
|
||||||
@@ -63,7 +65,13 @@ data class ImageVariable(
|
|||||||
return ImageVariable(null, null, null, str);
|
return ImageVariable(null, null, null, str);
|
||||||
}
|
}
|
||||||
fun fromFile(file: File): ImageVariable {
|
fun fromFile(file: File): ImageVariable {
|
||||||
return ImageVariable.fromBitmap(BitmapFactory.decodeFile(file.absolutePath));
|
try {
|
||||||
|
return ImageVariable.fromBitmap(BitmapFactory.decodeFile(file.absolutePath));
|
||||||
|
}
|
||||||
|
catch(ex: Throwable) {
|
||||||
|
Logger.e("ImageVariable", "Unsupported image format? " + ex.message, ex);
|
||||||
|
return fromResource(R.drawable.ic_error_pred);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Submodule app/src/stable/assets/sources/spotify updated: 0d05e35cfc...9c36c45746
Submodule app/src/stable/assets/sources/youtube updated: 857c147b3a...6e0fe92451
Submodule app/src/unstable/assets/sources/spotify updated: 0d05e35cfc...9c36c45746
Submodule app/src/unstable/assets/sources/youtube updated: 857c147b3a...6e0fe92451
+1
-1
Submodule dep/polycentricandroid updated: 44edd69ece...f87f00ab9e
Reference in New Issue
Block a user