Preference to disable multiple-login usernames (#2718)

* Preference to disable multiple-login usernames (with problems)

* Fix problem where 'show self username disambiguation' does not take effect immediately because MainActivity needed to be restarted

* Make 'show username in toolbars' a 3-option selector, default when multiple accounts logged in

* Move SHOW_SELF_USERNAME higher in preference fragment
This commit is contained in:
mcclure 2022-10-18 13:38:17 -04:00 committed by GitHub
commit 85a6b2d96b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 48 additions and 3 deletions

View file

@ -244,7 +244,7 @@ class ComposeActivity :
viewModel.setup(composeOptions)
if (accountManager.accounts.size > 1) {
if (accountManager.shouldDisplaySelfUsername(this)) {
binding.composeUsernameView.text = getString(
R.string.compose_active_account_description,
activeAccount.fullName

View file

@ -125,7 +125,7 @@ class PreferencesActivity :
this.restartCurrentActivity()
}
"statusTextSize", "absoluteTimeView", "showBotOverlay", "animateGifAvatars", "useBlurhash",
"showCardsInTimelines", "confirmReblogs", "confirmFavourites",
"showSelfUsername", "showCardsInTimelines", "confirmReblogs", "confirmFavourites",
"enableSwipeForTabs", "mainNavPosition", PrefKeys.HIDE_TOP_TOOLBAR -> {
restartActivitiesOnExit = true
}

View file

@ -96,6 +96,16 @@ class PreferencesFragment : PreferenceFragmentCompat(), Injectable {
setTitle(R.string.pref_main_nav_position)
}
listPreference {
setDefaultValue("disambiguate")
setEntries(R.array.pref_show_self_username_names)
setEntryValues(R.array.pref_show_self_username_values)
key = PrefKeys.SHOW_SELF_USERNAME
setSummaryProvider { entry }
setTitle(R.string.pref_title_show_self_username)
isSingleLineTitle = false
}
switchPreference {
setDefaultValue(false)
key = PrefKeys.HIDE_TOP_TOOLBAR