bug修复、App更新方式更换
This commit is contained in:
parent
2077808f18
commit
8b66cb3f68
@ -797,5 +797,6 @@ public class PathConfig {
|
|||||||
public static final String ACTION_UPDATE_ERROR = "com.tenlionsoft.girdcclient.update_error";
|
public static final String ACTION_UPDATE_ERROR = "com.tenlionsoft.girdcclient.update_error";
|
||||||
public static final String ACTION_UPDATE_PROGRESS = "com.tenlionsoft.girdcclient.update_progress";
|
public static final String ACTION_UPDATE_PROGRESS = "com.tenlionsoft.girdcclient.update_progress";
|
||||||
public static final String ACTION_UPDATE_SUCCESS = "com.tenlionsoft.girdcclient.update_success";
|
public static final String ACTION_UPDATE_SUCCESS = "com.tenlionsoft.girdcclient.update_success";
|
||||||
|
public static final String ACTION_UPDATE_STAET = "com.tenlionsoft.girdcclient.update_start";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -381,15 +381,13 @@ public class HttpUtils {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置拦截器
|
||||||
client.newBuilder()
|
client.newBuilder()
|
||||||
.addNetworkInterceptor(new Interceptor() { //设置拦截器
|
.addNetworkInterceptor(chain -> {
|
||||||
@Override
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
public Response intercept(Chain chain) throws IOException {
|
return originalResponse.newBuilder()
|
||||||
Response originalResponse = chain.proceed(chain.request());
|
.body(new ResponseProgressBody(originalResponse.body(), downloadResponseHandler))
|
||||||
return originalResponse.newBuilder()
|
.build();
|
||||||
.body(new ResponseProgressBody(originalResponse.body(), downloadResponseHandler))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
.newCall(request)
|
.newCall(request)
|
||||||
|
@ -23,7 +23,7 @@ public class DownloadCallback implements Callback {
|
|||||||
private String mFilename;
|
private String mFilename;
|
||||||
|
|
||||||
public DownloadCallback(Handler handler, DownloadResponseHandler downloadResponseHandler,
|
public DownloadCallback(Handler handler, DownloadResponseHandler downloadResponseHandler,
|
||||||
String filedir, String filename) {
|
String filedir, String filename) {
|
||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mDownloadResponseHandler = downloadResponseHandler;
|
mDownloadResponseHandler = downloadResponseHandler;
|
||||||
mFileDir = filedir;
|
mFileDir = filedir;
|
||||||
@ -44,39 +44,22 @@ public class DownloadCallback implements Callback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, final Response response) throws IOException {
|
public void onResponse(Call call, final Response response) throws IOException {
|
||||||
if(response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
File file = null;
|
File file = null;
|
||||||
try {
|
try {
|
||||||
file = saveFile(response, mFileDir, mFilename);
|
file = saveFile(response, mFileDir, mFilename);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
// LogUtils.e("onResponse saveFile fail", e);
|
// LogUtils.e("onResponse saveFile fail", e);
|
||||||
|
mHandler.post(() -> mDownloadResponseHandler.onFailure("onResponse saveFile fail." + e.toString()));
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mDownloadResponseHandler.onFailure("onResponse saveFile fail." + e.toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final File newFile = file;
|
final File newFile = file;
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(() -> mDownloadResponseHandler.onFinish(newFile));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mDownloadResponseHandler.onFinish(newFile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// LogUtils.e("onResponse fail status=" + response.code());
|
// LogUtils.e("onResponse fail status=" + response.code());
|
||||||
|
mHandler.post(() -> mDownloadResponseHandler.onFailure("fail status=" + response.code()));
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mDownloadResponseHandler.onFailure("fail status=" + response.code());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//保存文件
|
//保存文件
|
||||||
private File saveFile(Response response, String filedir, String filename) throws IOException {
|
private File saveFile(Response response, String filedir, String filename) throws IOException {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
|
@ -11,6 +11,7 @@ import com.tenlionsoft.baselib.core.network.HttpUtils;
|
|||||||
import com.tenlionsoft.baselib.core.network.response.DownloadResponseHandler;
|
import com.tenlionsoft.baselib.core.network.response.DownloadResponseHandler;
|
||||||
import com.tenlionsoft.baselib.core.network.update.utils.Constants;
|
import com.tenlionsoft.baselib.core.network.update.utils.Constants;
|
||||||
import com.tenlionsoft.baselib.core.network.update.utils.StorageUtils;
|
import com.tenlionsoft.baselib.core.network.update.utils.StorageUtils;
|
||||||
|
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||||
import com.tenlionsoft.baselib.utils.ToastUtils;
|
import com.tenlionsoft.baselib.utils.ToastUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -22,6 +23,7 @@ public class DownloadService extends Service {
|
|||||||
|
|
||||||
private DownInfo downInfo;
|
private DownInfo downInfo;
|
||||||
private int oldProgress = 0;
|
private int oldProgress = 0;
|
||||||
|
private boolean mIsSuccess = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
@ -44,20 +46,21 @@ public class DownloadService extends Service {
|
|||||||
|
|
||||||
|
|
||||||
private void downLoadFile() {
|
private void downLoadFile() {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction(PathConfig.ACTION_UPDATE_STAET);
|
||||||
|
sendBroadcast(intent);
|
||||||
HttpUtils.getInstance().download(downInfo.getUrl(), downInfo.getSavePath(), downInfo.getApkName(),
|
HttpUtils.getInstance().download(downInfo.getUrl(), downInfo.getSavePath(), downInfo.getApkName(),
|
||||||
new DownloadResponseHandler() {
|
new DownloadResponseHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinish(File download_file) {
|
public void onFinish(File download_file) {
|
||||||
//收起通知栏
|
LogUtils.e("下载成功");
|
||||||
Intent intent = new Intent();
|
if (mIsSuccess) {
|
||||||
intent.setAction(PathConfig.ACTION_UPDATE_SUCCESS);
|
//收起通知栏
|
||||||
intent.putExtra("apkFile", download_file);
|
Intent intent = new Intent();
|
||||||
sendBroadcast(intent);
|
intent.setAction(PathConfig.ACTION_UPDATE_SUCCESS);
|
||||||
// NotificationBarUtil.setNotificationBarVisibility(DownloadService.this, false);
|
intent.putExtra("apkFile", download_file);
|
||||||
//安装
|
sendBroadcast(intent);
|
||||||
|
}
|
||||||
// notificationHelper.cancel();
|
|
||||||
|
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +68,6 @@ public class DownloadService extends Service {
|
|||||||
public void onProgress(long currentBytes, long totalBytes) {
|
public void onProgress(long currentBytes, long totalBytes) {
|
||||||
int progress = (int) ((currentBytes * 1.0 / totalBytes) * 100);
|
int progress = (int) ((currentBytes * 1.0 / totalBytes) * 100);
|
||||||
if (progress != oldProgress) {
|
if (progress != oldProgress) {
|
||||||
// notificationHelper.updateProgress(progress);
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(PathConfig.ACTION_UPDATE_PROGRESS);
|
intent.setAction(PathConfig.ACTION_UPDATE_PROGRESS);
|
||||||
intent.putExtra("progress", progress);
|
intent.putExtra("progress", progress);
|
||||||
@ -76,11 +78,12 @@ public class DownloadService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(String error_msg) {
|
public void onFailure(String error_msg) {
|
||||||
|
LogUtils.e("下载失败");
|
||||||
|
mIsSuccess = false;
|
||||||
ToastUtils.show("App下载失败,请稍后重试");
|
ToastUtils.show("App下载失败,请稍后重试");
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(PathConfig.ACTION_UPDATE_ERROR);
|
intent.setAction(PathConfig.ACTION_UPDATE_ERROR);
|
||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
// notificationHelper.cancel();
|
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,587 @@
|
|||||||
|
package com.tenlionsoft.baselib.core.widget.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Path;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.text.Layout;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.StaticLayout;
|
||||||
|
import android.text.TextPaint;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.text.style.RelativeSizeSpan;
|
||||||
|
import android.text.style.StyleSpan;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.tenlionsoft.baselib.utils.ConvertUtils;
|
||||||
|
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||||
|
|
||||||
|
public class HalfCircleChartView extends View {
|
||||||
|
|
||||||
|
private Path mPath;
|
||||||
|
private Paint mPaintProgress;
|
||||||
|
private Paint mPaintProgressColor;
|
||||||
|
private Paint mColorPaint;
|
||||||
|
private Paint mPercentPaint;
|
||||||
|
private TextPaint mTextPaint;
|
||||||
|
|
||||||
|
private Paint mGrayPaint;
|
||||||
|
private int mPadding = 60;
|
||||||
|
private int mPaintWidth = 60;//画笔线宽
|
||||||
|
|
||||||
|
private RectF mRectF;
|
||||||
|
private int mWidth;
|
||||||
|
private int mHeight;
|
||||||
|
private Paint mBlackPaint;
|
||||||
|
|
||||||
|
|
||||||
|
public HalfCircleChartView(Context context) {
|
||||||
|
super(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HalfCircleChartView(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
|
||||||
|
mPath = new Path();
|
||||||
|
mPath.reset();
|
||||||
|
|
||||||
|
mRectF = new RectF();
|
||||||
|
|
||||||
|
|
||||||
|
mPaintProgress = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
mPaintProgress.setStrokeWidth(mPaintWidth);
|
||||||
|
mPaintProgress.setColor(Color.parseColor("#EBF0F6"));
|
||||||
|
mPaintProgress.setStyle(Paint.Style.STROKE);
|
||||||
|
mPaintProgress.setStrokeCap(Paint.Cap.ROUND);
|
||||||
|
// mPaintProgress.setAlpha(40);
|
||||||
|
mPaintProgress.setShadowLayer(6, 0, 6, Color.parseColor("#E0E0E0"));
|
||||||
|
|
||||||
|
mPaintProgressColor = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
mPaintProgressColor.setStrokeWidth(mPaintWidth);
|
||||||
|
mPaintProgressColor.setColor(Color.parseColor("#305DFD"));
|
||||||
|
mPaintProgressColor.setStyle(Paint.Style.STROKE);
|
||||||
|
mPaintProgressColor.setStrokeCap(Paint.Cap.ROUND);
|
||||||
|
// mPaintProgressColor.setShadowLayer(6, -5, 5, Color.parseColor("#C2C9E3"));
|
||||||
|
|
||||||
|
mColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
mColorPaint.setColor(Color.parseColor("#305DFD"));
|
||||||
|
mColorPaint.setStyle(Paint.Style.FILL);
|
||||||
|
mColorPaint.setTextAlign(Paint.Align.CENTER);
|
||||||
|
mColorPaint.setFakeBoldText(true);
|
||||||
|
mColorPaint.setTextSize(ConvertUtils.sp2px(20));
|
||||||
|
mColorPaint.setTextAlign(Paint.Align.CENTER);
|
||||||
|
mPercentPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
mPercentPaint.setColor(Color.parseColor("#305DFD"));
|
||||||
|
mPercentPaint.setStyle(Paint.Style.FILL);
|
||||||
|
mPercentPaint.setTextAlign(Paint.Align.CENTER);
|
||||||
|
mPercentPaint.setFakeBoldText(true);
|
||||||
|
mPercentPaint.setTextSize(ConvertUtils.sp2px(12));
|
||||||
|
mPercentPaint.setTextAlign(Paint.Align.CENTER);
|
||||||
|
|
||||||
|
|
||||||
|
mGrayPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
mGrayPaint.setColor(Color.parseColor("#8F8F8F"));
|
||||||
|
mGrayPaint.setStyle(Paint.Style.FILL);
|
||||||
|
mGrayPaint.setTextAlign(Paint.Align.CENTER);
|
||||||
|
mGrayPaint.setTextSize(ConvertUtils.sp2px(12));
|
||||||
|
|
||||||
|
mBlackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
mBlackPaint.setColor(Color.BLACK);
|
||||||
|
mBlackPaint.setStyle(Paint.Style.FILL);
|
||||||
|
mBlackPaint.setStrokeWidth(10);
|
||||||
|
|
||||||
|
mTextPaint = new TextPaint();
|
||||||
|
mTextPaint.setColor(Color.parseColor("#305DFD"));
|
||||||
|
mTextPaint.setTextSize(ConvertUtils.sp2px(14));
|
||||||
|
mTextPaint.setTextAlign(Paint.Align.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
mWidth = resolveSize(400, widthMeasureSpec);
|
||||||
|
mHeight = resolveSize(400, heightMeasureSpec);
|
||||||
|
setMeasuredDimension(
|
||||||
|
Math.max(getSuggestedMinimumWidth(),
|
||||||
|
resolveSize(mWidth,
|
||||||
|
widthMeasureSpec)),
|
||||||
|
Math.max(getSuggestedMinimumHeight(),
|
||||||
|
resolveSize(mHeight,
|
||||||
|
heightMeasureSpec)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
//获取最小一边
|
||||||
|
int min = Math.min(mWidth, mHeight);
|
||||||
|
//中心点
|
||||||
|
int centerX = mWidth / 2;
|
||||||
|
int centerY = mHeight / 2;
|
||||||
|
|
||||||
|
|
||||||
|
int startY = centerY - min / 2;
|
||||||
|
int startX = centerX - min / 2;
|
||||||
|
int endY = centerY + min / 2;
|
||||||
|
int endX = centerX + min / 2;
|
||||||
|
LogUtils.e("矩形:(" + startX + ".." + startY + ")(" + endX + ".." + endY + ")");
|
||||||
|
// Rect path = new Rect(startX, startY, endX, endY);
|
||||||
|
// canvas.drawRect(path, mGrayPaint);
|
||||||
|
mRectF.set(startX + mPaintWidth, startY + mPaintWidth, endX - mPaintWidth, endY - mPaintWidth);
|
||||||
|
int offsetY = centerY - mPaintWidth;
|
||||||
|
LogUtils.e("中心点Y:" + mRectF.centerY() + "==" + centerY);
|
||||||
|
mRectF.offset(0, offsetY);
|
||||||
|
//绘制第一个环形背景
|
||||||
|
mPath.arcTo(mRectF, 180, 180);
|
||||||
|
canvas.drawPath(mPath, mPaintProgress);
|
||||||
|
|
||||||
|
//添加进度
|
||||||
|
addProgress(canvas);
|
||||||
|
//绘制文字
|
||||||
|
drawText(canvas, "70", offsetY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void drawText(Canvas canvas, String percent, int offsetY) {
|
||||||
|
//中心点
|
||||||
|
canvas.save();
|
||||||
|
int centerX = mWidth / 2;
|
||||||
|
int centerY = mHeight / 2;
|
||||||
|
SpannableString s = makeTxt("60");
|
||||||
|
StaticLayout textLayout = new StaticLayout(s, mTextPaint, canvas.getWidth(),
|
||||||
|
Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
|
canvas.translate(centerX, centerY + offsetY - mPaintWidth);
|
||||||
|
textLayout.draw(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
//计算文字所占大小
|
||||||
|
// Rect perRect = new Rect();
|
||||||
|
// mColorPaint.getTextBounds(percent, 0, percent.length(), perRect);
|
||||||
|
//
|
||||||
|
// Rect centRect = new Rect();
|
||||||
|
// mPercentPaint.getTextBounds("%", 0, "%".length(), centRect);
|
||||||
|
// //文字所占长宽
|
||||||
|
// int strWidth = perRect.width() + centRect.width();
|
||||||
|
// LogUtils.e("文字所占宽度:" + strWidth);
|
||||||
|
// int strHeight = perRect.height();
|
||||||
|
//
|
||||||
|
// canvas.drawText(percent, centerX - strWidth / 2, centerY + perRect.height() / 2 + offsetY - mPaintWidth,
|
||||||
|
// mColorPaint);//绘制占比数字
|
||||||
|
//
|
||||||
|
// canvas.drawText("%", centerX + perRect.width() / 2, centerY + centRect.height() + offsetY - mPaintWidth,
|
||||||
|
// mPercentPaint);//绘制百分号
|
||||||
|
// canvas.drawPoint(centerX, centerY + offsetY - mPaintWidth, mBlackPaint);
|
||||||
|
//
|
||||||
|
// Rect re = new Rect();
|
||||||
|
// String s = "重点青少年占比";
|
||||||
|
// mGrayPaint.getTextBounds(s, 0, s.length(), re);
|
||||||
|
// canvas.drawText(s, centerX - re.width() / 2,
|
||||||
|
// centerY + strHeight + re.height() / 2 + 10 + offsetY - mPaintWidth, mGrayPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SpannableString makeTxt(String str) {
|
||||||
|
String content = str + "%\n重点青少年占比";
|
||||||
|
SpannableString s = new SpannableString(content);
|
||||||
|
s.setSpan(new StyleSpan(Typeface.BOLD), 0, content.indexOf("重"), 0);
|
||||||
|
s.setSpan(new ForegroundColorSpan(Color.parseColor("#2F5CFB")), 0, content.indexOf("重"), 0);
|
||||||
|
s.setSpan(new RelativeSizeSpan(1.3f), 0, content.indexOf("重"), 0);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addProgress(Canvas canvas) {
|
||||||
|
Path mPathProgress = new Path();
|
||||||
|
mPathProgress.reset();
|
||||||
|
//70%的进度
|
||||||
|
float progress = 0.7f;
|
||||||
|
float sweepAngle = progress * 180;
|
||||||
|
mPathProgress.arcTo(mRectF, 180, sweepAngle);
|
||||||
|
canvas.drawPath(mPathProgress, mPaintProgressColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Android Canvas沿着Path绘制文字
|
||||||
|
// private void addTextPath(Canvas canvas) {
|
||||||
|
//
|
||||||
|
// int startAngle = 135; //开始角度
|
||||||
|
// int sweepAngle = 45; //总共 270度角,分6次则为 45度
|
||||||
|
//
|
||||||
|
// String[] content = {"0-10W", "10-20W", "20-30W", "30-40W", "40-50W", "50W+"};
|
||||||
|
// Paint mTextPaint = new Paint();
|
||||||
|
// mTextPaint.setColor(Color.BLACK);
|
||||||
|
// mTextPaint.setTextSize(40);
|
||||||
|
// Path path = null;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// for (int i = 0; i < 6; i++) {
|
||||||
|
// path = new Path();
|
||||||
|
// path.addArc(mRectF2, startAngle, sweepAngle);
|
||||||
|
// float textLength = mTextPaint.measureText(content[i]);//获得字体长度
|
||||||
|
// float hOffset = (float) (mDiam2 * Math.PI * (sweepAngle * 1.0 / 360) / 2 - textLength / 2);//The
|
||||||
|
// distance along the path
|
||||||
|
// float vOffset = (float) (mDiam2 / 2 / 6); //垂直路径方向上的偏移
|
||||||
|
// canvas.drawTextOnPath(content[i], path, hOffset, vOffset, mTextPaint);
|
||||||
|
//
|
||||||
|
//// Log.d("Circle", "hOffset:" + hOffset + " vOffset: " + vOffset);
|
||||||
|
// startAngle += sweepAngle;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// private void addKeDu1(Canvas canvas) {
|
||||||
|
//
|
||||||
|
// int pointX = 500;
|
||||||
|
// int pointY = 500;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Paint paintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(12);
|
||||||
|
//
|
||||||
|
// Paint paintLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(4);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// float angle = 45;
|
||||||
|
// //刻度直径
|
||||||
|
// int radius = 800 - 40;
|
||||||
|
// int length = 80; //刻度线长度
|
||||||
|
//
|
||||||
|
// int px_a1 = (int) (radius / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a1 = (int) (radius / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_1 = pointX - px_a1;
|
||||||
|
// int py_a_1 = pointY + py_a1;
|
||||||
|
//
|
||||||
|
// int radius2 = radius - length;
|
||||||
|
// int px_a2 = (int) (radius2 / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a2 = (int) (radius2 / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_2 = pointX - px_a2;
|
||||||
|
// int py_a_2 = pointY + py_a2;
|
||||||
|
//
|
||||||
|
// //绘制粗刻度线
|
||||||
|
// canvas.drawLine(px_a_1, py_a_1, px_a_2, py_a_2, paintLine);
|
||||||
|
//
|
||||||
|
// //绘制细刻度线
|
||||||
|
// int length2 = 50;
|
||||||
|
// for (int i = 1; i < 9; i++) {
|
||||||
|
//
|
||||||
|
// float angle2 = 45 - (i * 45 / 9);
|
||||||
|
// int px_a3 = (int) (radius / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a3 = (int) (radius / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_3 = pointX - px_a3;
|
||||||
|
// int py_a_3 = pointY + py_a3;
|
||||||
|
//
|
||||||
|
// int radius3 = radius - length2;
|
||||||
|
// int px_a4 = (int) (radius3 / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a4 = (int) (radius3 / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_4 = pointX - px_a4;
|
||||||
|
// int py_a_4 = pointY + py_a4;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_3, py_a_3, px_a_4, py_a_4, paintLine2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addKeDu2(Canvas canvas) {
|
||||||
|
//
|
||||||
|
// int pointX = 500;
|
||||||
|
// int pointY = 500;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Paint paintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(12);
|
||||||
|
//
|
||||||
|
// Paint paintLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(4);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// float angle = 0;
|
||||||
|
// int radius = 800 - 40;
|
||||||
|
// int length = 80;
|
||||||
|
//
|
||||||
|
// int px_a1 = (int) (radius / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a1 = (int) (radius / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_1 = pointX - px_a1;
|
||||||
|
// int py_a_1 = pointY + py_a1;
|
||||||
|
//
|
||||||
|
// int radius2 = radius - length;
|
||||||
|
// int px_a2 = (int) (radius2 / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a2 = (int) (radius2 / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_2 = pointX - px_a2;
|
||||||
|
// int py_a_2 = pointY + py_a2;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_1, py_a_1, px_a_2, py_a_2, paintLine);
|
||||||
|
//
|
||||||
|
// int length2 = 50;
|
||||||
|
// for (int i = 1; i < 9; i++) {
|
||||||
|
//
|
||||||
|
// float angle2 = angle + (i * 45 / 9);
|
||||||
|
// int px_a3 = (int) (radius / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a3 = (int) (radius / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_3 = pointX - px_a3;
|
||||||
|
// int py_a_3 = pointY - py_a3;
|
||||||
|
//
|
||||||
|
// int radius3 = radius - length2;
|
||||||
|
// int px_a4 = (int) (radius3 / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a4 = (int) (radius3 / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_4 = pointX - px_a4;
|
||||||
|
// int py_a_4 = pointY - py_a4;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_3, py_a_3, px_a_4, py_a_4, paintLine2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addKeDu3(Canvas canvas) {
|
||||||
|
//
|
||||||
|
// int pointX = 500;
|
||||||
|
// int pointY = 500;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Paint paintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(12);
|
||||||
|
//
|
||||||
|
// Paint paintLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(4);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// float angle = 45;
|
||||||
|
// int radius = 800 - 40;
|
||||||
|
// int length = 80;
|
||||||
|
//
|
||||||
|
// int px_a1 = (int) (radius / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a1 = (int) (radius / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_1 = pointX - px_a1;
|
||||||
|
// int py_a_1 = pointY - py_a1;
|
||||||
|
//
|
||||||
|
// int radius2 = radius - length;
|
||||||
|
// int px_a2 = (int) (radius2 / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a2 = (int) (radius2 / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_2 = pointX - px_a2;
|
||||||
|
// int py_a_2 = pointY - py_a2;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_1, py_a_1, px_a_2, py_a_2, paintLine);
|
||||||
|
//
|
||||||
|
// int length2 = 50;
|
||||||
|
// for (int i = 1; i < 9; i++) {
|
||||||
|
//
|
||||||
|
// float angle2 = angle + (i * 45 / 9);
|
||||||
|
// int px_a3 = (int) (radius / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a3 = (int) (radius / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_3 = pointX - px_a3;
|
||||||
|
// int py_a_3 = pointY - py_a3;
|
||||||
|
//
|
||||||
|
// int radius3 = radius - length2;
|
||||||
|
// int px_a4 = (int) (radius3 / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a4 = (int) (radius3 / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_4 = pointX - px_a4;
|
||||||
|
// int py_a_4 = pointY - py_a4;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_3, py_a_3, px_a_4, py_a_4, paintLine2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addKeDu4(Canvas canvas) {
|
||||||
|
//
|
||||||
|
// int pointX = 500;
|
||||||
|
// int pointY = 500;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Paint paintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(12);
|
||||||
|
//
|
||||||
|
// Paint paintLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(4);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// float angle = 90;
|
||||||
|
// int radius = 800 - 40;
|
||||||
|
// int length = 80;
|
||||||
|
//
|
||||||
|
// int px_a1 = (int) (radius / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a1 = (int) (radius / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_1 = pointX - px_a1;
|
||||||
|
// int py_a_1 = pointY - py_a1;
|
||||||
|
//
|
||||||
|
// int radius2 = radius - length;
|
||||||
|
// int px_a2 = (int) (radius2 / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a2 = (int) (radius2 / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_2 = pointX - px_a2;
|
||||||
|
// int py_a_2 = pointY - py_a2;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_1, py_a_1, px_a_2, py_a_2, paintLine);
|
||||||
|
//
|
||||||
|
// int length2 = 50;
|
||||||
|
// for (int i = 1; i < 9; i++) {
|
||||||
|
//
|
||||||
|
// float angle2 = angle + (i * 45 / 9);
|
||||||
|
// int px_a3 = (int) (radius / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a3 = (int) (radius / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_3 = pointX - px_a3;
|
||||||
|
// int py_a_3 = pointY - py_a3;
|
||||||
|
//
|
||||||
|
// int radius3 = radius - length2;
|
||||||
|
// int px_a4 = (int) (radius3 / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a4 = (int) (radius3 / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_4 = pointX - px_a4;
|
||||||
|
// int py_a_4 = pointY - py_a4;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_3, py_a_3, px_a_4, py_a_4, paintLine2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addKeDu5(Canvas canvas) {
|
||||||
|
//
|
||||||
|
// int pointX = 500;
|
||||||
|
// int pointY = 500;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Paint paintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(12);
|
||||||
|
//
|
||||||
|
// Paint paintLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(4);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// float angle = 135;
|
||||||
|
// int radius = 800 - 40;
|
||||||
|
// int length = 80;
|
||||||
|
//
|
||||||
|
// int px_a1 = (int) (radius / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a1 = (int) (radius / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_1 = pointX - px_a1;
|
||||||
|
// int py_a_1 = pointY - py_a1;
|
||||||
|
//
|
||||||
|
// int radius2 = radius - length;
|
||||||
|
// int px_a2 = (int) (radius2 / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a2 = (int) (radius2 / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_2 = pointX - px_a2;
|
||||||
|
// int py_a_2 = pointY - py_a2;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_1, py_a_1, px_a_2, py_a_2, paintLine);
|
||||||
|
//
|
||||||
|
// int length2 = 50;
|
||||||
|
// for (int i = 1; i < 9; i++) {
|
||||||
|
//
|
||||||
|
// float angle2 = angle + (i * 45 / 9);
|
||||||
|
// int px_a3 = (int) (radius / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a3 = (int) (radius / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_3 = pointX - px_a3;
|
||||||
|
// int py_a_3 = pointY - py_a3;
|
||||||
|
//
|
||||||
|
// int radius3 = radius - length2;
|
||||||
|
// int px_a4 = (int) (radius3 / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a4 = (int) (radius3 / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_4 = pointX - px_a4;
|
||||||
|
// int py_a_4 = pointY - py_a4;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_3, py_a_3, px_a_4, py_a_4, paintLine2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addKeDu6(Canvas canvas) {
|
||||||
|
//
|
||||||
|
// int pointX = 500;
|
||||||
|
// int pointY = 500;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Paint paintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(12);
|
||||||
|
//
|
||||||
|
// Paint paintLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(4);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// float angle = 180;
|
||||||
|
// int radius = 800 - 40;
|
||||||
|
// int length = 80;
|
||||||
|
//
|
||||||
|
// int px_a1 = (int) (radius / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a1 = (int) (radius / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_1 = pointX - px_a1;
|
||||||
|
// int py_a_1 = pointY - py_a1;
|
||||||
|
//
|
||||||
|
// int radius2 = radius - length;
|
||||||
|
// int px_a2 = (int) (radius2 / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a2 = (int) (radius2 / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_2 = pointX - px_a2;
|
||||||
|
// int py_a_2 = pointY - py_a2;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_1, py_a_1, px_a_2, py_a_2, paintLine);
|
||||||
|
//
|
||||||
|
// int length2 = 50;
|
||||||
|
// for (int i = 1; i < 9; i++) {
|
||||||
|
//
|
||||||
|
// float angle2 = angle + (i * 45 / 9);
|
||||||
|
// int px_a3 = (int) (radius / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a3 = (int) (radius / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_3 = pointX - px_a3;
|
||||||
|
// int py_a_3 = pointY - py_a3;
|
||||||
|
//
|
||||||
|
// int radius3 = radius - length2;
|
||||||
|
// int px_a4 = (int) (radius3 / 2 * Math.cos(Math.PI * angle2 / 180));
|
||||||
|
// int py_a4 = (int) (radius3 / 2 * Math.sin(Math.PI * angle2 / 180));
|
||||||
|
// int px_a_4 = pointX - px_a4;
|
||||||
|
// int py_a_4 = pointY - py_a4;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_3, py_a_3, px_a_4, py_a_4, paintLine2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addEndKeDu(Canvas canvas) {
|
||||||
|
// int pointX = 500;
|
||||||
|
// int pointY = 500;
|
||||||
|
//
|
||||||
|
// Paint paintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(12);
|
||||||
|
//
|
||||||
|
// Paint paintLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// paintLine.setColor(0xff454545);
|
||||||
|
// paintLine.setStrokeWidth(4);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// float angle = 225;
|
||||||
|
// int radius = 800 - 40;
|
||||||
|
// int length = 80;
|
||||||
|
//
|
||||||
|
// int px_a1 = (int) (radius / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a1 = (int) (radius / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_1 = pointX - px_a1;
|
||||||
|
// int py_a_1 = pointY - py_a1;
|
||||||
|
//
|
||||||
|
// int radius2 = radius - length;
|
||||||
|
// int px_a2 = (int) (radius2 / 2 * Math.cos(Math.PI * angle / 180));
|
||||||
|
// int py_a2 = (int) (radius2 / 2 * Math.sin(Math.PI * angle / 180));
|
||||||
|
// int px_a_2 = pointX - px_a2;
|
||||||
|
// int py_a_2 = pointY - py_a2;
|
||||||
|
//
|
||||||
|
// canvas.drawLine(px_a_1, py_a_1, px_a_2, py_a_2, paintLine);
|
||||||
|
// }
|
||||||
|
}
|
@ -49,7 +49,7 @@ public class ExceptionHandler {
|
|||||||
} else if (throwable instanceof SocketTimeoutException) {
|
} else if (throwable instanceof SocketTimeoutException) {
|
||||||
ToastUtils.show("网络连接超时");
|
ToastUtils.show("网络连接超时");
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.show("网络错误,请稍后重试(500)");
|
ToastUtils.show("服务器发生错误(500)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ ext {
|
|||||||
gCompileSdkVersion = 30
|
gCompileSdkVersion = 30
|
||||||
gMinSdkVersion = 21
|
gMinSdkVersion = 21
|
||||||
gTargetSdkVersion = 30
|
gTargetSdkVersion = 30
|
||||||
gVersionCode = 14
|
gVersionCode = 15
|
||||||
gVersionName = '1.1.3'
|
gVersionName = '1.1.4'
|
||||||
gBuildToolsVersion = "29.0.2"
|
gBuildToolsVersion = "29.0.2"
|
||||||
// gVersionCode=26
|
// gVersionCode=26
|
||||||
// gVersionName='1.3.0'
|
// gVersionName='1.3.0'
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.tengshisoft.commonmodule.activitys.usercenter;
|
package com.tengshisoft.commonmodule.activitys.usercenter;
|
||||||
|
|
||||||
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -19,6 +21,9 @@ import android.widget.ImageView;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
@ -26,7 +31,6 @@ import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
|||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.github.promeg.pinyinhelper.Pinyin;
|
import com.github.promeg.pinyinhelper.Pinyin;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.tenlionsoft.baselib.utils.ToastUtils;
|
|
||||||
import com.tengshisoft.commonmodule.R;
|
import com.tengshisoft.commonmodule.R;
|
||||||
import com.tengshisoft.commonmodule.R2;
|
import com.tengshisoft.commonmodule.R2;
|
||||||
import com.tengshisoft.commonmodule.beans.ChangePwdBean;
|
import com.tengshisoft.commonmodule.beans.ChangePwdBean;
|
||||||
@ -61,6 +65,7 @@ import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
|||||||
import com.tenlionsoft.baselib.utils.FileUtils;
|
import com.tenlionsoft.baselib.utils.FileUtils;
|
||||||
import com.tenlionsoft.baselib.utils.LogUtils;
|
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||||
import com.tenlionsoft.baselib.utils.ProiderUtil;
|
import com.tenlionsoft.baselib.utils.ProiderUtil;
|
||||||
|
import com.tenlionsoft.baselib.utils.ToastUtils;
|
||||||
import com.tenlionsoft.baselib.utils.UIUtil;
|
import com.tenlionsoft.baselib.utils.UIUtil;
|
||||||
import com.tenlionsoft.baselib.utils.UserLgUtils;
|
import com.tenlionsoft.baselib.utils.UserLgUtils;
|
||||||
|
|
||||||
@ -70,8 +75,6 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.content.FileProvider;
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.Unbinder;
|
import butterknife.Unbinder;
|
||||||
@ -85,8 +88,6 @@ import okhttp3.RequestBody;
|
|||||||
import top.zibin.luban.Luban;
|
import top.zibin.luban.Luban;
|
||||||
import top.zibin.luban.OnCompressListener;
|
import top.zibin.luban.OnCompressListener;
|
||||||
|
|
||||||
import static android.app.Activity.RESULT_OK;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作者: Adam
|
* 作者: Adam
|
||||||
* 日期: 2019/7/30 - 09:31
|
* 日期: 2019/7/30 - 09:31
|
||||||
@ -179,8 +180,8 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void doChangeUserInfo() {
|
private void doChangeUserInfo() {
|
||||||
ARouter.getInstance()
|
ARouter.getInstance()
|
||||||
.build(PathConfig.PATH_MODULE_COMMON_ACTIVITY_USER_INFO)
|
.build(PathConfig.PATH_MODULE_COMMON_ACTIVITY_USER_INFO)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,8 +201,8 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void doOpenCollect() {
|
private void doOpenCollect() {
|
||||||
ARouter.getInstance()
|
ARouter.getInstance()
|
||||||
.build(PathConfig.PATH_MODULE_COMMON_ACTIVITY_MINE_COLLECT)
|
.build(PathConfig.PATH_MODULE_COMMON_ACTIVITY_MINE_COLLECT)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -246,46 +247,47 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void doSyncUser() {
|
private void doSyncUser() {
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(GridApis.class)
|
.create(GridApis.class)
|
||||||
.getAllUserList(UserLgUtils.getToken())
|
.getAllUserList(UserLgUtils.getToken())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<List<UserDatabaseBean>>() {
|
.subscribe(new Observer<List<UserDatabaseBean>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull List<UserDatabaseBean> userDatabaseBeans) {
|
public void onNext(@NonNull List<UserDatabaseBean> userDatabaseBeans) {
|
||||||
mUserDatabaseBeanList = userDatabaseBeans;
|
mUserDatabaseBeanList = userDatabaseBeans;
|
||||||
for (UserDatabaseBean next : mUserDatabaseBeanList) {
|
for (UserDatabaseBean next : mUserDatabaseBeanList) {
|
||||||
if (!TextUtils.isEmpty(next.getUserName())) {
|
if (!TextUtils.isEmpty(next.getUserName())) {
|
||||||
next.setPinYin(Pinyin.toPinyin(next.getUserName(), ","));
|
next.setPinYin(Pinyin.toPinyin(next.getUserName(), ","));
|
||||||
} else {
|
} else {
|
||||||
next.setPinYin("#");
|
next.setPinYin("#");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collator collator = Collator.getInstance(Locale.ENGLISH);
|
||||||
|
Collections.sort(mUserDatabaseBeanList, (o1, o2) -> collator.compare(o1.getPinYin(),
|
||||||
|
o2.getPinYin()));
|
||||||
|
++mCount;
|
||||||
|
if (mCount == 2) {
|
||||||
|
insertAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collator collator = Collator.getInstance(Locale.ENGLISH);
|
|
||||||
Collections.sort(mUserDatabaseBeanList, (o1, o2) -> collator.compare(o1.getPinYin(), o2.getPinYin()));
|
@Override
|
||||||
++mCount;
|
public void onError(@NonNull Throwable e) {
|
||||||
if (mCount == 2) {
|
mCount = 0;
|
||||||
insertAll();
|
mDialog.dismiss();
|
||||||
|
ToastUtils.show("同步失败,请稍后重试");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onComplete() {
|
||||||
mCount = 0;
|
|
||||||
mDialog.dismiss();
|
|
||||||
ToastUtils.show("同步失败,请稍后重试");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onComplete() {
|
});
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,37 +295,37 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void doSyncDept() {
|
private void doSyncDept() {
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(GridApis.class)
|
.create(GridApis.class)
|
||||||
.getAllDeptList(UserLgUtils.getToken())
|
.getAllDeptList(UserLgUtils.getToken())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<List<DeptDatabaseBean>>() {
|
.subscribe(new Observer<List<DeptDatabaseBean>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(@NonNull List<DeptDatabaseBean> deptDatabaseBeans) {
|
|
||||||
++mCount;
|
|
||||||
mDatabaseBeanList = deptDatabaseBeans;
|
|
||||||
if (mCount == 2) {
|
|
||||||
insertAll();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onNext(@NonNull List<DeptDatabaseBean> deptDatabaseBeans) {
|
||||||
mCount = 0;
|
++mCount;
|
||||||
mDialog.dismiss();
|
mDatabaseBeanList = deptDatabaseBeans;
|
||||||
ToastUtils.show("同步失败,请稍后重试");
|
if (mCount == 2) {
|
||||||
}
|
insertAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onError(@NonNull Throwable e) {
|
||||||
|
mCount = 0;
|
||||||
|
mDialog.dismiss();
|
||||||
|
ToastUtils.show("同步失败,请稍后重试");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
});
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -358,33 +360,33 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
String obj = gson.toJson(bean);
|
String obj = gson.toJson(bean);
|
||||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(BaseApiService.class)
|
.create(BaseApiService.class)
|
||||||
.doChangePwd(body, UserLgUtils.getToken())
|
.doChangePwd(body, UserLgUtils.getToken())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<BaseSuccessBean>() {
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull BaseSuccessBean baseSuccessBean) {
|
public void onNext(@NonNull BaseSuccessBean baseSuccessBean) {
|
||||||
ToastUtils.show("密码修改成功,请重新登录");
|
ToastUtils.show("密码修改成功,请重新登录");
|
||||||
doLoginOut();
|
doLoginOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
ExceptionHandler.handleException(e);
|
ExceptionHandler.handleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -393,11 +395,11 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void changeUserIcon() {
|
private void changeUserIcon() {
|
||||||
ButtomDialogView buttomDialogView = new ButtomDialogView.DialogBuilder(mActivity)
|
ButtomDialogView buttomDialogView = new ButtomDialogView.DialogBuilder(mActivity)
|
||||||
.setIsBackCancelable(true)
|
.setIsBackCancelable(true)
|
||||||
.setIscancelable(true)
|
.setIscancelable(true)
|
||||||
.setShowLocation(Gravity.BOTTOM)
|
.setShowLocation(Gravity.BOTTOM)
|
||||||
.setIsShowFile(false)
|
.setIsShowFile(false)
|
||||||
.build();
|
.build();
|
||||||
buttomDialogView.addOnChoseListener(new ButtomDialogView.OnChoseListener() {
|
buttomDialogView.addOnChoseListener(new ButtomDialogView.OnChoseListener() {
|
||||||
@Override
|
@Override
|
||||||
public void choseFile() {
|
public void choseFile() {
|
||||||
@ -407,7 +409,7 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
public void choseAlbum() {
|
public void choseAlbum() {
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK, null);
|
Intent intent = new Intent(Intent.ACTION_PICK, null);
|
||||||
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||||
"image/*");
|
"image/*");
|
||||||
startActivityForResult(intent, BaseUrlApi.PHOTO_REQUEST);
|
startActivityForResult(intent, BaseUrlApi.PHOTO_REQUEST);
|
||||||
buttomDialogView.dismiss();
|
buttomDialogView.dismiss();
|
||||||
}
|
}
|
||||||
@ -480,63 +482,64 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
ProgressDialog progressDialog = UIUtil.initDialog(mActivity, "头像修改中...");
|
ProgressDialog progressDialog = UIUtil.initDialog(mActivity, "头像修改中...");
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
Luban.with(mActivity)
|
Luban.with(mActivity)
|
||||||
.load(picPath)
|
.load(picPath)
|
||||||
.ignoreBy(100)
|
.ignoreBy(100)
|
||||||
.setTargetDir(mCachePath)
|
.setTargetDir(mCachePath)
|
||||||
.filter(path -> !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif")))
|
.filter(path -> !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif")))
|
||||||
.setCompressListener(new OnCompressListener() {
|
.setCompressListener(new OnCompressListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(File file) {
|
|
||||||
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
|
||||||
MultipartBody.Part body = MultipartBody.Part.createFormData("image", file.getName(), requestFile);
|
|
||||||
RetrofitManager.getInstance()
|
|
||||||
.create(BaseApiService.class)
|
|
||||||
.uploadImage(body, UserLgUtils.getToken())
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new Observer<BaseSuccessBean>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(BaseSuccessBean baseUserBean) {
|
|
||||||
changeUserInfo(baseUserBean.getData(), progressDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
if (progressDialog != null && progressDialog.isShowing()) {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
}
|
|
||||||
ToastUtils.show("头像修改失败,请稍后重试.");
|
|
||||||
if (file.exists()) {
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
if (progressDialog.isShowing()) {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
}
|
}
|
||||||
ToastUtils.show("头像修改失败,请稍后重试");
|
|
||||||
}
|
@Override
|
||||||
})
|
public void onSuccess(File file) {
|
||||||
.launch();
|
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||||
|
MultipartBody.Part body = MultipartBody.Part.createFormData("image", file.getName(),
|
||||||
|
requestFile);
|
||||||
|
RetrofitManager.getInstance()
|
||||||
|
.create(BaseApiService.class)
|
||||||
|
.uploadImage(body, UserLgUtils.getToken())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BaseSuccessBean baseUserBean) {
|
||||||
|
changeUserInfo(baseUserBean.getData(), progressDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
if (progressDialog != null && progressDialog.isShowing()) {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
}
|
||||||
|
ToastUtils.show("头像修改失败,请稍后重试.");
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
if (progressDialog.isShowing()) {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
}
|
||||||
|
ToastUtils.show("头像修改失败,请稍后重试");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeUserInfo(String id, ProgressDialog dialog) {
|
private void changeUserInfo(String id, ProgressDialog dialog) {
|
||||||
@ -549,32 +552,32 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
String obj = gson.toJson(bean);
|
String obj = gson.toJson(bean);
|
||||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(BaseApiService.class)
|
.create(BaseApiService.class)
|
||||||
.doChangeUserInfo(body, UserLgUtils.getToken())
|
.doChangeUserInfo(body, UserLgUtils.getToken())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<BaseSuccessBean>() {
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull BaseSuccessBean successBean) {
|
public void onNext(@NonNull BaseSuccessBean successBean) {
|
||||||
doLoginApp(UserLgUtils.getUserName(), UserLgUtils.getPassword(), dialog);
|
doLoginApp(UserLgUtils.getUserName(), UserLgUtils.getPassword(), dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
ExceptionHandler.handleException(e);
|
ExceptionHandler.handleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -593,66 +596,67 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
String obj = gson.toJson(info);
|
String obj = gson.toJson(info);
|
||||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(BaseApiService.class)
|
.create(BaseApiService.class)
|
||||||
.doLogin(body)
|
.doLogin(body)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<BaseSuccessBean>() {
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(BaseSuccessBean baseUserBean) {
|
public void onNext(BaseSuccessBean baseUserBean) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
if (!TextUtils.isEmpty(baseUserBean.getData())) {
|
if (!TextUtils.isEmpty(baseUserBean.getData())) {
|
||||||
byte[] decode = Base64.decode(baseUserBean.getData(), Base64.DEFAULT);
|
byte[] decode = Base64.decode(baseUserBean.getData(), Base64.DEFAULT);
|
||||||
try {
|
try {
|
||||||
String loginUserInfo = AesUtil.aesCommonDecoder(PathConfig.SECRET, new String(decode, "UTF-8"));
|
String loginUserInfo = AesUtil.aesCommonDecoder(PathConfig.SECRET, new String(decode,
|
||||||
LogUtils.e(loginUserInfo);
|
"UTF-8"));
|
||||||
if (!TextUtils.isEmpty(loginUserInfo)) {
|
LogUtils.e(loginUserInfo);
|
||||||
AppTokenUser appTokenUser = gson.fromJson(loginUserInfo, AppTokenUser.class);
|
if (!TextUtils.isEmpty(loginUserInfo)) {
|
||||||
UserLgUtils.setLoginInfo(loginUserInfo);
|
AppTokenUser appTokenUser = gson.fromJson(loginUserInfo, AppTokenUser.class);
|
||||||
UserLgUtils.setAvatar(appTokenUser.getAvatar());
|
UserLgUtils.setLoginInfo(loginUserInfo);
|
||||||
UserLgUtils.setEmail(appTokenUser.getEmail());
|
UserLgUtils.setAvatar(appTokenUser.getAvatar());
|
||||||
UserLgUtils.setId(appTokenUser.getId());
|
UserLgUtils.setEmail(appTokenUser.getEmail());
|
||||||
UserLgUtils.setName(appTokenUser.getName());
|
UserLgUtils.setId(appTokenUser.getId());
|
||||||
UserLgUtils.setUserName(appTokenUser.getUsername());
|
UserLgUtils.setName(appTokenUser.getName());
|
||||||
UserLgUtils.setPhone(appTokenUser.getPhone());
|
UserLgUtils.setUserName(appTokenUser.getUsername());
|
||||||
UserLgUtils.setToken(baseUserBean.getData());
|
UserLgUtils.setPhone(appTokenUser.getPhone());
|
||||||
GlobalProvider.save(mActivity, "token", baseUserBean.getData());
|
UserLgUtils.setToken(baseUserBean.getData());
|
||||||
UserLgUtils.setPassword(pwd);
|
GlobalProvider.save(mActivity, "token", baseUserBean.getData());
|
||||||
Glide.with(mActivity)
|
UserLgUtils.setPassword(pwd);
|
||||||
.load(BaseUrlApi.BASE_IMG_URL + appTokenUser.getAvatar())
|
Glide.with(mActivity)
|
||||||
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
.load(BaseUrlApi.BASE_IMG_URL + appTokenUser.getAvatar())
|
||||||
.error(R.drawable.ic_user_default)
|
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
||||||
.placeholder(R.drawable.ic_user_default))
|
.error(R.drawable.ic_user_default)
|
||||||
.into(mIvUserIcon);
|
.placeholder(R.drawable.ic_user_default))
|
||||||
ToastUtils.show("头像修改成功.");
|
.into(mIvUserIcon);
|
||||||
} else {
|
ToastUtils.show("头像修改成功.");
|
||||||
|
} else {
|
||||||
|
ToastUtils.show("头像修改失败,请稍后重试.");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
ToastUtils.show("头像修改失败,请稍后重试.");
|
ToastUtils.show("头像修改失败,请稍后重试.");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
e.printStackTrace();
|
|
||||||
ToastUtils.show("头像修改失败,请稍后重试.");
|
ToastUtils.show("头像修改失败,请稍后重试.");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ToastUtils.show("头像修改失败,请稍后重试.");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
ExceptionHandler.handleException(e);
|
ExceptionHandler.handleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -662,16 +666,16 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
//测试聊天
|
//测试聊天
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mHomeActivity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(mHomeActivity);
|
||||||
builder.setTitle("提示")
|
builder.setTitle("提示")
|
||||||
.setMessage("确认要清除缓存文件吗?")
|
.setMessage("确认要清除缓存文件吗?")
|
||||||
.setPositiveButton("确定", (dialog, which) -> {
|
.setPositiveButton("确定", (dialog, which) -> {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
boolean b = FileUtils.deleteFilesInDir(mCachePath);
|
boolean b = FileUtils.deleteFilesInDir(mCachePath);
|
||||||
if (b) {
|
if (b) {
|
||||||
ToastUtils.show("清除成功");
|
ToastUtils.show("清除成功");
|
||||||
mTvCacheNum.setText("0.00MB");
|
mTvCacheNum.setText("0.00MB");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss());
|
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss());
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,16 +690,17 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
* 初始化视图
|
* 初始化视图
|
||||||
*/
|
*/
|
||||||
private void initContentView() {
|
private void initContentView() {
|
||||||
mCachePath = mHomeActivity.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath() + File.separator;
|
mCachePath =
|
||||||
|
mHomeActivity.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath() + File.separator;
|
||||||
mTvCacheNum.setText(FileUtils.getDirSize(mCachePath));
|
mTvCacheNum.setText(FileUtils.getDirSize(mCachePath));
|
||||||
mTvVersionNum.setText("v " + AppUtils.getAppVersionName());
|
mTvVersionNum.setText("v " + AppUtils.getAppVersionName());
|
||||||
mTvUserName.setText(UserLgUtils.getName());
|
mTvUserName.setText(UserLgUtils.getName());
|
||||||
Glide.with(mActivity)
|
Glide.with(mActivity)
|
||||||
.load(BaseUrlApi.BASE_IMG_URL + UserLgUtils.getAvatar())
|
.load(BaseUrlApi.BASE_IMG_URL + UserLgUtils.getAvatar())
|
||||||
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
||||||
.error(R.drawable.ic_user_default)
|
.error(R.drawable.ic_user_default)
|
||||||
.placeholder(R.drawable.ic_user_default))
|
.placeholder(R.drawable.ic_user_default))
|
||||||
.into(mIvUserIcon);
|
.into(mIvUserIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -713,46 +718,46 @@ public class UserCenterFragment extends BaseFragment {
|
|||||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "检查中...");
|
ProgressDialog dialog = UIUtil.initDialog(mActivity, "检查中...");
|
||||||
dialog.show();
|
dialog.show();
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(BaseApiService.class)
|
.create(BaseApiService.class)
|
||||||
.doCheckAppVersion(BaseUrlApi.APP_VERSION_ID)
|
.doCheckAppVersion(BaseUrlApi.APP_VERSION_ID)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<VersionBean>() {
|
.subscribe(new Observer<VersionBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(VersionBean successBean) {
|
public void onNext(VersionBean successBean) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
if (successBean != null && successBean.getData() > 0) {
|
if (successBean != null && successBean.getData() > 0) {
|
||||||
if (CheckUpdateUtils.checkcode(mActivity, successBean.getData() + "")) {
|
if (CheckUpdateUtils.checkcode(mActivity, successBean.getData() + "")) {
|
||||||
startDownloadApk();
|
startDownloadApk();
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.show("已经是最新版本");
|
ToastUtils.show("已经是最新版本");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
ExceptionHandler.handleException(e);
|
ExceptionHandler.handleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始下载Apk
|
* 开始下载Apk
|
||||||
*/
|
*/
|
||||||
private void startDownloadApk() {
|
private void startDownloadApk() {
|
||||||
mHomeActivity.showUpdate();
|
// mHomeActivity.showUpdate();
|
||||||
ToastUtils.show("检测到新版本,开始下载.");
|
ToastUtils.show("检测到新版本,开始下载.");
|
||||||
Intent intent = new Intent(mActivity, DownloadService.class);
|
Intent intent = new Intent(mActivity, DownloadService.class);
|
||||||
intent.putExtra(Constants.APK_DOWNLOAD_URL, BaseUrlApi.APP_DOWNLOAD_URL);
|
intent.putExtra(Constants.APK_DOWNLOAD_URL, BaseUrlApi.APP_DOWNLOAD_URL);
|
||||||
|
@ -139,11 +139,10 @@ public class PopulaceGridStatisticsFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void setYoungData(String per) {
|
private void setYoungData(String per) {
|
||||||
Double aDouble = Double.valueOf(per);
|
Double aDouble = Double.valueOf(per);
|
||||||
Double youngPer = aDouble / 100;
|
Double surplus = 100 - aDouble;
|
||||||
Double surplus = 100 - youngPer;
|
LogUtils.e("占比:" + aDouble + "\n剩余:" + surplus);
|
||||||
LogUtils.e("占比:" + youngPer + "\n剩余:" + surplus);
|
|
||||||
ArrayList<PieEntry> values = new ArrayList<>();
|
ArrayList<PieEntry> values = new ArrayList<>();
|
||||||
values.add(new PieEntry(youngPer.floatValue(), ""));
|
values.add(new PieEntry(aDouble.floatValue(), ""));
|
||||||
values.add(new PieEntry(surplus.floatValue(), ""));
|
values.add(new PieEntry(surplus.floatValue(), ""));
|
||||||
|
|
||||||
PieDataSet dataSet = new PieDataSet(values, "");
|
PieDataSet dataSet = new PieDataSet(values, "");
|
||||||
@ -155,7 +154,7 @@ public class PopulaceGridStatisticsFragment extends BaseFragment {
|
|||||||
data.setDrawValues(false);
|
data.setDrawValues(false);
|
||||||
data.setValueTextSize(11f);
|
data.setValueTextSize(11f);
|
||||||
data.setValueTextColor(Color.WHITE);
|
data.setValueTextColor(Color.WHITE);
|
||||||
mPcYoung.setCenterText(youngCenterSpannableText(youngPer + ""));
|
mPcYoung.setCenterText(youngCenterSpannableText(aDouble + ""));
|
||||||
mPcYoung.setData(data);
|
mPcYoung.setData(data);
|
||||||
mPcYoung.invalidate();
|
mPcYoung.invalidate();
|
||||||
//将图表移动到底部
|
//将图表移动到底部
|
||||||
|
@ -2,7 +2,6 @@ package com.tengshisoft.gridmodule.incident.activitys.populace;
|
|||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -25,7 +24,6 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
|||||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.tenlionsoft.baselib.utils.ToastUtils;
|
|
||||||
import com.tengshisoft.commonmodule.adapters.CensusPersonAdapter;
|
import com.tengshisoft.commonmodule.adapters.CensusPersonAdapter;
|
||||||
import com.tengshisoft.commonmodule.beans.AreaGridListBean;
|
import com.tengshisoft.commonmodule.beans.AreaGridListBean;
|
||||||
import com.tengshisoft.commonmodule.beans.CensusPersonBean;
|
import com.tengshisoft.commonmodule.beans.CensusPersonBean;
|
||||||
@ -44,7 +42,7 @@ import com.tenlionsoft.baselib.core.widget.views.CenterBaseInputView;
|
|||||||
import com.tenlionsoft.baselib.core.widget.views.CenterGridPhoneListView;
|
import com.tenlionsoft.baselib.core.widget.views.CenterGridPhoneListView;
|
||||||
import com.tenlionsoft.baselib.core.widget.views.GridTextAdapter;
|
import com.tenlionsoft.baselib.core.widget.views.GridTextAdapter;
|
||||||
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
||||||
import com.tenlionsoft.baselib.utils.LogUtils;
|
import com.tenlionsoft.baselib.utils.ToastUtils;
|
||||||
import com.tenlionsoft.baselib.utils.UIUtil;
|
import com.tenlionsoft.baselib.utils.UIUtil;
|
||||||
import com.tenlionsoft.baselib.utils.UserLgUtils;
|
import com.tenlionsoft.baselib.utils.UserLgUtils;
|
||||||
|
|
||||||
@ -257,19 +255,23 @@ public class CensusBaseSearchActivity extends BaseActivity {
|
|||||||
* 显示网格选择
|
* 显示网格选择
|
||||||
*/
|
*/
|
||||||
private void onShowGrid() {
|
private void onShowGrid() {
|
||||||
if (mGridPicker == null) {
|
if (mGridList != null && mGridList.size() > 0) {
|
||||||
mGridPicker = new OptionsPickerBuilder(mActivity, (o1, o2, o3, v) -> {
|
if (mGridPicker == null) {
|
||||||
mSelGrid = mGridList.get(o1);
|
mGridPicker = new OptionsPickerBuilder(mActivity, (o1, o2, o3, v) -> {
|
||||||
mTvGrid.setText(mSelGrid.getGridName());
|
mSelGrid = mGridList.get(o1);
|
||||||
})
|
mTvGrid.setText(mSelGrid.getGridName());
|
||||||
.setTitleText("请选择")
|
})
|
||||||
.setCancelColor(Color.parseColor("#1189FF"))
|
.setTitleText("请选择")
|
||||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
.setCancelColor(Color.parseColor("#1189FF"))
|
||||||
.setTitleColor(Color.parseColor("#1189FF"))
|
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||||
.build();
|
.setTitleColor(Color.parseColor("#1189FF"))
|
||||||
mGridPicker.setPicker(mGridList);
|
.build();
|
||||||
|
mGridPicker.setPicker(mGridList);
|
||||||
|
}
|
||||||
|
mGridPicker.show();
|
||||||
|
} else {
|
||||||
|
ToastUtils.show("您暂未绑定网格,请联系管理员进行绑定.");
|
||||||
}
|
}
|
||||||
mGridPicker.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -457,7 +457,6 @@ public class MainTabActivity extends BaseActivity implements LoginView, LocalBro
|
|||||||
*/
|
*/
|
||||||
private void startDownloadApk() {
|
private void startDownloadApk() {
|
||||||
ToastUtils.show("检测到新版本,开始下载");
|
ToastUtils.show("检测到新版本,开始下载");
|
||||||
showUpdateProgress();
|
|
||||||
Intent intent = new Intent(mActivity, DownloadService.class);
|
Intent intent = new Intent(mActivity, DownloadService.class);
|
||||||
intent.putExtra(Constants.APK_DOWNLOAD_URL, BaseUrlApi.APP_DOWNLOAD_URL);
|
intent.putExtra(Constants.APK_DOWNLOAD_URL, BaseUrlApi.APP_DOWNLOAD_URL);
|
||||||
startService(intent);
|
startService(intent);
|
||||||
@ -520,6 +519,7 @@ public class MainTabActivity extends BaseActivity implements LoginView, LocalBro
|
|||||||
filter.addAction(PathConfig.ACTION_UPDATE_SUCCESS);//下载成功
|
filter.addAction(PathConfig.ACTION_UPDATE_SUCCESS);//下载成功
|
||||||
filter.addAction(PathConfig.ACTION_UPDATE_ERROR);//下载失败
|
filter.addAction(PathConfig.ACTION_UPDATE_ERROR);//下载失败
|
||||||
filter.addAction(PathConfig.ACTION_UPDATE_PROGRESS);//进度更新
|
filter.addAction(PathConfig.ACTION_UPDATE_PROGRESS);//进度更新
|
||||||
|
filter.addAction(PathConfig.ACTION_UPDATE_STAET);//开始下载App
|
||||||
registerReceiver(mReceiver, filter);
|
registerReceiver(mReceiver, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1054,6 +1054,8 @@ public class MainTabActivity extends BaseActivity implements LoginView, LocalBro
|
|||||||
//判断是否可以安装
|
//判断是否可以安装
|
||||||
File apkFile = (File) intent.getSerializableExtra("apkFile");
|
File apkFile = (File) intent.getSerializableExtra("apkFile");
|
||||||
installApk(apkFile);
|
installApk(apkFile);
|
||||||
|
}else if(PathConfig.ACTION_UPDATE_STAET.equals(action)){
|
||||||
|
showUpdateProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,13 +217,13 @@
|
|||||||
<!--通知公告-->
|
<!--通知公告-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_notice"
|
android:id="@+id/ll_notice"
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@drawable/shp_rectangle_white_5"
|
android:background="@drawable/shp_rectangle_white_5"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
@ -261,8 +261,8 @@
|
|||||||
android:id="@+id/tv_notice_1"
|
android:id="@+id/tv_notice_1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginLeft="3dp"
|
||||||
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="@dimen/text_14" />
|
android:textSize="@dimen/text_14" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user