forked from jens/Automation
Rework
This commit is contained in:
parent
8b29dd0985
commit
8e5ad15c34
@ -28,8 +28,6 @@ public class ActivityManageTriggerDevicePosition extends Activity
|
||||
|
||||
boolean editMode = false;
|
||||
|
||||
boolean messageDisplayed = false;
|
||||
|
||||
float desiredAzimuth, desiredPitch, desiredRoll, desiredAzimuthTolerance, desiredPitchTolerance, desiredRollTolerance;
|
||||
|
||||
public void updateFields(float azimuth, float pitch, float roll)
|
||||
@ -38,7 +36,7 @@ public class ActivityManageTriggerDevicePosition extends Activity
|
||||
currentPitch.setText(Float.toString(pitch));
|
||||
currentRoll.setText(Float.toString(roll));
|
||||
|
||||
if(checkInputs())
|
||||
if(checkInputs(false))
|
||||
{
|
||||
desiredAzimuth = Float.parseFloat(etDesiredAzimuth.getText().toString());
|
||||
desiredAzimuthTolerance = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString());
|
||||
@ -107,9 +105,9 @@ public class ActivityManageTriggerDevicePosition extends Activity
|
||||
// etDesiredAzimuth.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
|
||||
// etDesiredPitch.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
|
||||
// etDesiredRoll.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
|
||||
etDesiredAzimuthTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 359)});
|
||||
etDesiredPitchTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 359)});
|
||||
etDesiredRollTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 359)});
|
||||
etDesiredAzimuthTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
|
||||
etDesiredPitchTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
|
||||
etDesiredRollTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
|
||||
|
||||
if(getIntent().hasExtra(vectorFieldName))
|
||||
{
|
||||
@ -144,7 +142,7 @@ public class ActivityManageTriggerDevicePosition extends Activity
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
if(!checkInputs())
|
||||
if(!checkInputs(true))
|
||||
{
|
||||
Toast.makeText(ActivityManageTriggerDevicePosition.this, getResources().getString(R.string.enterValidNumbersIntoAllFields), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
@ -167,7 +165,7 @@ public class ActivityManageTriggerDevicePosition extends Activity
|
||||
});
|
||||
}
|
||||
|
||||
boolean checkInputs()
|
||||
boolean checkInputs(boolean showMessages)
|
||||
{
|
||||
if(
|
||||
!StringUtils.isEmpty(etDesiredAzimuth.getText().toString()) && Miscellaneous.isNumeric(etDesiredAzimuth.getText().toString())
|
||||
@ -192,7 +190,7 @@ public class ActivityManageTriggerDevicePosition extends Activity
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!messageDisplayed)
|
||||
if(showMessages)
|
||||
{
|
||||
float dat = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString());
|
||||
float dpt = Float.parseFloat(etDesiredPitchTolerance.getText().toString());
|
||||
@ -204,7 +202,6 @@ public class ActivityManageTriggerDevicePosition extends Activity
|
||||
*/
|
||||
if (Math.abs(dat) >= 180 && Math.abs(dpt) >= 180 && Math.abs(drt) >= 180)
|
||||
{
|
||||
messageDisplayed = true;
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.warning), getResources().getString(R.string.toleranceOf180OnlyAllowedIn2Fields), ActivityManageTriggerDevicePosition.this).show();
|
||||
return false;
|
||||
}
|
||||
|
@ -97,13 +97,14 @@
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="Position"
|
||||
android:text="@string/position"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/tolerance"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
@ -146,6 +147,8 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppliesAzimuth"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/unknown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
@ -178,6 +181,8 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppliesPitch"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/unknown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
@ -210,6 +215,8 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppliesRoll"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/unknown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
@ -714,7 +714,7 @@
|
||||
<string name="btTetheringNotice">This feature is confirmed to work up until Android 8.0. From some higher version upwards it ceases to work, but due to a lack of physical devices I cannot tell which one that is. On Android 11 it definitely ain\'t working anymore. If you have a version in between please let me know if it\'s working or not.</string>
|
||||
<string name="notice">Notice</string>
|
||||
<string name="devicePosition">Device position (Gyroscope)</string>
|
||||
<string name="tolerance">Tolerance</string>
|
||||
<string name="tolerance">Tolerance\n(0-180)</string>
|
||||
<string name="orientationAzimuth">Azimuth:</string>
|
||||
<string name="orientationPitch">Pitch:</string>
|
||||
<string name="orientationRoll">Roll:</string>
|
||||
@ -723,4 +723,6 @@
|
||||
<string name="wouldCurrentlyApply">Would currently apply?</string>
|
||||
<string name="deviceIsInCertainPosition">the device is in a certain position</string>
|
||||
<string name="toleranceOf180OnlyAllowedIn2Fields">A tolerance of 180 is allowed for 2 tolerance fields only, not all 3. Otherwise the trigger would ALWAYS apply.</string>
|
||||
<string name="unknown">unknown</string>
|
||||
<string name="position">Position</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user