@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); mLiveChatManager = LiveChatManager.getInstance(); mLiveChatManager.RegisterMagicIconListener(this); mMagicIconConfig = mLiveChatManager.GetMagicIconConfigItem(); if (mMagicIconConfig == null) { // 本地无配置,调用接口获取或更新 mProgress.setVisibility(View.VISIBLE); mLiveChatManager.GetMagicIconConfig(); } else { updateView(); } }
@Override protected void handleUiMessage(Message msg) { // TODO Auto-generated method stub super.handleUiMessage(msg); switch (msg.what) { case GET_MAGICICON_CALLBACK: mProgress.setVisibility(View.GONE); if (msg.arg1 == 1) { // 小高表请求成功 MagicIconConfig item = (MagicIconConfig) msg.obj; if (item != null) { if (mMagicIconConfig == null) { // 本地无数据或者数据更新时,刷新界面 mMagicIconConfig = mLiveChatManager.GetMagicIconConfigItem(); updateView(); } } } break; default: break; } }
@Override public void onDetach() { // TODO Auto-generated method stub super.onDetach(); mLiveChatManager.UnregisterMagicIconListener(this); }