1.是否有邀请信息红点的设置
class="brush:java;gutter:true;">// 获取当前是否有新的邀请信息 boolean is_notify = SpUtils.getInstace(IMApplication.getGlobalApplication()).getBoolean(SpUtils.IS_INVITE_NOTIY, false); iv_contact_notify.setVisibility(is_notify ? View.VISIBLE : View.GONE);
2.注册联系人邀请信息变化的广播
private BroadcastReceiver InviteChangedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // 显示红点 iv_contact_notify.setVisibility(View.VISIBLE); // 保存红点状态 SpUtils.getInstace(IMApplication.getGlobalApplication()).save(SpUtils.IS_INVITE_NOTIY, true); } };
3.邀请信息条目的点击事件
// 好友邀请的点击事件 ll_contact_invite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 消失红点 iv_contact_notify.setVisibility(View.GONE); // 保存红点状态 SpUtils.getInstace(IMApplication.getGlobalApplication()).save(SpUtils.IS_INVITE_NOTIY, false); // 跳转到邀请信息列表页面 Intent intent = new Intent(getActivity(), InviteAcitivity.class); getActivity().startActivity(intent); } });