private void initDrawerView() { if (User.isLogin(getApplicationContext())) { drawerHeaderViewHolder.tvPhone.setText(User.getUserAccount(getApplicationContext())); drawerHeaderViewHolder.llHasLogin.setVisibility(View.VISIBLE); drawerHeaderViewHolder.llNotLogin.setVisibility(View.GONE); } else { drawerHeaderViewHolder.llNotLogin.setVisibility(View.VISIBLE); drawerHeaderViewHolder.llHasLogin.setVisibility(View.GONE); } Glide.with(this) .load(R.drawable.user) .override(150, 150) .into(drawerHeaderViewHolder.ivProfile); drawerHeaderViewHolder.btnLogin.setOnClickListener(this); drawerHeaderViewHolder.btnLogout.setOnClickListener(this); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.me_btn_login: drawerLayout.closeDrawers(); new Handler() .postDelayed( new Runnable() { @Override public void run() { AccountActivity.requestLogin(BaseDrawerActivity.this, new int[] {0, 0}); } }, NAVDRAWER_LAUNCH_DELAY); break; case R.id.me_btn_logout: User.deleteUserInfo(getApplicationContext()); animateLogout(); break; } }