@@ -81,15 +81,21 @@ public SensorValue getSensorValue() {
81
81
}
82
82
83
83
private void drawPitchRoll (Canvas canvas ) {
84
+ int length = 450 ;
85
+ float radius = realPx (length );
86
+
87
+ mPathPaint .setColor (mBackgroundColor );
88
+ mPathPaint .setStyle (Paint .Style .FILL );
89
+ canvas .drawCircle (mCenter .x , mCenter .y , radius , mPathPaint );
90
+
84
91
mPathPaint .setColor (mPrimaryTextColor );
85
92
mPathPaint .setStyle (Paint .Style .FILL );
86
93
float roll = mSensorValue .getRoll ();
87
94
float pitch = mSensorValue .getPitch ();
88
95
89
- float radius = realPx (20 );
96
+ radius = realPx (100 );
90
97
91
98
float cosP = (float ) Math .cos (Math .toRadians (pitch - 90 ));
92
- int length = 100 ;
93
99
float x = (float ) (realPx (length ) * cosP );
94
100
float cosR = (float ) Math .cos (Math .toRadians (roll - 90 ));
95
101
float y = (float ) (realPx (length ) * cosR );
@@ -101,11 +107,13 @@ private void drawPitchRoll(Canvas canvas) {
101
107
mPath .lineTo (mCenter .x + radius , mCenter .y );
102
108
mPath .moveTo (mCenter .x , mCenter .y - radius );
103
109
mPath .lineTo (mCenter .x , mCenter .y + radius );
110
+ mPath .addCircle (mCenter .x , mCenter .y , radius , Path .Direction .CCW );
104
111
105
112
mPathPaint .setColor (mSecondaryTextColor );
106
- mPathPaint .setStrokeWidth (realPx (3 ));
113
+ mPathPaint .setStrokeWidth (realPx (5 ));
107
114
mPathPaint .setStyle (Paint .Style .STROKE );
108
115
canvas .drawPath (mPath , mPathPaint );
116
+
109
117
}
110
118
111
119
public void onSizeChanged (int w , int h , int oldw , int oldh ) {
0 commit comments