蒋洪波

修改聊天界面,修改播放状态下退回到桌面出现声音的BUG

正在显示 100 个修改的文件 包含 113 行增加69 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

... ... @@ -20,8 +20,8 @@ public class EncryptUtilTest {
@Test
public void testMD5Encode() throws Exception {
String s = EncryptUtil.MD5Encode("123456");
// Assert.assertEquals("e10adc3949ba59abbe56e057f20f883e", s);
BigDecimal bigDecimal = new BigDecimal("4.44").setScale(1, BigDecimal.ROUND_HALF_UP);
Assert.assertEquals(bigDecimal.floatValue(), 5);
Assert.assertEquals("e10adc3949ba59abbe56e057f20f883e", s);
// BigDecimal bigDecimal = new BigDecimal("4.44").setScale(1, BigDecimal.ROUND_HALF_UP);
// Assert.assertEquals(bigDecimal.floatValue(), 5);
}
}
\ No newline at end of file
... ...
... ... @@ -14,7 +14,7 @@ public class AnnotaionEntity {
public String curPageNo;
public List<PointGroupEntity> pointGroup;
public String color;
public String thickness;
public int thickness;
public String radius;
public String fontSize;
public String fontName;
... ...
... ... @@ -4,7 +4,6 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.DisplayMetrics;
... ... @@ -79,6 +78,12 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
docUrlTransformBitmap(null);
}
@Override
public void onDestroyView() {
super.onDestroyView();
handler.removeCallbacksAndMessages(null);
}
private void getWindowWith(DisplayMetrics metric) {
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metric);
winWidth = metric.widthPixels; // 屏幕宽度(像素)
... ... @@ -115,18 +120,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
public final static int SEND = 0;
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
int what = msg.what;
WhiteboardUpdateEntity obj = (WhiteboardUpdateEntity) msg.obj;
switch (what) {
case SEND:
mCanvasView.drawLine(obj.annotaionItems);
break;
}
}
};
static Handler handler = new Handler();
/**
* @param entity
... ... @@ -147,7 +141,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
}
private void delayDraw(final WhiteboardUpdateEntity entity) {
handler.postDelayed(new BaseRunnable<WhiteboardUpdateEntity>(entity) {
handler.postDelayed(new BaseRunnable<WhiteboardUpdateEntity>() {
@Override
protected void handle(WhiteboardUpdateEntity o) {
... ... @@ -218,20 +212,13 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
@Override
public void call(WrapDocBitMapEntity resource) {
//用handler发送 跟drawline在一个队列里执行,否则顺序乱了导致切换图片的时候还有上一个画面的标注
handler.post(new BaseRunnable<WrapDocBitMapEntity>(resource) {
@Override
protected void handle(WrapDocBitMapEntity wrapDocBitMapEntity) {
if (wrapDocBitMapEntity.getBitmap() == null) {
showMessage("图片获取失败");
Bitmap bitmap = getNoDocBitmap();
mCanvasView.setBitmap(bitmap, false);
} else {
mCanvasView.setBitmap(wrapDocBitMapEntity.getBitmap(), !wrapDocBitMapEntity.showNoDoc());
}
}
});
if (resource.getBitmap() == null) {
showMessage("图片获取失败");
Bitmap bitmap = getNoDocBitmap();
mCanvasView.setBitmap(bitmap, false);
} else {
mCanvasView.setBitmap(resource.getBitmap(), !resource.showNoDoc());
}
}
});
}
... ...
... ... @@ -7,6 +7,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.MotionEvent;
... ... @@ -796,6 +797,25 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
}
@Override
public void showAlertDialog(@StringRes int alertStr) {
AlertDialog dialog = new AlertDialog.Builder(getContext())
.setTitle(R.string.home_pwd_mention)
.setMessage(alertStr)
.setPositiveButton(R.string.home_confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
})
.create();
dialog.show();
dialog.setCanceledOnTouchOutside(false);
}
@Override
public void showErrorDialog(String reason) {
if (mErrorDialog != null)
... ... @@ -823,6 +843,11 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
}
}
@Override
public boolean getVisible() {
return this.isSupportVisible();
}
private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
public void onStartTrackingTouch(SeekBar bar) {
... ... @@ -891,4 +916,6 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
mShowing = false;
}
}
}
... ...
... ... @@ -110,23 +110,23 @@ public interface Constants {
/**
* 获取录制回放数据失败
*/
String GET_RECORD_ERROR = "911";
int GET_RECORD_ERROR = 911;
/**
* 初始化录制回放失败
*/
String INIT_RECORD_ERROR = "910";
int INIT_RECORD_ERROR = 910;
/**
* [加入课堂] 有相同身份的人员加入课堂,自己被踢出课堂
*/
String KICK_SELF = "208";
int KICK_SELF = 208;
/**
* [加入课堂] 已经在其它地方登陆
*/
String ALREAD_LOGIN = "207";
int ALREAD_LOGIN = 207;
/**
* [加入课堂] 密码错误
*/
String PWD_ERROR = "206";
int PWD_ERROR = 206;
/**
* [加入课堂] 人数已满
*/
... ...
... ... @@ -17,6 +17,7 @@
package com.xdy.home.vp;
import android.content.Context;
import android.support.annotation.StringRes;
import android.view.SurfaceView;
import com.xdy.commonlibrary.mvp.BaseView;
... ... @@ -123,6 +124,7 @@ public interface LiveContract {
* @param reson
*/
void showErrorDialog(int reson);
/**
* 展示错误界面
* @param reson
... ... @@ -130,9 +132,20 @@ public interface LiveContract {
void showErrorDialog(String reson);
/**
* 提示框
* @param alertStr
*/
void showAlertDialog(@StringRes int alertStr);
/**
* 重置SEEKBAR
*/
void resetSeekBar();
/**
* 获取界面状态
*/
boolean getVisible();
}
interface ChatView extends BaseView {
... ...
... ... @@ -380,11 +380,13 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
public void playAudio(String pa) {
currentPlayAudio = GsonUtil.json2Bean(pa, VideoEntity.class);
if (currentPlayAudio != null) {
checkPlayMode(false);
mRootView.playAudio(currentPlayAudio);
} else {
mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error));
if (mRootView.getVisible()) {
if (currentPlayAudio != null) {
checkPlayMode(false);
mRootView.playAudio(currentPlayAudio);
} else {
mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error));
}
}
}
... ... @@ -400,12 +402,14 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
public void playVideo(String pa) {
currentPlayVideo = GsonUtil.json2Bean(pa, VideoEntity.class);
if (currentPlayVideo != null) {
checkPlayMode(true);
if (mRootView.getVisible()) {
if (currentPlayVideo != null) {
checkPlayMode(true);
// String rtmpUrl = currentPlayVideo.getRtmpUrl();
mRootView.playVideo(currentPlayVideo);
} else {
mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error));
mRootView.playVideo(currentPlayVideo);
} else {
mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error));
}
}
}
... ... @@ -453,7 +457,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
if (errorEvent != null) {
String reason = errorEvent.getReson();
if (!TextUtils.isEmpty(reason) && !(Constants.LEAVE_CLASS_CODE == errorEvent.getCode())) {
if (Constants.PWD_ERROR == errorEvent.getCode()) {//密码错误
mRootView.showAlertDialog(R.string.home_pwd_wrong);
} else if (!TextUtils.isEmpty(reason) && !(Constants.LEAVE_CLASS_CODE == errorEvent.getCode())) {
connceted = false;
mRootView.showMessage(reason);
mRootView.quit();
... ...
... ... @@ -131,12 +131,17 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
pathLists.clear();
this.historyPointer = 0;
for (List<PointGroupEntity> pointGroupEntities : originPoint) {
// Path path = new Path();
// path.addCircle(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop, annotations.get(0).thickness, Path.Direction.CW);
// pathLists.add(path);
pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop));
this.historyPointer++;
for (int j = 0; j < pointGroupEntities.size(); j++) {
PointGroupEntity pointGroupEntity = pointGroupEntities.get(j);
Path path = this.getCurrentPath();
path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop);
Path p = this.getCurrentPath();
// p.addCircle(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop, annotations.get(0).thickness, Path.Direction.CW);
p.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop);
}
}
}
... ... @@ -269,6 +274,9 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
float h = pointGroupEntities.get(0).h + (FLOAT_TYPE * offsetY) / (FLOAT_TYPE * finalWidth) * 100f;
pointGroupEntities.get(0).h = h;
// Path p = new Path();
// p.addCircle(w / 100f * finalWidth, h / 100f * finalWidth, annotations.get(0).thickness, Path.Direction.CW);
// pathLists.add(p);
pathLists.add(createPath(w / 100f * finalWidth, h / 100f * finalWidth));
historyPointer++;
for (int j = 1; j < pointGroupEntities.size(); j++) {
... ... @@ -278,6 +286,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
float h2 = pointGroupEntity.h + (FLOAT_TYPE * offsetY) / (FLOAT_TYPE * finalWidth) * 100f;
pointGroupEntity.h = h2;
path.lineTo(w2 / 100 * finalWidth, h2 / 100 * finalWidth);
// path.addCircle(w2 / 100 * finalWidth, h2 / 100 * finalWidth, annotations.get(0).thickness, Path.Direction.CW);
}
}
}
... ... @@ -358,13 +367,20 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
pathLists.clear();
historyPointer = 0;
for (List<PointGroupEntity> pointGroupEntities : operatePoints) {
// Path p = new Path();
// p.addCircle(pointGroupEntities.get(0).w / 100f * finalWidth, pointGroupEntities.get(0).h / 100f * finalWidth, annotations.get(0).thickness, Path.Direction.CW);
// pathLists.add(p);
pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop));
historyPointer++;
for (int i = 1; i < pointGroupEntities.size(); i++) {
PointGroupEntity pointGroupEntity = pointGroupEntities.get(i);
Path path = this.getCurrentPath();
path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop);
// path.addCircle(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth, annotations.get(0).thickness, Path.Direction.CW);
}
}
... ... @@ -395,6 +411,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
/**
* 记录最原始的数据
*/
private List<AnnotaionEntity> annotations = new ArrayList<>();
private List<List<PointGroupEntity>> originPoint = new ArrayList<>();
private List<List<PointGroupEntity>> operatePoints = new ArrayList<>();
private List<Path> pathLists = new ArrayList<Path>();
... ... @@ -452,9 +469,6 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
// this.setZOrderMediaOverlay(true);
this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
// this.pathLists.add(new Path());
// this.paintLists.add(this.createPaint(paintFillColor));
// this.historyPointer++;
screenWidth = DisplayUtil.getScreenWidth(getContext());
}
... ... @@ -464,14 +478,14 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
* @param color
* @return paint This is returned as the instance of Paint
*/
private Paint createPaint(int color) {
private Paint createPaint(int color, int thickness) {
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(this.paintStyle);
paint.setStrokeWidth(this.paintStrokeWidth);///设置线宽
paint.setStrokeWidth(thickness);///设置线宽
paint.setStrokeCap(this.lineCap);
paint.setStrokeJoin(Paint.Join.MITER); // fixed
paint.setStrokeJoin(Paint.Join.ROUND); // fixed
// Otherwise
paint.setColor(color);
paint.setShadowLayer(this.blur, 0F, 0F, this.paintStrokeColor);
... ... @@ -521,23 +535,12 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
* @param annotations
*/
public void drawLine(List<AnnotaionEntity> annotations) {
this.annotations.addAll(annotations);
for (AnnotaionEntity annotation : annotations) {
List<PointGroupEntity> pointXies = annotation.pointGroup;
int color = Color.parseColor(annotation.color);
setPaintFillColor(color);
copyArr(pointXies);
// adjustPath(mRectDes.top);
// for (int j = 0; j < pointXies.size(); j++) {
// PointGroupEntity pointGroupEntity = pointXies.get(j);
// Path path = this.getCurrentPath();
// float w2 = pointGroupEntity.w;
// float h2 = pointGroupEntity.h + (FLOAT_TYPE * mRectDes.top) / (FLOAT_TYPE * finalWidth) * 100f;
// pointGroupEntity.h = h2;
// path.lineTo(w2 / 100 * finalWidth, h2 / 100 * finalWidth);
// }
for (PointGroupEntity pointXy : pointXies) {
float w = pointXy.w;
float h = pointXy.h + (FLOAT_TYPE * currentOffsetY) / (FLOAT_TYPE * finalWidth) * 100f;
... ... @@ -546,11 +549,18 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
//操作一下這個點
operatePoints.add(pointXies);
// Path path = new Path();
// path.addCircle(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop, annotations.get(0).thickness, Path.Direction.CW);
// pathLists.add(path);
pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop));
paintLists.add(this.createPaint(color));
paintLists.add(this.createPaint(color, annotation.thickness * 2));
this.historyPointer++;
for (int i = 0; i < pointXies.size(); i++) {
Path path = this.getCurrentPath();
// p.addCircle(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop, annotation.thickness, Path.Direction.CW);
path.lineTo(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop);
}
}
... ...