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)
This commit is contained in:
Vivianne 2022-09-17 10:05:56 -07:00 committed by GitHub
parent ffe42c992f
commit c908ebb3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View File

@ -834,6 +834,9 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
header.clear() header.clear()
header.profiles = profiles header.profiles = profiles
header.setActiveProfile(accountManager.activeAccount!!.id) header.setActiveProfile(accountManager.activeAccount!!.id)
binding.mainToolbar.subtitle = if (accountManager.accounts.size > 1) {
accountManager.activeAccount!!.fullName
} else null
} }
override fun getActionButton() = binding.composeButton override fun getActionButton() = binding.composeButton

View File

@ -236,6 +236,17 @@ class ComposeActivity :
val composeOptions: ComposeOptions? = intent.getParcelableExtra(COMPOSE_OPTIONS_EXTRA) val composeOptions: ComposeOptions? = intent.getParcelableExtra(COMPOSE_OPTIONS_EXTRA)
viewModel.setup(composeOptions) 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) setupReplyViews(composeOptions?.replyingStatusAuthor, composeOptions?.replyingStatusContent)
val statusContent = composeOptions?.content val statusContent = composeOptions?.content
if (!statusContent.isNullOrEmpty()) { if (!statusContent.isNullOrEmpty()) {

View File

@ -71,6 +71,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:id="@+id/composeUsernameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="0dp"
android:textSize="?attr/status_text_small"
android:textStyle="bold"
android:visibility="gone"
tools:text="Posting as @username@domain"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/composeReplyView" android:id="@+id/composeReplyView"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -401,7 +401,7 @@
<string name="action_add_to_list">Add account to the list</string> <string name="action_add_to_list">Add account to the list</string>
<string name="action_remove_from_list">Remove account from the list</string> <string name="action_remove_from_list">Remove account from the list</string>
<string name="compose_active_account_description">Posting with account %1$s</string> <string name="compose_active_account_description">Posting as %1$s</string>
<string name="error_failed_set_caption">Failed to set caption</string> <string name="error_failed_set_caption">Failed to set caption</string>
<plurals name="hint_describe_for_visually_impaired"> <plurals name="hint_describe_for_visually_impaired">