diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt index 62a4ac569a..06b591673c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt @@ -12,6 +12,7 @@ import com.dd.processbutton.iml.ActionProcessButton import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.ui.base.controller.DialogController +import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.widget.SimpleTextWatcher import kotlinx.android.synthetic.main.pref_account_login.view.* import kotlinx.coroutines.CoroutineScope @@ -42,9 +43,6 @@ abstract class LoginDialogPreference( val dialog = MaterialDialog(activity!!).apply { customView(R.layout.pref_account_login, scrollable = false) positiveButton(android.R.string.cancel) - if (canLogout) { - negativeButton(R.string.logout) { logout() } - } } onViewCreated(dialog.view) @@ -72,6 +70,11 @@ abstract class LoginDialogPreference( setCredentialsOnView(this) + if (canLogout && !username.text.isNullOrEmpty()) { + logout.visible() + logout.setOnClickListener { logout() } + } + show_password.isEnabled = password.text.isNullOrEmpty() password.addTextChangedListener(object : SimpleTextWatcher() { diff --git a/app/src/main/res/layout/pref_account_login.xml b/app/src/main/res/layout/pref_account_login.xml index bc62c5a5d2..8df75f759e 100644 --- a/app/src/main/res/layout/pref_account_login.xml +++ b/app/src/main/res/layout/pref_account_login.xml @@ -63,4 +63,15 @@ app:pb_textError="@string/could_not_log_in" app:pb_textProgress="@string/loading"/> + + \ No newline at end of file