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.View.OnClickListener
|
||||||
import android.view.animation.DecelerateInterpolator
|
import android.view.animation.DecelerateInterpolator
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import kotlinx.android.synthetic.main.header_drawer_account_selector.view.*
|
import kotlinx.android.synthetic.main.header_drawer_account_selector.view.*
|
||||||
import org.mariotaku.chameleon.Chameleon
|
import org.mariotaku.chameleon.Chameleon
|
||||||
import org.mariotaku.kpreferences.get
|
import org.mariotaku.kpreferences.get
|
||||||
|
@ -108,6 +109,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
private val floatingProfileImageSnapshot by lazy { accountsHeader.floatingProfileImageSnapshot }
|
private val floatingProfileImageSnapshot by lazy { accountsHeader.floatingProfileImageSnapshot }
|
||||||
private val accountProfileImageView by lazy { accountsHeader.profileImage }
|
private val accountProfileImageView by lazy { accountsHeader.profileImage }
|
||||||
private val accountProfileNameView by lazy { accountsHeader.name }
|
private val accountProfileNameView by lazy { accountsHeader.name }
|
||||||
|
private val accountUserTypeView by lazy { accountsHeader.user_type }
|
||||||
private val accountProfileScreenNameView by lazy { accountsHeader.screenName }
|
private val accountProfileScreenNameView by lazy { accountsHeader.screenName }
|
||||||
private val accountDashboardMenu by lazy { accountsHeader.accountDashboardMenu }
|
private val accountDashboardMenu by lazy { accountsHeader.accountDashboardMenu }
|
||||||
private val profileContainer by lazy { accountsHeader.profileContainer }
|
private val profileContainer by lazy { accountsHeader.profileContainer }
|
||||||
|
@ -548,6 +550,12 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||||
val account = accountsAdapter.selectedAccount ?: return
|
val account = accountsAdapter.selectedAccount ?: return
|
||||||
accountProfileNameView.spannable = account.user.name
|
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}"
|
accountProfileScreenNameView.spannable = "@${account.user.screen_name}"
|
||||||
requestManager.loadProfileImage(context!!, account, preferences[profileImageStyleKey],
|
requestManager.loadProfileImage(context!!, account, preferences[profileImageStyleKey],
|
||||||
accountProfileImageView.cornerRadius, accountProfileImageView.cornerRadiusRatio,
|
accountProfileImageView.cornerRadius, accountProfileImageView.cornerRadiusRatio,
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -133,6 +133,8 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.FixedTextView
|
<org.mariotaku.twidere.view.FixedTextView
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -145,6 +147,8 @@
|
||||||
tools:text="Name"/>
|
tools:text="Name"/>
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.FixedTextView
|
<org.mariotaku.twidere.view.FixedTextView
|
||||||
|
android:layout_below="@id/name"
|
||||||
|
android:layout_toEndOf="@id/user_type"
|
||||||
android:id="@+id/screenName"
|
android:id="@+id/screenName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -155,7 +159,20 @@
|
||||||
android:textColor="@color/material_grey"
|
android:textColor="@color/material_grey"
|
||||||
tools:text="\@username"/>
|
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
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
Loading…
Reference in New Issue