作者 qin

接口修改

... ... @@ -147,7 +147,7 @@ public interface MyServer {
* @return
*/
@GET("MobileLogin")
Observable<UserBean> mobileLogin(@Query("mobileNumber") String mobileNumber, @Query("verCode") String verCode);
Observable<UserBean> mobileLogin(@Query("mobileNumber") String mobileNumber, @Query("verCode") String verCode, @Query("logType") int logType);
/**
* 微信绑定手机
... ...
package com.hh.xuetubao.Utils;
/**
* Time: 11/23/2019 10:08
* Author: tao
* Description:
*/
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
import android.support.annotation.ColorRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.OvershootInterpolator;
import com.hh.xuetubao.R;
public class CircularProgressView extends View {
private Paint mBackPaint, mProgPaint; // 绘制画笔
private RectF mRectF; // 绘制区域
private int[] mColorArray; // 圆环渐变色
private int mProgress; // 圆环进度(0-100)
public CircularProgressView(Context context) {
this(context, null);
}
public CircularProgressView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public CircularProgressView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
@SuppressLint("Recycle")
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView);
// 初始化背景圆环画笔
mBackPaint = new Paint();
mBackPaint.setStyle(Paint.Style.STROKE); // 只描边,不填充
mBackPaint.setStrokeCap(Paint.Cap.ROUND); // 设置圆角
mBackPaint.setAntiAlias(true); // 设置抗锯齿
mBackPaint.setDither(true); // 设置抖动
mBackPaint.setStrokeWidth(typedArray.getDimension(R.styleable.CircularProgressView_backWidth, 5));
mBackPaint.setColor(typedArray.getColor(R.styleable.CircularProgressView_backColor, Color.LTGRAY));
// 初始化进度圆环画笔
mProgPaint = new Paint();
mProgPaint.setStyle(Paint.Style.STROKE); // 只描边,不填充
mProgPaint.setStrokeCap(Paint.Cap.ROUND); // 设置圆角
mProgPaint.setAntiAlias(true); // 设置抗锯齿
mProgPaint.setDither(true); // 设置抖动
mProgPaint.setStrokeWidth(typedArray.getDimension(R.styleable.CircularProgressView_progWidth, 10));
mProgPaint.setColor(typedArray.getColor(R.styleable.CircularProgressView_progColor, Color.BLUE));
// 初始化进度圆环渐变色
int startColor = typedArray.getColor(R.styleable.CircularProgressView_progStartColor, -1);
int firstColor = typedArray.getColor(R.styleable.CircularProgressView_progFirstColor, -1);
if (startColor != -1 && firstColor != -1) mColorArray = new int[]{startColor, firstColor};
else mColorArray = null;
// 初始化进度
mProgress = typedArray.getInteger(R.styleable.CircularProgressView_progress, 0);
typedArray.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int viewWide = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
int viewHigh = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
int mRectLength = (int) ((viewWide > viewHigh ? viewHigh : viewWide) - (mBackPaint.getStrokeWidth() > mProgPaint.getStrokeWidth() ? mBackPaint.getStrokeWidth() : mProgPaint.getStrokeWidth()));
int mRectL = getPaddingLeft() + (viewWide - mRectLength) / 2;
int mRectT = getPaddingTop() + (viewHigh - mRectLength) / 2;
mRectF = new RectF(mRectL, mRectT, mRectL + mRectLength, mRectT + mRectLength);
// 设置进度圆环渐变色
if (mColorArray != null && mColorArray.length > 1)
mProgPaint.setShader(new LinearGradient(0, 0, 0, getMeasuredWidth(), mColorArray, null, Shader.TileMode.MIRROR));
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawArc(mRectF, 0, 360, false, mBackPaint);
canvas.drawArc(mRectF, 275, 360 * mProgress / 100, false, mProgPaint);
}
// ---------------------------------------------------------------------------------------------
/**
* 获取当前进度
*
* @return 当前进度(0-100)
*/
public int getProgress() {
return mProgress;
}
/**
* 设置当前进度
*
* @param progress 当前进度(0-100)
*/
public void setProgress(int progress) {
this.mProgress = progress;
invalidate();
}
/**
* 设置当前进度,并展示进度动画。如果动画时间小于等于0,则不展示动画
*
* @param progress 当前进度(0-100)
* @param animTime 动画时间(毫秒)
*/
public void setProgress(int progress, long animTime) {
if (animTime <= 0) setProgress(progress);
else {
ValueAnimator animator = ValueAnimator.ofInt(mProgress, progress);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mProgress = (int) animation.getAnimatedValue();
invalidate();
}
});
animator.setInterpolator(new OvershootInterpolator());
animator.setDuration(animTime);
animator.start();
}
}
/**
* 设置背景圆环宽度
*
* @param width 背景圆环宽度
*/
public void setBackWidth(int width) {
mBackPaint.setStrokeWidth(width);
invalidate();
}
/**
* 设置背景圆环颜色
*
* @param color 背景圆环颜色
*/
public void setBackColor(@ColorRes int color) {
mBackPaint.setColor(ContextCompat.getColor(getContext(), color));
invalidate();
}
/**
* 设置进度圆环宽度
*
* @param width 进度圆环宽度
*/
public void setProgWidth(int width) {
mProgPaint.setStrokeWidth(width);
invalidate();
}
/**
* 设置进度圆环颜色
*
* @param color 景圆环颜色
*/
public void setProgColor(@ColorRes int color) {
mProgPaint.setColor(ContextCompat.getColor(getContext(), color));
mProgPaint.setShader(null);
invalidate();
}
/**
* 设置进度圆环颜色(支持渐变色)
*
* @param startColor 进度圆环开始颜色
* @param firstColor 进度圆环结束颜色
*/
public void setProgColor(@ColorRes int startColor, @ColorRes int firstColor) {
mColorArray = new int[]{ContextCompat.getColor(getContext(), startColor), ContextCompat.getColor(getContext(), firstColor)};
mProgPaint.setShader(new LinearGradient(0, 0, 0, getMeasuredWidth(), mColorArray, null, Shader.TileMode.MIRROR));
invalidate();
}
/**
* 设置进度圆环颜色(支持渐变色)
*
* @param colorArray 渐变色集合
*/
public void setProgColor(@ColorRes int[] colorArray) {
if (colorArray == null || colorArray.length < 2) return;
mColorArray = new int[colorArray.length];
for (int index = 0; index < colorArray.length; index++)
mColorArray[index] = ContextCompat.getColor(getContext(), colorArray[index]);
mProgPaint.setShader(new LinearGradient(0, 0, 0, getMeasuredWidth(), mColorArray, null, Shader.TileMode.MIRROR));
invalidate();
}
}
\ No newline at end of file
... ...
... ... @@ -162,7 +162,7 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
switch (v.getId()) {
case R.id.login:
if (isCellphone(edPhone.getText().toString()) && !TextUtils.isEmpty(edPhone.getText().toString()))
mPresenter.getPresenter(1, 2, edPhone.getText().toString(), edCode.getText().toString());
mPresenter.getPresenter(1, 2, edPhone.getText().toString(), edCode.getText().toString(),String.valueOf(2));
else
Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
break;
... ...
... ... @@ -55,7 +55,7 @@ public class AccountModel implements ICommonModel {
/* 验证码登录 */
private void mobileLogin(final ICommonView commonView, final int api, final int intent, String... params) {
if (api == 1 && intent == 2)
mServers.mobileLogin(params[0], params[1])
mServers.mobileLogin(params[0], params[1],Integer.valueOf(params[2]))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseObsever() {
... ...
... ... @@ -4,47 +4,61 @@
android:background="@drawable/coners_5_stoke"
android:layout_height="wrap_content">
<TextView
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
<RelativeLayout
android:id="@+id/real"
android:layout_marginTop="@dimen/dp_75"
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_marginTop="@dimen/dp_15"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_count"
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
android:textColor="#FF5400"
android:layout_centerHorizontal="true"
android:text="剩余未做"
android:textColor="#999999"
android:textSize="15sp" />
<TextView
<LinearLayout
android:id="@+id/lin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="题"
android:textColor="#FF5400"
android:textSize="15sp" />
</LinearLayout>
android:layout_below="@+id/leave"
android:layout_marginTop="@dimen/dp_15"
android:layout_centerHorizontal="true"
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" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="题"
android:textColor="#FF5400"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
<com.hh.xuetubao.Utils.CircularProgressView
android:layout_width="@dimen/dp_128"
android:layout_height="@dimen/dp_128"/>
<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/lin"
android:layout_below="@+id/real"
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_75"
android:layout_centerHorizontal="true"
... ...
... ... @@ -22,4 +22,15 @@
<attr name="labels" format="string" />
</declare-styleable>
<declare-styleable name="CircularProgressView">
<attr name="backWidth" format="dimension" /> <!--背景圆环宽度-->
<attr name="progWidth" format="dimension" /> <!--进度圆环宽度-->
<attr name="backColor" format="color" /> <!--背景圆环颜色-->
<attr name="progColor" format="color" /> <!--进度圆环颜色-->
<attr name="progStartColor" format="color" /> <!--进度圆环开始颜色-->
<attr name="progFirstColor" format="color" /> <!--进度圆环结束颜色-->
<attr name="progress" format="integer" /> <!--圆环进度-->
</declare-styleable>
</resources>
\ No newline at end of file
... ...