Package 

Class Avatar

  • All Implemented Interfaces:

    
    public final class Avatar
    
                        

    A data transfer model for transferring image data to AvatarFetcher. This model will be fetched by AvatarFetcher when we request image loading by using this type to Coil.

    The default supported data types are:

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Avatar(List<Object> data, Integer maxSectionSize, Integer avatarBorderWidth, Drawable errorPlaceholder, Function2<ImageRequest, SuccessResult, Unit> onSuccess, Function2<ImageRequest, ErrorResult, Unit> onError)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final List<Object> getData() A list of data to be requested.
      final Integer getMaxSectionSize() The maximum size of the sections.
      final Integer getAvatarBorderWidth() The border width of AvatarView.
      final Drawable getErrorPlaceholder() An error placeholder that should be shown when request failed.
      final Function2<ImageRequest, SuccessResult, Unit> getOnSuccess() A lambda function will be executed when loading succeeds.
      final Function2<ImageRequest, ErrorResult, Unit> getOnError() A lambda function will be executed when loading failed.
      final <T extends Any> Unit setTagIfAbsent(String key, T newValue) Sets a tag associated with this avatar and a key.
      final <T extends Any> T getTag(String key) Returns the tag associated with this avatar using the given key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Avatar

        Avatar(List<Object> data, Integer maxSectionSize, Integer avatarBorderWidth, Drawable errorPlaceholder, Function2<ImageRequest, SuccessResult, Unit> onSuccess, Function2<ImageRequest, ErrorResult, Unit> onError)
    • Method Detail

      • getOnSuccess

         final Function2<ImageRequest, SuccessResult, Unit> getOnSuccess()

        A lambda function will be executed when loading succeeds.

      • getOnError

         final Function2<ImageRequest, ErrorResult, Unit> getOnError()

        A lambda function will be executed when loading failed.

      • setTagIfAbsent

         final <T extends Any> Unit setTagIfAbsent(String key, T newValue)

        Sets a tag associated with this avatar and a key. If the given newValue was already set for the given key, this calls do nothing, the given newValue would be ignored.

        Parameters:
        key - A new key to set a tag associated with this avatar.
        newValue - A new value to be set on the bag.
      • getTag

         final <T extends Any> T getTag(String key)

        Returns the tag associated with this avatar using the given key.

        Parameters:
        key - A new key to get a tag associated with this avatar.