|
|
package com.hh.xuetubao.activity.pratice;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.view.View;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
import com.hh.xuetubao.MyServer;
|
|
|
import com.hh.xuetubao.R;
|
|
|
import com.hh.xuetubao.Utils.BaseObsever;
|
|
|
import com.hh.xuetubao.Utils.HttpUtils;
|
|
|
import com.hh.xuetubao.Utils.NetConfig;
|
|
|
import com.hh.xuetubao.Utils.SharedPrefrenceUtils;
|
|
|
import com.hh.xuetubao.Utils.WaveView;
|
|
|
import com.hh.xuetubao.bean.AnswerBean;
|
|
|
import com.hh.xuetubao.model.MainModel;
|
|
|
import com.hh.xuetubao.mvp.BaseMvpActivity;
|
|
|
import com.hh.xuetubao.mvp.CommonPresenter;
|
|
|
import com.hh.xuetubao.mvp.ICommonView;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
/**
|
|
|
* 答题结果
|
...
|
...
|
@@ -31,11 +43,23 @@ public class AnswerResultActivity extends BaseMvpActivity<CommonPresenter, MainM |
|
|
|
|
|
int ZomCount = 0; // 总题目数量
|
|
|
int zql = 0; // 正确率
|
|
|
private int thisPositon;
|
|
|
private List<String> cataLogLst;
|
|
|
private String accountOid;
|
|
|
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
int rightCount = getIntent().getIntExtra("rightCount", 0);
|
|
|
int wrongCount = getIntent().getIntExtra("wrongCount", 0);
|
|
|
String cataloglst = getIntent().getStringExtra("cataloglst");
|
|
|
cataLogLst = SharedPrefrenceUtils.getStringList(this, "CataLogLst");
|
|
|
accountOid = SharedPrefrenceUtils.getString(this, "AccountOid");
|
|
|
for (int i = 0; i < cataLogLst.size(); i++) {
|
|
|
if (cataLogLst.get(i).equals(cataloglst)) {
|
|
|
thisPositon = i;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
tvRight.setText(String.valueOf(rightCount));
|
|
|
tvWrong.setText(String.valueOf(wrongCount));
|
...
|
...
|
@@ -94,7 +118,36 @@ public class AnswerResultActivity extends BaseMvpActivity<CommonPresenter, MainM |
|
|
public void onClick(View v) {
|
|
|
switch (v.getId()) {
|
|
|
case R.id.tv_next:
|
|
|
if (thisPositon + 1 >= cataLogLst.size()) {
|
|
|
Toast.makeText(this, "当前已是最后一套题", Toast.LENGTH_SHORT).show();
|
|
|
} else {
|
|
|
doRequestTwo(cataLogLst.get(thisPositon + 1), accountOid);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void doRequestTwo(final String catalogOid, String accountOid) {
|
|
|
MyServer mServers = HttpUtils.getInstance().getServer(NetConfig.shuaTiUrl);
|
|
|
mServers.GetRandomQuestions(catalogOid, Integer.valueOf(10), accountOid)
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new BaseObsever() {
|
|
|
@Override
|
|
|
public void onNext(Object value) {
|
|
|
super.onNext(value);
|
|
|
AnswerBean bean = (AnswerBean) value;
|
|
|
if (bean.isIsSuccess()) {
|
|
|
Intent intent = new Intent(AnswerResultActivity.this, a.class);
|
|
|
intent.putExtra("catalogOid", cataLogLst.get(thisPositon + 1));
|
|
|
startActivity(intent);
|
|
|
} else {
|
|
|
Toast.makeText(AnswerResultActivity.this, "当前账号无权限,请拨打电话xxxxxxxxxx", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|