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 part of #130: Cellular data alert in audio player #146

Merged
merged 22 commits into from
Sep 25, 2019

Conversation

rt4914
Copy link
Contributor

@rt4914 rt4914 commented Sep 19, 2019

Explanation

This PR contains the code for cellular data alert. Currently the code does not save user preference to storage.

Output (low-fi)

Screenshot 2019-09-19 at 10 19 01 PM

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 assigned to an appropriate reviewer.

@rt4914
Copy link
Contributor Author

rt4914 commented Sep 19, 2019

@BenHenning @jamesxu0 PTAL

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Generally LGTM @rt4914--can you also add tests to verify that the dialogs at least appear? I know we can't fully flesh out the behavioral aspects of when they should show up, but ideally if they are always showing then these tests will fail once the real domain implementations are added, and then we'll need to update them accordingly.

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Sep 20, 2019
@rt4914
Copy link
Contributor Author

rt4914 commented Sep 20, 2019

Generally LGTM @rt4914--can you also add tests to verify that the dialogs at least appear? I know we can't fully flesh out the behavioral aspects of when they should show up, but ideally if they are always showing then these tests will fail once the real domain implementations are added, and then we'll need to update them accordingly.

Test case done. This test case checks the entire flow of the audio component from showing CelluarDataDialogFragment to AudioFragment to LanguageDialogFragment

@rt4914 rt4914 assigned BenHenning and unassigned rt4914 Sep 20, 2019
@rt4914
Copy link
Contributor Author

rt4914 commented Sep 20, 2019

@BenHenning PTAL
I have made following changes as per our discussion:

  1. Shifted code of CellularDataDialogFragment to StateFragment
  2. Changed the usage implementation of CellularDataInterfaceand LanguageInterface as per your suggestions from this link: https://stackoverflow.com/a/23144683/3689782
  3. Added test-case which checks the entire flow of CellularDataDialogFragment, AudioFragment and LanguageDialogFragment
  4. Based on user selection in CellularDataDialogFragment, the code controls whether to show AudioFragment or not.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Just did a really quick glance, but didn't deep-dive yet. Got a bit tired all of a sudden, so I'll take a closer look at this later.

@jamesxu0 could you please give this PR a pass tomorrow?

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @rt4914! Did a more thorough pass on this. PTAL at comments.

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Sep 24, 2019
languageList.add("hi-en")
}
var selectedIndex = arguments!!.getInt(KEY_SELECTED_INDEX, 0)
val languageArrayList: ArrayList<String> = arguments?.getStringArrayList(KEY_LANGUAGE_LIST) as ArrayList<String>
Copy link
Member

Choose a reason for hiding this comment

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

Why is this cast needed? It seems superfluous since getStringArrayList() returns ArrayList.

Also, the ?. operator needed here? I think you can avoid it by saving arguments locally:

val args = checkNotNull(arguments) { "Expected arguments to be pass to LanguageDialogFragment" }
// args can now be used without the nullability considerations

Copy link
Contributor Author

@rt4914 rt4914 Sep 25, 2019

Choose a reason for hiding this comment

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

Regarding extra cast:

val languageArrayList: ArrayList<String> = args.getStringArrayList(KEY_LANGUAGE_LIST) as ArrayList<String>

If we do not add this extra cast then there is type mismatch warning
Screenshot 2019-09-25 at 11 18 20 AM

Added this line:

val args = checkNotNull(arguments) { "Expected arguments to be pass to LanguageDialogFragment" }

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @rt4914! Generally LGTM, but I think there are still some earlier unresolved comments. Can you please take a look at those & address them? I'm specifically interested in the request for additional tests.

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Sep 25, 2019
Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Given that the remaining changes are trivial, feel free to submit once they're resolved (changing the fragment manager & adding the remaining 2 test cases).

@rt4914
Copy link
Contributor Author

rt4914 commented Sep 25, 2019

Given that the remaining changes are trivial, feel free to submit once they're resolved (changing the fragment manager & adding the remaining 2 test cases).

Thanks @BenHenning for regular and prompt reviews.

I have replaced fragmentManager with childFragmentManager to establish parent/child relation within fragments.

Also, working on test-cases now.

@rt4914
Copy link
Contributor Author

rt4914 commented Sep 25, 2019

Final task of adding test-cases has been done, therefore, merging this PR now.

@rt4914 rt4914 merged commit 4404f71 into develop Sep 25, 2019
@rt4914 rt4914 deleted the exploration-player-audio-low-fi branch September 25, 2019 06:31
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.

5 participants