@Override protected void onDestroy() { MyApplication.removeAct(this); super.onDestroy(); if (popup != null && popup.isShowing()) { popup.dismiss(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (user == null) { user = new User(); } popup = new PopupWindow(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); // 若popup未设置Backgroud会导致在点击其它地方时popup不自动收起 popup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); popup.setFocusable(true); MyApplication.addAct(this); }
@Override protected void onResume() { super.onResume(); if (!CacheUtil.isInit()) { CacheUtil.initCache(context); } drawer = new SimpleSideDrawer(this); drawer.setLeftBehindContentView(R.layout.left); name = (TextView) drawer.findViewById(R.id.name); role = (TextView) drawer.findViewById(R.id.role); company = (TextView) drawer.findViewById(R.id.company); change_pwd = (LinearLayout) drawer.findViewById(R.id.change_pwd); system_config = (LinearLayout) drawer.findViewById(R.id.system_config); quit = (TextView) drawer.findViewById(R.id.quit); quit.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { BaseActivity.this.finish(); } }); if (user != null) { name.setText(user.getUser()); role.setText(user.getRole()); company.setText(user.getCompany()); change_pwd.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(BaseActivity.this, ChangePwd.class); startActivity(intent); } }); system_config.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(BaseActivity.this, SystemConfig.class); startActivity(intent); } }); } }