Compare commits

..
6 Commits
Author SHA1 Message Date
Markus Fisch bb9d556c16 Advance version number to 1.49.1 2022-03-31 20:50:50 +02:00
VixbandGitHub 9e395d1928 Update Simplified Chinese translation 2022-03-31 19:11:01 +02:00
Markus Fisch 95f12e7c31 Return directly to caller for deep links
If this app was invoked via a deep link, but without a return URI,
we never want to return to the camera screen after scanning, but
to the caller.
2022-03-30 20:11:44 +02:00
Markus Fisch 9dac0b13fb Fix getting ORIENTATION member from meta data
Was UPC_EAN_EXTENSION instead.
2022-03-30 19:57:00 +02:00
Markus Fisch 7939a728bc Make isReturnUrl() a String extension
And thereby remove Intent from the scope of the function.
2022-03-30 19:51:19 +02:00
Markus Fisch b6ca20d813 Move Cursor extensions to a separate file 2022-03-30 19:48:43 +02:00
7 changed files with 117 additions and 101 deletions
+5
View File
@@ -1,5 +1,10 @@
# Change Log
## 1.49.1
* Update Simplified Chinese translation
* Return directly to caller for deep links
* Fix metadata for deep links
## 1.49.0
* Add a setting to quickly enable/disable forwarding
* Stop playing error beep when in silent mode
+2 -2
View File
@@ -8,8 +8,8 @@ android {
minSdkVersion 9
targetSdkVersion sdk_version
versionCode 94
versionName '1.49.0'
versionCode 95
versionName '1.49.1'
// Required for desugaring.
multiDexEnabled true
@@ -80,6 +80,7 @@ class CameraActivity : AppCompatActivity() {
private var decoding = true
private var returnResult = false
private var returnUrlTemplate: String? = null
private var finishAfterShowingResult = false
private var frontFacing = false
private var bulkMode = prefs.bulkMode
private var restrictFormat: String? = null
@@ -197,8 +198,9 @@ class CameraActivity : AppCompatActivity() {
intent?.action == "com.google.zxing.client.android.SCAN" -> {
returnResult = true
}
isReturnUrl(intent) -> intent?.data?.let {
returnUrlTemplate = it.getQueryParameter("ret")
intent?.dataString?.isReturnUrl() == true -> {
finishAfterShowingResult = true
returnUrlTemplate = intent.data?.getQueryParameter("ret")
}
}
}
@@ -732,12 +734,20 @@ class CameraActivity : AppCompatActivity() {
returnUri != null -> execShareIntent(
Intent(Intent.ACTION_VIEW, returnUri)
)
else -> showResult(
this@CameraActivity,
result,
vibrator,
bulkMode
)
else -> {
showResult(
this@CameraActivity,
result,
vibrator,
bulkMode
)
// If this app was invoked via a deep link but without
// a return URI, we probably don't want to return to
// the camera screen after scanning, but to the caller.
if (finishAfterShowingResult) {
finish()
}
}
}
if (bulkMode) {
ignoreNext = result.text
@@ -822,7 +832,7 @@ fun getReturnIntent(result: Result): Intent {
intent.putExtra("SCAN_RESULT_BYTES", result.rawBytes)
}
result.resultMetadata?.let { metadata ->
metadata[ResultMetadataType.UPC_EAN_EXTENSION]?.let {
metadata[ResultMetadataType.ORIENTATION]?.let {
intent.putExtra(
"SCAN_RESULT_ORIENTATION",
it.toString()
@@ -852,17 +862,11 @@ fun getReturnIntent(result: Result): Intent {
return intent
}
private fun isReturnUrl(intent: Intent?): Boolean {
val dataString = intent?.dataString
return listOf(
"binaryeye://scan",
"http://markusfisch.de/BinaryEye",
"https://markusfisch.de/BinaryEye"
).firstOrNull {
val result = dataString?.startsWith(it) == true
result
} != null
}
private fun String.isReturnUrl() = listOf(
"binaryeye://scan",
"http://markusfisch.de/BinaryEye",
"https://markusfisch.de/BinaryEye"
).firstOrNull { startsWith(it) } != null
private fun completeUrl(urlTemplate: String, result: Result) = Uri.parse(
urlTemplate
@@ -0,0 +1,18 @@
package de.markusfisch.android.binaryeye.database
import android.database.Cursor
fun Cursor.getString(name: String): String {
val idx = getColumnIndex(name)
return if (idx < 0) "" else getString(idx) ?: ""
}
fun Cursor.getBlob(name: String): ByteArray? {
val idx = getColumnIndex(name)
return if (idx < 0) null else getBlob(idx)
}
fun Cursor.getLong(name: String): Long {
val idx = getColumnIndex(name)
return if (idx < 0) 0L else getLong(idx)
}
@@ -7,21 +7,6 @@ import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import de.markusfisch.android.binaryeye.app.prefs
fun Cursor.getString(name: String): String {
val idx = getColumnIndex(name)
return if (idx < 0) "" else getString(idx) ?: ""
}
fun Cursor.getBlob(name: String): ByteArray? {
val idx = getColumnIndex(name)
return if (idx < 0) null else getBlob(idx)
}
fun Cursor.getLong(name: String): Long {
val idx = getColumnIndex(name)
return if (idx < 0) 0L else getLong(idx)
}
class Database {
private lateinit var db: SQLiteDatabase
+64 -64
View File
@@ -1,36 +1,36 @@
<resources>
<string name="no_camera_no_fun">给我相机权限,不给你扫了,哼</string>
<string name="no_camera_no_fun">相机权限的话,该应用没有任何意义。再见</string>
<string name="camera_error">无法访问相机,请重试。</string>
<string name="scan_code"></string>
<string name="compose_barcode">制作条形</string>
<string name="decode_barcode">码条形</string>
<string name="scan_code"></string>
<string name="compose_barcode">生成条</string>
<string name="decode_barcode">析条</string>
<string name="content">内容</string>
<string name="binary_data">(二进制数据)</string>
<plurals name="barcode_info">
<item quantity="other">%2$d 字符, %1$s</item>
</plurals>
<string name="error_correction_level">纠错级别</string>
<string name="error_correction_level_l" formatted="false"> (~7&#37; correction)</string>
<string name="error_correction_level_m" formatted="false"> (~15&#37; correction)</string>
<string name="error_correction_level_q" formatted="false">Quartile (~25&#37; correction)</string>
<string name="error_correction_level_h" formatted="false"> (~30&#37; correction)</string>
<string name="error_correction_level_l" formatted="false">Low (~7&#37; 准确度)</string>
<string name="error_correction_level_m" formatted="false">Medium (~15&#37; 准确度)</string>
<string name="error_correction_level_q" formatted="false">Quartile (~25&#37; 准确度)</string>
<string name="error_correction_level_h" formatted="false">High (~30&#37; 准确度)</string>
<string name="issue_number">发行编号</string>
<string name="orientation">方向</string>
<string name="other_meta_data">元数据</string>
<string name="pdf417_extra_metadata">PDF417 元数据</string>
<string name="possible_country">可能产地</string>
<string name="suggested_price">隐含价格</string>
<string name="suggested_price">建议价格</string>
<string name="upc_ean_extension">UPC EAN 扩展</string>
<string name="toggle_flash">开关闪光灯</string>
<string name="error_flash">Error toggling flash</string>
<string name="error_flash">开关闪光灯出错</string>
<string name="share">分享</string>
<string name="share_as">以何种方式分享?</string>
<string name="share_as">以何种方式分享</string>
<string name="copy_to_clipboard">复制到剪贴板</string>
<string name="copied_to_clipboard">已复制到剪贴板</string>
<string name="copy_password">复制密码到剪贴板</string>
<string name="copied_password_to_clipboard">已复制密码到剪贴板</string>
<string name="open_url">打开链接</string>
<string name="cannot_resolve_action">没有相关APP可以打开它</string>
<string name="cannot_resolve_action">没有应用可以打开它</string>
<string name="pick_search_engine">选择一个搜索引擎</string>
<string name="format">编码格式</string>
<string name="size">图片尺寸</string>
@@ -38,21 +38,21 @@
<string name="input_content_here">在这里输入内容</string>
<string name="encode">编码</string>
<string name="error_no_content">缺少内容</string>
<string name="error_encoding_barcode">无法生成条</string>
<string name="view_barcode">查看条</string>
<string name="error_encoding_barcode">无法生成条码</string>
<string name="view_barcode">查看条码</string>
<string name="info">关于</string>
<string name="switch_camera">切换摄像头</string>
<string name="bulk_mode">连续扫描</string>
<string name="bulk_mode_summary">始终开启连续扫描</string>
<string name="bulk_mode_delay">Delay between continuous scans</string>
<string name="restrict_format">Restrict format</string>
<string name="remove_restriction">Remove restriction</string>
<string name="scan_format">Scan %s</string>
<string name="quarter_second">A quarter second</string>
<string name="half_second">Half a second</string>
<string name="a_second">One second</string>
<string name="two_seconds">Two seconds</string>
<string name="five_seconds">Five seconds</string>
<string name="bulk_mode_delay">连续扫描之间的延迟</string>
<string name="restrict_format">受限格式</string>
<string name="remove_restriction">解除限制</string>
<string name="scan_format">扫描 %s</string>
<string name="quarter_second">四分之一秒</string>
<string name="half_second">半秒</string>
<string name="a_second">一秒</string>
<string name="two_seconds">两秒</string>
<string name="five_seconds">五秒</string>
<string name="history">历史</string>
<string name="preferences">首选项</string>
<string name="scan_category">扫描</string>
@@ -60,19 +60,19 @@
<string name="locale_category">语言</string>
<string name="custom_locale">设定语言</string>
<string name="follow_system_settings">跟随系统设置</string>
<string name="show_crop_handle">限制扫描区域</string>
<string name="show_crop_handle">限制扫描范围</string>
<string name="show_crop_handle_summary">把扫描区域限制在选定范围内</string>
<string name="barcode_formats">Barcode formats</string>
<string name="barcode_formats">条码格式</string>
<string name="zoom_by_swiping">上下滑动缩放</string>
<string name="zoom_by_swiping_summary">通过上下滑动在扫描界面控制相机缩放</string>
<string name="auto_rotate">识别竖直的1D条形码</string>
<string name="auto_rotate_summary">自动旋转相机以识别竖直的1D条形码(可能会影响一些设备的扫描性能)</string>
<string name="auto_rotate">识别竖直的 1D 条形码</string>
<string name="auto_rotate_summary">自动旋转相机以识别竖直的 1D 条形码(可能会影响一些设备的扫描性能)</string>
<string name="try_harder">提高扫描精度</string>
<string name="try_harder_summary">扫描很难识别的条码时可启用该选项,但会降低扫描速度</string>
<string name="try_harder_summary">扫描很难识别的条码时可启用该选项!会影响性能</string>
<string name="show_toast_in_bulk_mode">在连续扫描模式中显示数据</string>
<string name="show_toast_in_bulk_mode_summary">连续扫描时简要显示扫描数据。</string>
<string name="vibrate">振动提示</string>
<string name="vibrate_summary">扫描完成时振动提示</string>
<string name="vibrate">识别时震动</string>
<string name="vibrate_summary">如果你希望在识别到条码后震动设备,请启用该选项。</string>
<string name="use_history">保存扫描历史</string>
<string name="use_history_summary">在本地保存扫描历史</string>
<string name="ignore_consecutive_duplicates">不保存重复历史</string>
@@ -80,31 +80,31 @@
<string name="open_immediately">不查看内容立即打开</string>
<string name="open_immediately_summary">可能会打开有害内容</string>
<string name="copy_immediately">自动复制扫描结果到剪贴板</string>
<string name="copy_immediately_summary">注意其他APP可能会在后台监控剪贴板</string>
<string name="copy_immediately_summary">注意其他 APP 可能会在后台监控剪贴板</string>
<string name="show_meta_data">显示元数据</string>
<string name="show_meta_data_summary">显示已扫描条码的额外数据</string>
<string name="show_meta_data_summary">显示已扫描条码的额外数据</string>
<string name="show_hex_dump">显示16进制数据</string>
<string name="show_hex_dump_summary">显示已扫描条码的16进制数据</string>
<string name="show_hex_dump_summary">显示已扫描条码的16进制数据</string>
<string name="close_automatically">复制/分享后自动返回</string>
<string name="close_automatically_summary">复制或分享读取的内容后自动返回扫描主界面。</string>
<string name="default_search_engine">Open unknown data in</string>
<string name="always_ask">Always ask</string>
<string name="open_with_url">使用URL打开未知数据</string>
<string name="clear_network_suggestions">Clear network suggestions</string>
<string name="clear_network_suggestions_summary">Remove all of the network suggestions that were previously provided by this app.</string>
<string name="really_remove_all_networks">Really remove all networks?</string>
<string name="clear_network_suggestions_success">Network suggestions cleared</string>
<string name="clear_network_suggestions_nothing_to_remove">Nothing to remove</string>
<string name="default_search_engine">打开未知数据方式</string>
<string name="always_ask">总是询问</string>
<string name="open_with_url">使用 URL 打开未知数据</string>
<string name="clear_network_suggestions">清除网络建议</string>
<string name="clear_network_suggestions_summary">清除该应用之前提供的所有网络建议。</string>
<string name="really_remove_all_networks">确定清除所有网络建议?</string>
<string name="clear_network_suggestions_success">网络建议已清除</string>
<string name="clear_network_suggestions_nothing_to_remove">无内容可清除</string>
<string name="send_category">转发</string>
<string name="send_scan_active">Forward scans</string>
<string name="send_scan_active_summary">Enable to forward scans to a the given URL</string>
<string name="send_scan_url">将每个扫描结果发送到URL</string>
<string name="send_scan_active">转发扫描</string>
<string name="send_scan_active_summary">启用以转发扫描到给定的 URL</string>
<string name="send_scan_url">要转发的 URL</string>
<string name="send_scan_type">请求类型</string>
<string name="send_type_get_add_content">GET 简单附加数据</string>
<string name="send_type_get_query_string">GET 完整查询数据</string>
<string name="send_type_post_form">POST application/x-www-form-urlencoded</string>
<string name="send_type_post_json">POST application/json</string>
<string name="send_type_external_browser">Open in external browser</string>
<string name="send_type_external_browser">在外部浏览器中打开</string>
<string name="test_url">测试 URL</string>
<string name="really_remove_scan">确定删除记录?</string>
<string name="really_remove_all_scans">确定删除全部记录?</string>
@@ -115,7 +115,7 @@
<string name="remove_scan">删除所选记录</string>
<string name="enter_name">输入名称</string>
<string name="enter_name_hint">扫描描述</string>
<string name="no_barcode_found">未找到条</string>
<string name="no_barcode_found">未找到条码</string>
<string name="pick_list_separator">如何分隔列表项?</string>
<string name="separator_line_break">换行符</string>
<string name="separator_ruler">分割线</string>
@@ -123,9 +123,9 @@
<string name="file_name">文件名</string>
<string name="error_saving_file">无法保存文件</string>
<string name="error_file_exists">文件已存在</string>
<string name="connect_to_wifi">连接到WiFi</string>
<string name="wifi_config_failed">无法配置WiFi</string>
<string name="wifi_added">WiFi已添加</string>
<string name="connect_to_wifi">连接到 WiFi</string>
<string name="wifi_config_failed">无法配置 WiFi</string>
<string name="wifi_added">WiFi 已添加</string>
<string name="sms_send">发送短信</string>
<string name="sms_error">无法发送短信</string>
<string name="tel_dial">拨打号码</string>
@@ -141,26 +141,26 @@
<string name="search_scan">搜索扫描记录</string>
<string name="export_to_file">导出为文件</string>
<string name="export_as">另存为?</string>
<string name="export_csv_comma">逗号分隔的CSV</string>
<string name="export_csv_semicolon">分号分隔的CSV</string>
<string name="export_csv_comma">逗号分隔的 CSV</string>
<string name="export_csv_semicolon">分号分隔的 CSV</string>
<string name="export_json">JSON</string>
<string name="export_database">导出SQLite数据库</string>
<string name="export_database">导出 SQLite 数据库</string>
<string name="saved_in_downloads">已保存到下载目录</string>
<string name="rotate_image_cw">旋转图片</string>
<string name="pick_file">选择图片文件</string>
<string name="pick_code_to_scan">选择扫描编码</string>
<string name="shortcut_decode">扫描条</string>
<string name="shortcut_encode">创建条</string>
<string name="shortcut_decode">扫描条码</string>
<string name="shortcut_encode">创建条码</string>
<string name="shortcut_preferences">设置</string>
<string name="background_request_failed">后台请求失败</string>
<string name="entry_type">Type</string>
<string name="wifi_network">Wi-Fi network</string>
<string name="wifi_ssid">Name</string>
<string name="wifi_type">Authentication type</string>
<string name="wifi_password">Password</string>
<string name="wifi_hidden">Hidden network</string>
<string name="wifi_eap">EAP method</string>
<string name="wifi_anonymous_identity">Anonymous identity</string>
<string name="wifi_identity">Identity</string>
<string name="wifi_phase2">Phase 2 method</string>
<string name="entry_type">类型</string>
<string name="wifi_network">Wi-Fi 网络</string>
<string name="wifi_ssid">名称</string>
<string name="wifi_type">认证类型</string>
<string name="wifi_password">密码</string>
<string name="wifi_hidden">隐藏的网络</string>
<string name="wifi_eap">EAP 方法</string>
<string name="wifi_anonymous_identity">匿名身份</string>
<string name="wifi_identity">身份</string>
<string name="wifi_phase2">阶段 2 方法</string>
</resources>
@@ -0,0 +1,4 @@
* Update Simplified Chinese translation
* Return directly to caller for deep links
* Fix metadata for deep links