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

issue 1554 #9

Closed
wants to merge 1 commit into from
Closed

issue 1554 #9

wants to merge 1 commit into from

Conversation

packlnd
Copy link

@packlnd packlnd commented Jan 5, 2013

First deck name is shown twice when deleting two decks. Fixed by
removing dialog after it is closed instead of just dismiss.

First deck name is shown twice when deleting two decks. Fixed by
removing dialog after it is closed instead of just dismiss.
@ghost ghost assigned flerda Jan 5, 2013
@packlnd
Copy link
Author

packlnd commented Jan 5, 2013

I tested the code and it works. In a similar issue (1371) the information that should be updated is in onPrepareDialog but it does not update because the dialog is already built. That issue would also be fixed by using removeDialog. Should removeDialog be avoided even if it works?

@flerda
Copy link
Owner

flerda commented Jan 5, 2013

I notice now that someone tried already to fix it with onPrepareDialog.
The problem is that the condition there on whether the collection is open is incorrect, it needs to be negated.

As for your fix, remove dialog in the code is called only if the progress dialog is shown and it is not shown if you press cancel.

I tried it and it does not seem to work for me at least.
I did the following:

  1. Create d1
  2. Create d2
  3. Long press on d1
  4. Select delete deck
  5. Press cancel
  6. Long press on d2
  7. Select delete deck

At this point the dialog shows d1 instead of d2.

The simpler fix is probably:
https://github.com/ntsp/Anki-Android/commit/9578b083b6c7f949baa8eff6fc0ba4eac4faf5ec

What do you think?

@flerda
Copy link
Owner

flerda commented Jan 5, 2013

In terms of using removeDialog itself, removeDialog is less efficient as it means the dialog needs to be recreated instead of just being reused. It is usually better to instead update the dialog as necessary in onPrepareDialog.

In this particular case, we could add removeDialog both to the case of pressing ok and cancel, but since onPrepareDialog should already be doing the right thing, there is no need.

@packlnd
Copy link
Author

packlnd commented Jan 5, 2013

Sorry, I missed the cancel part. I still had issue 1371 in mind where onPrepareDialog doesn't seem work. Changing the if-statement is, as you said, a simpler and more clean fix.

@flerda
Copy link
Owner

flerda commented Jan 5, 2013

No problem. I probably would have missed it myself if I were doing the same fix maybe.
This is the reason while I suggested having code reviews.
Having too people look at the code will help us make AnkiDroid's code better!

I will close this pull request and ask ntsp to continue with his.

@flerda flerda closed this Jan 5, 2013
flerda pushed a commit that referenced this pull request Jan 8, 2013
Updates from my v2.0.1-dev branch
flerda pushed a commit that referenced this pull request Jan 23, 2013
Removing some extra whitespace.
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