正在显示
100 个修改的文件
包含
113 行增加
和
69 行删除
| @@ -20,8 +20,8 @@ public class EncryptUtilTest { | @@ -20,8 +20,8 @@ public class EncryptUtilTest { | ||
| 20 | @Test | 20 | @Test |
| 21 | public void testMD5Encode() throws Exception { | 21 | public void testMD5Encode() throws Exception { |
| 22 | String s = EncryptUtil.MD5Encode("123456"); | 22 | String s = EncryptUtil.MD5Encode("123456"); |
| 23 | -// Assert.assertEquals("e10adc3949ba59abbe56e057f20f883e", s); | ||
| 24 | - BigDecimal bigDecimal = new BigDecimal("4.44").setScale(1, BigDecimal.ROUND_HALF_UP); | ||
| 25 | - Assert.assertEquals(bigDecimal.floatValue(), 5); | 23 | + Assert.assertEquals("e10adc3949ba59abbe56e057f20f883e", s); |
| 24 | +// BigDecimal bigDecimal = new BigDecimal("4.44").setScale(1, BigDecimal.ROUND_HALF_UP); | ||
| 25 | +// Assert.assertEquals(bigDecimal.floatValue(), 5); | ||
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| @@ -14,7 +14,7 @@ public class AnnotaionEntity { | @@ -14,7 +14,7 @@ public class AnnotaionEntity { | ||
| 14 | public String curPageNo; | 14 | public String curPageNo; |
| 15 | public List<PointGroupEntity> pointGroup; | 15 | public List<PointGroupEntity> pointGroup; |
| 16 | public String color; | 16 | public String color; |
| 17 | - public String thickness; | 17 | + public int thickness; |
| 18 | public String radius; | 18 | public String radius; |
| 19 | public String fontSize; | 19 | public String fontSize; |
| 20 | public String fontName; | 20 | public String fontName; |
| @@ -4,7 +4,6 @@ import android.graphics.Bitmap; | @@ -4,7 +4,6 @@ import android.graphics.Bitmap; | ||
| 4 | import android.graphics.BitmapFactory; | 4 | import android.graphics.BitmapFactory; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.os.Handler; | 6 | import android.os.Handler; |
| 7 | -import android.os.Message; | ||
| 8 | import android.support.annotation.NonNull; | 7 | import android.support.annotation.NonNull; |
| 9 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
| 10 | import android.util.DisplayMetrics; | 9 | import android.util.DisplayMetrics; |
| @@ -79,6 +78,12 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | @@ -79,6 +78,12 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | ||
| 79 | docUrlTransformBitmap(null); | 78 | docUrlTransformBitmap(null); |
| 80 | } | 79 | } |
| 81 | 80 | ||
| 81 | + @Override | ||
| 82 | + public void onDestroyView() { | ||
| 83 | + super.onDestroyView(); | ||
| 84 | + handler.removeCallbacksAndMessages(null); | ||
| 85 | + } | ||
| 86 | + | ||
| 82 | private void getWindowWith(DisplayMetrics metric) { | 87 | private void getWindowWith(DisplayMetrics metric) { |
| 83 | getActivity().getWindowManager().getDefaultDisplay().getMetrics(metric); | 88 | getActivity().getWindowManager().getDefaultDisplay().getMetrics(metric); |
| 84 | winWidth = metric.widthPixels; // 屏幕宽度(像素) | 89 | winWidth = metric.widthPixels; // 屏幕宽度(像素) |
| @@ -115,18 +120,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | @@ -115,18 +120,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | ||
| 115 | 120 | ||
| 116 | public final static int SEND = 0; | 121 | public final static int SEND = 0; |
| 117 | 122 | ||
| 118 | - Handler handler = new Handler() { | ||
| 119 | - @Override | ||
| 120 | - public void handleMessage(Message msg) { | ||
| 121 | - int what = msg.what; | ||
| 122 | - WhiteboardUpdateEntity obj = (WhiteboardUpdateEntity) msg.obj; | ||
| 123 | - switch (what) { | ||
| 124 | - case SEND: | ||
| 125 | - mCanvasView.drawLine(obj.annotaionItems); | ||
| 126 | - break; | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | - }; | 123 | + static Handler handler = new Handler(); |
| 130 | 124 | ||
| 131 | /** | 125 | /** |
| 132 | * @param entity | 126 | * @param entity |
| @@ -147,7 +141,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | @@ -147,7 +141,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | ||
| 147 | } | 141 | } |
| 148 | 142 | ||
| 149 | private void delayDraw(final WhiteboardUpdateEntity entity) { | 143 | private void delayDraw(final WhiteboardUpdateEntity entity) { |
| 150 | - handler.postDelayed(new BaseRunnable<WhiteboardUpdateEntity>(entity) { | 144 | + handler.postDelayed(new BaseRunnable<WhiteboardUpdateEntity>() { |
| 151 | 145 | ||
| 152 | @Override | 146 | @Override |
| 153 | protected void handle(WhiteboardUpdateEntity o) { | 147 | protected void handle(WhiteboardUpdateEntity o) { |
| @@ -218,20 +212,13 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | @@ -218,20 +212,13 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC | ||
| 218 | @Override | 212 | @Override |
| 219 | public void call(WrapDocBitMapEntity resource) { | 213 | public void call(WrapDocBitMapEntity resource) { |
| 220 | 214 | ||
| 221 | - //用handler发送 跟drawline在一个队列里执行,否则顺序乱了导致切换图片的时候还有上一个画面的标注 | ||
| 222 | - handler.post(new BaseRunnable<WrapDocBitMapEntity>(resource) { | ||
| 223 | - @Override | ||
| 224 | - protected void handle(WrapDocBitMapEntity wrapDocBitMapEntity) { | ||
| 225 | - | ||
| 226 | - if (wrapDocBitMapEntity.getBitmap() == null) { | ||
| 227 | - showMessage("图片获取失败"); | ||
| 228 | - Bitmap bitmap = getNoDocBitmap(); | ||
| 229 | - mCanvasView.setBitmap(bitmap, false); | ||
| 230 | - } else { | ||
| 231 | - mCanvasView.setBitmap(wrapDocBitMapEntity.getBitmap(), !wrapDocBitMapEntity.showNoDoc()); | ||
| 232 | - } | ||
| 233 | - } | ||
| 234 | - }); | 215 | + if (resource.getBitmap() == null) { |
| 216 | + showMessage("图片获取失败"); | ||
| 217 | + Bitmap bitmap = getNoDocBitmap(); | ||
| 218 | + mCanvasView.setBitmap(bitmap, false); | ||
| 219 | + } else { | ||
| 220 | + mCanvasView.setBitmap(resource.getBitmap(), !resource.showNoDoc()); | ||
| 221 | + } | ||
| 235 | } | 222 | } |
| 236 | }); | 223 | }); |
| 237 | } | 224 | } |
| @@ -7,6 +7,7 @@ import android.os.Bundle; | @@ -7,6 +7,7 @@ import android.os.Bundle; | ||
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | import android.os.Message; | 8 | import android.os.Message; |
| 9 | import android.support.annotation.NonNull; | 9 | import android.support.annotation.NonNull; |
| 10 | +import android.support.annotation.StringRes; | ||
| 10 | import android.support.v7.app.AlertDialog; | 11 | import android.support.v7.app.AlertDialog; |
| 11 | import android.util.Log; | 12 | import android.util.Log; |
| 12 | import android.view.MotionEvent; | 13 | import android.view.MotionEvent; |
| @@ -796,6 +797,25 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live | @@ -796,6 +797,25 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live | ||
| 796 | } | 797 | } |
| 797 | 798 | ||
| 798 | @Override | 799 | @Override |
| 800 | + public void showAlertDialog(@StringRes int alertStr) { | ||
| 801 | + | ||
| 802 | + AlertDialog dialog = new AlertDialog.Builder(getContext()) | ||
| 803 | + .setTitle(R.string.home_pwd_mention) | ||
| 804 | + .setMessage(alertStr) | ||
| 805 | + .setPositiveButton(R.string.home_confirm, new DialogInterface.OnClickListener() { | ||
| 806 | + @Override | ||
| 807 | + public void onClick(DialogInterface dialogInterface, int i) { | ||
| 808 | + dialogInterface.dismiss(); | ||
| 809 | + } | ||
| 810 | + }) | ||
| 811 | + .create(); | ||
| 812 | + | ||
| 813 | + dialog.show(); | ||
| 814 | + dialog.setCanceledOnTouchOutside(false); | ||
| 815 | + } | ||
| 816 | + | ||
| 817 | + | ||
| 818 | + @Override | ||
| 799 | public void showErrorDialog(String reason) { | 819 | public void showErrorDialog(String reason) { |
| 800 | 820 | ||
| 801 | if (mErrorDialog != null) | 821 | if (mErrorDialog != null) |
| @@ -823,6 +843,11 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live | @@ -823,6 +843,11 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live | ||
| 823 | } | 843 | } |
| 824 | } | 844 | } |
| 825 | 845 | ||
| 846 | + @Override | ||
| 847 | + public boolean getVisible() { | ||
| 848 | + return this.isSupportVisible(); | ||
| 849 | + } | ||
| 850 | + | ||
| 826 | private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() { | 851 | private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() { |
| 827 | 852 | ||
| 828 | public void onStartTrackingTouch(SeekBar bar) { | 853 | public void onStartTrackingTouch(SeekBar bar) { |
| @@ -891,4 +916,6 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live | @@ -891,4 +916,6 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live | ||
| 891 | mShowing = false; | 916 | mShowing = false; |
| 892 | } | 917 | } |
| 893 | } | 918 | } |
| 919 | + | ||
| 920 | + | ||
| 894 | } | 921 | } |
| @@ -110,23 +110,23 @@ public interface Constants { | @@ -110,23 +110,23 @@ public interface Constants { | ||
| 110 | /** | 110 | /** |
| 111 | * 获取录制回放数据失败 | 111 | * 获取录制回放数据失败 |
| 112 | */ | 112 | */ |
| 113 | - String GET_RECORD_ERROR = "911"; | 113 | + int GET_RECORD_ERROR = 911; |
| 114 | /** | 114 | /** |
| 115 | * 初始化录制回放失败 | 115 | * 初始化录制回放失败 |
| 116 | */ | 116 | */ |
| 117 | - String INIT_RECORD_ERROR = "910"; | 117 | + int INIT_RECORD_ERROR = 910; |
| 118 | /** | 118 | /** |
| 119 | * [加入课堂] 有相同身份的人员加入课堂,自己被踢出课堂 | 119 | * [加入课堂] 有相同身份的人员加入课堂,自己被踢出课堂 |
| 120 | */ | 120 | */ |
| 121 | - String KICK_SELF = "208"; | 121 | + int KICK_SELF = 208; |
| 122 | /** | 122 | /** |
| 123 | * [加入课堂] 已经在其它地方登陆 | 123 | * [加入课堂] 已经在其它地方登陆 |
| 124 | */ | 124 | */ |
| 125 | - String ALREAD_LOGIN = "207"; | 125 | + int ALREAD_LOGIN = 207; |
| 126 | /** | 126 | /** |
| 127 | * [加入课堂] 密码错误 | 127 | * [加入课堂] 密码错误 |
| 128 | */ | 128 | */ |
| 129 | - String PWD_ERROR = "206"; | 129 | + int PWD_ERROR = 206; |
| 130 | /** | 130 | /** |
| 131 | * [加入课堂] 人数已满 | 131 | * [加入课堂] 人数已满 |
| 132 | */ | 132 | */ |
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | package com.xdy.home.vp; | 17 | package com.xdy.home.vp; |
| 18 | 18 | ||
| 19 | import android.content.Context; | 19 | import android.content.Context; |
| 20 | +import android.support.annotation.StringRes; | ||
| 20 | import android.view.SurfaceView; | 21 | import android.view.SurfaceView; |
| 21 | 22 | ||
| 22 | import com.xdy.commonlibrary.mvp.BaseView; | 23 | import com.xdy.commonlibrary.mvp.BaseView; |
| @@ -123,6 +124,7 @@ public interface LiveContract { | @@ -123,6 +124,7 @@ public interface LiveContract { | ||
| 123 | * @param reson | 124 | * @param reson |
| 124 | */ | 125 | */ |
| 125 | void showErrorDialog(int reson); | 126 | void showErrorDialog(int reson); |
| 127 | + | ||
| 126 | /** | 128 | /** |
| 127 | * 展示错误界面 | 129 | * 展示错误界面 |
| 128 | * @param reson | 130 | * @param reson |
| @@ -130,9 +132,20 @@ public interface LiveContract { | @@ -130,9 +132,20 @@ public interface LiveContract { | ||
| 130 | void showErrorDialog(String reson); | 132 | void showErrorDialog(String reson); |
| 131 | 133 | ||
| 132 | /** | 134 | /** |
| 135 | + * 提示框 | ||
| 136 | + * @param alertStr | ||
| 137 | + */ | ||
| 138 | + void showAlertDialog(@StringRes int alertStr); | ||
| 139 | + | ||
| 140 | + /** | ||
| 133 | * 重置SEEKBAR | 141 | * 重置SEEKBAR |
| 134 | */ | 142 | */ |
| 135 | void resetSeekBar(); | 143 | void resetSeekBar(); |
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * 获取界面状态 | ||
| 147 | + */ | ||
| 148 | + boolean getVisible(); | ||
| 136 | } | 149 | } |
| 137 | 150 | ||
| 138 | interface ChatView extends BaseView { | 151 | interface ChatView extends BaseView { |
| @@ -380,11 +380,13 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac | @@ -380,11 +380,13 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac | ||
| 380 | 380 | ||
| 381 | public void playAudio(String pa) { | 381 | public void playAudio(String pa) { |
| 382 | currentPlayAudio = GsonUtil.json2Bean(pa, VideoEntity.class); | 382 | currentPlayAudio = GsonUtil.json2Bean(pa, VideoEntity.class); |
| 383 | - if (currentPlayAudio != null) { | ||
| 384 | - checkPlayMode(false); | ||
| 385 | - mRootView.playAudio(currentPlayAudio); | ||
| 386 | - } else { | ||
| 387 | - mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error)); | 383 | + if (mRootView.getVisible()) { |
| 384 | + if (currentPlayAudio != null) { | ||
| 385 | + checkPlayMode(false); | ||
| 386 | + mRootView.playAudio(currentPlayAudio); | ||
| 387 | + } else { | ||
| 388 | + mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error)); | ||
| 389 | + } | ||
| 388 | } | 390 | } |
| 389 | } | 391 | } |
| 390 | 392 | ||
| @@ -400,12 +402,14 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac | @@ -400,12 +402,14 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac | ||
| 400 | 402 | ||
| 401 | public void playVideo(String pa) { | 403 | public void playVideo(String pa) { |
| 402 | currentPlayVideo = GsonUtil.json2Bean(pa, VideoEntity.class); | 404 | currentPlayVideo = GsonUtil.json2Bean(pa, VideoEntity.class); |
| 403 | - if (currentPlayVideo != null) { | ||
| 404 | - checkPlayMode(true); | 405 | + if (mRootView.getVisible()) { |
| 406 | + if (currentPlayVideo != null) { | ||
| 407 | + checkPlayMode(true); | ||
| 405 | // String rtmpUrl = currentPlayVideo.getRtmpUrl(); | 408 | // String rtmpUrl = currentPlayVideo.getRtmpUrl(); |
| 406 | - mRootView.playVideo(currentPlayVideo); | ||
| 407 | - } else { | ||
| 408 | - mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error)); | 409 | + mRootView.playVideo(currentPlayVideo); |
| 410 | + } else { | ||
| 411 | + mRootView.showMessage(ResUtil.get().getString(R.string.home_parse_error)); | ||
| 412 | + } | ||
| 409 | } | 413 | } |
| 410 | } | 414 | } |
| 411 | 415 | ||
| @@ -453,7 +457,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac | @@ -453,7 +457,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac | ||
| 453 | 457 | ||
| 454 | if (errorEvent != null) { | 458 | if (errorEvent != null) { |
| 455 | String reason = errorEvent.getReson(); | 459 | String reason = errorEvent.getReson(); |
| 456 | - if (!TextUtils.isEmpty(reason) && !(Constants.LEAVE_CLASS_CODE == errorEvent.getCode())) { | 460 | + |
| 461 | + if (Constants.PWD_ERROR == errorEvent.getCode()) {//密码错误 | ||
| 462 | + mRootView.showAlertDialog(R.string.home_pwd_wrong); | ||
| 463 | + } else if (!TextUtils.isEmpty(reason) && !(Constants.LEAVE_CLASS_CODE == errorEvent.getCode())) { | ||
| 457 | connceted = false; | 464 | connceted = false; |
| 458 | mRootView.showMessage(reason); | 465 | mRootView.showMessage(reason); |
| 459 | mRootView.quit(); | 466 | mRootView.quit(); |
| @@ -131,12 +131,17 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -131,12 +131,17 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 131 | pathLists.clear(); | 131 | pathLists.clear(); |
| 132 | this.historyPointer = 0; | 132 | this.historyPointer = 0; |
| 133 | for (List<PointGroupEntity> pointGroupEntities : originPoint) { | 133 | for (List<PointGroupEntity> pointGroupEntities : originPoint) { |
| 134 | +// Path path = new Path(); | ||
| 135 | +// path.addCircle(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop, annotations.get(0).thickness, Path.Direction.CW); | ||
| 136 | +// pathLists.add(path); | ||
| 134 | pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop)); | 137 | pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop)); |
| 135 | this.historyPointer++; | 138 | this.historyPointer++; |
| 136 | for (int j = 0; j < pointGroupEntities.size(); j++) { | 139 | for (int j = 0; j < pointGroupEntities.size(); j++) { |
| 137 | PointGroupEntity pointGroupEntity = pointGroupEntities.get(j); | 140 | PointGroupEntity pointGroupEntity = pointGroupEntities.get(j); |
| 138 | - Path path = this.getCurrentPath(); | ||
| 139 | - path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop); | 141 | + Path p = this.getCurrentPath(); |
| 142 | +// p.addCircle(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop, annotations.get(0).thickness, Path.Direction.CW); | ||
| 143 | + | ||
| 144 | + p.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop); | ||
| 140 | } | 145 | } |
| 141 | } | 146 | } |
| 142 | } | 147 | } |
| @@ -269,6 +274,9 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -269,6 +274,9 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 269 | float h = pointGroupEntities.get(0).h + (FLOAT_TYPE * offsetY) / (FLOAT_TYPE * finalWidth) * 100f; | 274 | float h = pointGroupEntities.get(0).h + (FLOAT_TYPE * offsetY) / (FLOAT_TYPE * finalWidth) * 100f; |
| 270 | pointGroupEntities.get(0).h = h; | 275 | pointGroupEntities.get(0).h = h; |
| 271 | 276 | ||
| 277 | +// Path p = new Path(); | ||
| 278 | +// p.addCircle(w / 100f * finalWidth, h / 100f * finalWidth, annotations.get(0).thickness, Path.Direction.CW); | ||
| 279 | +// pathLists.add(p); | ||
| 272 | pathLists.add(createPath(w / 100f * finalWidth, h / 100f * finalWidth)); | 280 | pathLists.add(createPath(w / 100f * finalWidth, h / 100f * finalWidth)); |
| 273 | historyPointer++; | 281 | historyPointer++; |
| 274 | for (int j = 1; j < pointGroupEntities.size(); j++) { | 282 | for (int j = 1; j < pointGroupEntities.size(); j++) { |
| @@ -278,6 +286,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -278,6 +286,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 278 | float h2 = pointGroupEntity.h + (FLOAT_TYPE * offsetY) / (FLOAT_TYPE * finalWidth) * 100f; | 286 | float h2 = pointGroupEntity.h + (FLOAT_TYPE * offsetY) / (FLOAT_TYPE * finalWidth) * 100f; |
| 279 | pointGroupEntity.h = h2; | 287 | pointGroupEntity.h = h2; |
| 280 | path.lineTo(w2 / 100 * finalWidth, h2 / 100 * finalWidth); | 288 | path.lineTo(w2 / 100 * finalWidth, h2 / 100 * finalWidth); |
| 289 | +// path.addCircle(w2 / 100 * finalWidth, h2 / 100 * finalWidth, annotations.get(0).thickness, Path.Direction.CW); | ||
| 281 | } | 290 | } |
| 282 | } | 291 | } |
| 283 | } | 292 | } |
| @@ -358,13 +367,20 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -358,13 +367,20 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 358 | pathLists.clear(); | 367 | pathLists.clear(); |
| 359 | historyPointer = 0; | 368 | historyPointer = 0; |
| 360 | for (List<PointGroupEntity> pointGroupEntities : operatePoints) { | 369 | for (List<PointGroupEntity> pointGroupEntities : operatePoints) { |
| 370 | +// Path p = new Path(); | ||
| 371 | +// p.addCircle(pointGroupEntities.get(0).w / 100f * finalWidth, pointGroupEntities.get(0).h / 100f * finalWidth, annotations.get(0).thickness, Path.Direction.CW); | ||
| 372 | +// pathLists.add(p); | ||
| 373 | + | ||
| 361 | pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop)); | 374 | pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop)); |
| 362 | historyPointer++; | 375 | historyPointer++; |
| 363 | for (int i = 1; i < pointGroupEntities.size(); i++) { | 376 | for (int i = 1; i < pointGroupEntities.size(); i++) { |
| 364 | PointGroupEntity pointGroupEntity = pointGroupEntities.get(i); | 377 | PointGroupEntity pointGroupEntity = pointGroupEntities.get(i); |
| 365 | Path path = this.getCurrentPath(); | 378 | Path path = this.getCurrentPath(); |
| 366 | path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop); | 379 | path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop); |
| 380 | +// path.addCircle(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth, annotations.get(0).thickness, Path.Direction.CW); | ||
| 381 | + | ||
| 367 | } | 382 | } |
| 383 | + | ||
| 368 | } | 384 | } |
| 369 | 385 | ||
| 370 | 386 | ||
| @@ -395,6 +411,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -395,6 +411,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 395 | /** | 411 | /** |
| 396 | * 记录最原始的数据 | 412 | * 记录最原始的数据 |
| 397 | */ | 413 | */ |
| 414 | + private List<AnnotaionEntity> annotations = new ArrayList<>(); | ||
| 398 | private List<List<PointGroupEntity>> originPoint = new ArrayList<>(); | 415 | private List<List<PointGroupEntity>> originPoint = new ArrayList<>(); |
| 399 | private List<List<PointGroupEntity>> operatePoints = new ArrayList<>(); | 416 | private List<List<PointGroupEntity>> operatePoints = new ArrayList<>(); |
| 400 | private List<Path> pathLists = new ArrayList<Path>(); | 417 | private List<Path> pathLists = new ArrayList<Path>(); |
| @@ -452,9 +469,6 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -452,9 +469,6 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 452 | // this.setZOrderMediaOverlay(true); | 469 | // this.setZOrderMediaOverlay(true); |
| 453 | this.getHolder().setFormat(PixelFormat.TRANSLUCENT); | 470 | this.getHolder().setFormat(PixelFormat.TRANSLUCENT); |
| 454 | 471 | ||
| 455 | -// this.pathLists.add(new Path()); | ||
| 456 | -// this.paintLists.add(this.createPaint(paintFillColor)); | ||
| 457 | -// this.historyPointer++; | ||
| 458 | screenWidth = DisplayUtil.getScreenWidth(getContext()); | 472 | screenWidth = DisplayUtil.getScreenWidth(getContext()); |
| 459 | } | 473 | } |
| 460 | 474 | ||
| @@ -464,14 +478,14 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -464,14 +478,14 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 464 | * @param color | 478 | * @param color |
| 465 | * @return paint This is returned as the instance of Paint | 479 | * @return paint This is returned as the instance of Paint |
| 466 | */ | 480 | */ |
| 467 | - private Paint createPaint(int color) { | 481 | + private Paint createPaint(int color, int thickness) { |
| 468 | Paint paint = new Paint(); | 482 | Paint paint = new Paint(); |
| 469 | 483 | ||
| 470 | paint.setAntiAlias(true); | 484 | paint.setAntiAlias(true); |
| 471 | paint.setStyle(this.paintStyle); | 485 | paint.setStyle(this.paintStyle); |
| 472 | - paint.setStrokeWidth(this.paintStrokeWidth);///设置线宽 | 486 | + paint.setStrokeWidth(thickness);///设置线宽 |
| 473 | paint.setStrokeCap(this.lineCap); | 487 | paint.setStrokeCap(this.lineCap); |
| 474 | - paint.setStrokeJoin(Paint.Join.MITER); // fixed | 488 | + paint.setStrokeJoin(Paint.Join.ROUND); // fixed |
| 475 | // Otherwise | 489 | // Otherwise |
| 476 | paint.setColor(color); | 490 | paint.setColor(color); |
| 477 | paint.setShadowLayer(this.blur, 0F, 0F, this.paintStrokeColor); | 491 | paint.setShadowLayer(this.blur, 0F, 0F, this.paintStrokeColor); |
| @@ -521,23 +535,12 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -521,23 +535,12 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 521 | * @param annotations | 535 | * @param annotations |
| 522 | */ | 536 | */ |
| 523 | public void drawLine(List<AnnotaionEntity> annotations) { | 537 | public void drawLine(List<AnnotaionEntity> annotations) { |
| 538 | + this.annotations.addAll(annotations); | ||
| 524 | for (AnnotaionEntity annotation : annotations) { | 539 | for (AnnotaionEntity annotation : annotations) { |
| 525 | List<PointGroupEntity> pointXies = annotation.pointGroup; | 540 | List<PointGroupEntity> pointXies = annotation.pointGroup; |
| 526 | int color = Color.parseColor(annotation.color); | 541 | int color = Color.parseColor(annotation.color); |
| 527 | setPaintFillColor(color); | 542 | setPaintFillColor(color); |
| 528 | copyArr(pointXies); | 543 | copyArr(pointXies); |
| 529 | -// adjustPath(mRectDes.top); | ||
| 530 | - | ||
| 531 | -// for (int j = 0; j < pointXies.size(); j++) { | ||
| 532 | -// PointGroupEntity pointGroupEntity = pointXies.get(j); | ||
| 533 | -// Path path = this.getCurrentPath(); | ||
| 534 | -// float w2 = pointGroupEntity.w; | ||
| 535 | -// float h2 = pointGroupEntity.h + (FLOAT_TYPE * mRectDes.top) / (FLOAT_TYPE * finalWidth) * 100f; | ||
| 536 | -// pointGroupEntity.h = h2; | ||
| 537 | -// path.lineTo(w2 / 100 * finalWidth, h2 / 100 * finalWidth); | ||
| 538 | -// } | ||
| 539 | - | ||
| 540 | - | ||
| 541 | for (PointGroupEntity pointXy : pointXies) { | 544 | for (PointGroupEntity pointXy : pointXies) { |
| 542 | float w = pointXy.w; | 545 | float w = pointXy.w; |
| 543 | float h = pointXy.h + (FLOAT_TYPE * currentOffsetY) / (FLOAT_TYPE * finalWidth) * 100f; | 546 | float h = pointXy.h + (FLOAT_TYPE * currentOffsetY) / (FLOAT_TYPE * finalWidth) * 100f; |
| @@ -546,11 +549,18 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | @@ -546,11 +549,18 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V | ||
| 546 | 549 | ||
| 547 | //操作一下這個點 | 550 | //操作一下這個點 |
| 548 | operatePoints.add(pointXies); | 551 | operatePoints.add(pointXies); |
| 552 | + | ||
| 553 | +// Path path = new Path(); | ||
| 554 | +// path.addCircle(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop, annotations.get(0).thickness, Path.Direction.CW); | ||
| 555 | +// pathLists.add(path); | ||
| 556 | + | ||
| 549 | pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop)); | 557 | pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop)); |
| 550 | - paintLists.add(this.createPaint(color)); | 558 | + paintLists.add(this.createPaint(color, annotation.thickness * 2)); |
| 551 | this.historyPointer++; | 559 | this.historyPointer++; |
| 552 | for (int i = 0; i < pointXies.size(); i++) { | 560 | for (int i = 0; i < pointXies.size(); i++) { |
| 553 | Path path = this.getCurrentPath(); | 561 | Path path = this.getCurrentPath(); |
| 562 | +// p.addCircle(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop, annotation.thickness, Path.Direction.CW); | ||
| 563 | + | ||
| 554 | path.lineTo(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop); | 564 | path.lineTo(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop); |
| 555 | } | 565 | } |
| 556 | } | 566 | } |
2.4 KB
2.4 KB
2.4 KB
2.6 KB
2.5 KB
5.0 KB
4.8 KB
2.4 KB
2.1 KB
4.4 KB
2.2 KB
2.5 KB
2.4 KB
3.7 KB
2.4 KB
4.6 KB
4.3 KB
2.5 KB
2.2 KB
2.6 KB
home/src/main/res/drawable-nodpi/hua.png
已删除
100644 → 0
1.4 KB
2.5 KB
4.7 KB
4.6 KB
4.6 KB
2.6 KB
2.7 KB
2.5 KB
2.5 KB
3.6 KB
home/src/main/res/drawable-nodpi/kun.png
已删除
100644 → 0
2.4 KB
4.8 KB
2.3 KB
4.3 KB
4.3 KB
2.3 KB
2.5 KB
2.2 KB
1.9 KB
2.4 KB
home/src/main/res/drawable-nodpi/qiu.png
已删除
100644 → 0
3.7 KB
home/src/main/res/drawable-nodpi/ruo.png
已删除
100644 → 0
3.4 KB
2.6 KB
4.8 KB
home/src/main/res/drawable-nodpi/sun.png
已删除
100644 → 0
2.4 KB
2.9 KB
2.6 KB
home/src/main/res/drawable-nodpi/tu.png
已删除
100644 → 0
2.4 KB
2.5 KB
2.4 KB
2.2 KB
2.2 KB
home/src/main/res/drawable-nodpi/xin.png
已删除
100644 → 0
2.0 KB
4.5 KB
5.3 KB
2.2 KB
home/src/main/res/drawable-nodpi/yue.png
已删除
100644 → 0
2.4 KB
2.5 KB
home/src/main/res/drawable-nodpi/yun.png
已删除
100644 → 0
2.4 KB
2.6 KB
2.3 KB
2.5 KB
4.7 KB
2.2 KB
1.7 KB
home/src/main/res/drawable-xxhdpi/aimu.png
0 → 100644
4.5 KB
home/src/main/res/drawable-xxhdpi/aoman.png
0 → 100644
4.6 KB
home/src/main/res/drawable-xxhdpi/baiyan.png
0 → 100644
4.6 KB
4.8 KB
home/src/main/res/drawable-xxhdpi/bishi.png
0 → 100644
5.1 KB
home/src/main/res/drawable-xxhdpi/bizui.png
0 → 100644
5.1 KB
home/src/main/res/drawable-xxhdpi/cahan.png
0 → 100644
5.1 KB
676 字节
home/src/main/res/drawable-xxhdpi/cool.png
0 → 100644
4.8 KB
home/src/main/res/drawable-xxhdpi/dabing.png
0 → 100644
4.5 KB
home/src/main/res/drawable-xxhdpi/daku.png
0 → 100644
4.7 KB
home/src/main/res/drawable-xxhdpi/dangao.png
0 → 100644
4.5 KB
home/src/main/res/drawable-xxhdpi/daxiao.png
0 → 100644
5.1 KB
home/src/main/res/drawable-xxhdpi/fadai.png
0 → 100644
4.9 KB
home/src/main/res/drawable-xxhdpi/fanu.png
0 → 100644
5.6 KB
home/src/main/res/drawable-xxhdpi/fendou.png
0 → 100644
4.8 KB
home/src/main/res/drawable-xxhdpi/ganga.png
0 → 100644
4.8 KB
home/src/main/res/drawable-xxhdpi/guai.png
0 → 100644
4.5 KB
5.1 KB
4.7 KB
home/src/main/res/drawable-xxhdpi/haqi.png
0 → 100644
5.2 KB
home/src/main/res/drawable-xxhdpi/hua.png
0 → 100644
3.0 KB
4.9 KB
home/src/main/res/drawable-xxhdpi/jiew.png
0 → 100644
4.9 KB
4.9 KB
home/src/main/res/drawable-xxhdpi/jingya.png
0 → 100644
4.9 KB
-
请 注册 或 登录 后发表评论