mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2024-12-31 18:58:08 +01:00
Add account type display support
This commit is contained in:
parent
1d19161b2e
commit
f49b77bfce
@ -51,6 +51,7 @@ import android.view.*
|
||||
import android.view.View.OnClickListener
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.widget.ImageView
|
||||
import androidx.core.view.isVisible
|
||||
import kotlinx.android.synthetic.main.header_drawer_account_selector.view.*
|
||||
import org.mariotaku.chameleon.Chameleon
|
||||
import org.mariotaku.kpreferences.get
|
||||
@ -108,6 +109,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||
private val floatingProfileImageSnapshot by lazy { accountsHeader.floatingProfileImageSnapshot }
|
||||
private val accountProfileImageView by lazy { accountsHeader.profileImage }
|
||||
private val accountProfileNameView by lazy { accountsHeader.name }
|
||||
private val accountUserTypeView by lazy { accountsHeader.user_type }
|
||||
private val accountProfileScreenNameView by lazy { accountsHeader.screenName }
|
||||
private val accountDashboardMenu by lazy { accountsHeader.accountDashboardMenu }
|
||||
private val profileContainer by lazy { accountsHeader.profileContainer }
|
||||
@ -548,6 +550,12 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||
val account = accountsAdapter.selectedAccount ?: return
|
||||
accountProfileNameView.spannable = account.user.name
|
||||
accountsAdapter.accounts?.groupBy { it.type }?.count()?.let {
|
||||
it > 1
|
||||
}?.let {
|
||||
accountUserTypeView.isVisible = it
|
||||
}
|
||||
accountUserTypeView.spannable = account.type
|
||||
accountProfileScreenNameView.spannable = "@${account.user.screen_name}"
|
||||
requestManager.loadProfileImage(context!!, account, preferences[profileImageStyleKey],
|
||||
accountProfileImageView.cornerRadius, accountProfileImageView.cornerRadiusRatio,
|
||||
|
@ -125,7 +125,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
@ -133,6 +133,8 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.mariotaku.twidere.view.FixedTextView
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -145,6 +147,8 @@
|
||||
tools:text="Name"/>
|
||||
|
||||
<org.mariotaku.twidere.view.FixedTextView
|
||||
android:layout_below="@id/name"
|
||||
android:layout_toEndOf="@id/user_type"
|
||||
android:id="@+id/screenName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -155,7 +159,20 @@
|
||||
android:textColor="@color/material_grey"
|
||||
tools:text="\@username"/>
|
||||
|
||||
</LinearLayout>
|
||||
<org.mariotaku.twidere.view.FixedTextView
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@id/name"
|
||||
android:id="@+id/user_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:focusable="false"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="@color/material_grey"
|
||||
tools:text="twidere"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
Reference in New Issue
Block a user