|
|
@ -10,7 +10,10 @@ import android.os.Bundle
|
|
|
|
import android.os.Handler
|
|
|
|
import android.os.Handler
|
|
|
|
import android.text.Spannable
|
|
|
|
import android.text.Spannable
|
|
|
|
import android.text.SpannableStringBuilder
|
|
|
|
import android.text.SpannableStringBuilder
|
|
|
|
|
|
|
|
import android.text.method.LinkMovementMethod
|
|
|
|
|
|
|
|
import android.text.style.ClickableSpan
|
|
|
|
import android.text.style.StyleSpan
|
|
|
|
import android.text.style.StyleSpan
|
|
|
|
|
|
|
|
import android.view.View
|
|
|
|
import android.widget.Toast
|
|
|
|
import android.widget.Toast
|
|
|
|
import kotlinx.android.synthetic.main.activity_register.*
|
|
|
|
import kotlinx.android.synthetic.main.activity_register.*
|
|
|
|
import network.loki.messenger.R
|
|
|
|
import network.loki.messenger.R
|
|
|
@ -45,11 +48,23 @@ class RegisterActivity : BaseActionBarActivity() {
|
|
|
|
setUpActionBarSessionLogo()
|
|
|
|
setUpActionBarSessionLogo()
|
|
|
|
registerButton.setOnClickListener { register() }
|
|
|
|
registerButton.setOnClickListener { register() }
|
|
|
|
copyButton.setOnClickListener { copyPublicKey() }
|
|
|
|
copyButton.setOnClickListener { copyPublicKey() }
|
|
|
|
val termsExplanation = SpannableStringBuilder("By using this service, you agree to our Terms and Conditions and Privacy Statement")
|
|
|
|
val termsExplanation = SpannableStringBuilder("By using this service, you agree to our Terms of Service and Privacy Policy")
|
|
|
|
termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 40, 60, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
|
|
|
termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 40, 56, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
|
|
|
termsExplanation.setSpan(StyleSpan(Typeface.BOLD), 65, 82, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
|
|
|
termsExplanation.setSpan(object : ClickableSpan() {
|
|
|
|
termsButton.text = termsExplanation
|
|
|
|
|
|
|
|
termsButton.setOnClickListener { showTerms() }
|
|
|
|
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()
|
|
|
|
updateKeyPair()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// endregion
|
|
|
|
// endregion
|
|
|
@ -142,9 +157,9 @@ class RegisterActivity : BaseActionBarActivity() {
|
|
|
|
Toast.makeText(this, R.string.activity_register_public_key_copied_message, Toast.LENGTH_SHORT).show()
|
|
|
|
Toast.makeText(this, R.string.activity_register_public_key_copied_message, Toast.LENGTH_SHORT).show()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun showTerms() {
|
|
|
|
private fun openURL(url: String) {
|
|
|
|
try {
|
|
|
|
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)
|
|
|
|
startActivity(intent)
|
|
|
|
} catch (e: Exception) {
|
|
|
|
} catch (e: Exception) {
|
|
|
|
Toast.makeText(this, "Couldn't open link", Toast.LENGTH_SHORT).show()
|
|
|
|
Toast.makeText(this, "Couldn't open link", Toast.LENGTH_SHORT).show()
|
|
|
|