-
Notifications
You must be signed in to change notification settings - Fork 550
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
Conversation
@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 Line 35 in 3a0afb4
@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 |
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? |
@rt4914 I am facing few dependency errors which I am unable to resolve - |
Once this issue is resolved, I will mark the PR ready for review. |
https://drive.google.com/file/d/16pGyh9XBpd7eCYU7iz6IvuQ1YIZkPzIN/view?usp=sharing this is the link of video |
There was a problem hiding this 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.
app/src/main/java/org/oppia/android/app/fragment/BottomSheetFragment.kt
Outdated
Show resolved
Hide resolved
@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 |
@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 |
@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. For this I used Pixel 3A API 28 |
But why are the same checks failing on Github Actions. PTAL |
@bkaur-bkj For now I have re-ran the CI checks as we have noticed something similar on #4183 also. |
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. |
Okay sir but I am not clear then how I should proceed as the checks failed again. |
There was a problem hiding this 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() { |
There was a problem hiding this comment.
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 { | ||
|
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @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) |
There was a problem hiding this comment.
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"?> |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
android:id="@+id/bottom_sheet_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="10dp" | ||
android:orientation="vertical"> |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
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. |
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. |
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. |
Explanation
Essential Checklist
For UI-specific PRs only
If your PR includes UI-related changes, then: