AccountActivity: show admin/moderator badge
This commit is contained in:
parent
083352c45f
commit
c915ee9935
|
@ -210,6 +210,8 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide
|
|||
*/
|
||||
private fun setupAccountViews() {
|
||||
// Initialise the default UI states.
|
||||
binding.accountAdminTextView.hide()
|
||||
binding.accountModeratorTextView.hide()
|
||||
binding.accountFloatingActionButton.hide()
|
||||
binding.accountFollowButton.hide()
|
||||
binding.accountMuteButton.hide()
|
||||
|
@ -478,6 +480,8 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide
|
|||
|
||||
binding.accountLockedImageView.visible(account.locked)
|
||||
binding.accountBadgeTextView.visible(account.bot)
|
||||
binding.accountAdminTextView.visible(account.pleroma?.isAdmin ?: false)
|
||||
binding.accountModeratorTextView.visible(account.pleroma?.isModerator ?: false)
|
||||
|
||||
updateAccountAvatar()
|
||||
updateToolbar()
|
||||
|
|
|
@ -36,8 +36,8 @@ data class Account(
|
|||
val bot: Boolean = false,
|
||||
val emojis: List<Emoji>? = emptyList(), // nullable for backward compatibility
|
||||
val fields: List<Field>? = emptyList(), // nullable for backward compatibility
|
||||
val moved: Account? = null
|
||||
|
||||
val moved: Account? = null,
|
||||
val pleroma: PleromaAccount? = null,
|
||||
) {
|
||||
|
||||
val name: String
|
||||
|
@ -48,6 +48,11 @@ data class Account(
|
|||
}
|
||||
|
||||
fun isRemote(): Boolean = this.username != this.localUsername
|
||||
|
||||
data class PleromaAccount(
|
||||
@SerializedName("is_admin") val isAdmin: Boolean?,
|
||||
@SerializedName("is_moderator") val isModerator: Boolean?,
|
||||
)
|
||||
}
|
||||
|
||||
data class AccountSource(
|
||||
|
|
|
@ -153,6 +153,32 @@
|
|||
app:tint="?android:textColorSecondary"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accountAdminTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/profile_badge_background"
|
||||
android:text="@string/admin"
|
||||
android:textSize="?attr/status_text_small"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountUsernameTextView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accountModeratorTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/profile_badge_background"
|
||||
android:text="@string/moderator"
|
||||
android:textSize="?attr/status_text_small"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/accountAdminTextView"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountUsernameTextView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accountFollowsYouTextView"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -162,8 +188,8 @@
|
|||
android:text="@string/follows_you"
|
||||
android:textSize="?attr/status_text_small"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountUsernameTextView"
|
||||
app:layout_constraintStart_toEndOf="@id/accountModeratorTextView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/accountUsernameTextView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
|
@ -186,7 +212,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="accountFollowsYouTextView,accountBadgeTextView" />
|
||||
app:constraint_referenced_ids="accountAdminTextView,accountModeratorTextView,accountFollowsYouTextView,accountBadgeTextView" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/accountNoteTextInputLayout"
|
||||
|
|
|
@ -3,4 +3,7 @@
|
|||
|
||||
<string name="pref_title_enable_big_emojis">Enable bigger custom emojis</string>
|
||||
|
||||
<string name="admin">Admin</string>
|
||||
<string name="moderator">Moderator</string>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue