@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tribe_home_activity); receiver = new upDateUnReadCountReceiver(); IntentFilter filter = new IntentFilter(TribeConstant.UNREAD_MSG_COUNT); this.registerReceiver(receiver, filter); addRecoder("兴趣部落"); init(); }
@Override protected void setDataForView(AbstractRequest request) { super.setDataForView(request); if (request instanceof TribeUnReadNumRequest) { TribeUnReadNumRequest numRequest = (TribeUnReadNumRequest) request; if (numRequest.errorCode.equals("1")) { tvCount.setText(numRequest.errorInfo); if (numRequest.errorInfo.equals("0")) { tvCount.setVisibility(View.GONE); } else { tvCount.setVisibility(View.VISIBLE); } } } }
@Override public void onClick(View v) { if (v == ivBack) { super.onBackPressed(); } else if (v == tvSearch) { Intent intent = new Intent(TribeHomeActivity.this, TribeSearchActivity.class); startActivity(intent); } else if (v == ivPersonal) { Intent intent = new Intent(this, TribePersonalCenterActivity.class); intent.putExtra( TribePersonalCenterActivity.USER_ACCOUNT, ConstantPool.getInstance().USER_ACCOUNT); startActivity(intent); } else if (v == ivMessage) { Intent intent = new Intent(TribeHomeActivity.this, TribeMyMsgActivity.class); startActivity(intent); } }
@Override protected void onDestroy() { super.onDestroy(); this.unregisterReceiver(receiver); }