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 #3894 : Added bottomsheet #4099

Closed
wants to merge 18 commits into from

Conversation

bkaur-bkj
Copy link
Contributor

Explanation

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

If your PR includes UI-related changes, then:

  • Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes
  • For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see RTL guide)
  • Add a video showing the full UX flow with a screen reader enabled (see accessibility guide)
  • Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing

@bkaur-bkj bkaur-bkj requested a review from rt4914 January 14, 2022 05:39
@bkaur-bkj
Copy link
Contributor Author

@rt4914 I created the bottom sheet fragment and tried implementing listeners on help and options button but I can't figure out a way to call the original function from within the fragment. I have also tried to paste the block of code in the fragment itself but it requires some dagger-related classes. PTAL

@rt4914
Copy link
Contributor

rt4914 commented Jan 19, 2022

@rt4914 I created the bottom sheet fragment and tried implementing listeners on help and options button but I can't figure out a way to call the original function from within the fragment. I have also tried to paste the block of code in the fragment itself but it requires some dagger-related classes. PTAL

Have a look at

val stopStatePlayingSessionListener: StopStatePlayingSessionListener =
where we attach an interface to activity and similar to this link call the function of that interface. You can do something similar to communicate from BottomSheet to activity/fragment.

@bkaur-bkj I have tried the accessibility part and I have shared this video which shows how we don't require the "Close" item.

device-2022-01-19-232038.mp4

@rt4914 rt4914 assigned bkaur-bkj and unassigned rt4914 Jan 19, 2022
@bkaur-bkj
Copy link
Contributor Author

sir, I tried accessibility with bottom sheet after bottomsheet gets open if I swipe up my bottomsheet gets closed directly I don't get any such actions option. I see its fine but don't know why it shows different way

@rt4914
Copy link
Contributor

rt4914 commented Jan 21, 2022

sir, I tried accessibility with bottom sheet after bottomsheet gets open if I swipe up my bottomsheet gets closed directly I don't get any such actions option. I see its fine but don't know why it shows different way

@bkaur-bkj Can you please record and share the video?

@bkaur-bkj
Copy link
Contributor Author

@rt4914 I am facing few dependency errors which I am unable to resolve -
symbol: class BottomSheetItemClickListener location: package org.oppia.android.app.player.explorationC:\Users\Asus\Desktop\git_practice\oppia-android\app\build\tmp\kapt3\stubs\debug\org\oppia\android\app\player\exploration\ExplorationActivity.java:9: error: [ComponentProcessor:MiscError] dagger.internal.codegen.ComponentProcessor was unable to process this class because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.

@bkaur-bkj
Copy link
Contributor Author

bkaur-bkj commented Jan 21, 2022

Once this issue is resolved, I will mark the PR ready for review.

@bkaur-bkj bkaur-bkj assigned rt4914 and unassigned bkaur-bkj Jan 21, 2022
@bkaur-bkj
Copy link
Contributor Author

sir, I tried accessibility with bottom sheet after bottomsheet gets open if I swipe up my bottomsheet gets closed directly I don't get any such actions option. I see its fine but don't know why it shows different way

@bkaur-bkj Can you please record and share the video?

https://drive.google.com/file/d/16pGyh9XBpd7eCYU7iz6IvuQ1YIZkPzIN/view?usp=sharing this is the link of video

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.

@bkaur-bkj Thanks for the video. Its a bit unexpected but anyways we will be add close option to sheet.

@rt4914 rt4914 assigned bkaur-bkj and unassigned rt4914 Jan 25, 2022
@bkaur-bkj bkaur-bkj assigned rt4914 and unassigned bkaur-bkj Jan 26, 2022
@rt4914
Copy link
Contributor

rt4914 commented Jan 28, 2022

@bkaur-bkj I just checked out into your branch and ran the app and its working without any error. Can you try re-building once again? If the error still continues then we can meet and discuss it.

@rt4914 rt4914 assigned bkaur-bkj and unassigned rt4914 Jan 28, 2022
@bkaur-bkj
Copy link
Contributor Author

@bkaur-bkj I just checked out into your branch and ran the app and its working without any error. Can you try re-building once again? If the error still continues then we can meet and discuss it.

yes I tried rebuild, thanks it worked

@bkaur-bkj bkaur-bkj marked this pull request as ready for review January 29, 2022 12:50
@bkaur-bkj bkaur-bkj requested a review from BenHenning as a code owner January 29, 2022 12:50
@bkaur-bkj
Copy link
Contributor Author

@rt4914 the functionality is working fine now, let me know the changes and should I add close option then? as u refused before but you mentioned in the last review that we will be adding it

@rt4914
Copy link
Contributor

rt4914 commented Mar 1, 2022

testExploration_openBottomsheet_selectOptionsInBottomsheet_opensOptionsActivity

@bkaur-bkj Is your code updated to get this error? I checked out in your code and ran this test locally and it passed - twice.
Screenshot 2022-03-01 at 10 49 15 PM

For this I used Pixel 3A API 28

@rt4914 rt4914 assigned bkaur-bkj and unassigned rt4914 Mar 1, 2022
@bkaur-bkj
Copy link
Contributor Author

testExploration_openBottomsheet_selectOptionsInBottomsheet_opensOptionsActivity

