fix: correct Kotlin when-expression syntax to ensure else is last branch

This commit is contained in:
xiajiid
2026-02-09 23:53:20 +08:00
parent 846e956b24
commit 1434c7c933
3 changed files with 18 additions and 18 deletions

View File

@@ -259,12 +259,6 @@ class CameraActivity : AppCompatActivity() {
}
}
}
else -> {
Log.e(TAG, "其他错误: ${exception.imageCaptureError}")
runOnUiThread {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
ImageCapture.ERROR_UNKNOWN -> {
Log.e(TAG, "未知错误")
// 特殊处理:如果错误消息包含"processing",可能是内部处理问题
@@ -332,6 +326,12 @@ class CameraActivity : AppCompatActivity() {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
else -> {
Log.e(TAG, "其他错误: ${exception.imageCaptureError}")
runOnUiThread {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
}
}
}

View File

@@ -241,12 +241,6 @@ class SimpleCameraActivity : AppCompatActivity() {
}
}
}
else -> {
Log.e(TAG, "其他错误: ${exception.imageCaptureError}")
runOnUiThread {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
ImageCapture.ERROR_UNKNOWN -> {
Log.e(TAG, "未知错误")
// 特殊处理:如果错误消息包含"processing",可能是内部处理问题
@@ -302,6 +296,12 @@ class SimpleCameraActivity : AppCompatActivity() {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
else -> {
Log.e(TAG, "其他错误: ${exception.imageCaptureError}")
runOnUiThread {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
}
}
}

View File

@@ -245,12 +245,6 @@ class WatermarkCameraActivity : AppCompatActivity() {
}
}
}
else -> {
Log.e(TAG, "其他错误: ${exception.imageCaptureError}")
runOnUiThread {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
ImageCapture.ERROR_UNKNOWN -> {
Log.e(TAG, "未知错误")
// 特殊处理:如果错误消息包含"processing",可能是内部处理问题
@@ -310,6 +304,12 @@ class WatermarkCameraActivity : AppCompatActivity() {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
else -> {
Log.e(TAG, "其他错误: ${exception.imageCaptureError}")
runOnUiThread {
Toast.makeText(baseContext, "拍照失败: ${exception.message}", Toast.LENGTH_LONG).show()
}
}
}
}
}