/** * init all sub view of layout,and set buttons listener * * @date 2015-2-10 pm 6:01:04 * @param v */ private void initViews(View v) { // init view mbtnPass = (Button) v.findViewById(R.id.btn_tp_pass); mbtnFail = (Button) v.findViewById(R.id.btn_tp_fail); mTPView = (TouchPanelView) v.findViewById(R.id.tp_area); mTPView = (TouchPanelView) v.findViewById(R.id.tp_area); mbtnPass.setVisibility(View.INVISIBLE); // set listeners mbtnFail.setOnClickListener(this); mbtnPass.setOnClickListener(this); mTPView.setTouchPanel(this); }
/* * click pass or fail button to finish cunrrent test */ @Override public void onClick(View v) { switch (v.getId()) { /** click pass to set Test result pass */ case R.id.btn_tp_pass: setResult(TestResult.Pass); ItemTestActivity.itemActivity.finish(); mTPView.stepToFinish(); break; /** click pass to set Test result fail */ case R.id.btn_tp_fail: setResult(TestResult.Fail); ItemTestActivity.itemActivity.finish(); break; default: break; } }