@bkaur-bkj Is your code updated to get this error? I checked out in your code and ran this test locally and it passed - twice. Screenshot 2022-03-01 at 10 49 15 PM

For this I used Pixel 3A API 28

But why are the same checks failing on Github Actions. PTAL

@bkaur-bkj bkaur-bkj assigned rt4914 and unassigned bkaur-bkj Mar 7, 2022
@rt4914
Copy link
Contributor

rt4914 commented Mar 7, 2022

@bkaur-bkj For now I have re-ran the CI checks as we have noticed something similar on #4183 also.

@rt4914 rt4914 assigned bkaur-bkj and unassigned rt4914 Mar 7, 2022
@oppiabot
Copy link

oppiabot bot commented Mar 14, 2022

Hi @bkaur-bkj, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 14, 2022
@bkaur-bkj
Copy link
Contributor Author

bkaur-bkj commented Mar 16, 2022

@bkaur-bkj For now I have re-ran the CI checks as we have noticed something similar on #4183 also.

Okay sir but I am not clear then how I should proceed as the checks failed again.

@oppiabot oppiabot bot removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 16, 2022
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 @bkaur-bkj. Took a pass--PTAL.

I'm also going to dig into why the CI checks aren't running; I'm going to see if I can get them to restart.

import org.oppia.android.databinding.FragmentBottomSheetBinding

/** Bottom sheet fragment for displaying options menu */
class BottomSheetOptionsMenu(val internalProfileId: Int) : BottomSheetDialogFragment() {
Copy link
Member

Choose a reason for hiding this comment

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

Does this parameter need to be passed in through arguments, instead, since Android can recreate the fragment itself?

private fun setUpOnClickListeners(binding: FragmentBottomSheetBinding) {
val bottomSheetItemClickListener = activity as BottomSheetOptionsMenuItemClickListener
binding.actionHelp.setOnClickListener {

Copy link
Member

Choose a reason for hiding this comment

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

Nit: please remove extra newline for consistency. Ditto below.

* Function for passing the selected itemId
*
* @param itemId: Resource Id of the option selected
* @return [Unit]
Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed for Unit return types.

/**
* Function for passing the selected itemId
*
* @param itemId: Resource Id of the option selected
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param itemId: Resource Id of the option selected
* @param itemId resource Id of the option selected

* @param itemId: Resource Id of the option selected
* @return [Unit]
*/
fun handleOnOptionsItemSelected(itemId: Int)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps use an enum instead of a resource ID to limit the possibilities of what can be passed to this function (limiting possibilities generally results in more error-tolerant and understandable code).

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

The name of this file should match its location since all layout resources are global to the app.

@@ -55,6 +55,14 @@
android:scaleType="center"
app:srcCompat="@{viewModel.isAudioStreamingOn ? @drawable/ic_audio_streaming_on_24dp : @drawable/ic_audio_streaming_off_24dp}"
android:visibility="@{viewModel.showAudioButton ? View.VISIBLE : View.GONE}" />

<ImageButton
android:id="@+id/action_bottom_sheet"
Copy link
Member

Choose a reason for hiding this comment

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

IDs are global to the app--this should be more specific to what specific menu it corresponds to.

Ditto for the options in the bottom sheet fragment layout below.

Comment on lines +4 to +8
android:id="@+id/bottom_sheet_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
Copy link
Member

Choose a reason for hiding this comment

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

Indentation seems off here--please fix.

@@ -444,7 +443,7 @@ class ExplorationActivityTest {
}

@Test
fun testExploration_overflowMenu_isDisplayedSuccessfully() {
fun testExploration_openBottomSheet() {
Copy link
Member

Choose a reason for hiding this comment

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

What's the expected outcome? The action seems to be opening the bottom sheet, but it's not clear what this test is making sure works.

Perhaps instead:

testActivity_initialState_openBottomSheet_showsBottomSheet

Might help clarify?

@@ -1839,7 +1867,8 @@ class ExplorationActivityTest {

private fun addShadowMediaPlayerException(dataSource: Any, exception: Exception) {
val classLoader = ExplorationActivityTest::class.java.classLoader!!
val shadowMediaPlayerClass = classLoader.loadClass("org.robolectric.shadows.ShadowMediaPlayer")
val shadowMediaPlayerClass =
classLoader.loadClass("org.robolectric.shadows.ShadowMediaPlayer")
Copy link
Member

Choose a reason for hiding this comment

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

Why this change? Ditto above. I suspect these might be extra and unnecessary reformats done by Android Studio.

@BenHenning BenHenning closed this Mar 24, 2022
@BenHenning BenHenning reopened this Mar 24, 2022
@BenHenning
Copy link
Member

BenHenning commented Mar 24, 2022

It looks like CI checks are running now. It may help also to merge the latest develop in @bkaur-bkj as it contains improvements for Gradle runs.

@BenHenning BenHenning assigned bkaur-bkj and unassigned BenHenning Mar 24, 2022
@oppiabot
Copy link

oppiabot bot commented Mar 31, 2022

Hi @bkaur-bkj, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 31, 2022
@oppiabot oppiabot bot removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 31, 2022
@oppiabot
Copy link

oppiabot bot commented Apr 7, 2022

Hi @bkaur-bkj, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Apr 7, 2022
@oppiabot oppiabot bot closed this Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Corresponds to items that haven't seen a recent update and may be automatically closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants