Skip to content

Commit

Permalink
fix: handle logged in logo visibility in landscape
Browse files Browse the repository at this point in the history
previously the two logos were assigned to the same variable,
so toggling visibility on landscape mode hid one of the logos
(the login one) but did not hide the other one (logged in one)

now we maintain reference to both logos and toggle visibility
of both in landscape mode
  • Loading branch information
mikehardy authored and david-allison committed Oct 9, 2024
1 parent be83ed8 commit d189482
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ open class MyAccount : AnkiActivity() {
var toolbar: Toolbar? = null
private lateinit var passwordLayout: TextInputLayout
private lateinit var loginLogo: ImageView
private lateinit var loggedInLogo: ImageView

// if the 'remove account' fragment is open, close it first
private val onRemoveAccountBackCallback = object : OnBackPressedCallback(false) {
Expand Down Expand Up @@ -111,8 +112,10 @@ open class MyAccount : AnkiActivity() {
}
if (isScreenSmall && this.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
loginLogo.visibility = View.GONE
loggedInLogo.visibility = View.GONE
} else {
loginLogo.visibility = View.VISIBLE
loggedInLogo.visibility = View.VISIBLE
}
onBackPressedDispatcher.addCallback(this, onRemoveAccountBackCallback)
}
Expand Down Expand Up @@ -262,7 +265,7 @@ open class MyAccount : AnkiActivity() {
findViewById<Button>(R.id.privacy_policy_button).apply {
setOnClickListener { openAnkiDroidPrivacyPolicy() }
}
loginLogo = findViewById(R.id.login_logo)
loggedInLogo = findViewById(R.id.login_logo)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Expand All @@ -288,8 +291,10 @@ open class MyAccount : AnkiActivity() {
super.onConfigurationChanged(newConfig)
if (isScreenSmall && newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
loginLogo.visibility = View.GONE
loggedInLogo.visibility = View.GONE
} else {
loginLogo.visibility = View.VISIBLE
loggedInLogo.visibility = View.VISIBLE
}
}

Expand Down

0 comments on commit d189482

Please sign in to comment.