mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-19 06:26:51 -06:00
Fix empty hosts list after activity recreating (#477)
This commit is contained in:
parent
39fb4f5def
commit
455b04f183
@ -34,13 +34,11 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
|||||||
fun newInstance() = LoginFormFragment()
|
fun newInstance() = LoginFormFragment()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val formNameValue: String
|
override val formNameValue get() = loginFormName.text.toString()
|
||||||
get() = loginFormName.text.toString()
|
|
||||||
|
|
||||||
override val formPassValue: String
|
override val formPassValue get() = loginFormPass.text.toString()
|
||||||
get() = loginFormPass.text.toString()
|
|
||||||
|
|
||||||
override val formHostValue: String?
|
override val formHostValue
|
||||||
get() = hostValues.getOrNull(hostKeys.indexOf(loginFormHost.text.toString()))
|
get() = hostValues.getOrNull(hostKeys.indexOf(loginFormHost.text.toString()))
|
||||||
|
|
||||||
private lateinit var hostKeys: Array<String>
|
private lateinit var hostKeys: Array<String>
|
||||||
@ -71,6 +69,9 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
with(loginFormHost) {
|
with(loginFormHost) {
|
||||||
|
//Bug with filter in ExposedDropdownMenu on restoring state
|
||||||
|
isSaveEnabled = false
|
||||||
|
|
||||||
setText(hostKeys.getOrElse(0) { "" })
|
setText(hostKeys.getOrElse(0) { "" })
|
||||||
setAdapter(ArrayAdapter(context, R.layout.support_simple_spinner_dropdown_item, hostKeys))
|
setAdapter(ArrayAdapter(context, R.layout.support_simple_spinner_dropdown_item, hostKeys))
|
||||||
keyListener = null
|
keyListener = null
|
||||||
@ -83,28 +84,28 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun setErrorNameRequired() {
|
override fun setErrorNameRequired() {
|
||||||
loginFormNameLayout.run {
|
with(loginFormNameLayout) {
|
||||||
requestFocus()
|
requestFocus()
|
||||||
error = getString(R.string.login_field_required)
|
error = getString(R.string.login_field_required)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setErrorPassRequired(focus: Boolean) {
|
override fun setErrorPassRequired(focus: Boolean) {
|
||||||
loginFormPassLayout.run {
|
with(loginFormPassLayout) {
|
||||||
if (focus) requestFocus()
|
if (focus) requestFocus()
|
||||||
error = getString(R.string.login_field_required)
|
error = getString(R.string.login_field_required)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setErrorPassInvalid(focus: Boolean) {
|
override fun setErrorPassInvalid(focus: Boolean) {
|
||||||
loginFormPassLayout.run {
|
with(loginFormPassLayout) {
|
||||||
if (focus) requestFocus()
|
if (focus) requestFocus()
|
||||||
error = getString(R.string.login_invalid_password)
|
error = getString(R.string.login_invalid_password)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setErrorPassIncorrect() {
|
override fun setErrorPassIncorrect() {
|
||||||
loginFormPassLayout.run {
|
with(loginFormPassLayout) {
|
||||||
requestFocus()
|
requestFocus()
|
||||||
error = getString(R.string.login_incorrect_password)
|
error = getString(R.string.login_incorrect_password)
|
||||||
}
|
}
|
||||||
@ -136,7 +137,7 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
|||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun showVersion() {
|
override fun showVersion() {
|
||||||
loginFormVersion.apply {
|
with(loginFormVersion) {
|
||||||
visibility = VISIBLE
|
visibility = VISIBLE
|
||||||
text = "${getString(R.string.app_name)} ${appInfo.versionName}"
|
text = "${getString(R.string.app_name)} ${appInfo.versionName}"
|
||||||
}
|
}
|
||||||
@ -147,11 +148,12 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun notifyParentAccountLogged(students: List<Student>) {
|
override fun notifyParentAccountLogged(students: List<Student>) {
|
||||||
(activity as? LoginActivity)?.onFormFragmentAccountLogged(students, Triple(
|
(activity as? LoginActivity)?.onFormFragmentAccountLogged(students,
|
||||||
loginFormName.text.toString(),
|
Triple(
|
||||||
loginFormPass.text.toString(),
|
loginFormName.text.toString(),
|
||||||
resources.getStringArray(R.array.endpoints_values)[1]
|
loginFormPass.text.toString(),
|
||||||
))
|
resources.getStringArray(R.array.endpoints_values)[1]
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openPrivacyPolicyPage() {
|
override fun openPrivacyPolicyPage() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user