WIP display/username
This commit is contained in:
parent
2816c232c0
commit
4b6003816b
@ -48,7 +48,7 @@ class PostActivity : BaseActivity() {
|
|||||||
accessToken = user?.accessToken.orEmpty()
|
accessToken = user?.accessToken.orEmpty()
|
||||||
|
|
||||||
|
|
||||||
supportActionBar?.title = getString(R.string.post_title).format(status.account?.getDisplayName())
|
supportActionBar?.title = getString(R.string.post_title).format(status.account?.getusername())
|
||||||
|
|
||||||
val holder = StatusViewHolder(binding.postFragmentSingle)
|
val holder = StatusViewHolder(binding.postFragmentSingle)
|
||||||
|
|
||||||
|
@ -86,13 +86,13 @@ class StatusViewHolder(val binding: PostFragmentBinding) : RecyclerView.ViewHold
|
|||||||
) {
|
) {
|
||||||
//Setup username as a button that opens the profile
|
//Setup username as a button that opens the profile
|
||||||
binding.username.apply {
|
binding.username.apply {
|
||||||
text = status?.account?.getDisplayName() ?: ""
|
text = status?.account?.getusername() ?: ""
|
||||||
setTypeface(null, Typeface.BOLD)
|
setTypeface(null, Typeface.BOLD)
|
||||||
setOnClickListener { status?.account?.openProfile(binding.root.context) }
|
setOnClickListener { status?.account?.openProfile(binding.root.context) }
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.usernameDesc.apply {
|
binding.usernameDesc.apply {
|
||||||
text = status?.account?.getDisplayName() ?: ""
|
text = status?.account?.getusername() ?: ""
|
||||||
setTypeface(null, Typeface.BOLD)
|
setTypeface(null, Typeface.BOLD)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ class FollowsActivity : BaseActivity() {
|
|||||||
|
|
||||||
if(account == null) {
|
if(account == null) {
|
||||||
val user = db.userDao().getActiveUser()!!
|
val user = db.userDao().getActiveUser()!!
|
||||||
startFragment(user.user_id, user.display_name, followers)
|
startFragment(user.user_id, user.username, followers)
|
||||||
} else {
|
} else {
|
||||||
startFragment(account.id!!, account.getDisplayName(), followers)
|
startFragment(account.id!!, account.getusername(), followers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class ProfileActivity : BaseActivity() {
|
|||||||
lifecycleScope
|
lifecycleScope
|
||||||
)
|
)
|
||||||
|
|
||||||
val displayName = account.getDisplayName()
|
val displayName = account.getusername()
|
||||||
|
|
||||||
binding.accountNameTextView.text = displayName
|
binding.accountNameTextView.text = displayName
|
||||||
|
|
||||||
|
@ -79,6 +79,12 @@ data class Account(
|
|||||||
else -> display_name.orEmpty()
|
else -> display_name.orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getusername() : String = when {
|
||||||
|
username.isNullOrBlank() && display_name.isNullOrBlank() -> ""
|
||||||
|
username.isNullOrBlank() -> "@$display_name"
|
||||||
|
else -> username.orEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Open profile activity with given account
|
* @brief Open profile activity with given account
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +34,7 @@ class PostUnitTest {
|
|||||||
fun getProfilePicUrlReturnsAValidURL() = Assert.assertNotNull(status.getProfilePicUrl())
|
fun getProfilePicUrlReturnsAValidURL() = Assert.assertNotNull(status.getProfilePicUrl())
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getUsernameReturnsACorrectName() = Assert.assertEquals(status.account!!.display_name, status.account!!.getDisplayName())
|
fun getUsernameReturnsACorrectName() = Assert.assertEquals(status.account!!.display_name, status.account!!.getusername())
|
||||||
|
|
||||||
/*@Test
|
/*@Test
|
||||||
fun getUsernameReturnsOtherNameIfUsernameIsNull() {
|
fun getUsernameReturnsOtherNameIfUsernameIsNull() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user