Fixed
Status Update
Comments
du...@google.com <du...@google.com> #2
Hi Doudera,
Thank you for reporting this issue. It is working as intended. This is because the state of CameraControl follows Camera. Once the Camera is closed, all settings will be restored, just like the settings of the focus area and zoom level. The app can restore the torch state by resetting torch at the time of activity onResume.
du...@google.com <du...@google.com> #3
Hello,
thank you for the fast reply. The behaviour is unexpected to me because if you have the same code as before and just add logging like this:
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, preview, imageCapture, imageAnalyzer)
.apply {
Log.d(TAG, "Enabling torch after binding") // <-- called everytime it returns to Activity so next statement should be applied
cameraControl.enableTorch(true)
}
The log is always called even when returning to Activity so I suppose it should be applied. Why it is not applied when it is called?
Unfortunately, I cannot make it work even with your hint. I tried to add camera?.cameraControl?.enableTorch(true) to onResume() but without any effect. Can you please describe more how to reset torch state onResume().
As you said the same happens with setZoomRatio() etc.
Thank you, Martin
thank you for the fast reply. The behaviour is unexpected to me because if you have the same code as before and just add logging like this:
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, preview, imageCapture, imageAnalyzer)
.apply {
Log.d(TAG, "Enabling torch after binding") // <-- called everytime it returns to Activity so next statement should be applied
cameraControl.enableTorch(true)
}
The log is always called even when returning to Activity so I suppose it should be applied. Why it is not applied when it is called?
Unfortunately, I cannot make it work even with your hint. I tried to add camera?.cameraControl?.enableTorch(true) to onResume() but without any effect. Can you please describe more how to reset torch state onResume().
As you said the same happens with setZoomRatio() etc.
Thank you, Martin
ap...@google.com <ap...@google.com> #4
Hi Doudera, Thank you for the detail description. It sounds like some problem in the code. I will investigate it more.
du...@google.com <du...@google.com> #5
From the log, it shows the camera state
-> open -> enable torch -> close -> open
The torch was gone because it restarted the camera.
It needs to investigate more about why it open/close so frequently.
Description
Version used: 3.0.0-alpha01
I'm trying to replace my old PagedListAdapters with the new PagingDataAdapter.
Using the RecyclerView selection tracker library I need to implement an ItemKeyProvider which has two methods :
getKey(position: Int) and getPosition(key: String).
For the first one I can retrieve the key by calling adapter.getItem(position) but for the second one the PagingDataAdapter doesn't expose the list of items or any method to get the position of an item (like adapter.getposition(item)).
With the PagedListAdapter I was exposing the list by overriding submitList() and making a copy of the list (I don't know if it was a good solution though) but I can't do it with the new adapter as the submitData method is not open.
Is there already a solution that I don't know about or should the PagingDataAdapter exposing a method?