-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: gas sensor automatic record without sensor #2153
Conversation
@@ -10,6 +10,7 @@ | |||
import android.support.annotation.Nullable; | |||
import android.support.design.widget.Snackbar; | |||
import android.support.v4.app.Fragment; | |||
import android.util.Log; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.util.Log; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
app/src/main/res/values/strings.xml
Outdated
@@ -886,6 +886,9 @@ | |||
<string name="gas_sensor_description">Air quality sensor for detecting a wide range of gases, including NH3, NOx, alcohol, benzene, smoke and CO2</string> | |||
<string name="gas_sensor_label">Gas Contents (PPM)</string> | |||
<string name="gas_sensor_unit">PPM</string> | |||
<string name="gas_sensor_not_connected">Sensor not Found</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<string name="gas_sensor_not_connected">Sensor not Found</string> | |
<string name="gas_sensor_not_connected">Sensor not found</string> |
app/src/main/res/values/strings.xml
Outdated
@@ -886,6 +886,9 @@ | |||
<string name="gas_sensor_description">Air quality sensor for detecting a wide range of gases, including NH3, NOx, alcohol, benzene, smoke and CO2</string> | |||
<string name="gas_sensor_label">Gas Contents (PPM)</string> | |||
<string name="gas_sensor_unit">PPM</string> | |||
<string name="gas_sensor_not_connected">Sensor not Found</string> | |||
<string name="gas_sensor_not_connected_description">Please connect a device or choose an phone sensor (if available)</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use existing device not connected message instead of this
else | ||
{ | ||
try { | ||
CustomSnackBar.showSnackBar(sensorParentView, NOT_CONNECTED, null, null, Snackbar.LENGTH_LONG); | ||
|
||
AlertDialog.Builder builder1 = new AlertDialog.Builder(this); | ||
builder1.setTitle(R.string.gas_sensor_not_connected); | ||
builder1.setMessage(R.string.gas_sensor_not_connected_description); | ||
builder1.setCancelable(true); | ||
|
||
builder1.setPositiveButton( | ||
R.string.gas_sensor_configure_button, | ||
new DialogInterface.OnClickListener() { | ||
public void onClick(DialogInterface dialog, int id) { | ||
dialog.cancel(); | ||
} | ||
}); | ||
|
||
builder1.setNegativeButton( | ||
R.string.cancel, | ||
new DialogInterface.OnClickListener() { | ||
public void onClick(DialogInterface dialog, int id) { | ||
dialog.cancel(); | ||
} | ||
}); | ||
builder1.setIcon(android.R.drawable.ic_dialog_alert); | ||
AlertDialog alert11 = builder1.create(); | ||
alert11.show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need of many dialog boxes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, sure I will resolve these issues very soon. Thanks.
All changes are done, Please review this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Need to reformat to fix spacing and indentation
} | ||
else | ||
{ | ||
try { | ||
CustomSnackBar.showSnackBar(sensorParentView, NOT_CONNECTED, null, null, Snackbar.LENGTH_LONG); | ||
|
||
}catch (IllegalStateException e) | ||
{ | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reformat this file using Android Studio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
Spaces and indentation perfected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PSLab.java
is an abstract class. We don't implement unit specific features inside an abstract class. Instead that is done inside the class extending it.
Fixes #2093
Changes: Changes are made in PSLabSensor.java at onOptionsItemSelected(MenuItem item) function a check is added for gas sensor. (If a gas sensor is connected, only then a recording of data will start)
Screenshot/s for the changes:
https://user-images.githubusercontent.com/62503399/103482147-193a8280-4e05-11eb-829d-38a307c52344.mp4
https://user-images.githubusercontent.com/62503399/103482149-1a6baf80-4e05-11eb-9afc-de0b85f6525b.mp4
https://user-images.githubusercontent.com/62503399/103482150-1b044600-4e05-11eb-9a74-d8601a9d366f.mp4
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard-coding themstrings.xml
,dimens.xml
orcolors.xml
APK for testing:
app-fdroid-debug.zip