ChannelLogoUtils
@WorkerThread
public class ChannelLogoUtils
A utility class for conveniently storing and loading channel logos.
Summary
Public constructors |
|---|
|
This method is deprecated. This type should not be instantiated as it contains only static methods. |
Public methods |
|
|---|---|
static @Nullable Bitmap |
@WorkerThreadA convenient helper method to get the channel logo associated to the given channel ID from the system content provider. |
static boolean |
@WorkerThreadStores the given channel logo |
static boolean |
storeChannelLogo(Stores channel logo in the system content provider from the given URI. |
Public constructors
Public methods
loadChannelLogo
@WorkerThread
public static @Nullable Bitmap loadChannelLogo(@NonNull Context context, long channelId)
A convenient helper method to get the channel logo associated to the given channel ID from the system content provider.
| Parameters | |
|---|---|
@NonNull Context context |
the context used to access the system content provider |
long channelId |
the ID of the channel whose logo is supposed to be loaded |
| See also | |
|---|---|
storeChannelLogo |
|
storeChannelLogo |
storeChannelLogo
@WorkerThread
public static boolean storeChannelLogo(
@NonNull Context context,
long channelId,
@NonNull Bitmap logo
)
Stores the given channel logo Bitmap in the system content provider and associate it with the given channel ID.
| Parameters | |
|---|---|
@NonNull Context context |
the context used to access the system content provider |
long channelId |
the ID of the target channel with which the given logo should be associated |
@NonNull Bitmap logo |
the logo image to be stored |
| Returns | |
|---|---|
boolean |
|
| See also | |
|---|---|
loadChannelLogo |
storeChannelLogo
public static boolean storeChannelLogo(
@NonNull Context context,
long channelId,
@NonNull Uri logoUri
)
Stores channel logo in the system content provider from the given URI. The method will try to fetch the image file and decode it into Bitmap. Once the image is successfully fetched, it will be stored in the system content provider and associated with the given channel ID.
The URI provided to this method can be a URL referring to a image file residing in some remote site/server, or a URI in one of the following formats:
- content (
SCHEME_CONTENT) - android.resource (
#SCHEME_ANDROID_RESOURCE) - file (
SCHEME_FILE)
This method should be run in a worker thread since it may require network connection, which will raise an exception if it's running in the main thread.
| Parameters | |
|---|---|
@NonNull Context context |
the context used to access the system content provider |
long channelId |
the ID of the target channel with which the fetched logo should be associated |
@NonNull Uri logoUri |
the |
| Returns | |
|---|---|
boolean |
|
| See also | |
|---|---|
loadChannelLogo |