Skip to content

Commit

Permalink
do not show invalid notification message
Browse files Browse the repository at this point in the history
  • Loading branch information
imndx committed Apr 3, 2019
1 parent bae3709 commit 55b0ea0
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.Bind;
import cn.wildfire.chat.kit.annotation.LayoutRes;
import cn.wildfire.chat.kit.annotation.MessageContentType;
import cn.wildfire.chat.kit.conversation.message.model.UiMessage;
import cn.wildfirechat.chat.R;
import cn.wildfirechat.message.notification.RecallMessageContent;
import cn.wildfirechat.message.notification.AddGroupMemberNotificationContent;
import cn.wildfirechat.message.notification.ChangeGroupNameNotificationContent;
import cn.wildfirechat.message.notification.ChangeGroupPortraitNotificationContent;
Expand All @@ -21,6 +19,7 @@
import cn.wildfirechat.message.notification.ModifyGroupAliasNotificationContent;
import cn.wildfirechat.message.notification.NotificationMessageContent;
import cn.wildfirechat.message.notification.QuitGroupNotificationContent;
import cn.wildfirechat.message.notification.RecallMessageContent;
import cn.wildfirechat.message.notification.TipNotificationContent;
import cn.wildfirechat.message.notification.TransferGroupOwnerNotificationContent;

Expand All @@ -47,7 +46,6 @@
*/
public class SimpleNotificationMessageContentViewHolder extends MessageContentViewHolder {

@Nullable
@Bind(R.id.notificationTextView)
TextView notificationTextView;

Expand All @@ -67,7 +65,11 @@ public boolean contextMenuItemFilter(UiMessage uiMessage, String tag) {
}

protected void onBind(UiMessage message) {
String notification = ((NotificationMessageContent) message.message.content).formatNotification();
notificationTextView.setText(notification);
try {
String notification = ((NotificationMessageContent) message.message.content).formatNotification();
notificationTextView.setText(notification);
} catch (Exception e) {
e.printStackTrace();
}
}
}

0 comments on commit 55b0ea0

Please sign in to comment.