private void initUI() { mAvatorIV = (ImageView) findViewById(R.id.splash_logo_image); mAvatorIV.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if (Config.getIsLogin(mContext)) { // 如果是登录状态中则点击退出登录 Config.setIsLogin(mContext, false); Config.setNickName(mContext, null); File file = new File(AppConstants.AVATOR_PATH); file.deleteOnExit(); mAvatorIV.setImageResource(R.drawable.login_logo); mNameTV.setText(""); setLoginLayout(); } } }); mTitleTV = (TextView) findViewById(R.id.middle_title); mTitleTV.setText("用户信息"); mNameTV = (TextView) findViewById(R.id.nickname); if (Config.getIsLogin(mContext)) { mAvator = Utility.toRoundBitmap(BitmapFactory.decodeFile(AppConstants.AVATOR_PATH)); mAvatorIV.setImageBitmap(mAvator); mNameTV.setText(Config.getNickName(mContext)); } mSettingBtn = (RelativeLayout) findViewById(R.id.setting); mAboutBtn = (RelativeLayout) findViewById(R.id.about); setLoginLayout(); }
@Override public void onTaskFinish(ITask task, InputStream is) { // TODO Auto-generated method stub Utility.saveFile(is, AppConstants.AVATOR_PATH); Bitmap temp = BitmapFactory.decodeFile(AppConstants.AVATOR_PATH); mAvator = Utility.toRoundBitmap(temp); temp.recycle(); temp = null; mHandler.sendEmptyMessage(AppConstants.MsgType.LOGIN_SUCCESS); }