summaryrefslogtreecommitdiffhomepage
path: root/android/app
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2022-09-06 08:02:27 +0200
committerAlbin <albin@mullvad.net>2022-09-06 09:52:53 +0200
commit2ddb4c88f58ae8d894134416e1b43dfa1cb4addb (patch)
tree20fd7c28c1ca3c07f9175abf3d53be88559b52a9 /android/app
parent2950bb6362a98ad3640052bed8e023c596fe570a (diff)
downloadmullvadvpn-2ddb4c88f58ae8d894134416e1b43dfa1cb4addb.tar.xz
mullvadvpn-2ddb4c88f58ae8d894134416e1b43dfa1cb4addb.zip
Disable settings button during login
Disabling the settings button during login will prevent some strange UI behavior. It also doesn't make much sense to open it while the login is loading.
Diffstat (limited to 'android/app')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/LoginFragment.kt4
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt12
2 files changed, 14 insertions, 2 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/LoginFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/LoginFragment.kt
index c04f41ca1c..989202f9a0 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/LoginFragment.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/LoginFragment.kt
@@ -212,6 +212,7 @@ class LoginFragment : BaseFragment(), NavigationBarPainter {
private fun showLoading(overrideSpinnerWithErrorIcon: Boolean = false) {
accountLogin.state = LoginState.InProgress
+ headerBar.setSettingsButtonEnabled(false)
title.setText(R.string.logging_in_title)
subtitle.setText(R.string.logging_in_description)
@@ -244,6 +245,7 @@ class LoginFragment : BaseFragment(), NavigationBarPainter {
loggedInStatus.visibility = View.VISIBLE
accountLogin.state = LoginState.Success
+ headerBar.setSettingsButtonEnabled(false)
scrollToShow(loggedInStatus)
}
@@ -257,6 +259,7 @@ class LoginFragment : BaseFragment(), NavigationBarPainter {
loggedInStatus.visibility = View.GONE
accountLogin.state = LoginState.InProgress
+ headerBar.setSettingsButtonEnabled(true)
scrollToShow(loggingInStatus)
}
@@ -270,6 +273,7 @@ class LoginFragment : BaseFragment(), NavigationBarPainter {
loggedInStatus.visibility = View.GONE
accountLogin.state = LoginState.Failure
+ headerBar.setSettingsButtonEnabled(true)
scrollToShow(accountLogin)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt
index 052739c826..e1688ace21 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt
@@ -21,6 +21,7 @@ class HeaderBar @JvmOverloads constructor(
defStyleRes: Int = 0
) : LinearLayout(context, attributes, defStyleAttr, defStyleRes), StatusBarPainter {
private val container = LayoutInflater.from(context).inflate(R.layout.header_bar, this)
+ private val settingsButton = findViewById<View>(R.id.settings)
private val disabledColor = ContextCompat.getColor(context, android.R.color.transparent)
private val securedColor = ContextCompat.getColor(context, R.color.green)
@@ -43,10 +44,17 @@ class HeaderBar @JvmOverloads constructor(
gravity = Gravity.CENTER_VERTICAL
orientation = HORIZONTAL
- findViewById<View>(R.id.settings).setOnClickListener {
- (context as? MainActivity)?.openSettings()
+ settingsButton.apply {
+ isEnabled = true
+ setOnClickListener {
+ (context as? MainActivity)?.openSettings()
+ }
}
tunnelState = null
}
+
+ fun setSettingsButtonEnabled(isEnabled: Boolean) {
+ settingsButton.isEnabled = isEnabled
+ }
}