Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/stfalcon-studio/ChatKit i…
Browse files Browse the repository at this point in the history
…nto v0.3.2
  • Loading branch information
bevzaanton committed Sep 28, 2018
2 parents 3a10017 + 70d935b commit e3bcc47
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,37 @@ MessageHolders registerContentType(
return this;
}

/**
* Registers custom content type (e.g. multimedia, events etc.)
*
* @param type unique id for content type
* @param incomingHolder holder class for incoming message
* @param outcomingHolder holder class for outcoming message
* @param incomingPayload payload for incoming message
* @param outcomingPayload payload for outcoming message
* @param incomingLayout layout resource for incoming message
* @param outcomingLayout layout resource for outcoming message
* @param contentChecker {@link MessageHolders.ContentChecker} for registered type
* @return {@link MessageHolders} for subsequent configuration.
*/
public <TYPE extends MessageContentType>
MessageHolders registerContentType(
byte type,
@NonNull Class<? extends MessageHolders.BaseMessageViewHolder<TYPE>> incomingHolder, Object incomingPayload, @LayoutRes int incomingLayout,
@NonNull Class<? extends MessageHolders.BaseMessageViewHolder<TYPE>> outcomingHolder, Object outcomingPayload, @LayoutRes int outcomingLayout,
@NonNull MessageHolders.ContentChecker contentChecker) {

if (type == 0)
throw new IllegalArgumentException("content type must be greater or less than '0'!");

customContentTypes.add(
new MessageHolders.ContentTypeConfig<>(type,
new MessageHolders.HolderConfig<>(incomingHolder, incomingLayout, incomingPayload),
new MessageHolders.HolderConfig<>(outcomingHolder, outcomingLayout, outcomingPayload)));
this.contentChecker = contentChecker;
return this;
}

/*
* INTERFACES
* */
Expand Down

0 comments on commit e3bcc47

Please sign in to comment.