Skip to content
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 : Recording starts even when device not connected. #2295

Merged
merged 4 commits into from
Jan 17, 2022
Merged

fix : Recording starts even when device not connected. #2295

merged 4 commits into from
Jan 17, 2022

Conversation

apoorva-raj
Copy link
Contributor

Fixes #2093

Changes:

  • Created a method in the PSLabSensor.java abstract class to check whether the android device has the required sensor or not.
  • If the phone doesn't have the required sensor in-built and PS Lab is not connected, data recording won't start.

Checklist:

  • I have used resources from strings.xml, dimens.xml and colors.xml without hard-coding any value.
  • No modifications done at the end of resource files strings.xml, dimens.xml or colors.xml.
  • I have reformatted code and fixed indentation in every file included in this pull request
  • My code does not contain any extra lines or extra spaces.
  • I have requested reviews from maintainers.

Copy link
Collaborator

@CloudyPadmal CloudyPadmal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Always keep your branch updated
  2. Reformat code
  3. Fix issues reported by Codacy

@apoorva-raj
Copy link
Contributor Author

Fixed the problems.

Copy link
Collaborator

@CloudyPadmal CloudyPadmal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't edit (reshuffle) rest of the unrelated code.

app/src/main/java/io/pslab/activity/MainActivity.java Outdated Show resolved Hide resolved
@CloudyPadmal
Copy link
Collaborator

Also there are several commits related to gradle fixes. Update the PR and squash commits into one. https://github.com/fossasia/pslab-android#how-to-git-squash

@apoorva-raj
Copy link
Contributor Author

@CloudyPadmal I tried to change the settings in my IDE and then reformat the code but I don't know why it is still shuffling some parts. The app is working fine though and the fixes I made are reflected there.

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
app/src/main/java/io/pslab/models/PSLabSensor.java Outdated Show resolved Hide resolved
app/src/main/java/io/pslab/models/PSLabSensor.java Outdated Show resolved Hide resolved
@@ -316,9 +318,12 @@ public boolean onOptionsItemSelected(MenuItem item) {
will fire up. If user declines to give permission, don't do anything.
*/
case R.id.record_data:
if (!isRecording) {
if (!isRecording && (!sensorNotFound() || scienceLab.isConnected())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to this logic, if PSLab is connected, it doesn't check the sensor test right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It checks but user would be able to start the recording nevertheless since PSLab is connected.

@CloudyPadmal CloudyPadmal merged commit 8903556 into fossasia:development Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants