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

Fixed Dialog Button for Experimental Magenta Theme #3851

Merged

Conversation

SaumiaSinghal
Copy link
Contributor

@SaumiaSinghal SaumiaSinghal commented May 21, 2020

Work towards #3849

What has been done to verify that this works as intended?

I tested it.

Light Theme Magenta Theme
WhatsApp Image 2020-05-31 at 18 24 49 (1) WhatsApp Image 2020-05-31 at 18 24 49

Why is this the best possible solution? Were any other approaches considered?

I replaced Progress dialog with Alert dialog, and inflated the view with progress_dialog.xml file.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No

Do we need any specific form for testing your changes? If so, please attach one.

No

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No

Before submitting this PR, please make sure you have:

  • run ./gradlew checkAll and confirmed all checks still pass OR confirm CircleCI build passes and run ./gradlew connectedDebugAndroidTest locally.
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@SaumiaSinghal SaumiaSinghal marked this pull request as ready for review May 26, 2020 13:28
@SaumiaSinghal
Copy link
Contributor Author

Hi @seadowg! There are many other dialogs in the code, where we are having this problem, as we are not using the androidx package, or something else. Should I address them in this PR itself?

@seadowg
Copy link
Member

seadowg commented May 29, 2020

@SaumiaSinghal I think it's enough to fix one for the moment! Maybe you could comment on the issue (#3849) about the other ones you've found? That way you can move away from dialogues :)

@@ -683,7 +684,7 @@ public void onClick(DialogInterface dialog, int i) {
}

private void createProgressDialog() {
progressDialog = new ProgressDialog(this);
progressDialog = new AlertDialog.Builder(this).create();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this not use a ProgressDialogFragment instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't use ProgressDialogFrgament because I thought that the lifecycle changes are handled here by the ViewModel, so, I just used an AlertDialog instead. But, as I have read in most of the articles like here, that using a dialog instead of fragment, and handling lifecycle changes by the use of some variable, is a bad practice, so I'll just switch to ProgressDialogFragment here.

@SaumiaSinghal SaumiaSinghal requested a review from seadowg June 2, 2020 10:12
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of wee changes inline. Looking good!

viewModel.setProgressDialogShowing(false);
} catch (IllegalArgumentException e) {
Timber.i("Attempting to close a dialog that was not previously opened");
Fragment dialogFragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.COLLECT_PROGRESS_DIALOG_TAG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right thing to do, but we have a helper that does it for you! You can use DialogUtils.dismissDialog should help you out here.

}
createProgressDialog();
refreshFormListDialogFragment = new RefreshFormListDialogFragment();
refreshFormListDialogFragment.show(getSupportFragmentManager(), ProgressDialogFragment.COLLECT_PROGRESS_DIALOG_TAG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like with dismissing you can use DialogUtils.showIfNotShowing. Sorry I should have pointed those out before leading you down the ProgressDialogFragment path!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's okay! Actually I have used DialogUtils.showIfNotShowing before 😞

@SaumiaSinghal SaumiaSinghal requested a review from seadowg June 2, 2020 13:29
@seadowg
Copy link
Member

seadowg commented Jun 3, 2020

@SaumiaSinghal are you able to rerun the Circle CI tests? It looks like the process crashed not any tests failed. Also can you confirm you've run ./gradlew checkAll locally and seen no failures? We need to make sure we're doing that so we don't merge avoidable failures into master.

@SaumiaSinghal
Copy link
Contributor Author

SaumiaSinghal commented Jun 3, 2020

Hi @seadowg! I checked locally. Any of the newly added unit tests does not fail, but ./gradlew checkTests fails. However, ./gradlew checkTests fails even on master branch.

@seadowg
Copy link
Member

seadowg commented Jun 4, 2020

@SaumiaSinghal master should be fixed now. Could you rebase this on top of master and check again. Post any failures you're seeing!

@mmarciniak90
Copy link
Contributor

Tested with success

Verified on Android: 6.0, 7.0, 8.1, 9.0

Verified cases:

  • Connection to server dialog
  • refresh
  • Central and Aggregate server
  • rotating
  • minimize app

Screenshots from 3 modes to compare

magenta light dark
magenta light dark

@SaumiaSinghal SaumiaSinghal force-pushed the fixed_dialog_button_for_magenta_theme branch from aeb8df0 to 24c295b Compare June 4, 2020 11:48
@kkrawczyk123
Copy link
Contributor

Verified on Androids 5.1, 7.1 and 10.

@getodk-bot unlabel "needs testing"
@getodk-bot label "behavior verified"

@grzesiek2010 grzesiek2010 merged commit 5c7b7da into getodk:master Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants