You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Category_5/TestSettingActivity.java

107 lines
3.3 KiB

package com.example.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import androidx.appcompat.app.AppCompatActivity;
import com.example.MainActivity;
import com.example.R;
import com.example.StudentLogin;
import butterknife.BindView;
import butterknife.OnClick;
public class TestSettingActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {
RadioButton btn1,btn2;
Button btn3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_setting);
btn1 = (RadioButton) findViewById(R.id.rbtn_num_5);
btn2 = (RadioButton) findViewById(R.id.rbtn_num_10);
btn3 = (Button) findViewById(R.id.btn_start_test);
btn1.setOnCheckedChangeListener(this);
btn2.setOnCheckedChangeListener(this);
btn3.setOnClickListener(this);
}
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
}
@Override
public void onClick(View view) {
Intent intent = new Intent(TestSettingActivity.this, StudentLogin.class);
startActivity(intent);
}
/* // 初始化试题类型
String type = Config.TestType_English;
// 初始化 题目数目
int num = 5;
@Override
int getLayoutId() {
return R.layout.activity_test_setting;
}
@Override
void initView() {
rgTestType.check(R.id.rbtn_enlish);
rgTestNum.check(R.id.rbtn_num_5);
}
@Override
void initListener() {
rgTestType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rbtn_chinise:
type = Config.TestType_Chinese;
break;
case R.id.rbtn_math:
type = Config.TestType_Math;
break;
case R.id.rbtn_enlish:
type = Config.TestType_English;
break;
default:
break;
}
}
});
rgTestNum.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rbtn_num_5:
num = 5;
break;
case R.id.rbtn_num_10:
num = 10;
break;
}
}
});
}
@OnClick(R.id.btn_start_test)
public void onViewClicked() {
Intent intent = new Intent(TestSettingActivity.this, top.vchao.examine.activity.TestAnswerActivity.class);
intent.putExtra("kind", type);
intent.putExtra("num", num + "");
startActivity(intent);
finish();
}*/
}