diff --git a/res/layout-sw400dp/activity_register.xml b/res/layout-sw400dp/activity_register.xml
index 6cb987305b..0a905eca61 100644
--- a/res/layout-sw400dp/activity_register.xml
+++ b/res/layout-sw400dp/activity_register.xml
@@ -65,17 +65,16 @@
android:layout_marginRight="@dimen/massive_spacing"
android:text="Copy" />
-
+ android:text="By using this service, you agree to our Terms of Service and Privacy Policy" />
\ No newline at end of file
diff --git a/res/layout-sw400dp/activity_restore.xml b/res/layout-sw400dp/activity_restore.xml
index 1697ebc224..82e1cf8d13 100644
--- a/res/layout-sw400dp/activity_restore.xml
+++ b/res/layout-sw400dp/activity_restore.xml
@@ -55,17 +55,16 @@
android:layout_marginRight="@dimen/massive_spacing"
android:text="Continue" />
-
+ android:text="By using this service, you agree to our Terms of Service and Privacy Policy" />
\ No newline at end of file
diff --git a/res/layout/activity_register.xml b/res/layout/activity_register.xml
index 2f481e477b..636ab61f0c 100644
--- a/res/layout/activity_register.xml
+++ b/res/layout/activity_register.xml
@@ -66,17 +66,16 @@
android:layout_marginRight="@dimen/massive_spacing"
android:text="Copy" />
-
+ android:text="By using this service, you agree to our Terms of Service and Privacy Policy" />
\ No newline at end of file
diff --git a/res/layout/activity_restore.xml b/res/layout/activity_restore.xml
index eb5db6bf14..70749c5186 100644
--- a/res/layout/activity_restore.xml
+++ b/res/layout/activity_restore.xml
@@ -55,17 +55,16 @@
android:layout_marginRight="@dimen/massive_spacing"
android:text="Continue" />
-
+ android:text="By using this service, you agree to our Terms of Service and Privacy Policy" />
\ No newline at end of file
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/RegisterActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/RegisterActivity.kt
index 50936cf3f9..75352682a0 100644
--- a/src/org/thoughtcrime/securesms/loki/redesign/activities/RegisterActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/RegisterActivity.kt
@@ -10,7 +10,10 @@ import android.os.Bundle
import android.os.Handler
import android.text.Spannable
import android.text.SpannableStringBuilder
+import android.text.method.LinkMovementMethod
+import android.text.style.ClickableSpan
import android.text.style.StyleSpan
+import android.view.View
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_register.*
import network.loki.messenger.R
@@ -45,11 +48,23 @@ class RegisterActivity : BaseActionBarActivity() {
setUpActionBarSessionLogo()
registerButton.setOnClickListener { register() }
copyButton.setOnClickListener { copyPublicKey() }
- val termsExplanation = SpannableStringBuilder("By using this service, you agree to our Terms and Conditions and Privacy Statement")
- termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 40, 60, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
- termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 65, 82, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
- termsButton.text = termsExplanation
- termsButton.setOnClickListener { showTerms() }
+ val termsExplanation = SpannableStringBuilder("By using this service, you agree to our Terms of Service and Privacy Policy")
+ termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 40, 56, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsExplanation.setSpan(object : ClickableSpan() {
+
+ override fun onClick(widget: View) {
+ openURL("https://getsession.org/legal/#tos")
+ }
+ }, 40, 56, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 61, 75, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsExplanation.setSpan(object : ClickableSpan() {
+
+ override fun onClick(widget: View) {
+ openURL("https://getsession.org/privacy-policy/")
+ }
+ }, 61, 75, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsTextView.movementMethod = LinkMovementMethod.getInstance()
+ termsTextView.text = termsExplanation
updateKeyPair()
}
// endregion
@@ -142,9 +157,9 @@ class RegisterActivity : BaseActionBarActivity() {
Toast.makeText(this, R.string.activity_register_public_key_copied_message, Toast.LENGTH_SHORT).show()
}
- private fun showTerms() {
+ private fun openURL(url: String) {
try {
- val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/loki-project/loki-messenger-android/blob/master/privacy-policy.md"))
+ val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
} catch (e: Exception) {
Toast.makeText(this, "Couldn't open link", Toast.LENGTH_SHORT).show()
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/RestoreActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/RestoreActivity.kt
index 7bc10e7253..4c35f88271 100644
--- a/src/org/thoughtcrime/securesms/loki/redesign/activities/RestoreActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/RestoreActivity.kt
@@ -6,7 +6,10 @@ import android.net.Uri
import android.os.Bundle
import android.text.Spannable
import android.text.SpannableStringBuilder
+import android.text.method.LinkMovementMethod
+import android.text.style.ClickableSpan
import android.text.style.StyleSpan
+import android.view.View
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_restore.*
import network.loki.messenger.R
@@ -38,11 +41,23 @@ class RestoreActivity : BaseActionBarActivity() {
setContentView(R.layout.activity_restore)
mnemonicEditText.imeOptions = mnemonicEditText.imeOptions or 16777216 // Always use incognito keyboard
restoreButton.setOnClickListener { restore() }
- val termsExplanation = SpannableStringBuilder("By using this service, you agree to our Terms and Conditions and Privacy Statement")
- termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 40, 60, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
- termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 65, 82, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
- termsButton.text = termsExplanation
- termsButton.setOnClickListener { showTerms() }
+ val termsExplanation = SpannableStringBuilder("By using this service, you agree to our Terms of Service and Privacy Policy")
+ termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 40, 56, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsExplanation.setSpan(object : ClickableSpan() {
+
+ override fun onClick(widget: View) {
+ openURL("https://getsession.org/legal/#tos")
+ }
+ }, 40, 56, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 61, 75, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsExplanation.setSpan(object : ClickableSpan() {
+
+ override fun onClick(widget: View) {
+ openURL("https://getsession.org/privacy-policy/")
+ }
+ }, 61, 75, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
+ termsTextView.movementMethod = LinkMovementMethod.getInstance()
+ termsTextView.text = termsExplanation
}
// endregion
@@ -97,9 +112,9 @@ class RestoreActivity : BaseActionBarActivity() {
}
}
- private fun showTerms() {
+ private fun openURL(url: String) {
try {
- val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/loki-project/loki-messenger-android/blob/master/privacy-policy.md"))
+ val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
} catch (e: Exception) {
Toast.makeText(this, "Couldn't open link", Toast.LENGTH_SHORT).show()