Created
October 11, 2017 05:34
-
-
Save fauzisho/4fd7e7cbaa34fa7cfeb21289e2b63974 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected int getItemViewTypeCustomMessage(QiscusComment qiscusComment, int position) { | |
try { | |
JSONObject payload = new JSONObject(qiscusComment.getExtraPayload()); | |
if (payload.optString("type").equals("survey")) { | |
return qiscusComment.getSenderEmail().equals(qiscusAccount.getEmail()) ? TYPE_SURVEY : TYPE_SURVEY_OTHERS; | |
} | |
} catch (JSONException ignored) { | |
} | |
return super.getItemViewTypeCustomMessage(qiscusComment, position); | |
} | |
@Override | |
protected int getItemResourceLayout(int viewType) { | |
switch (viewType) { | |
case TYPE_SURVEY: | |
return R.layout.item_message_survey; | |
case TYPE_SURVEY_OTHERS: | |
return R.layout.item_message_survey; | |
default: | |
return super.getItemResourceLayout(viewType); | |
} | |
} | |
@Override | |
public QiscusBaseMessageViewHolder<QiscusComment> onCreateViewHolder(ViewGroup parent, int viewType) { | |
switch (viewType) { | |
case TYPE_SURVEY: | |
case TYPE_SURVEY_OTHERS: | |
return new BubbleMessageViewHolder(getView(parent, viewType), itemClickListener, longItemClickListener,context); | |
default: | |
return super.onCreateViewHolder(parent, viewType); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment