@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_circle_info); cid = getIntent().getStringExtra("cid"); findViewById(); setListener(); modle = DBUtils.getCircleDetail(cid); imageLoader = CLXApplication.getImageLoader(); options = CLXApplication.getOptions(); if (!Utils.isNetworkAvailable()) { Utils.showToast("请检查网络"); return; } if (modle != null) { isSelf(modle.getCreator()); setvalue( modle.getName(), modle.getLogo(), modle.getDescription(), modle.getMembersTotal() + "", modle.getMembersVerified() + ""); } else { pd = DialogUtil.getWaitDialog(this, "请稍后"); pd.show(); } getServerData(); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.circleLogo: break; case R.id.btnDissolve: PostTask("/circles/idissolve"); type = 2; break; case R.id.btnExit: PostTask("/circles/iquit"); type = 1; break; case R.id.back: Intent it = new Intent(); it.putExtra("flag", false); setResult(1, it); finish(); Utils.rightOut(this); break; case R.id.edit: Intent intent = new Intent(); intent.setClass(this, EditCircleActivity.class); intent.putExtra("cid", cid); // startActivity(intent); startActivityForResult(intent, 2); Utils.leftOutRightIn(this); // finish(); break; default: break; } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 2 && data != null) { boolean flag = data.getBooleanExtra("flag", false); if (flag) { Intent intent = new Intent(); intent.putExtra("flag", flag); setResult(1, intent); finish(); Utils.rightOut(this); } else { String cirName = data.getStringExtra("circleName"); String circleDescriptionStr = data.getStringExtra("circleDescription"); Bitmap bmp = data.getParcelableExtra("cirBmp"); if (bmp != null) { circleLogo.setImageBitmap(bmp); } circleName.setText(cirName); titleName.setText(cirName); circleDescription.setText(circleDescriptionStr); Intent intent = new Intent(); intent.setAction(Constants.UPDECIRNAME); intent.putExtra("cirName", cirName); intent.putExtra("cid", cid); BroadCast.sendBroadCast(this, intent); } } }
private void exitSuccess() { // Home.exitCircle(cid); Intent acIntent = new Intent(); acIntent.setAction(Constants.EXIT_CIRCLE); acIntent.putExtra("cid", cid); BroadCast.sendBroadCast(this, acIntent); Intent intent = new Intent(); intent.putExtra("flag", true); setResult(1, intent); finish(); Utils.rightOut(this); }
@Override public void taskFinish(String result) { pd.dismiss(); try { JSONObject object = new JSONObject(result); int rt = object.getInt("rt"); if (rt != 1) { String errCode = object.getString("err"); Utils.showToast(ErrorCodeUtil.convertToChines(errCode)); return; } if (type == 1) { Utils.showToast("退出圈子成功"); exitSuccess(); } else if (type == 2) { Utils.showToast("解散圈子成功"); exitSuccess(); } } catch (JSONException e) { e.printStackTrace(); } }