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

Fixes #1752 : Unnecessary running of Spinner.OnItemSelectedListener fixed

Open NikunjGarg2000 opened this issue 4 years ago • 3 comments

Fixes #1752

Just added a quick check using a boolean variable whether user is entering fragment first time or not.

https://user-images.githubusercontent.com/67901968/107141466-dbbe9d00-694e-11eb-9657-13f5b842ddfe.mp4

Please make sure these boxes are checked before submitting your pull request - thanks!

  • [x] Apply the MifosStyle.xml style template to your code in Android Studio.

  • [x] Run the unit tests with ./gradlew check to make sure you didn't break anything

  • [x] If you have multiple commits please combine them into one commit by squashing them.

NikunjGarg2000 avatar Feb 07 '21 08:02 NikunjGarg2000

@NikunjGarg2000 i have problem differentiating any changes from issue video. I can see progress bar for first time too in pr video also. Am i missing out something or am I right ? Also opening takes same time so what is significance of adding extra boolean?

PatelVatsalB21 avatar Feb 08 '21 18:02 PatelVatsalB21

@PatelVatsalB21 the progress bar is not under Spinner.onItemselectedListener in code. You are missing the toast message in issue video. At the first time when user enters when office is selected to select office only then while setOnitemSelectedListener called in setUi(), onItemSelectedListener called by default and runs automatically and checks whether user have selected something which is very obvious since it's first time that user hasn't interacted yet. Boolean check is added to tell if it's first time onItemSelectedListener called because we can't stop it from being called it's by default while setting up listener.

NikunjGarg2000 avatar Feb 08 '21 18:02 NikunjGarg2000

Yes I know that but I was concerned about 2 spinner calling 2 OnItemSelected two times. LGTM

PatelVatsalB21 avatar Feb 09 '21 05:02 PatelVatsalB21

We are closing this PR as it causes a branch conflict since the Java file has now been migrated to kotlin

Aditya-gupta99 avatar Jun 19 '23 13:06 Aditya-gupta99