package com.netease.nim.uikit.session.viewholder;
import android.text.method.LinkMovementMethod;
import android.text.style.ImageSpan;
import android.widget.TextView;
import com.netease.nim.uikit.R;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nim.uikit.session.emoji.MoonUtil;
import com.netease.nim.uikit.session.helper.TeamNotificationHelper;
public class MsgViewHolderNotification extends MsgViewHolderBase {
public MsgViewHolderNotification(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
protected TextView notificationTextView;
@Override
protected int getContentResId() {
return R.layout.nim_message_item_notification;
}
@Override
protected void inflateContentView() {
notificationTextView = (TextView) view.findViewById(R.id.message_item_notification_label);
}
@Override
protected void bindContentView() {
handleTextNotification(getDisplayText());
}
protected String getDisplayText() {
return TeamNotificationHelper.getTeamNotificationText(message, message.getSessionId());
}
private void handleTextNotification(String text) {
MoonUtil.identifyFaceExpressionAndATags(context, notificationTextView, text, ImageSpan.ALIGN_BOTTOM);
notificationTextView.setMovementMethod(LinkMovementMethod.getInstance());
}
@Override
protected boolean isMiddleItem() {
return true;
}
}