| | |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | |
| | | private LinkedBlockingQueue queue = new LinkedBlockingQueue(100); |
| | | private ExecutorService producer = Executors.newSingleThreadExecutor(); |
| | | private ExecutorService consumer = Executors.newSingleThreadExecutor(); |
| | | |
| | | |
| | | private long count =0; |
| | | private long lastcount =0; |
| | | private ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | |
| | | gson = new Gson(); |
| | | initView(view); |
| | | consumer.execute(new CalRunnable()); |
| | | scheduledExecutorService.scheduleAtFixedRate(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Log.i(TAG,"1s到"); |
| | | if (lastcount==count){ |
| | | Log.i(TAG,"已经没在发消息了"); |
| | | leftDistance = 0.0; |
| | | rightDistance = 0.0; |
| | | } |
| | | lastcount = count; |
| | | } |
| | | },1000,1000, TimeUnit.MILLISECONDS); |
| | | return view; |
| | | } |
| | | private int avaliableHeight,avalibleWidth; |
| | |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(base_x-110, base_y-35); |
| | | pathText.lineTo(base_x-20, base_y-35); |
| | | canvas3.drawTextOnPath(String.valueOf(leftDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | if (leftDistance == 0.0){ |
| | | |
| | | canvas3.drawTextOnPath("...", pathText, 0, 0, mPaint);//逆时针生成 |
| | | }else{ |
| | | |
| | | canvas3.drawTextOnPath(String.valueOf(leftDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | } |
| | | } |
| | | if (osdMoveDirect != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(base_x+30, base_y-35); |
| | | pathText.lineTo(base_x+110, base_y-35); |
| | | canvas3.drawTextOnPath(String.valueOf(rightDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | if (rightDistance == 0.0){ |
| | | |
| | | canvas3.drawTextOnPath("...", pathText, 0, 0, mPaint);//逆时针生成 |
| | | }else{ |
| | | canvas3.drawTextOnPath(String.valueOf(rightDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | } |
| | | } |
| | | paint.setColor(Color.RED); |
| | | canvas3.drawLine(base_x-120,base_y-200,base_x-120,base_y+200,paint); |