Skip to content

Swapping From and To fields sometimes results in an animation glitch #732

@AcharyaS97

Description

@AcharyaS97

Describe the bug

It looks like there's a bug in the DirectionsFragment where if the From and To fields are both empty and you try swapping them, there's an animation glitch where it'll do the swap but then the hint text will reset. I saw that there have been a few issues relating to the DirectionsFragment with the 2 LocationViews for From and To, and there was a Pull Request #722 that addressed some problems. If that PR or some other PR addresses the problem I mention here then do let me know.

To Reproduce
Steps to reproduce the behavior:

(3 and 4 are separate usecases where I observed weird behavior.

  1. Open the directions view (click the left turn arrow in the map view)

  2. Make sure that both the From and To fields are empty and only the hint text is showing

  3. Type something in either From or To but don't select an option from the search results

  4. Click the swap button on the UI.

Notice that if the fields are empty, the swap will happen but the hint text on the From and To fields will reset to their original positions after the animation ends. If either field is populated but it's not a result from Search task, that field will be erased.

Expected behavior

For the 3. case (with both fields empty), the simplest solution might be just to not do anything if the swap is clicked and both From and To fields don't have any text in them.

For the 4. case (where the fields are populated with text but don't have a Location selected from the search results) I think it might be a little more complicated.

From looking at how the swap works, I understand that it doesn't actually change the positions of the two LocationViews, just swaps the underlying saved locations in those views. We could update this to actually swap the positions of those views? Alternatively we could change to swap the text of the LocationViews by surfacing a method in the LocationView to set the Text of the TextView in the LocationViewHolder independent of the Location it has stored.

Versions (please complete the following information):

  • Transportr Version: [2.1.0]
  • Device: [Samsung A70]
  • Android Version: [10]

Metadata

Metadata

Labels

beginner job 🔰This is a relatively easy task suitable for new contributors.bug 🐞A functional defect or unexpected behavior.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions