1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState)
val userProtocol = getString(R.string.protocol_cdam_user) val privacyProtocol = getString(R.string.protocol_cdam_privacy) val aidText = " " val protocols = getString(R.string.protocol_reception, userProtocol, privacyProtocol) + aidText val userProtocolStart = protocols.indexOf(userProtocol) val userProtocolEnd = userProtocolStart + userProtocol.length val privacyProtocolStart = protocols.indexOf(privacyProtocol) val privacyProtocolEnd = privacyProtocolStart + privacyProtocol.length val aidTextStart = privacyProtocolEnd val aidTextEnd = protocols.length - 1 val spsb = SpannableStringBuilder(protocols) spsb.setSpan(object : ProtocolClickableSpan() { override fun onClick(widget: View?) { WebHelper.toWebFragment((activity as BaseActivity), DisplayWebFragment(), H5URL.USER_PROTOCOL, getString(R.string.auth_user_protocol), true) } }, userProtocolStart, userProtocolEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) spsb.setSpan(object : ProtocolClickableSpan() { override fun onClick(widget: View?) { WebHelper.toWebFragment((activity as BaseActivity), DisplayWebFragment(), H5URL.PRIVACY_PROTOCOL, isAddStack = true) } }, privacyProtocolStart, privacyProtocolEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) spsb.setSpan(object : ProtocolClickableSpan(){ override fun onClick(widget: View?) { } },aidTextStart, aidTextEnd, Spannable.SPAN_INCLUSIVE_INCLUSIVE) tv_registration_protocols.movementMethod = LinkMovementMethod.getInstance() tv_registration_protocols.text = spsb }
|