@Override public void onClick(View v) { switch (v.getId()) { case R.id.layout_top_comfirm: if (isOpen) { Intent intent = new Intent(); intent.putExtra("status", isOpen ? "营业中" : "已停业"); setResult(RESULT_OK, intent); finish(); } else { showOffDialog(); } break; case R.id.layout_top_back: finish(); break; case R.id.business_off: isOpen = false; mOpen.setImageVisibility(false); mOff.setImageVisibility(true); break; case R.id.business_open: isOpen = true; mOpen.setImageVisibility(true); mOff.setImageVisibility(false); break; } }
private void initView() { isOpen = getIntent().getBooleanExtra("status", true); mRight = (TextView) findViewById(R.id.layout_top_comfirm); mBack = (ImageView) findViewById(R.id.layout_top_back); mTitle = (TextView) findViewById(R.id.layout_top_title); mOpen = (SelTextView) findViewById(R.id.business_open); mOff = (SelTextView) findViewById(R.id.business_off); mOpen.setmText("营业中"); mOff.setmText("已停业"); mOpen.setImageVisibility(isOpen); mOff.setImageVisibility(!isOpen); mOff.setImageVisibility(false); mOpen.setOnClickListener(this); mOff.setOnClickListener(this); mRight.setOnClickListener(this); mBack.setOnClickListener(this); mTitle.setText("营业状态"); mRight.setText("提交"); }