Browse Source

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)
pull/2710/head
Vivianne 4 years ago committed by GitHub
parent
commit
c908ebb3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/src/main/java/com/keylesspalace/tusky/MainActivity.kt
  2. 11
      app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt
  3. 13
      app/src/main/res/layout/activity_compose.xml
  4. 2
      app/src/main/res/values/strings.xml

3
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

11
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()) {

13
app/src/main/res/layout/activity_compose.xml

@ -71,6 +71,19 @@
android:layout_height="wrap_content"
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
android:id="@+id/composeReplyView"
android:layout_width="wrap_content"

2
app/src/main/res/values/strings.xml

@ -401,7 +401,7 @@
<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="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>
<plurals name="hint_describe_for_visually_impaired">

Loading…
Cancel
Save