diff options
author | pacien | 2018-08-22 22:44:53 +0200 |
---|---|---|
committer | pacien | 2018-08-22 22:44:53 +0200 |
commit | 718c152a6a63a20c5a49f32f6f0884e32848f4e9 (patch) | |
tree | 90695a395b88c9dcbe028fe88e3fbf04c2f5ea3b | |
parent | 24c881750aee124a95ec803755ee9334597e5b09 (diff) | |
download | tincapp-718c152a6a63a20c5a49f32f6f0884e32848f4e9.tar.gz |
Re-organise string resources
22 files changed, 221 insertions, 279 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 d9d549b..975d4cf 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt | |||
@@ -85,12 +85,12 @@ abstract class BaseActivity : AppCompatActivity() { | |||
85 | fun aboutDialog(m: MenuItem) { | 85 | fun aboutDialog(m: MenuItem) { |
86 | AlertDialog.Builder(this) | 86 | AlertDialog.Builder(this) |
87 | .setTitle(resources.getString(R.string.app_name)) | 87 | .setTitle(resources.getString(R.string.app_name)) |
88 | .setMessage(resources.getString(R.string.app_short_desc) + "\n\n" + | 88 | .setMessage(resources.getString(R.string.about_app_short_desc) + "\n\n" + |
89 | resources.getString(R.string.app_copyright) + " " + | 89 | resources.getString(R.string.about_app_copyright) + " " + |
90 | resources.getString(R.string.app_license) + "\n\n" + | 90 | resources.getString(R.string.about_app_license) + "\n\n" + |
91 | AppInfo.all()) | 91 | AppInfo.all()) |
92 | .setNeutralButton(R.string.action_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.app_website_url)) } | 92 | .setNeutralButton(R.string.about_app_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.about_app_website_url)) } |
93 | .setPositiveButton(R.string.action_close) { _, _ -> Unit } | 93 | .setPositiveButton(R.string.generic_action_close) { _, _ -> Unit } |
94 | .show() | 94 | .show() |
95 | } | 95 | } |
96 | 96 | ||
@@ -103,18 +103,18 @@ abstract class BaseActivity : AppCompatActivity() { | |||
103 | CrashRecorder.dismissPreviousCrash() | 103 | CrashRecorder.dismissPreviousCrash() |
104 | 104 | ||
105 | AlertDialog.Builder(this) | 105 | AlertDialog.Builder(this) |
106 | .setTitle(R.string.title_app_crash) | 106 | .setTitle(R.string.crash_modal_title) |
107 | .setMessage(listOf( | 107 | .setMessage(listOf( |
108 | resources.getString(R.string.message_app_crash), | 108 | resources.getString(R.string.crash_modal_message), |
109 | resources.getString(R.string.message_crash_logged, AppPaths.appLogFile().absolutePath) | 109 | resources.getString(R.string.crash_modal_crash_logged, AppPaths.appLogFile().absolutePath) |
110 | ).joinToString("\n\n")) | 110 | ).joinToString("\n\n")) |
111 | .setNeutralButton(R.string.action_send_report) { _, _ -> | 111 | .setNeutralButton(R.string.crash_modal_action_send_report) { _, _ -> |
112 | App.sendMail( | 112 | App.sendMail( |
113 | resources.getString(R.string.app_dev_email), | 113 | resources.getString(R.string.crash_modal_dev_email), |
114 | listOf(R.string.app_name, R.string.title_app_crash).joinToString(" / ", transform = resources::getString), | 114 | listOf(R.string.app_name, R.string.crash_modal_title).joinToString(" / ", transform = resources::getString), |
115 | AppPaths.appLogFile().let { if (it.exists()) it.readText() else "" }) | 115 | AppPaths.appLogFile().let { if (it.exists()) it.readText() else "" }) |
116 | } | 116 | } |
117 | .setPositiveButton(R.string.action_close) { _, _ -> Unit } | 117 | .setPositiveButton(R.string.generic_action_close) { _, _ -> Unit } |
118 | .show() | 118 | .show() |
119 | } | 119 | } |
120 | 120 | ||
@@ -125,6 +125,6 @@ abstract class BaseActivity : AppCompatActivity() { | |||
125 | fun notify(msg: String) = Snackbar.make(base_activity_frame, msg, Snackbar.LENGTH_LONG).show() | 125 | fun notify(msg: String) = Snackbar.make(base_activity_frame, msg, Snackbar.LENGTH_LONG).show() |
126 | 126 | ||
127 | fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) | 127 | fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) |
128 | .setTitle(R.string.title_error).setMessage(msg) | 128 | .setTitle(R.string.generic_title_error).setMessage(msg) |
129 | .setPositiveButton(R.string.action_close) { _, _ -> Unit }.show() | 129 | .setPositiveButton(R.string.generic_action_close) { _, _ -> Unit }.show() |
130 | } | 130 | } |
diff --git a/app/src/main/java/org/pacien/tincapp/activities/configure/tools/ConfigurationTool.kt b/app/src/main/java/org/pacien/tincapp/activities/configure/tools/ConfigurationTool.kt index 41d1f55..4fa85f8 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/configure/tools/ConfigurationTool.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/configure/tools/ConfigurationTool.kt | |||
@@ -43,7 +43,7 @@ abstract class ConfigurationTool(private val parentActivity: BaseActivity) { | |||
43 | .setTitle(title) | 43 | .setTitle(title) |
44 | .setView(view) | 44 | .setView(view) |
45 | .setPositiveButton(applyButton) { _, _ -> applyAction(view) } | 45 | .setPositiveButton(applyButton) { _, _ -> applyAction(view) } |
46 | .setNegativeButton(R.string.action_cancel) { _, _ -> Unit } | 46 | .setNegativeButton(R.string.generic_action_cancel) { _, _ -> Unit } |
47 | .show() | 47 | .show() |
48 | } | 48 | } |
49 | 49 | ||
@@ -51,7 +51,7 @@ abstract class ConfigurationTool(private val parentActivity: BaseActivity) { | |||
51 | ProgressModal.show(parentActivity, parentActivity.getString(label)).let { progressDialog -> | 51 | ProgressModal.show(parentActivity, parentActivity.getString(label)).let { progressDialog -> |
52 | action | 52 | action |
53 | .whenComplete { _, _ -> progressDialog.dismiss() } | 53 | .whenComplete { _, _ -> progressDialog.dismiss() } |
54 | .thenAccept { parentActivity.notify(R.string.message_network_configuration_written) } | 54 | .thenAccept { parentActivity.notify(R.string.configure_tools_message_network_configuration_written) } |
55 | .exceptionallyAccept { parentActivity.runOnUiThread { parentActivity.showErrorDialog(it.cause!!.localizedMessage) } } | 55 | .exceptionallyAccept { parentActivity.runOnUiThread { parentActivity.showErrorDialog(it.cause!!.localizedMessage) } } |
56 | } | 56 | } |
57 | } | 57 | } |
@@ -60,5 +60,5 @@ abstract class ConfigurationTool(private val parentActivity: BaseActivity) { | |||
60 | if (networkNamePattern.matcher(netName).matches()) | 60 | if (networkNamePattern.matcher(netName).matches()) |
61 | CompletableFuture.completedFuture(Unit) | 61 | CompletableFuture.completedFuture(Unit) |
62 | else | 62 | else |
63 | CompletableFuture.failedFuture(IllegalArgumentException(parentActivity.getString(R.string.message_invalid_network_name))) | 63 | CompletableFuture.failedFuture(IllegalArgumentException(parentActivity.getString(R.string.configure_tools_message_invalid_network_name))) |
64 | } | 64 | } |
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt b/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt index 06046e9..d1ccd3f 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt | |||
@@ -55,10 +55,10 @@ class ConnectionStarter(private val parentActivity: StartActivity) { | |||
55 | val dialogView = parentActivity.layoutInflater.inflate(R.layout.dialog_decrypt_keys, parentActivity.base_activity_frame, false) | 55 | val dialogView = parentActivity.layoutInflater.inflate(R.layout.dialog_decrypt_keys, parentActivity.base_activity_frame, false) |
56 | 56 | ||
57 | AlertDialog.Builder(parentActivity) | 57 | AlertDialog.Builder(parentActivity) |
58 | .setTitle(R.string.title_unlock_private_keys) | 58 | .setTitle(R.string.decrypt_key_modal_title) |
59 | .setView(dialogView) | 59 | .setView(dialogView) |
60 | .setPositiveButton(R.string.action_unlock) { _, _ -> tryStart(passphrase = dialogView.passphrase.text.toString()) } | 60 | .setPositiveButton(R.string.decrypt_key_modal_action_unlock) { _, _ -> tryStart(passphrase = dialogView.passphrase.text.toString()) } |
61 | .setNegativeButton(R.string.action_cancel) { _, _ -> Unit } | 61 | .setNegativeButton(R.string.decrypt_key_modal_action_cancel) { _, _ -> Unit } |
62 | .show() | 62 | .show() |
63 | } | 63 | } |
64 | 64 | ||
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt index 9cc6159..802115f 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt | |||
@@ -99,7 +99,7 @@ class StartActivity : BaseActivity() { | |||
99 | } | 99 | } |
100 | 100 | ||
101 | fun showConnectProgressDialog() { | 101 | fun showConnectProgressDialog() { |
102 | connectDialog = ProgressModal.show(this, resources.getString(R.string.message_starting_vpn)) | 102 | connectDialog = ProgressModal.show(this, resources.getString(R.string.start_starting_vpn)) |
103 | } | 103 | } |
104 | 104 | ||
105 | @Suppress("UNUSED_PARAMETER") | 105 | @Suppress("UNUSED_PARAMETER") |
diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt index 3815bc9..152ed83 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt | |||
@@ -104,7 +104,7 @@ class StatusActivity : BaseActivity() { | |||
104 | } | 104 | } |
105 | 105 | ||
106 | private fun stopVpn() { | 106 | private fun stopVpn() { |
107 | shutdownDialog = ProgressModal.show(this, getString(R.string.message_disconnecting_vpn)) | 107 | shutdownDialog = ProgressModal.show(this, getString(R.string.status_activity_disconnecting_vpn)) |
108 | vpnService.disconnect() | 108 | vpnService.disconnect() |
109 | } | 109 | } |
110 | 110 | ||
diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt b/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt index a519d07..568714e 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt | |||
@@ -30,7 +30,7 @@ object VpnInterfaceConfigurationFormatter { | |||
30 | 30 | ||
31 | fun formatList(list: List<Any>) = when { | 31 | fun formatList(list: List<Any>) = when { |
32 | list.isNotEmpty() -> list.joinToString("\n", transform = this::formatListElement) | 32 | list.isNotEmpty() -> list.joinToString("\n", transform = this::formatListElement) |
33 | else -> resources.getString(R.string.status_network_info_none_value)!! | 33 | else -> resources.getString(R.string.status_network_info_value_none)!! |
34 | } | 34 | } |
35 | 35 | ||
36 | private fun formatListElement(element: Any) = when (element) { | 36 | private fun formatListElement(element: Any) = when (element) { |