作者 qin

Auto stash before cherrypick of "接口修改"

... ... @@ -31,6 +31,7 @@ public class CircularProgressView extends View {
private RectF mRectF; // 绘制区域
private int[] mColorArray; // 圆环渐变色
private int mProgress; // 圆环进度(0-100)
private int maxProgress = 100;
public CircularProgressView(Context context) {
this(context, null);
... ... @@ -93,7 +94,7 @@ public class CircularProgressView extends View {
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawArc(mRectF, 0, 360, false, mBackPaint);
canvas.drawArc(mRectF, 275, 360 * mProgress / 100, false, mProgPaint);
canvas.drawArc(mRectF, 275, 360 * mProgress / maxProgress, false, mProgPaint);
}
// ---------------------------------------------------------------------------------------------
... ... @@ -118,6 +119,16 @@ public class CircularProgressView extends View {
}
/**
* 设置进度条最大进度
*
* @param progress 最大进度
*/
public void setMaxProgress(int progress) {
this.maxProgress = progress;
invalidate();
}
/**
* 设置当前进度,并展示进度动画。如果动画时间小于等于0,则不展示动画
*
* @param progress 当前进度(0-100)
... ...
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();
}
}
});
}
}
... ...
... ... @@ -308,7 +308,7 @@ public class a extends BaseMvpActivity<CommonPresenter, ExerciseModel> implement
tvRadio.setText(type);
rightAnswer = questionLstBeans.get(listIndex).getAnswer();
rightSelect.setText(questionLstBeans.get(listIndex).getAnswer());
if(!TextUtils.isEmpty(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);
... ... @@ -339,8 +339,8 @@ public class a extends BaseMvpActivity<CommonPresenter, ExerciseModel> implement
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());
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);
... ... @@ -461,14 +461,15 @@ public class a extends BaseMvpActivity<CommonPresenter, ExerciseModel> implement
if (TextUtils.isEmpty(selectAnswer)) {
wrongCount++;
}
}else if(listIndex==questionLst.size()-1){
if(TextUtils.isEmpty(selectAnswer)){
} else if (listIndex == questionLst.size() - 1) {
if (TextUtils.isEmpty(selectAnswer)) {
wrongCount++;
}
}
Intent intent = new Intent(this, AnswerResultActivity.class);
intent.putExtra("rightCount", rightCount);
intent.putExtra("wrongCount", wrongCount);
intent.putExtra("cataloglst", catalogOid);
startActivity(intent);
break;
case R.id.tv_show_card:
... ...
... ... @@ -24,6 +24,7 @@ import android.widget.TextView;
import android.widget.Toast;
import com.hh.xuetubao.R;
import com.hh.xuetubao.Utils.CircularProgressView;
import com.hh.xuetubao.Utils.SharedPrefrenceUtils;
import com.hh.xuetubao.adapter.AnswerSheetGridAdapter;
import com.hh.xuetubao.adapter.ListAnswerAdapter;
... ... @@ -494,6 +495,14 @@ public class b extends BaseMvpActivity<CommonPresenter, ExerciseModel> implement
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);
CircularProgressView circular = (CircularProgressView) contentView.findViewById(R.id.circular);
circular.setBackColor(R.color.color_fee3e0);
circular.setProgColor(R.color.color_ff5400);
circular.setBackWidth(20);
circular.setProgWidth(20);
circular.setMaxProgress(questionLst.size());
circular.setProgress(questionLst.size()-laveCount);
count.setText(String.valueOf(laveCount));
... ...
... ... @@ -27,6 +27,7 @@ import com.hh.xuetubao.bean.DoExerciseBean;
import com.hh.xuetubao.bean.FreeCourseBean;
import com.hh.xuetubao.fragment.CurriculumScheduleFragment;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
... ... @@ -40,6 +41,7 @@ public class CertificationCourseDetailAdapter extends BaseAdapter {
private int thisPosition;
private int viewId;
private int type;
private List<String> cataloglst = new ArrayList<>();
public CertificationCourseDetailAdapter(List<DoExerciseBean.bean> list, Context context, FragmentTransaction transaction, int viewId, int type) {
this.list = list;
... ... @@ -80,6 +82,12 @@ public class CertificationCourseDetailAdapter extends BaseAdapter {
lv.setAdapter(adapter);
ListviewUtils.setListViewHeightBasedOnChildren(lv);
for (DoExerciseBean.bean a : catalogLst) {
cataloglst.add(a.getCatalogOid());
}
SharedPrefrenceUtils.putStringList(context, "CataLogLst", cataloglst);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
private Intent intent;
... ... @@ -88,6 +96,7 @@ public class CertificationCourseDetailAdapter extends BaseAdapter {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String oid = list.get(thisPosition).getSubCatalogLst().get(thisPosition).getSubCatalogLst().get(position).getCatalogOid();
String accountOid = SharedPrefrenceUtils.getString(context, "AccountOid");
if (type == 1) {
//认证课程
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:background="@drawable/coners_5_stoke"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="@drawable/coners_5_stoke">
<RelativeLayout
android:id="@+id/real"
android:layout_marginTop="@dimen/dp_75"
<FrameLayout
android:id="@+id/frame"
android:layout_marginTop="@dimen/dp_30"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
<TextView
android:id="@+id/leave"
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content">
android:text="剩余未做"
android:textColor="#999999"
android:textSize="15sp" />
<com.hh.xuetubao.Utils.CircularProgressView
android:id="@+id/circular"
android:layout_width="@dimen/dp_128"
android:layout_height="@dimen/dp_128" />
<LinearLayout
android:id="@+id/lin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/leave"
android:layout_marginTop="@dimen/dp_15"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_count"
<RelativeLayout
android:id="@+id/real"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
android:textColor="#FF5400"
android:textSize="15sp" />
android:layout_centerInParent="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="题"
android:textColor="#FF5400"
android:textSize="15sp" />
</LinearLayout>
<TextView
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="剩余未做"
android:textColor="#999999"
android:textSize="15sp" />
<LinearLayout
android:id="@+id/lin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/leave"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_15"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
android:textColor="#FF5400"
android:textSize="15sp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="题"
android:textColor="#FF5400"
android:textSize="15sp" />
</LinearLayout>
<com.hh.xuetubao.Utils.CircularProgressView
android:layout_width="@dimen/dp_128"
android:layout_height="@dimen/dp_128"/>
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
<LinearLayout
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginRight="@dimen/dp_25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/real"
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_75"
android:layout_below="@+id/frame"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_25"
android:layout_marginBottom="@dimen/dp_20"
android:orientation="horizontal">
<TextView
... ...
... ... @@ -29,5 +29,6 @@
<color name="color_f8f8f8">#f8f8f8</color>
<color name="color_b0b0b0">#b0b0b0</color>
<color name="color_tm">#80000000</color>
<color name="color_fee3e0">#FEE3E0</color>
</resources>
... ...