aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-08-05 22:12:46 +0200
committerpacien2018-08-05 22:12:46 +0200
commit9012ef92ed810f4a08b5f01cd2c18430a277eacf (patch)
tree7e2dc8f9b61698e895fab07bc524575af5ec484b
parenta9d1ac81374119e33871484c8749a94d11a71cae (diff)
downloadtincapp-9012ef92ed810f4a08b5f01cd2c18430a277eacf.tar.gz
Code style
-rw-r--r--app/src/main/c/exec.c6
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt10
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt6
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt4
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt2
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/Executor.kt2
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/Tincd.kt2
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/App.kt2
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/AppInfo.kt6
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/AppPaths.kt8
-rw-r--r--app/src/main/java/org/pacien/tincapp/data/CidrAddress.kt2
-rw-r--r--app/src/main/java/org/pacien/tincapp/data/TincConfiguration.kt6
-rw-r--r--app/src/main/java/org/pacien/tincapp/data/VpnInterfaceConfiguration.kt38
-rw-r--r--app/src/main/java/org/pacien/tincapp/extensions/Android.kt4
-rw-r--r--app/src/main/java/org/pacien/tincapp/extensions/VpnServiceBuilder.kt18
-rw-r--r--app/src/main/java/org/pacien/tincapp/intent/BroadcastMapper.kt2
-rw-r--r--app/src/main/java/org/pacien/tincapp/utils/PemUtils.kt72
-rw-r--r--app/src/main/res/drawable/horizontal_line.xml2
-rw-r--r--app/src/main/res/layout/base.xml2
-rw-r--r--app/src/main/res/layout/dialog_decrypt_keys.xml2
-rw-r--r--app/src/main/res/layout/dialog_encrypt_decrypt_keys.xml2
-rw-r--r--app/src/main/res/layout/dialog_network_generate.xml2
-rw-r--r--app/src/main/res/layout/dialog_network_join.xml2
-rw-r--r--app/src/main/res/layout/dialog_node_details.xml2
-rw-r--r--app/src/main/res/layout/fragment_list_item.xml2
-rw-r--r--app/src/main/res/layout/fragment_list_view.xml2
-rw-r--r--app/src/main/res/layout/fragment_network_list_header.xml2
-rw-r--r--app/src/main/res/layout/fragment_network_status_header.xml2
-rw-r--r--app/src/main/res/layout/page_configure.xml2
-rw-r--r--app/src/main/res/layout/page_viewlog.xml2
-rw-r--r--app/src/main/res/menu/menu_base.xml2
-rw-r--r--app/src/main/res/menu/menu_start.xml2
-rw-r--r--app/src/main/res/menu/menu_status.xml2
-rw-r--r--app/src/main/res/menu/menu_viewlog.xml2
-rw-r--r--app/src/main/res/values-ja/strings.xml2
-rw-r--r--app/src/main/res/values-nb-rNO/strings.xml2
-rw-r--r--app/src/main/res/values-w600dp/dimens.xml2
-rw-r--r--app/src/main/res/values-w960dp/dimens.xml2
-rw-r--r--app/src/main/res/values-zh-rCN/strings.xml2
-rw-r--r--app/src/main/res/values-zh-rHK/strings.xml2
-rw-r--r--app/src/main/res/values-zh-rTW/strings.xml2
-rw-r--r--app/src/main/res/values/dimens.xml2
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/values/styles.xml2
44 files changed, 157 insertions, 87 deletions
diff --git a/app/src/main/c/exec.c b/app/src/main/c/exec.c
index 838135c..5e92b11 100644
--- a/app/src/main/c/exec.c
+++ b/app/src/main/c/exec.c
@@ -40,11 +40,11 @@ static inline void exec(const char **argcv) {
40} 40}
41 41
42JNIEXPORT jint JNICALL 42JNIEXPORT jint JNICALL
43Java_org_pacien_tincapp_commands_Executor_forkExec(JNIEnv *env, jclass class, jobjectArray argcv) { 43Java_org_pacien_tincapp_commands_Executor_forkExec(JNIEnv *env, __attribute__((unused)) jclass class, jobjectArray args) {
44 pid_t pid = fork(); 44 pid_t pid = fork();
45 switch (pid) { 45 switch (pid) {
46 case 0: 46 case 0:
47 exec(to_string_array(env, argcv)); 47 exec(to_string_array(env, args));
48 return 0; 48 return 0;
49 49
50 default: 50 default:
@@ -53,7 +53,7 @@ Java_org_pacien_tincapp_commands_Executor_forkExec(JNIEnv *env, jclass class, jo
53} 53}
54 54
55JNIEXPORT jint JNICALL 55JNIEXPORT jint JNICALL
56Java_org_pacien_tincapp_commands_Executor_wait(JNIEnv *env, jclass class, jint pid) { 56Java_org_pacien_tincapp_commands_Executor_wait(__attribute__((unused))JNIEnv *env, __attribute__((unused)) jclass class, jint pid) {
57 int status; 57 int status;
58 waitpid(pid, &status, 0); 58 waitpid(pid, &status, 0);
59 return WIFEXITED(status) ? WEXITSTATUS(status) : -1; 59 return WIFEXITED(status) ? WEXITSTATUS(status) : -1;
diff --git a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
index 3e2bebd..4b1cb91 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
@@ -78,7 +78,7 @@ abstract class BaseActivity : AppCompatActivity() {
78 resources.getString(R.string.app_license) + "\n\n" + 78 resources.getString(R.string.app_license) + "\n\n" +
79 AppInfo.all()) 79 AppInfo.all())
80 .setNeutralButton(R.string.action_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.app_website_url)) } 80 .setNeutralButton(R.string.action_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.app_website_url)) }
81 .setPositiveButton(R.string.action_close, { _, _ -> Unit }) 81 .setPositiveButton(R.string.action_close) { _, _ -> Unit }
82 .show() 82 .show()
83 } 83 }
84 84
@@ -96,13 +96,13 @@ abstract class BaseActivity : AppCompatActivity() {
96 resources.getString(R.string.message_app_crash), 96 resources.getString(R.string.message_app_crash),
97 resources.getString(R.string.message_crash_logged, AppPaths.appLogFile().absolutePath) 97 resources.getString(R.string.message_crash_logged, AppPaths.appLogFile().absolutePath)
98 ).joinToString("\n\n")) 98 ).joinToString("\n\n"))
99 .setNeutralButton(R.string.action_send_report, { _, _ -> 99 .setNeutralButton(R.string.action_send_report) { _, _ ->
100 App.sendMail( 100 App.sendMail(
101 resources.getString(R.string.app_dev_email), 101 resources.getString(R.string.app_dev_email),
102 listOf(R.string.app_name, R.string.title_app_crash).joinToString(" / ", transform = resources::getString), 102 listOf(R.string.app_name, R.string.title_app_crash).joinToString(" / ", transform = resources::getString),
103 AppPaths.appLogFile().let { if (it.exists()) it.readText() else "" }) 103 AppPaths.appLogFile().let { if (it.exists()) it.readText() else "" })
104 }) 104 }
105 .setPositiveButton(R.string.action_close, { _, _ -> Unit }) 105 .setPositiveButton(R.string.action_close) { _, _ -> Unit }
106 .show() 106 .show()
107 } 107 }
108 108
@@ -111,5 +111,5 @@ abstract class BaseActivity : AppCompatActivity() {
111 protected fun showProgressDialog(@StringRes msg: Int): AlertDialog = ProgressModal.show(this, getString(msg)) 111 protected fun showProgressDialog(@StringRes msg: Int): AlertDialog = ProgressModal.show(this, getString(msg))
112 protected fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) 112 protected fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this)
113 .setTitle(R.string.title_error).setMessage(msg) 113 .setTitle(R.string.title_error).setMessage(msg)
114 .setPositiveButton(R.string.action_close, { _, _ -> Unit }).show() 114 .setPositiveButton(R.string.action_close) { _, _ -> Unit }.show()
115} 115}
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 45a29bf..f823691 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
@@ -76,7 +76,7 @@ class ConfigureActivity : BaseActivity() {
76 genDialog.new_net_name.text.toString(), 76 genDialog.new_net_name.text.toString(),
77 genDialog.new_node_name.text.toString(), 77 genDialog.new_node_name.text.toString(),
78 genDialog.new_passphrase.text.toString()) 78 genDialog.new_passphrase.text.toString())
79 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show() 79 }.setNegativeButton(R.string.action_cancel) { _, _ -> Unit }.show()
80 } 80 }
81 81
82 fun openJoinNetworkDialog(@Suppress("UNUSED_PARAMETER") v: View) { 82 fun openJoinNetworkDialog(@Suppress("UNUSED_PARAMETER") v: View) {
@@ -87,7 +87,7 @@ class ConfigureActivity : BaseActivity() {
87 joinDialog!!.net_name.text.toString(), 87 joinDialog!!.net_name.text.toString(),
88 joinDialog!!.invitation_url.text.toString(), 88 joinDialog!!.invitation_url.text.toString(),
89 joinDialog!!.join_passphrase.text.toString()) 89 joinDialog!!.join_passphrase.text.toString())
90 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show() 90 }.setNegativeButton(R.string.action_cancel) { _, _ -> Unit }.show()
91 } 91 }
92 92
93 fun openEncryptDecryptPrivateKeyDialog(@Suppress("UNUSED_PARAMETER") v: View) { 93 fun openEncryptDecryptPrivateKeyDialog(@Suppress("UNUSED_PARAMETER") v: View) {
@@ -98,7 +98,7 @@ class ConfigureActivity : BaseActivity() {
98 encryptDecryptDialog!!.enc_dec_net_name.text.toString(), 98 encryptDecryptDialog!!.enc_dec_net_name.text.toString(),
99 encryptDecryptDialog.enc_dec_current_passphrase.text.toString(), 99 encryptDecryptDialog.enc_dec_current_passphrase.text.toString(),
100 encryptDecryptDialog.enc_dec_new_passphrase.text.toString()) 100 encryptDecryptDialog.enc_dec_new_passphrase.text.toString())
101 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show() 101 }.setNegativeButton(R.string.action_cancel) { _, _ -> Unit }.show()
102 } 102 }
103 103
104 private fun writeContent() { 104 private fun writeContent() {
diff --git a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt
index fbcde81..4be1609 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt
@@ -68,7 +68,7 @@ class StartActivity : BaseActivity() {
68 } 68 }
69 69
70 override fun onRefresh() { 70 override fun onRefresh() {
71 val networks = AppPaths.confDir()?.list()?.toList() ?: emptyList() 71 val networks = AppPaths.confDir().list()?.toList() ?: emptyList()
72 runOnUiThread { 72 runOnUiThread {
73 networkListAdapter?.setElements(networks) 73 networkListAdapter?.setElements(networks)
74 setPlaceholderVisibility() 74 setPlaceholderVisibility()
@@ -121,7 +121,7 @@ class StartActivity : BaseActivity() {
121 AlertDialog.Builder(this@StartActivity) 121 AlertDialog.Builder(this@StartActivity)
122 .setTitle(R.string.title_unlock_private_keys).setView(dialog) 122 .setTitle(R.string.title_unlock_private_keys).setView(dialog)
123 .setPositiveButton(R.string.action_unlock) { _, _ -> tryStart(passphrase = dialog.passphrase.text.toString()) } 123 .setPositiveButton(R.string.action_unlock) { _, _ -> tryStart(passphrase = dialog.passphrase.text.toString()) }
124 .setNegativeButton(R.string.action_cancel, { _, _ -> Unit }) 124 .setNegativeButton(R.string.action_cancel) { _, _ -> Unit }
125 .show() 125 .show()
126 }