forked from github/wulkanowy-mirror
Change style of privacy policy link (#321)
This commit is contained in:

committed by
Mikołaj Pich

parent
cbf3215dd1
commit
74e98e4430
@ -1,8 +1,8 @@
|
||||
package io.github.wulkanowy.ui.modules.login.form
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
@ -54,8 +54,8 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
||||
loginFormName.setOnTextChangedListener { presenter.onNameTextChanged() }
|
||||
loginFormPass.setOnTextChangedListener { presenter.onPassTextChanged() }
|
||||
loginFormHost.setOnItemSelectedListener { presenter.onHostSelected() }
|
||||
loginFormPrivacyPolicyLink.movementMethod = LinkMovementMethod.getInstance()
|
||||
loginFormSignIn.setOnClickListener { presenter.attemptLogin() }
|
||||
loginFormSignIn.setOnClickListener { presenter.onSignInClick() }
|
||||
loginFormPrivacyLink.setOnClickListener { presenter.onPrivacyLinkClick() }
|
||||
|
||||
loginFormPass.setOnEditorActionListener { _, id, _ ->
|
||||
if (id == IME_ACTION_DONE || id == IME_NULL) loginFormSignIn.callOnClick() else false
|
||||
@ -132,6 +132,10 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
||||
}
|
||||
}
|
||||
|
||||
override fun showPrivacyPolicy() {
|
||||
loginFormPrivacyLink.visibility = VISIBLE
|
||||
}
|
||||
|
||||
override fun notifyParentAccountLogged(students: List<Student>) {
|
||||
(activity as? LoginActivity)?.onFormFragmentAccountLogged(students, Triple(
|
||||
loginFormName.text.toString(),
|
||||
@ -140,6 +144,10 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
||||
))
|
||||
}
|
||||
|
||||
override fun openPrivacyPolicyPage() {
|
||||
startActivity(Intent.parseUri("https://wulkanowy.github.io/polityka-prywatnosci.html", 0))
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
presenter.onDetachView()
|
||||
|
@ -22,7 +22,8 @@ class LoginFormPresenter @Inject constructor(
|
||||
super.onAttachView(view)
|
||||
view.run {
|
||||
initView()
|
||||
if (isDebug) showVersion()
|
||||
if (isDebug) showVersion() else showPrivacyPolicy()
|
||||
|
||||
errorHandler.onBadCredentials = {
|
||||
setErrorPassIncorrect()
|
||||
showSoftKeyboard()
|
||||
@ -31,6 +32,10 @@ class LoginFormPresenter @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun onPrivacyLinkClick() {
|
||||
view?.openPrivacyPolicyPage()
|
||||
}
|
||||
|
||||
fun onHostSelected() {
|
||||
view?.apply {
|
||||
clearPassError()
|
||||
@ -47,7 +52,7 @@ class LoginFormPresenter @Inject constructor(
|
||||
view?.clearNameError()
|
||||
}
|
||||
|
||||
fun attemptLogin() {
|
||||
fun onSignInClick() {
|
||||
val email = view?.formNameValue.orEmpty()
|
||||
val password = view?.formPassValue.orEmpty()
|
||||
val endpoint = view?.formHostValue.orEmpty()
|
||||
|
@ -37,5 +37,9 @@ interface LoginFormView : BaseView {
|
||||
|
||||
fun showVersion()
|
||||
|
||||
fun showPrivacyPolicy()
|
||||
|
||||
fun notifyParentAccountLogged(students: List<Student>)
|
||||
|
||||
fun openPrivacyPolicyPage()
|
||||
}
|
||||
|
Reference in New Issue
Block a user