aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien/tincapp/activities
diff options
context:
space:
mode:
authorpacien2018-02-16 18:42:02 +0100
committerpacien2018-02-16 18:42:02 +0100
commitd360837d494a86930b8323a99691dc52925eb7ea (patch)
tree2fc1a8b1bf70d0fdbaa45a0185b0158f23a29a5d /app/src/main/java/org/pacien/tincapp/activities
parent5a4f0f964e41847b10ed44ac1f5b2bbf060102c3 (diff)
downloadtincapp-d360837d494a86930b8323a99691dc52925eb7ea.tar.gz
Cosmetic
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/activities')
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt6
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt11
2 files changed, 6 insertions, 11 deletions
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 c092111..44f3210 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
@@ -18,7 +18,6 @@ import org.pacien.tincapp.context.AppInfo
18 * @author pacien 18 * @author pacien
19 */ 19 */
20abstract class BaseActivity : AppCompatActivity() { 20abstract class BaseActivity : AppCompatActivity() {
21
22 override fun onCreate(savedInstanceState: Bundle?) { 21 override fun onCreate(savedInstanceState: Bundle?) {
23 super.onCreate(savedInstanceState) 22 super.onCreate(savedInstanceState)
24 setContentView(R.layout.base) 23 setContentView(R.layout.base)
@@ -38,7 +37,7 @@ abstract class BaseActivity : AppCompatActivity() {
38 resources.getString(R.string.app_license) + "\n\n" + 37 resources.getString(R.string.app_license) + "\n\n" +
39 AppInfo.all()) 38 AppInfo.all())
40 .setNeutralButton(R.string.action_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.app_website_url)) } 39 .setNeutralButton(R.string.action_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.app_website_url)) }
41 .setPositiveButton(R.string.action_close, App.dismissAction) 40 .setPositiveButton(R.string.action_close, { _, _ -> Unit })
42 .show() 41 .show()
43 } 42 }
44 43
@@ -47,6 +46,5 @@ abstract class BaseActivity : AppCompatActivity() {
47 protected fun showProgressDialog(@StringRes msg: Int): ProgressDialog = ProgressDialog.show(this, null, getString(msg), true, false) 46 protected fun showProgressDialog(@StringRes msg: Int): ProgressDialog = ProgressDialog.show(this, null, getString(msg), true, false)
48 protected fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) 47 protected fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this)
49 .setTitle(R.string.title_error).setMessage(msg) 48 .setTitle(R.string.title_error).setMessage(msg)
50 .setPositiveButton(R.string.action_close, App.dismissAction).show() 49 .setPositiveButton(R.string.action_close, { _, _ -> Unit }).show()
51
52} 50}
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 ec17c11..a67887c 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
@@ -17,7 +17,6 @@ import kotlinx.android.synthetic.main.page_configure.*
17import org.pacien.tincapp.R 17import org.pacien.tincapp.R
18import org.pacien.tincapp.commands.Tinc 18import org.pacien.tincapp.commands.Tinc
19import org.pacien.tincapp.commands.TincApp 19import org.pacien.tincapp.commands.TincApp
20import org.pacien.tincapp.context.App
21import org.pacien.tincapp.context.AppPaths 20import org.pacien.tincapp.context.AppPaths
22import org.pacien.tincapp.extensions.Java.exceptionallyAccept 21import org.pacien.tincapp.extensions.Java.exceptionallyAccept
23 22
@@ -25,7 +24,6 @@ import org.pacien.tincapp.extensions.Java.exceptionallyAccept
25 * @author pacien 24 * @author pacien
26 */ 25 */
27class ConfigureActivity : BaseActivity() { 26class ConfigureActivity : BaseActivity() {
28
29 companion object { 27 companion object {
30 val REQUEST_SCAN = 0 28 val REQUEST_SCAN = 0
31 val SCAN_PROVIDER = "com.google.zxing.client.android" 29 val SCAN_PROVIDER = "com.google.zxing.client.android"
@@ -55,7 +53,7 @@ class ConfigureActivity : BaseActivity() {
55 .setMessage(R.string.message_no_qr_code_scanner) 53 .setMessage(R.string.message_no_qr_code_scanner)
56 .setPositiveButton(R.string.action_install) { _, _ -> 54 .setPositiveButton(R.string.action_install) { _, _ ->
57 startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$SCAN_PROVIDER"))) 55 startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$SCAN_PROVIDER")))
58 }.setNegativeButton(R.string.action_cancel, App.dismissAction).show() 56 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show()
59 } 57 }
60 } 58 }
61 59
@@ -67,7 +65,7 @@ class ConfigureActivity : BaseActivity() {
67 genDialog.new_net_name.text.toString(), 65 genDialog.new_net_name.text.toString(),
68 genDialog.new_node_name.text.toString(), 66 genDialog.new_node_name.text.toString(),
69 genDialog.new_passphrase.text.toString()) 67 genDialog.new_passphrase.text.toString())
70 }.setNegativeButton(R.string.action_cancel, App.dismissAction).show() 68 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show()
71 } 69 }
72 70
73 fun openJoinNetworkDialog(@Suppress("UNUSED_PARAMETER") v: View) { 71 fun openJoinNetworkDialog(@Suppress("UNUSED_PARAMETER") v: View) {
@@ -78,7 +76,7 @@ class ConfigureActivity : BaseActivity() {
78 joinDialog!!.net_name.text.toString(), 76 joinDialog!!.net_name.text.toString(),
79 joinDialog!!.invitation_url.text.toString(), 77 joinDialog!!.invitation_url.text.toString(),
80 joinDialog!!.join_passphrase.text.toString()) 78 joinDialog!!.join_passphrase.text.toString())
81 }.setNegativeButton(R.string.action_cancel, App.dismissAction).show() 79 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show()
82 } 80 }
83 81
84 fun openEncryptDecryptPrivateKeyDialog(@Suppress("UNUSED_PARAMETER") v: View) { 82 fun openEncryptDecryptPrivateKeyDialog(@Suppress("UNUSED_PARAMETER") v: View) {
@@ -89,7 +87,7 @@ class ConfigureActivity : BaseActivity() {
89 encryptDecryptDialog!!.enc_dec_net_name.text.toString(), 87 encryptDecryptDialog!!.enc_dec_net_name.text.toString(),
90 encryptDecryptDialog.enc_dec_current_passphrase.text.toString(), 88 encryptDecryptDialog.enc_dec_current_passphrase.text.toString(),
91 encryptDecryptDialog.enc_dec_new_passphrase.text.toString()) 89 encryptDecryptDialog.enc_dec_new_passphrase.text.toString())
92 }.setNegativeButton(R.string.action_cancel, App.dismissAction).show() 90 }.setNegativeButton(R.string.action_cancel, { _, _ -> Unit }).show()
93 } 91 }
94 92
95 private fun writeContent() { 93 private fun writeContent() {
@@ -123,5 +121,4 @@ class ConfigureActivity : BaseActivity() {
123 .exceptionallyAccept { runOnUiThread { showErrorDialog(it.cause!!.localizedMessage) } } 121 .exceptionallyAccept { runOnUiThread { showErrorDialog(it.cause!!.localizedMessage) } }
124 } 122 }
125 } 123 }
126
127} 124}