Example #1
0
 @Override
 protected void onResume() {
   super.onResume();
   if (MessageCache.getUnreadCount(getContext()) == 0) {
     tv_unreadCount.setVisibility(View.INVISIBLE);
   } else {
     tv_unreadCount.setText(MessageCache.getUnreadCount(getContext()) + "");
     tv_unreadCount.setVisibility(View.VISIBLE);
   }
 }
Example #2
0
 @Override
 public void onReceive(Context context, Intent intent) {
   if (intent.getAction().equals(Constants.Action_Receive_UnreadCount)) { // got unread
     tv_unreadCount.setVisibility(View.INVISIBLE);
     if (MessageCache.getUnreadCount(getContext()) > 0) {
       tv_unreadCount.setText(MessageCache.getUnreadCount(getContext()) + "");
       tv_unreadCount.setVisibility(View.VISIBLE);
     }
   } else if (intent.getAction().equals(Constants.Action_Backgroud_switch)) {
     if (AppInfo.getBackgroudPath(getContext()) != null) {
       iv_backgroud.setImageBitmap(
           BitmapFactory.decodeFile(AppInfo.getBackgroudPath(getContext())));
     }
   } else if (intent.getAction().equals(Constants.Action_User_Login_Out)) {
     closeActivity();
   }
 }