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

feat: add dedicated horizontal layout for Power Source

Open marcnause opened this issue 1 year ago • 3 comments

Fixes #2493

Changes

  • Add horizontal layout for Power Source
  • Add new dimen for new layout

Screenshots / Recordings

Screenshot_20240625-231244

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.

marcnause avatar Jun 25 '24 21:06 marcnause

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

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

@marcnause The layout looks fantastic !! The only issue I can see in here is that the UP arrow button decreases the voltage whereas the DOWN arrow button increases the voltage 🙂😂😂. I am attaching a video for your reference.

https://github.com/fossasia/pslab-android/assets/125425881/10fdac9f-95b4-4aae-8ffa-baf127d7f32e

Perhaps we can also fix some hardcodes in a line or two. I'll just mark those areas in a review for your reference. I also tend to forget about a lot about the hardcoded values when dealing with 0dp margins :)).

AsCress avatar Jun 26 '24 15:06 AsCress

I checked the buttons and the up-button incremented the values and the down-button decremented the value. I think the problem was that the up-button was on the left and the down-button on the right. To me this does not feel natural. I checked my alarm clock 😂 and it has the buttons the other way around. I suspect that cultures which write from right to left may expect the button order the way it was, but I we don't support right to left layouts at the moment. I changed the order and it feels more natural to me now. @AsCress, does it feel right for you now too?

I also did some minor changes in the vertical layout to make it a little more consistent with the horizontal version. I think the sizes of the elements are aligned a little better now.

marcnause avatar Jun 26 '24 20:06 marcnause

@marcnause I have updated the PowerSourceActivity layouts, to use a more flexible ConstraintLayout for the inputs. I have also corrected some dimensions here and there. Could you please test it on the devices available with you and share your thoughts ?

AsCress avatar Jul 23 '24 17:07 AsCress

@AsCress I tried looking at he current status of the layout, but the app crashes on all of my devices when I open the Power Source screen.

edit: The crash seems to be a problem which is not related to this PR. I have created a new issue: https://github.com/fossasia/pslab-android/issues/2519

marcnause avatar Jul 27 '24 21:07 marcnause

Here are the screenshots of the Power Source screens. What' strange is that the unit of PCS has changed from "mA" to "m".

Fairphone 4 (vertical)

Fairphone 4 (horizontal)

Moto X Play (vertical)

Moto X play (horizontal)

Yoga Smart Tab (vertical)

Yoga Smart Tab (horizontal)

marcnause avatar Aug 03 '24 21:08 marcnause

@marcnause I see. The issue is android:maxLength="7" being set for all the EditTexts. I don't think we need a maxLength for the EditTexts we have in there. I'll just correct this. Also, I recognize that on some devices with smaller screen sizes (such as the Moto X Play), the units of voltage and current may not be properly displayed when higher values are chosen. But I think that it shouldn't be much of a problem. What are your views on this ?

AsCress avatar Aug 04 '24 03:08 AsCress

The issue with the units being cut off on smaller screens already existed previous to this PR. I will add a new issue for that.

marcnause avatar Aug 04 '24 13:08 marcnause

🧙 Sourcery has finished reviewing your pull request!


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 Aug 04 '24 13:08 sourcery-ai[bot]