|
|
package com.hh.xuetubao.activity.pratice;
|
|
|
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.RequiresApi;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.view.WindowManager;
|
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.GridView;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.ListView;
|
|
|
import android.widget.PopupWindow;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
import com.hh.xuetubao.R;
|
|
|
import com.hh.xuetubao.Utils.SharedPrefrenceUtils;
|
|
|
import com.hh.xuetubao.adapter.AnswerSheetGridAdapter;
|
|
|
import com.hh.xuetubao.adapter.ListAnswerAdapter;
|
|
|
import com.hh.xuetubao.bean.AnswerBean;
|
|
|
import com.hh.xuetubao.model.ExerciseModel;
|
|
|
import com.hh.xuetubao.mvp.BaseMvpActivity;
|
|
|
import com.hh.xuetubao.mvp.CommonPresenter;
|
|
|
import com.hh.xuetubao.mvp.ICommonView;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
|
|
|
/**
|
|
|
* 模拟练习页面
|
|
|
*/
|
|
|
public class c extends BaseMvpActivity<CommonPresenter, ExerciseModel> implements ICommonView, View.OnClickListener {
|
|
|
|
|
|
|
|
|
@BindView(R.id.list_answer)
|
|
|
ListView listAnswer;
|
|
|
@BindView(R.id.tv_radio)
|
|
|
TextView tvRadio;
|
|
|
@BindView(R.id.tv_max)
|
|
|
TextView tvMax;
|
|
|
@BindView(R.id.tv_current)
|
|
|
TextView tvCurrent;
|
|
|
@BindView(R.id.tv_title)
|
|
|
TextView tvTitle;
|
|
|
@BindView(R.id.tv_topic)
|
|
|
TextView tvTopic;
|
|
|
@BindView(R.id.rl_last)
|
|
|
RelativeLayout rlLast;
|
|
|
@BindView(R.id.rl_next)
|
|
|
RelativeLayout rlNext;
|
|
|
@BindView(R.id.index)
|
|
|
TextView index;
|
|
|
@BindView(R.id.all)
|
|
|
TextView all;
|
|
|
@BindView(R.id.tv_right_num)
|
|
|
TextView tvRightNum;
|
|
|
@BindView(R.id.tv_wrong_num)
|
|
|
TextView tvWrongNum;
|
|
|
@BindView(R.id.lin_tab)
|
|
|
LinearLayout linTab;
|
|
|
@BindView(R.id.rl_card)
|
|
|
RelativeLayout rlCard;
|
|
|
@BindView(R.id.right_select)
|
|
|
TextView rightSelect;
|
|
|
@BindView(R.id.right_answer)
|
|
|
TextView rightAnswerText;
|
|
|
@BindView(R.id.rl_answer)
|
|
|
RelativeLayout rlAnswer;
|
|
|
@BindView(R.id.commit)
|
|
|
LinearLayout commit;
|
|
|
@BindView(R.id.tv2)
|
|
|
TextView tv2;
|
|
|
@BindView(R.id.tv_show_card)
|
|
|
TextView tvShowCard;
|
|
|
|
|
|
|
|
|
private String catalogOid;
|
|
|
private String accountOid;
|
|
|
private int listIndex = 0; //数据下标
|
|
|
private String type;//题目类型
|
|
|
private boolean isClickAble = true;//是否能选择多条目
|
|
|
private String rightAnswer;//当前题目正确答案
|
|
|
private int rightCount;//答对题的数量
|
|
|
private int wrongCount;//答错题的数量
|
|
|
private List<AnswerBean.QuestionLstBean> questionLst = new ArrayList<>();//创建集合存储这一套题
|
|
|
private ListAnswerAdapter optionsAdapter;
|
|
|
private String selectAnswer = "";
|
|
|
private AnswerSheetGridAdapter sheetGridAdapter;
|
|
|
private PopupWindow popupWindow;
|
|
|
private List<Integer> statusList = new ArrayList<>();//保存答题结果 0:未答题 1:答对 2:答错
|
|
|
private List<Integer> integerList = new ArrayList<>();// 存放 1或者2 用来判断多选题 是否答对
|
|
|
private List<String> stringList = new ArrayList<>();//用来存放多选题选择的答案
|
|
|
private List<String> historyAnswer = new ArrayList<>();//存放历史选择的答案
|
|
|
private boolean isRight;
|
|
|
private int unDone;//未完成的题
|
|
|
private int danxuanCount;
|
|
|
private int duoxuanCount;
|
|
|
private int panduanCount;
|
|
|
private int danxuanWrong;
|
|
|
private int panduanWrong;
|
|
|
private int duoxuanWrong;
|
|
|
private double totalScore;
|
|
|
private double danxuan;
|
|
|
private double duoxuan;
|
|
|
private double panduan;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
|
|
|
accountOid = SharedPrefrenceUtils.getString(this, "AccountOid");
|
|
|
catalogOid = getIntent().getStringExtra("catalogOid");
|
|
|
|
|
|
rlLast.setOnClickListener(this);
|
|
|
rlNext.setOnClickListener(this);
|
|
|
linTab.setOnClickListener(this);
|
|
|
rlCard.setOnClickListener(this);
|
|
|
commit.setOnClickListener(this);
|
|
|
tvShowCard.setOnClickListener(this);
|
|
|
|
|
|
tvShowCard.setText("查看答案");
|
|
|
|
|
|
listAnswer.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
ImageView wrong = (ImageView) view.findViewById(R.id.img_wrong);
|
|
|
ImageView right = (ImageView) view.findViewById(R.id.img_right);
|
|
|
TextView option = (TextView) view.findViewById(R.id.option);
|
|
|
TextView text = (TextView) view.findViewById(R.id.text);
|
|
|
|
|
|
Log.e("zhangtao:trueType", type);
|
|
|
if (type.contains("单选") || type.contains("判断")) {
|
|
|
//单选· 多选 选择答案 设置为单选
|
|
|
if (isClickAble) {
|
|
|
isClickAble = false;
|
|
|
|
|
|
try {
|
|
|
if (position == 0) {
|
|
|
selectAnswer = "A";
|
|
|
} else if (position == 1) {
|
|
|
selectAnswer = "B";
|
|
|
} else if (position == 2) {
|
|
|
selectAnswer = "C";
|
|
|
} else if (position == 3) {
|
|
|
selectAnswer = "D";
|
|
|
} else if (position == 4) {
|
|
|
selectAnswer = "E";
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
Log.e("xuetubao:", e.toString());
|
|
|
}
|
|
|
|
|
|
//判断 单选题 是否答对
|
|
|
if (rightAnswer.contains(selectAnswer)) {
|
|
|
text.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
option.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
|
|
|
rightCount++;
|
|
|
tvRightNum.setText(String.valueOf(rightCount));
|
|
|
statusList.set(listIndex, 1);
|
|
|
sheetGridAdapter.notifyDataSetChanged();
|
|
|
|
|
|
if (type.contains("单选")) {
|
|
|
totalScore += danxuan;
|
|
|
} else if (type.contains("判断")) {
|
|
|
totalScore += panduan;
|
|
|
}
|
|
|
|
|
|
String questionOid = questionLst.get(position).getQuestionOid();
|
|
|
mPresenter.getPresenter(7, 2, accountOid, questionOid, String.valueOf(1), catalogOid);
|
|
|
|
|
|
} else if (!rightAnswer.contains(selectAnswer)) {
|
|
|
|
|
|
wrongCount++;
|
|
|
tvWrongNum.setText(String.valueOf(wrongCount));
|
|
|
|
|
|
statusList.set(listIndex, 2);
|
|
|
sheetGridAdapter.notifyDataSetChanged();
|
|
|
|
|
|
String questionOid = questionLst.get(position).getQuestionOid();
|
|
|
mPresenter.getPresenter(4, 2, accountOid, questionOid, String.valueOf(1), catalogOid);
|
|
|
|
|
|
text.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
option.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
|
|
|
if (type.contains("单选")) {
|
|
|
danxuanWrong++;
|
|
|
} else if (type.contains("判断")) {
|
|
|
panduanWrong++;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else if (type.contains("多选")) {
|
|
|
//多选题 选择答案 不用设置为单选
|
|
|
if (isClickAble) {
|
|
|
try {
|
|
|
if (position == 0) {
|
|
|
selectAnswer += "A";
|
|
|
stringList.add("A");
|
|
|
} else if (position == 1) {
|
|
|
selectAnswer += "B";
|
|
|
stringList.add("B");
|
|
|
} else if (position == 2) {
|
|
|
selectAnswer += "C";
|
|
|
stringList.add("C");
|
|
|
} else if (position == 3) {
|
|
|
selectAnswer += "D";
|
|
|
stringList.add("D");
|
|
|
} else if (position == 4) {
|
|
|
selectAnswer += "E";
|
|
|
stringList.add("E");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
Log.e("xuetubao:", e.toString());
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < stringList.size(); i++) {
|
|
|
if (rightAnswer.contains(stringList.get(i))) {
|
|
|
integerList.add(1);
|
|
|
} else {
|
|
|
integerList.add(2);
|
|
|
}
|
|
|
}
|
|
|
//判断多选题是否答对
|
|
|
for (int i = 0; i < integerList.size(); i++) {
|
|
|
if (integerList.get(i) == 2) {
|
|
|
text.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
option.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
|
|
|
isRight = false;
|
|
|
} else {
|
|
|
text.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
option.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
|
|
|
isRight = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!isRight) {
|
|
|
isClickAble = false;
|
|
|
statusList.set(listIndex, 1);
|
|
|
sheetGridAdapter.notifyDataSetChanged();
|
|
|
wrongCount++;
|
|
|
tvWrongNum.setText(String.valueOf(wrongCount));
|
|
|
|
|
|
statusList.set(listIndex, 2);
|
|
|
sheetGridAdapter.notifyDataSetChanged();
|
|
|
|
|
|
String questionOid = questionLst.get(position).getQuestionOid();
|
|
|
mPresenter.getPresenter(4, 2, accountOid, questionOid, String.valueOf(1), catalogOid);
|
|
|
|
|
|
/* optionsAdapter.setRight(rightAnswer);
|
|
|
optionsAdapter.notifyDataSetChanged();*/
|
|
|
|
|
|
text.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
option.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
|
|
|
duoxuanWrong++;
|
|
|
|
|
|
} else if (isRight && rightAnswer.length() == selectAnswer.length()) {
|
|
|
isClickAble = false;
|
|
|
rightCount++;
|
|
|
tvRightNum.setText(String.valueOf(rightCount));
|
|
|
statusList.set(listIndex, 1);
|
|
|
sheetGridAdapter.notifyDataSetChanged();
|
|
|
|
|
|
totalScore += duoxuan;
|
|
|
|
|
|
text.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
option.setTextColor(getResources().getColor(R.color.color_ff5400));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int initLayout() {
|
|
|
// return R.layout.activity_answer;
|
|
|
return R.layout.activity_answer_sheet;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void initData() {
|
|
|
// mPresenter.getPresenter(8, 1, catalogOid, String.valueOf(10), accountOid);
|
|
|
mPresenter.getPresenter(7, 1, accountOid, catalogOid, String.valueOf(1));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public CommonPresenter getPresenter() {
|
|
|
return new CommonPresenter();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ExerciseModel getModel() {
|
|
|
return new ExerciseModel();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void getData(Object o, int api, int intent) {
|
|
|
if (api == 7 && intent == 1) {
|
|
|
AnswerBean bean = (AnswerBean) o;
|
|
|
|
|
|
List<AnswerBean.QuestionLstBean> questionLstBeans = bean.getQuestionLst();
|
|
|
questionLst.addAll(questionLstBeans);
|
|
|
|
|
|
danxuanCount = bean.getRadioCount();
|
|
|
duoxuanCount = bean.getMultipleCount();
|
|
|
panduanCount = bean.getJudgeCount();
|
|
|
|
|
|
danxuan = bean.getRadioScore();
|
|
|
duoxuan = bean.getMultipleScore();
|
|
|
panduan = bean.getJudgeScore();
|
|
|
|
|
|
tvMax.setText(String.valueOf(questionLst.size()));
|
|
|
all.setText(String.valueOf(questionLst.size()));
|
|
|
tvTopic.setText(questionLstBeans.get(listIndex).getQuestionTitle());
|
|
|
tvCurrent.setText(String.valueOf(listIndex + 1));
|
|
|
index.setText(String.valueOf(listIndex + 1));
|
|
|
type = questionLstBeans.get(listIndex).getQuestionTypeName();
|
|
|
tvRadio.setText(type);
|
|
|
rightAnswer = questionLstBeans.get(listIndex).getAnswer();
|
|
|
rightSelect.setText(questionLstBeans.get(listIndex).getAnswer());
|
|
|
if (!TextUtils.isEmpty(questionLstBeans.get(listIndex).getAnswer())) {
|
|
|
rightAnswerText.setText(questionLstBeans.get(listIndex).getWrongAnaly());
|
|
|
}
|
|
|
optionsAdapter = new ListAnswerAdapter(questionLst.get(listIndex).getOptionsLst(), this);
|
|
|
listAnswer.setAdapter(optionsAdapter);
|
|
|
optionsAdapter.notifyDataSetChanged();
|
|
|
|
|
|
for (AnswerBean.QuestionLstBean a : questionLst) {
|
|
|
statusList.add(0);
|
|
|
}
|
|
|
sheetGridAdapter = new AnswerSheetGridAdapter(statusList, this);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void doRefresh(boolean isNext) {
|
|
|
|
|
|
historyAnswer.add(selectAnswer);
|
|
|
|
|
|
integerList.clear();
|
|
|
selectAnswer = "";
|
|
|
stringList.clear();
|
|
|
isClickAble = true;
|
|
|
|
|
|
tvTopic.setText(questionLst.get(listIndex).getQuestionTitle());
|
|
|
tvCurrent.setText(String.valueOf(listIndex + 1));
|
|
|
type = questionLst.get(listIndex).getQuestionTypeName();
|
|
|
tvRadio.setText(type);
|
|
|
index.setText(String.valueOf(listIndex + 1));
|
|
|
rightAnswer = questionLst.get(listIndex).getAnswer();
|
|
|
rightSelect.setText(questionLst.get(listIndex).getAnswer());
|
|
|
if (!TextUtils.isEmpty(questionLst.get(listIndex).getWrongAnaly()))
|
|
|
rightAnswerText.setText(questionLst.get(listIndex).getWrongAnaly());
|
|
|
rlAnswer.setVisibility(View.GONE);
|
|
|
|
|
|
optionsAdapter = new ListAnswerAdapter(questionLst.get(listIndex).getOptionsLst(), this);
|
|
|
listAnswer.setAdapter(optionsAdapter);
|
|
|
optionsAdapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
|
if (historyAnswer.size() > listIndex) {
|
|
|
optionsAdapter.setSelect(historyAnswer.get(listIndex));
|
|
|
optionsAdapter.notifyDataSetInvalidated();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void showAnswerCard(List<Integer> sheetCard, int rightCount, int wrongCount, int currentIndex, int maxTopic) {
|
|
|
View contentView = LayoutInflater.from(this).inflate(R.layout.pop_answer_sheet, null);
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.activity_answer, null);
|
|
|
|
|
|
TextView tv_card = (TextView) contentView.findViewById(R.id.tv_card);
|
|
|
GridView gridView = (GridView) contentView.findViewById(R.id.grid_dati);
|
|
|
TextView index = (TextView) contentView.findViewById(R.id.index);
|
|
|
TextView total = (TextView) contentView.findViewById(R.id.total);
|
|
|
TextView right = (TextView) contentView.findViewById(R.id.tv_right_num);
|
|
|
TextView wrong = (TextView) contentView.findViewById(R.id.tv_wrong_num);
|
|
|
|
|
|
right.setText(String.valueOf(rightCount));
|
|
|
wrong.setText(String.valueOf(wrongCount));
|
|
|
index.setText(String.valueOf(currentIndex + 1));
|
|
|
total.setText(String.valueOf(maxTopic));
|
|
|
|
|
|
// sheetGridAdapter = new AnswerSheetGridAdapter(sheetCard, this);
|
|
|
gridView.setAdapter(sheetGridAdapter);
|
|
|
|
|
|
popupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
|
|
popupWindow.setOutsideTouchable(false);
|
|
|
popupWindow.setTouchable(true);
|
|
|
popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);
|
|
|
tv_card.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
if (popupWindow != null) {
|
|
|
popupWindow.dismiss();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
|
|
private void showCommitCard(final Context context, int laveCount) {
|
|
|
View contentView = LayoutInflater.from(this).inflate(R.layout.pop_answer_commit, null);
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.activity_answer, null);
|
|
|
|
|
|
TextView count = (TextView) contentView.findViewById(R.id.tv_count);
|
|
|
TextView goOn = (TextView) contentView.findViewById(R.id.tv_continue);
|
|
|
TextView commit = (TextView) contentView.findViewById(R.id.tv_commit);
|
|
|
|
|
|
count.setText(String.valueOf(laveCount));
|
|
|
|
|
|
popupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
|
|
popupWindow.setOutsideTouchable(false);
|
|
|
popupWindow.setTouchable(true);
|
|
|
popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0);
|
|
|
|
|
|
goOn.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
popupWindow.dismiss();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
commit.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
popupWindow.dismiss();
|
|
|
Intent intent = new Intent(context, TestScoreActivity.class);
|
|
|
intent.putExtra("catalogOid", catalogOid);
|
|
|
intent.putExtra("danxuanCount", danxuanCount);
|
|
|
intent.putExtra("duoxuanCount", duoxuanCount);
|
|
|
intent.putExtra("panduanCount", panduanCount);
|
|
|
intent.putExtra("danxuanWrong", danxuanWrong);
|
|
|
intent.putExtra("panduanWrong", panduanWrong);
|
|
|
intent.putExtra("duoxuanWrong", duoxuanWrong);
|
|
|
intent.putExtra("totalScore", totalScore);
|
|
|
Log.e("zhangtao", totalScore + "分");
|
|
|
startActivity(intent);
|
|
|
c.this.finish();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
@Override
|
|
|
public void onDismiss() {
|
|
|
chageAlpha(1f);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
private void chageAlpha(float color) {
|
|
|
WindowManager.LayoutParams lp = this.getWindow().getAttributes();
|
|
|
lp.alpha = color;
|
|
|
this.getWindow().setAttributes(lp);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onComplete(int api) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(Throwable e, int api) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
// TODO: add setContentView(...) invocation
|
|
|
ButterKnife.bind(this);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
switch (v.getId()) {
|
|
|
case R.id.rl_last:
|
|
|
if (listIndex == 0) {
|
|
|
Toast.makeText(this, "当前已是第一题", Toast.LENGTH_SHORT).show();
|
|
|
} else {
|
|
|
listIndex--;
|
|
|
doRefresh(false);
|
|
|
}
|
|
|
break;
|
|
|
case R.id.rl_next:
|
|
|
if (listIndex < questionLst.size() - 1) {
|
|
|
|
|
|
if (type.contains("多选")) {
|
|
|
if (selectAnswer.length() != rightAnswer.length()) {
|
|
|
statusList.set(listIndex, 2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (TextUtils.isEmpty(selectAnswer)) {
|
|
|
if (listIndex > historyAnswer.size() - 1) {
|
|
|
unDone++;
|
|
|
wrongCount++;
|
|
|
statusList.set(listIndex, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
listIndex++;
|
|
|
doRefresh(true);
|
|
|
|
|
|
} else if (listIndex == questionLst.size() - 1) {
|
|
|
Toast.makeText(this, "当前已是最后一题", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
break;
|
|
|
case R.id.lin_tab:
|
|
|
this.finish();
|
|
|
break;
|
|
|
case R.id.tv_look:
|
|
|
rlAnswer.setVisibility(View.VISIBLE);
|
|
|
break;
|
|
|
case R.id.commit:
|
|
|
if (listIndex > historyAnswer.size()) {
|
|
|
if (TextUtils.isEmpty(selectAnswer)) {
|
|
|
wrongCount++;
|
|
|
if (type.contains("单选")) {
|
|
|
danxuanWrong++;
|
|
|
} else if (type.contains("判断")) {
|
|
|
panduanWrong++;
|
|
|
} else if (type.contains("多选")) {
|
|
|
duoxuanWrong++;
|
|
|
}
|
|
|
}
|
|
|
} else if (listIndex == questionLst.size() - 1) {
|
|
|
if (TextUtils.isEmpty(selectAnswer)) {
|
|
|
unDone++;
|
|
|
if (type.contains("单选")) {
|
|
|
danxuanWrong++;
|
|
|
} else if (type.contains("判断")) {
|
|
|
panduanWrong++;
|
|
|
} else if (type.contains("多选")) {
|
|
|
duoxuanWrong++;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
Toast.makeText(this, "当前已是最后一题", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
break;
|
|
|
case R.id.tv_show_card:
|
|
|
rlAnswer.setVisibility(View.VISIBLE);
|
|
|
break;
|
|
|
case R.id.rl_card:
|
|
|
showAnswerCard(statusList, rightCount, wrongCount, listIndex, questionLst.size());
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|