Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb5fec4

Browse files
Update to v1.0.1
2 parents772a836 +e581237 commitfb5fec4

24 files changed

+376
-153
lines changed

‎apk/Clinometer-1.0.1.apk‎

4.22 MB
Binary file not shown.

‎apk/Clinometer-latest.apk‎

585 KB
Binary file not shown.

‎app/build.gradle‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ android {
1818

1919
// -----------------------------------------------------------------------------------------
2020
// We use the Semantic Versioning (https://semver.org/):
21-
versionName'1.0.0'
22-
versionCode1
21+
versionName'1.0.1'
22+
versionCode2
2323
// -----------------------------------------------------------------------------------------
2424

2525
vectorDrawables.useSupportLibrary=true
@@ -51,10 +51,10 @@ dependencies {
5151
implementation'androidx.appcompat:appcompat:1.2.0'
5252
implementation'androidx.legacy:legacy-support-v4:1.0.0'
5353
implementation'androidx.preference:preference:1.1.1'
54-
implementation'androidx.navigation:navigation-fragment:2.3.2'
55-
implementation'androidx.navigation:navigation-ui:2.3.2'
54+
implementation'androidx.navigation:navigation-fragment:2.3.3'
55+
implementation'androidx.navigation:navigation-ui:2.3.3'
5656

57-
implementation'com.google.android.material:material:1.2.1'
57+
implementation'com.google.android.material:material:1.3.0'
5858

5959
testImplementation'junit:junit:4.12'
6060
androidTestImplementation'androidx.test.ext:junit:1.1.2'

‎app/src/main/java/eu/basicairdata/clinometer/CalibrationActivity.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,11 @@ public void onSensorChanged(SensorEvent event) {
434434
mvGravity1.loadSample(event.values[1]);
435435
mvGravity2.loadSample(event.values[2]);
436436

437-
textViewProgress.setText(String.format("Progress %1.0f%% Tolerance %1.3f",mvGravity0.percentLoaded(),mvGravity0.getTolerance()));
437+
textViewProgress.setText(String.format("%s %1.0f%% %s %1.3f",
438+
getString(R.string.calibration_progress),
439+
mvGravity0.percentLoaded(),
440+
getString(R.string.calibration_tolerance),
441+
mvGravity0.getTolerance()));
438442
intprogress1 = (int) (10 *mvGravity0.percentLoaded());
439443
intprogress2 = (int) (Math.min(1000,Math.max(0,1000 -1000 *(mvGravity0.getTolerance() /MIN_CALIBRATION_PRECISION))));
440444
progressBar.setSecondaryProgress(Math.max(progress1,progress2));

‎app/src/main/java/eu/basicairdata/clinometer/ClinometerActivity.java‎

Lines changed: 87 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ public static ClinometerActivity getInstance(){
9090
returnsingleton;
9191
}
9292

93-
ToneGeneratortoneGen1 =newToneGenerator(AudioManager.STREAM_MUSIC,ToneGenerator.TONE_CDMA_KEYPAD_VOLUME_KEY_LITE);
93+
privateToneGeneratortoneGen1 =newToneGenerator(AudioManager.STREAM_MUSIC,ToneGenerator.TONE_CDMA_KEYPAD_VOLUME_KEY_LITE);
9494
privateVibratorvibrator;
9595

96+
// RefAxis Animator
97+
privatePIDAnimatorpid =newPIDAnimator(0.0f,0.3f,0.0f,0.03f,16);
98+
privatefloatold_PIDValue =0.0f;
99+
96100
privatestaticfinalintTOAST_TIME =2500;// The time a toast is shown
97101

98102
privatestaticfinalfloatAUTOLOCK_MIN_TOLERANCE =0.05f;// The minimum tolerance of the AutoLock
@@ -110,12 +114,12 @@ public static ClinometerActivity getInstance(){
110114
privatefloatprefAutoLockTolerance;
111115
privateintprefExposureCompensation =0;
112116

113-
publicbooleanisFlat =true;// True if the device is oriented flat (for example on a table)
114-
publicbooleanisLocked =false;// True if the angles are locked by user
117+
privatebooleanisFlat =true;// True if the device is oriented flat (for example on a table)
118+
privatebooleanisLocked =false;// True if the angles are locked by user
115119
privatebooleanisLockRequested =false;
116-
publicfloatdisplayRotation =0;// The rotation angle from the natural position of the device
120+
privatefloatdisplayRotation =0;// The rotation angle from the natural position of the device
117121

118-
publicbooleanisInCameraMode =false;// True if Camera Mode is active
122+
privatebooleanisInCameraMode =false;// True if Camera Mode is active
119123
privatebooleanisCameraLivePreviewActive =false;// True if the Live Preview with Camera is active
120124
privateBitmapcameraPreviewBitmap;// The image saved from Camera Preview (used by Locking and onPause/onResume)
121125

@@ -143,37 +147,81 @@ public static ClinometerActivity getInstance(){
143147
privateSensorManagermSensorManager;
144148
privateSensormRotationSensor;
145149

146-
publicfloat[]gravity = {0,0,0};// The (filtered) current accelerometers values
147-
publicfloat[]gravity_gain = {0,0,0};
148-
publicfloat[]gravity_offset = {0,0,0};
149-
publicfloat[]gravity_calibrated = {0,0,0};// The (filtered) current calibrated accelerometers values
150+
privatefloat[]gravity = {0,0,0};// The (filtered) current accelerometers values
151+
privatefloat[]gravity_gain = {0,0,0};
152+
privatefloat[]gravity_offset = {0,0,0};
153+
privatefloat[]gravity_calibrated = {0,0,0};// The (filtered) current calibrated accelerometers values
150154

151-
publicfloat[]angle_calibration = {0,0,0};// The angles for calibration: alpha, beta, gamma (in degrees)
152-
publicfloat[]angle = {0,0,0};// The (filtered) current angles (in degrees)
155+
privatefloat[]angle_calibration = {0,0,0};// The angles for calibration: alpha, beta, gamma (in degrees)
156+
privatefloat[]angle = {0,0,0};// The (filtered) current angles (in degrees)
153157

154158
privatefinalfloat[][]calibrationMatrix =newfloat[3][3];
155159

156-
publicfloatgravityXY =0;
157-
publicfloatgravityXYZ =0;
158-
publicfloatangleXY =0;// The angle on the horizontal plane (in degrees)
159-
publicfloatangleXYZ =0;// The angle between XY vector and the vertical (in degrees)
160-
publicfloatangleTextLabels =0;// The rotation angle for the text labels
160+
privatefloatgravityXY =0;
161+
privatefloatgravityXYZ =0;
162+
privatefloatangleXY =0;// The angle on the horizontal plane (in degrees)
163+
privatefloatangleXYZ =0;// The angle between XY vector and the vertical (in degrees)
164+
privatefloatangleTextLabels =0;// The rotation angle for the text labels
161165

162166
privatefinalstaticintACCELEROMETER_UPDATE_INTERVAL_MICROS =10000;
163167

164-
finalMeanVariancemvAngle0 =newMeanVariance(SIZE_OF_MEANVARIANCE);
165-
finalMeanVariancemvAngle1 =newMeanVariance(SIZE_OF_MEANVARIANCE);
166-
finalMeanVariancemvAngle2 =newMeanVariance(SIZE_OF_MEANVARIANCE);
167-
finalMeanVariancemvGravity0 =newMeanVariance(16);
168-
finalMeanVariancemvGravity1 =newMeanVariance(16);
169-
finalMeanVariancemvGravity2 =newMeanVariance(16);
168+
privatefinalMeanVariancemvAngle0 =newMeanVariance(SIZE_OF_MEANVARIANCE);
169+
privatefinalMeanVariancemvAngle1 =newMeanVariance(SIZE_OF_MEANVARIANCE);
170+
privatefinalMeanVariancemvAngle2 =newMeanVariance(SIZE_OF_MEANVARIANCE);
171+
privatefinalMeanVariancemvGravity0 =newMeanVariance(16);
172+
privatefinalMeanVariancemvGravity1 =newMeanVariance(16);
173+
privatefinalMeanVariancemvGravity2 =newMeanVariance(16);
170174

171-
ValueAnimatoranimationR =newValueAnimator();
175+
privateValueAnimatoranimationR =newValueAnimator();
172176

173177
privateCameramCamera;
174178
privateCameraPreviewmPreview;
175179

176180

181+
// --------------------------------------------------------------------------------------------------------------------------
182+
// --- GETTERS AND SETTERS --------------------------------------------------------------------------------------------------
183+
// --------------------------------------------------------------------------------------------------------------------------
184+
185+
186+
publicvoidsetPIDTargetValue(floatnewValue) {
187+
pid.setTargetValue(newValue);
188+
}
189+
190+
191+
publicfloatgetPIDValue() {
192+
returnpid.getValue();
193+
}
194+
195+
196+
publicfloatgetDisplayRotation() {
197+
returndisplayRotation;
198+
}
199+
200+
publicbooleanisFlat() {
201+
returnisFlat;
202+
}
203+
204+
205+
publicfloat[]getAngles() {
206+
returnangle;
207+
}
208+
209+
210+
publicfloatgetAngleXY() {
211+
returnangleXY;
212+
}
213+
214+
215+
publicfloatgetAngleXYZ() {
216+
returnangleXYZ;
217+
}
218+
219+
220+
publicfloatgetAngleTextLabels() {
221+
returnangleTextLabels;
222+
}
223+
224+
177225
// --------------------------------------------------------------------------------------------------------------------------
178226
// --- CLASS METHODS --------------------------------------------------------------------------------------------------------
179227
// --------------------------------------------------------------------------------------------------------------------------
@@ -276,6 +324,11 @@ public void onClick(View view) {
276324
}
277325

278326
vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
327+
328+
if (!preferences.contains(KEY_PREF_CALIBRATION_ANGLE_0)) {
329+
// Not Calibrated!
330+
showToast(getString(R.string.toast_calibrate_before_use));
331+
}
279332
}
280333

281334

@@ -526,15 +579,18 @@ public void onSensorChanged(SensorEvent event) {
526579
mTextViewKeepScreenVertical.setVisibility(View.GONE);
527580
}
528581
}
529-
530582
// Apply Changes
531-
532583
mClinometerView.invalidate();
584+
585+
// You must put this setText here in order to force the re-layout also during the rotations.
586+
// Without this, if you lock the measure during the rotation animation, the layout doesn't change correctly :(
587+
mTextViewAngles.setText(String.format("%1.1f° %1.1f° %1.1f°",angle[0],angle[1],angle[2]));
533588
}
534589

535-
// You must put this setText here in order to force the re-layout also during the rotations.
536-
// Without this, if you lock the measure during the rotation animation, the layout doesn't change correctly :(
537-
mTextViewAngles.setText(String.format("%1.1f° %1.1f° %1.1f°",angle[0],angle[1],angle[2]));
590+
if (Math.abs(pid.getValue() -old_PIDValue) >0.001) {
591+
old_PIDValue =pid.getValue();
592+
mClinometerView.invalidate();
593+
}
538594
}
539595
}
540596

@@ -621,6 +677,9 @@ public void onAnimationUpdate(ValueAnimator updatedAnimation) {
621677
mFrameLayoutOverlays.getLayoutParams().width =newWidth;
622678
mFrameLayoutOverlays.setRotation(rotationAngle);
623679
}
680+
// You must put this setText here in order to force the re-layout also during the rotations.
681+
// Without this, if you lock the measure during the rotation animation, the layout doesn't change correctly :(
682+
mTextViewAngles.setText(String.format("%1.1f° %1.1f° %1.1f°",angle[0],angle[1],angle[2]));
624683
}
625684
});
626685
animationR.start();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp