|
|
|
@ -8,6 +8,7 @@ import android.graphics.Color;
|
|
|
|
|
import android.graphics.Paint;
|
|
|
|
|
import android.graphics.RectF;
|
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
|
@ -22,8 +23,8 @@ public class RockerView extends View{
|
|
|
|
|
Paint backPaint = new Paint(); // 背景画笔
|
|
|
|
|
Paint bubblePaint = new Paint(); // 气泡画笔
|
|
|
|
|
Paint rectfPaint = new Paint();
|
|
|
|
|
float bubbleX = 250, bubbleY = 300; // 定义气泡的位置
|
|
|
|
|
float backX = 250, backY = 300; // 背景圆的位置
|
|
|
|
|
float bubbleX = 300, bubbleY = 700; // 定义气泡的位置
|
|
|
|
|
float backX = 300, backY = 700; // 背景圆的位置
|
|
|
|
|
int radiusBack = 200, radiusBubble = 100; // 定义背景圆以及气泡的半径
|
|
|
|
|
RectF mRectF = new RectF(backX-radiusBack,backY-radiusBack,backX+radiusBack,backY+radiusBack);
|
|
|
|
|
Context mContext;
|
|
|
|
@ -37,11 +38,12 @@ public class RockerView extends View{
|
|
|
|
|
this.mContext = context;
|
|
|
|
|
}
|
|
|
|
|
private void initPaint() {
|
|
|
|
|
int grayColor = Color.argb(128, 128, 128, 128);
|
|
|
|
|
backPaint.setAntiAlias(true);
|
|
|
|
|
backPaint.setColor(Color.parseColor("blue"));
|
|
|
|
|
backPaint.setColor(grayColor);
|
|
|
|
|
|
|
|
|
|
bubblePaint.setAntiAlias(true);
|
|
|
|
|
bubblePaint.setColor(Color.parseColor("red"));
|
|
|
|
|
bubblePaint.setColor(grayColor);
|
|
|
|
|
|
|
|
|
|
rectfPaint.setAntiAlias(true);
|
|
|
|
|
rectfPaint.setColor(Color.parseColor("red"));
|
|
|
|
@ -57,6 +59,7 @@ public class RockerView extends View{
|
|
|
|
|
case "GO":
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
try {
|
|
|
|
|
Log.d("wifirobot","moveup");
|
|
|
|
|
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0xff});
|
|
|
|
|
socketWriter.flush();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|