Fixed
Status Update
Comments
il...@google.com <il...@google.com>
jd...@gmail.com <jd...@gmail.com> #2
This is a good idea and definitely worth investigating.
I think there's something to be said about what scope these coroutines would run in, but it should be possible to pass it back from adapter internally.
hu...@google.com <hu...@google.com> #3
Thanks for the suggestion!
hu...@google.com <hu...@google.com> #4
I was thinking of something more upstream. I may be wrong, because I'm just getting started with this new library
Using the scope of the adapter in case of a configuration change would cancel the coroutine, and the cachedIn operator wouldn't cache the mapped value, and some operations would have to be done multiple times.
Maybe using the scope on the producing side of the PageEvents, like in PageFetcher, could be an option.
Using the scope of the adapter in case of a configuration change would cancel the coroutine, and the cachedIn operator wouldn't cache the mapped value, and some operations would have to be done multiple times.
Maybe using the scope on the producing side of the PageEvents, like in PageFetcher, could be an option.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit debb2cb10010710d92c0da93b7ea6870fbc4d834
Author: Dustin Lam <dustinlam@google.com>
Date: Fri Jun 26 19:45:32 2020
Add suspend version of transform functions
RelNote: "Made existing PagingData operators accept suspending methods
and introduced new mapSync, flatMapSync, and filterSync non-suspending
operators for Java users. The existing transformation methods have been
moved to extension functions so Kotlin users will need to import them."
Fixes: 159983232
Test: ./gradlew paging:paging-common:test
Change-Id: I342390a7b1eb98ac87072998744a9e46c99a1000
M paging/common/api/3.0.0-alpha03.txt
M paging/common/api/current.txt
M paging/common/api/public_plus_experimental_3.0.0-alpha03.txt
M paging/common/api/public_plus_experimental_current.txt
M paging/common/api/restricted_3.0.0-alpha03.txt
M paging/common/api/restricted_current.txt
M paging/common/src/main/kotlin/androidx/paging/PageEvent.kt
M paging/common/src/main/kotlin/androidx/paging/PagingData.kt
M paging/common/src/main/kotlin/androidx/paging/Separators.kt
M paging/common/src/test/kotlin/androidx/paging/PageEventTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsTest.kt
M paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Activity.kt
M paging/samples/src/main/java/androidx/paging/samples/CachedInSample.kt
M paging/samples/src/main/java/androidx/paging/samples/InsertSeparatorsUiModelSample.kt
M paging/samples/src/main/java/androidx/paging/samples/java/InsertSeparatorsJavaUiModelSample.java
https://android-review.googlesource.com/1350688
Branch: androidx-master-dev
commit debb2cb10010710d92c0da93b7ea6870fbc4d834
Author: Dustin Lam <dustinlam@google.com>
Date: Fri Jun 26 19:45:32 2020
Add suspend version of transform functions
RelNote: "Made existing PagingData operators accept suspending methods
and introduced new mapSync, flatMapSync, and filterSync non-suspending
operators for Java users. The existing transformation methods have been
moved to extension functions so Kotlin users will need to import them."
Fixes: 159983232
Test: ./gradlew paging:paging-common:test
Change-Id: I342390a7b1eb98ac87072998744a9e46c99a1000
M paging/common/api/3.0.0-alpha03.txt
M paging/common/api/current.txt
M paging/common/api/public_plus_experimental_3.0.0-alpha03.txt
M paging/common/api/public_plus_experimental_current.txt
M paging/common/api/restricted_3.0.0-alpha03.txt
M paging/common/api/restricted_current.txt
M paging/common/src/main/kotlin/androidx/paging/PageEvent.kt
M paging/common/src/main/kotlin/androidx/paging/PagingData.kt
M paging/common/src/main/kotlin/androidx/paging/Separators.kt
M paging/common/src/test/kotlin/androidx/paging/PageEventTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsTest.kt
M paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Activity.kt
M paging/samples/src/main/java/androidx/paging/samples/CachedInSample.kt
M paging/samples/src/main/java/androidx/paging/samples/InsertSeparatorsUiModelSample.kt
M paging/samples/src/main/java/androidx/paging/samples/java/InsertSeparatorsJavaUiModelSample.java
jd...@gmail.com <jd...@gmail.com> #6
Hi all,
Sorry for my very late reply, but I was traveling and very busy.
I have just run the test again, and it still doesn't work.
As far as I understand, with the change that was introduced, I only had to update the dependencies and rerun the test as it was. Please correct me if I am wrong. These are my (relevant) dependencies:
- androidx.fragment and fragment-testing: 1.1.0-alpha05
- androidx.test.runner: 1.1.1
- androidx.test.core: 1.1.0
- androidx.test.ext.junit: 1.1.0
- org.robolectric: 4.2.1
Am I missing anything here? Thank you!
Best regards,
Jorge
Sorry for my very late reply, but I was traveling and very busy.
I have just run the test again, and it still doesn't work.
As far as I understand, with the change that was introduced, I only had to update the dependencies and rerun the test as it was. Please correct me if I am wrong. These are my (relevant) dependencies:
- androidx.fragment and fragment-testing: 1.1.0-alpha05
- androidx.test.runner: 1.1.1
- androidx.test.core: 1.1.0
- androidx.test.ext.junit: 1.1.0
- org.robolectric: 4.2.1
Am I missing anything here? Thank you!
Best regards,
Jorge
jd...@gmail.com <jd...@gmail.com> #7
Hi again,
The generated error is: "androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.canonicalexamples.realprogrammers:id/menu_item_save".
Running the application displays that button. However, the (partial) hierarchy shown in the log is:
"+---->ActionMenuView{id=-1, visibility=VISIBLE, width=56, height=48, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@340d8ce3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=264.0, y=0.0, child-count=1}
|
+----->OverflowMenuButton{id=-1, desc=More options, visibility=VISIBLE, width=56, height=48, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.ActionMenuView$LayoutParams@1c10a9c8, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+--->ActionBarContextView{id=16908677, res-name=action_context_bar, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@c883991, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0}
|
+-->ActionBarContainer{id=16909335, res-name=split_action_bar, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=com.android.internal.widget.ActionBarOverlayLayout$LayoutParams@820620, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} "
Best regards,
Jorge
The generated error is: "androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.canonicalexamples.realprogrammers:id/menu_item_save".
Running the application displays that button. However, the (partial) hierarchy shown in the log is:
"+---->ActionMenuView{id=-1, visibility=VISIBLE, width=56, height=48, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@340d8ce3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=264.0, y=0.0, child-count=1}
|
+----->OverflowMenuButton{id=-1, desc=More options, visibility=VISIBLE, width=56, height=48, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.ActionMenuView$LayoutParams@1c10a9c8, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+--->ActionBarContextView{id=16908677, res-name=action_context_bar, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@c883991, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0}
|
+-->ActionBarContainer{id=16909335, res-name=split_action_bar, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=com.android.internal.widget.ActionBarOverlayLayout$LayoutParams@820620, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} "
Best regards,
Jorge
Description
Version used: 1.1.0-alpha02
Devices/Android versions reproduced on: emulator
I am trying to test that a menu option is enabled or disabled when needed using Robolectric 4.0.2. The test will be something like:
@Test
fun enableSaveButton() {
sut.onFragment {
// TODO: trigger onCreateOptionsMenu(menu: Menu, inflater: MenuInflater)
openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext())
it.enableSaveButton(false)
}
onView(withId(R.id.menu_item_save)).check(matches(not(isEnabled())))
}
The fragment is launched and reaches the resumed state, but in the lamda that "onFragment" executes, onCreateMenuOptions() has NOT been executed yet becaues that is how the fragment lifecycle works (
I have also tried using Espresso's "openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext())" unsuccessfully.