pslab-android icon indicating copy to clipboard operation
pslab-android copied to clipboard

fix: fixed the graph to clear whenever no channel is active

Open AsCress opened this issue 1 year ago • 5 comments

Fixes #2460 Clears the graph whenever all the channels are toggled OFF.

Changes

  • app/src/main/java/io/pslab/activity/OscilloscopeActivity.java

Screenshots / Recordings

https://github.com/fossasia/pslab-android/assets/125425881/4db79832-fe22-410d-b7f9-89b0e4ff6727

Note:- Again, this is tested only with the In-Built MIC as shown. @marcnause Could you please test this with all the other channels and when more than one channels are active as well ?

Checklist:

  • [x] No hard coding: I have used resources from strings.xml, dimens.xml and colors.xml without hard coding any value.
  • [x] No end of file edits: No modifications done at end of resource files strings.xml, dimens.xml or colors.xml.
  • [x] Code reformatting: I have reformatted code and fixed indentation in every file included in this pull request.
  • [x] No extra space: My code does not contain any extra lines or extra spaces than the ones that are necessary.

AsCress avatar Jun 04 '24 10:06 AsCress

@marcnause Tested your fix on a couple of devices. Seems fine to me. I've added the isEmpty() check which solves the issue I guess. Can you please check and confirm ?

AsCress avatar Jun 05 '24 17:06 AsCress

@AsCress I tested with your latest changes and the UI was responding at all times. The graph was cleared when CH1, CH2, and CH3 were selected and the deselected.

The only case where I had problems was when the PSLab device was connected and one of the MIC options was used. Then the graph was not cleared anymore when all channels were disabled.

I suspect that the boolean expression which determines that the graph is to be cleared is not quite correct, but I don't see the problem at the moment.

marcnause avatar Jun 05 '24 20:06 marcnause

@marcnause Ok, got that. I'll go through the whole thing again and update this PR today.

AsCress avatar Jun 06 '24 00:06 AsCress

Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/10290947732/artifacts/1787442869

github-actions[bot] avatar Jun 24 '24 20:06 github-actions[bot]

@AsCress Your code was perfectly fine, the problem was located somewhere else in the OscilloscopeActivity. I have made some changes in https://github.com/fossasia/pslab-android/pull/2465/commits/a00fb2c2a59a7f14bc9b33190b898f631232b725 and I think the problem I reported previously should be fixed now.

Can you please review my changes?

marcnause avatar Jun 24 '24 22:06 marcnause

@sourcery-ai review

mariobehling avatar Jul 22 '24 06:07 mariobehling

Reviewer's Guide by Sourcery

This pull request addresses issue #2460 by ensuring that the graph is cleared whenever all channels are toggled off. The changes are implemented by modifying the OscilloscopeActivity.java file to manage the state of the channels more efficiently and clear the graph when no channels are active.

File-Level Changes

Files Changes
app/src/main/java/io/pslab/activity/OscilloscopeActivity.java Refactored the channel selection logic and added functionality to clear the graph when no channels are active.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

sourcery-ai[bot] avatar Jul 22 '24 06:07 sourcery-ai[bot]