Skip to content

Commit

Permalink
[fix] switch camera failed when using the same product cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangdg committed Aug 29, 2022
1 parent a40274d commit fd38e64
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/com/jiangdg/demo/DemoFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,19 @@ class DemoFragment : CameraFragment(), View.OnClickListener, CaptureMediaView.On
for (index in (0 until usbDeviceList.size)) {
val dev = usbDeviceList[index]
val devName = if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.LOLLIPOP && !dev.productName.isNullOrEmpty()) {
dev.productName
"${dev.productName}(${curDevice?.deviceId})"
} else {
"${dev.deviceName}(${dev.deviceId})"
dev.deviceName
}
val curDevName = if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.LOLLIPOP && !curDevice?.productName.isNullOrEmpty()) {
curDevice!!.productName
"${curDevice!!.productName}(${curDevice.deviceId})"
} else {
"${curDevice?.deviceName}(${curDevice?.deviceId})"
curDevice?.deviceName
}
if (devName == curDevName) {
selectedIndex = index
}
list.add(devName!!)
list.add(devName)
}
MaterialDialog(requireContext()).show {
listItemsSingleChoice(
Expand Down

0 comments on commit fd38e64

Please sign in to comment.