I'm using in my app the Conductor framework.
The app in general is fixed in portrait state, but I have 2 Controllers that use ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR and respond to device orientation changes
ControllerA - shows a summary of images takenControllerB - is the camera interaction
so when A is launched, it immediately launches B and shows the summary after images are taken.
A holds a RecyclerView that uses FlexboxLayoutManager (when I tried replacing the layout manager w/ a simple LinearLayoutManager nothing changed)
I have 3 flows that work fine:
- The device in held in Portrait -> A is launched -> B is launched -> images are taken -> B is closed -> the images are Shown in A
- The device in held in Landscape -> A is launched -> B is launched -> images are taken -> B is closed -> the images are Shown in A
- The device in held in Portrait -> A is launched -> B is launched -> device orientation changes to Landscape -> images are taken -> orientation changes to Portrait-> B is closed -> the images are Shown in A
However this scenario fails:
The device in held in Portrait -> A is launched -> B is launched -> device orientation changes to Landscape -> images are taken -> B is closed -> the images are NOT shown in A
In all the flows I see that the adapter is aware of the new items, and getItemViewType, onCreateViewHolder and onBindViewHolder are called with the correct positions
The flow that fails is actually that one that seems most natural to me as a user :(
- Does anyone have any idea what is going on?
- Can you suggest additional directions for investigation?
UPDATE:
- The recycler view was defined with
android:layout_height="wrap_content" - Changing to
android:layout_height="match_parent"while working withLinearLayoutManagerworks (looks ugly) - Changing it back to
FlexboxLayoutManagerfails all the flows that worked before
So I'm taking a look now at FlexboxLayoutManager to see if I can fix this easily - I don't think that a recycler view is actually needed in my flow
It seems that the solution was just changing the
RecyclerViewfromandroid:layout_height="wrap_content"toandroid:layout_height="match_parent".In the update above I said that it still doesn't work with
FlexboxLayoutManager, but the problem was on my end (too commenting out and in of code).The original code wasn't written by me, so I'm not sure why
wrap_contentwas used