From c908ebb3f19f9e95d4da77f89ae1cf25c62f576c Mon Sep 17 00:00:00 2001 From: Vivianne Date: Sat, 17 Sep 2022 10:05:56 -0700 Subject: [PATCH] Add display of handle when using multiple accounts (#2697) - Shown on the main toolbar (subtitle) - Shown just above the "replying to" message (even if not replying) --- .../java/com/keylesspalace/tusky/MainActivity.kt | 3 +++ .../tusky/components/compose/ComposeActivity.kt | 11 +++++++++++ app/src/main/res/layout/activity_compose.xml | 13 +++++++++++++ app/src/main/res/values/strings.xml | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index 8958feb01..f097f0e6d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -834,6 +834,9 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje header.clear() header.profiles = profiles header.setActiveProfile(accountManager.activeAccount!!.id) + binding.mainToolbar.subtitle = if (accountManager.accounts.size > 1) { + accountManager.activeAccount!!.fullName + } else null } override fun getActionButton() = binding.composeButton diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt index c2e3eba32..6a1949683 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt @@ -236,6 +236,17 @@ class ComposeActivity : val composeOptions: ComposeOptions? = intent.getParcelableExtra(COMPOSE_OPTIONS_EXTRA) viewModel.setup(composeOptions) + + if (accountManager.accounts.size > 1) { + binding.composeUsernameView.text = getString( + R.string.compose_active_account_description, + activeAccount.fullName + ) + binding.composeUsernameView.show() + } else { + binding.composeUsernameView.hide() + } + setupReplyViews(composeOptions?.replyingStatusAuthor, composeOptions?.replyingStatusContent) val statusContent = composeOptions?.content if (!statusContent.isNullOrEmpty()) { diff --git a/app/src/main/res/layout/activity_compose.xml b/app/src/main/res/layout/activity_compose.xml index b2d734ea1..902bae406 100644 --- a/app/src/main/res/layout/activity_compose.xml +++ b/app/src/main/res/layout/activity_compose.xml @@ -71,6 +71,19 @@ android:layout_height="wrap_content" android:orientation="vertical"> + + Add account to the list Remove account from the list - Posting with account %1$s + Posting as %1$s Failed to set caption