@@ -78,7 +78,7 @@ public void draw(Canvas canvas) {
78
78
drawBackground (canvas );
79
79
drawMagnetic (canvas );
80
80
drawClock (canvas );
81
- drawValue (canvas );
81
+ drawAzimuthValue (canvas );
82
82
//drawSunTime(canvas);
83
83
drawPitchRoll (canvas );
84
84
}
@@ -121,14 +121,14 @@ private void drawPitchRoll(Canvas canvas) {
121
121
float y = (float ) (realPx (length ) * cosR );
122
122
canvas .drawCircle (mCenter .x - x , mCenter .y + y , radius , mPathPaint );
123
123
124
- radius = realPx (length );
124
+ radius = realPx (length );
125
125
mPath .reset ();
126
126
mPath .moveTo (mCenter .x - radius , mCenter .y );
127
127
mPath .lineTo (mCenter .x + radius , mCenter .y );
128
128
mPath .moveTo (mCenter .x , mCenter .y - radius );
129
129
mPath .lineTo (mCenter .x , mCenter .y + radius );
130
130
131
- mPathPaint .setColor (Color . WHITE );
131
+ mPathPaint .setColor (mSecondaryTextColor );
132
132
mPathPaint .setStrokeWidth (realPx (3 ));
133
133
mPathPaint .setStyle (Style .STROKE );
134
134
canvas .drawPath (mPath , mPathPaint );
@@ -176,27 +176,40 @@ private void drawSunTime(Canvas canvas) {
176
176
canvas .drawPath (mPath , mPathPaint );
177
177
}
178
178
179
- private void drawValue (Canvas canvas ) {
179
+ private void drawAzimuthValue (Canvas canvas ) {
180
180
//draw triangle
181
- mPathPaint .setStyle (Style .FILL );
182
- mPathPaint .setColor (Color .WHITE );
183
- mPathPaint .setStrokeWidth (realPx (3 ));
181
+
184
182
185
183
int x = mCenter .x ;
186
184
int y = (int ) (mCenter .y - realPx (430 + mUnitPadding * 2 ));
187
- int length = ( int ) realPx (30 );
185
+ float length = realPx (30 );
188
186
189
187
mPath .reset ();
190
188
mPath .lineTo (x - length / 2.0f , y - length );
191
189
mPath .lineTo (x + length / 2.0f , y - length );
192
190
mPath .lineTo (x , y );
193
191
mPath .lineTo (x - length / 2.0f , y - length );
194
- canvas .drawPath (mPath , mPathPaint );
195
192
196
- mPathPaint .setTextSize ( realPx ( 80 ) );
193
+ mPathPaint .setStyle ( Style . FILL );
197
194
mPathPaint .setColor (Color .WHITE );
195
+ canvas .drawPath (mPath , mPathPaint );
196
+
197
+ length = realPx (15 );
198
+ y = (int ) (mCenter .y - realPx (440 + mUnitPadding * 2 ));
199
+ mPath .reset ();
200
+ mPath .lineTo (x - length / 2.0f , y - length );
201
+ mPath .lineTo (x + length / 2.0f , y - length );
202
+ mPath .lineTo (x , y );
203
+ mPath .lineTo (x - length / 2.0f , y - length );
204
+
205
+ mPathPaint .setStyle (Style .FILL );
206
+ mPathPaint .setColor (mAccentColor );
207
+ canvas .drawPath (mPath , mPathPaint );
208
+
209
+ mNumberTextPaint .setTextSize (realPx (80 ));
198
210
String str = ((int ) mSensorValue .getAzimuth ()) + "° " + getDirectionText (mSensorValue .getAzimuth ());
199
- canvas .drawText (str , x - mPathPaint .measureText (str ) / 2 , y - length - realPx (10 ), mPathPaint );
211
+ canvas .drawText (str , x - mNumberTextPaint .measureText (str ) / 2.0f ,
212
+ y - length - realPx (mUnitPadding * 2 ), mNumberTextPaint );
200
213
}
201
214
202
215
@@ -226,7 +239,6 @@ private void initPaint() {
226
239
}
227
240
228
241
229
-
230
242
private void drawClock (Canvas canvas ) {
231
243
canvas .save ();
232
244
canvas .rotate (-mSensorValue .getAzimuth (), mCenter .x , mCenter .y );
0 commit comments