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

Fix #1438 & #1761: Switch Profile Dialog lost in orientation change #1757

Merged

Conversation

anandwana001
Copy link
Contributor

@anandwana001 anandwana001 commented Sep 1, 2020

Explanation

Fix #1438 #1761

How to test

  1. open nav drawer
  2. click on switch profile -> dialog appears
  3. change orientation -> check if dialog visible or not

How to review

Check if the added test case works

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

/** [DialogFragment] that gives option to either cancel or exit current profile */
class NavigationDrawerSwitchProfileDialogFragment : DialogFragment() {

private lateinit var menu: Menu
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One suggestion I am looking for here:
Another approach is where we can have an interface and rather than passing menu and drawerLayout object we can implement an interface in NavigationDrawerFragment and use it from there.
The only thing we have to achieve with these objects is

menu.getItem(
          NavigationDrawerItem.HOME.ordinal
        ).isChecked =
          true
        drawerLayout.closeDrawers()

Copy link
Contributor

@rt4914 rt4914 Sep 1, 2020

Choose a reason for hiding this comment

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

This approach does sound correct. Please have a look at top level comment.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

This similar implementation is used in HomeActivity also, so I suggest applying this fragment there too.

Also, please update/rename NavigationDrawerSwitchProfileDialogFragment so that its not just linked to NavigationDrawer.

Something like ExitProfileDialogFragment

Also, update test cases accordingly.

@rt4914 rt4914 assigned anandwana001 and unassigned rt4914 Sep 1, 2020
@anandwana001 anandwana001 changed the title Fix #1438: Switch Profile Dialog lost in orientation change Fix #1438 & #1761: Switch Profile Dialog lost in orientation change Sep 2, 2020
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

Few nits/questions before final approval.

@rt4914 rt4914 assigned anandwana001 and unassigned rt4914 Sep 2, 2020
@anandwana001 anandwana001 assigned rt4914 and unassigned anandwana001 Sep 3, 2020
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

LGTM

@rt4914 rt4914 assigned anandwana001 and unassigned rt4914 Sep 3, 2020
@rt4914 rt4914 merged commit fc25224 into oppia:develop Sep 4, 2020
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.

HomeActivity backpress dialog lost in orientation change Switch Profile Dialog lost in orientation change
2 participants