aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle1
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt23
-rw-r--r--app/src/main/res/values-zh-rCN/strings.xml1
-rw-r--r--app/src/main/res/values-zh-rHK/strings.xml1
-rw-r--r--app/src/main/res/values-zh-rTW/strings.xml1
-rw-r--r--app/src/main/res/values/strings.xml1
6 files changed, 8 insertions, 20 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 815ca72..7a29d7b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -38,6 +38,7 @@ dependencies {
38 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 38 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
39 implementation 'net.sourceforge.streamsupport:streamsupport-cfuture:1.5.5' 39 implementation 'net.sourceforge.streamsupport:streamsupport-cfuture:1.5.5'
40 implementation 'com.android.support:design:25.4.0' 40 implementation 'com.android.support:design:25.4.0'
41 implementation 'com.google.zxing:android-integration:3.3.0'
41 implementation 'org.bouncycastle:bcpkix-jdk15on:1.57' 42 implementation 'org.bouncycastle:bcpkix-jdk15on:1.57'
42 implementation 'org.slf4j:slf4j-api:1.7.25' 43 implementation 'org.slf4j:slf4j-api:1.7.25'
43 implementation 'com.github.tony19:logback-android:1.1.1-9' 44 implementation 'com.github.tony19:logback-android:1.1.1-9'
diff --git a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
index e311415..5f6a3fe 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
@@ -1,13 +1,12 @@
1package org.pacien.tincapp.activities 1package org.pacien.tincapp.activities
2 2
3import android.app.Activity
4import android.content.ActivityNotFoundException
5import android.content.Intent 3import android.content.Intent
6import android.net.Uri
7import android.os.Bundle 4import android.os.Bundle
8import android.support.annotation.StringRes 5import android.support.annotation.StringRes
9import android.support.v7.app.AlertDialog 6import android.support.v7.app.AlertDialog
10import android.view.View 7import android.view.View
8import com.google.zxing.integration.android.IntentIntegrator
9import com.google.zxing.integration.android.IntentResult
11import java8.util.concurrent.CompletableFuture 10import java8.util.concurrent.CompletableFuture
12import kotlinx.android.synthetic.main.base.* 11import kotlinx.android.synthetic.main.base.*
13import kotlinx.android.synthetic.main.dialog_encrypt_decrypt_keys.view.* 12import kotlinx.android.synthetic.main.dialog_encrypt_decrypt_keys.view.*
@@ -26,8 +25,6 @@ import java.util.regex.Pattern
26 */ 25 */
27class ConfigureActivity : BaseActivity() { 26class ConfigureActivity : BaseActivity() {
28 companion object { 27 companion object {
29 private const val REQUEST_SCAN = 0
30 private const val SCAN_PROVIDER = "com.google.zxing.client.android"
31 private val NETWORK_NAME_PATTERN = Pattern.compile("^[^\\x00/]*$") 28 private val NETWORK_NAME_PATTERN = Pattern.compile("^[^\\x00/]*$")
32 } 29 }
33 30
@@ -36,8 +33,10 @@ class ConfigureActivity : BaseActivity() {
36 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { 33 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
37 super.onActivityResult(requestCode, resultCode, data) 34 super.onActivityResult(requestCode, resultCode, data)
38 35
39 if (requestCode == REQUEST_SCAN && resultCode == Activity.RESULT_OK) 36 IntentIntegrator.parseActivityResult(requestCode, resultCode, data)
40 joinDialog?.invitation_url?.setText(data!!.getStringExtra("SCAN_RESULT").trim()) 37 ?.let(IntentResult::getContents)
38 ?.let(String::trim)
39 ?.let { joinDialog?.invitation_url?.setText(it) }
41 } 40 }
42 41
43 override fun onCreate(savedInstanceState: Bundle?) { 42 override fun onCreate(savedInstanceState: Bundle?) {
@@ -48,15 +47,7 @@ class ConfigureActivity : BaseActivity() {
48 } 47 }
49 48
50 fun scanCode(@Suppress("UNUSED_PARAMETER") v: View) { 49 fun scanCode(@Suppress("UNUSED_PARAMETER") v: View) {
51 try { 50 IntentIntegrator(this).initiateScan()
52 startActivityForResult(Intent("$SCAN_PROVIDER.SCAN"), REQUEST_SCAN)
53 } catch (e: ActivityNotFoundException) {
54 AlertDialog.Builder(this).setTitle(R.string.action_scan_qr_code)
55 .setMessage(R.string.message_no_qr_code_scanner)
56 .setPositiveButton(R.string.action_install) { _, _ ->
57 startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$SCAN_PROVIDER")))
58 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show()
59 }
60 } 51 }
61 52
62 fun openGenerateConfDialog(@Suppress("UNUSED_PARAMETER") v: View) { 53 fun openGenerateConfDialog(@Suppress("UNUSED_PARAMETER") v: View) {
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index ce0a854..5feb75d 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -70,7 +70,6 @@
70 <string name="message_no_configuration_for_network_format">没有找到网络“%1$s”的配置。</string> 70 <string name="message_no_configuration_for_network_format">没有找到网络“%1$s”的配置。</string>
71 <string name="message_network_config_not_found_format">在“%1$s”找不到网络配置文件。</string> 71 <string name="message_network_config_not_found_format">在“%1$s”找不到网络配置文件。</string>
72 <string name="message_network_config_invalid_format">network.conf 中的网络配置无效:\n\n%1$s</string> 72 <string name="message_network_config_invalid_format">network.conf 中的网络配置无效:\n\n%1$s</string>
73 <string name="message_no_qr_code_scanner">无法启动扫描器。\n\n安装 Barcode Scanner?</string>
74 <string name="message_encrypting_decrypting_private_keys">加密/解密私钥</string> 73 <string name="message_encrypting_decrypting_private_keys">加密/解密私钥</string>
75 <string name="message_could_not_decrypt_private_keys_format">无法解密私钥:\n\n%1$s</string> 74 <string name="message_could_not_decrypt_private_keys_format">无法解密私钥:\n\n%1$s</string>
76 75
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index 6879117..dfc27fe 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -70,7 +70,6 @@
70 <string name="message_no_configuration_for_network_format">沒有找到網絡“%1$s”的配置。</string> 70 <string name="message_no_configuration_for_network_format">沒有找到網絡“%1$s”的配置。</string>
71 <string name="message_network_config_not_found_format">在“%1$s”找不到網絡配置文件。</string> 71 <string name="message_network_config_not_found_format">在“%1$s”找不到網絡配置文件。</string>
72 <string name="message_network_config_invalid_format">network.conf 中的網絡配置無效:\n\n%1$s</string> 72 <string name="message_network_config_invalid_format">network.conf 中的網絡配置無效:\n\n%1$s</string>
73 <string name="message_no_qr_code_scanner">無法啟動掃描器。\n\n安裝 Barcode Scanner?</string>
74 <string name="message_encrypting_decrypting_private_keys">加密/解密私鑰</string> 73 <string name="message_encrypting_decrypting_private_keys">加密/解密私鑰</string>
75 <string name="message_could_not_decrypt_private_keys_format">無法解密私鑰:\n\n%1$s</string> 74 <string name="message_could_not_decrypt_private_keys_format">無法解密私鑰:\n\n%1$s</string>
76 75
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 3c9927f..c553138 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -70,7 +70,6 @@
70 <string name="message_no_configuration_for_network_format">沒有找到網路“%1$s”的配置。</string> 70 <string name="message_no_configuration_for_network_format">沒有找到網路“%1$s”的配置。</string>
71 <string name="message_network_config_not_found_format">在“%1$s”找不到網路配置檔案。</string> 71 <string name="message_network_config_not_found_format">在“%1$s”找不到網路配置檔案。</string>
72 <string name="message_network_config_invalid_format">network.conf 中的網路配置無效:\n\n%1$s</string> 72 <string name="message_network_config_invalid_format">network.conf 中的網路配置無效:\n\n%1$s</string>
73 <string name="message_no_qr_code_scanner">無法啟動掃描器。\n\n安裝 Barcode Scanner?</string>
74 <string name="message_encrypting_decrypting_private_keys">加密/解密私鑰</string> 73 <string name="message_encrypting_decrypting_private_keys">加密/解密私鑰</string>
75 <string name="message_could_not_decrypt_private_keys_format">無法解密私鑰:\n\n%1$s</string> 74 <string name="message_could_not_decrypt_private_keys_format">無法解密私鑰:\n\n%1$s</string>
76 75
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6ac776f..ba0233d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -79,7 +79,6 @@
79 <string name="message_no_configuration_for_network_format">No configuration has been found for network \"%1$s\".</string> 79 <string name="message_no_configuration_for_network_format">No configuration has been found for network \"%1$s\".</string>
80 <string name="message_network_config_not_found_format">Network configuration file not found at \"%1$s\".</string> 80 <string name="message_network_config_not_found_format">Network configuration file not found at \"%1$s\".</string>
81 <string name="message_network_config_invalid_format">Invalid network configuration in network.conf:\n\n%1$s</string> 81 <string name="message_network_config_invalid_format">Invalid network configuration in network.conf:\n\n%1$s</string>
82 <string name="message_no_qr_code_scanner">No scanner could be started.\n\nInstall Barcode Scanner?</string>
83 <string name="message_encrypting_decrypting_private_keys">Encrypting/decrypting private keys</string> 82 <string name="message_encrypting_decrypting_private_keys">Encrypting/decrypting private keys</string>
84 <string name="message_could_not_decrypt_private_keys_format">Could not decrypt private keys:\n\n%1$s</string> 83 <string name="message_could_not_decrypt_private_keys_format">Could not decrypt private keys:\n\n%1$s</string>
85 <string name="message_storage_unavailable">Storage directory is unavailable.</string> 84 <string name="message_storage_unavailable">Storage directory is unavailable.</string>