More consistent, remove useless method
This commit is contained in:
parent
f6e4804c77
commit
53f5a151ba
|
@ -46,7 +46,7 @@ class PostActivity : BaseActivity() {
|
||||||
domain = user?.instance_uri.orEmpty()
|
domain = user?.instance_uri.orEmpty()
|
||||||
|
|
||||||
|
|
||||||
supportActionBar?.title = getString(R.string.post_title).format(status.account?.getusername())
|
supportActionBar?.title = getString(R.string.post_title).format(status.account?.username)
|
||||||
|
|
||||||
val holder = StatusViewHolder(binding.postFragmentSingle)
|
val holder = StatusViewHolder(binding.postFragmentSingle)
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,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?.getusername() ?: ""
|
text = status?.account?.username ?: ""
|
||||||
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?.getusername() ?: ""
|
text = status?.account?.username ?: ""
|
||||||
setTypeface(null, Typeface.BOLD)
|
setTypeface(null, Typeface.BOLD)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class FollowsActivity : BaseActivity() {
|
||||||
val user = db.userDao().getActiveUser()!!
|
val user = db.userDao().getActiveUser()!!
|
||||||
startFragment(user.user_id, user.username, followers)
|
startFragment(user.user_id, user.username, followers)
|
||||||
} else {
|
} else {
|
||||||
startFragment(account.id!!, account.getusername(), followers)
|
startFragment(account.id!!, account.username.orEmpty(), followers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,9 +157,10 @@ class ProfileActivity : BaseActivity() {
|
||||||
|
|
||||||
val displayName = account.getDisplayName()
|
val displayName = account.getDisplayName()
|
||||||
|
|
||||||
supportActionBar?.title = displayName
|
supportActionBar?.title = "@${account.acct}"
|
||||||
|
|
||||||
if(displayName != "@${account.acct}") {
|
if(displayName != "@${account.acct}") {
|
||||||
supportActionBar?.subtitle = "@${account.acct}"
|
supportActionBar?.subtitle = displayName
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.nbPostsTextView.text = resources.getQuantityString(
|
binding.nbPostsTextView.text = resources.getQuantityString(
|
||||||
|
|
|
@ -74,12 +74,6 @@ 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()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun anyAvatar(): String? = avatar_static ?: avatar
|
fun anyAvatar(): String? = avatar_static ?: avatar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -215,9 +215,9 @@ For more info about Pixelfed, you can check here: https://pixelfed.org"</string>
|
||||||
<string name="license_info">PixelDroid is free and open source software, licensed under the GNU General Public License (version 3 or later)</string>
|
<string name="license_info">PixelDroid is free and open source software, licensed under the GNU General Public License (version 3 or later)</string>
|
||||||
<string name="about">About</string>
|
<string name="about">About</string>
|
||||||
<string name="post_title">%1$s\'s post</string>
|
<string name="post_title">%1$s\'s post</string>
|
||||||
<string name="followers_title">%1$s\'s followers</string>
|
<string name="followers_title">\@%1$s\'s followers</string>
|
||||||
<string name="hashtag_title">#%1$s</string>
|
<string name="hashtag_title">#%1$s</string>
|
||||||
<string name="follows_title">%1$s\'s follows</string>
|
<string name="follows_title">\@%1$s\'s follows</string>
|
||||||
<string name="search_empty_error">Search query can\'t be empty</string>
|
<string name="search_empty_error">Search query can\'t be empty</string>
|
||||||
<string name="status_more_options">More options</string>
|
<string name="status_more_options">More options</string>
|
||||||
<string name="report">Report</string>
|
<string name="report">Report</string>
|
||||||
|
|
|
@ -33,9 +33,6 @@ class PostUnitTest {
|
||||||
@Test
|
@Test
|
||||||
fun getProfilePicUrlReturnsAValidURL() = Assert.assertNotNull(status.getProfilePicUrl())
|
fun getProfilePicUrlReturnsAValidURL() = Assert.assertNotNull(status.getProfilePicUrl())
|
||||||
|
|
||||||
@Test
|
|
||||||
fun getUsernameReturnsACorrectName() = Assert.assertEquals(status.account!!.username, status.account!!.getusername())
|
|
||||||
|
|
||||||
/*@Test
|
/*@Test
|
||||||
fun getUsernameReturnsOtherNameIfUsernameIsNull() {
|
fun getUsernameReturnsOtherNameIfUsernameIsNull() {
|
||||||
val emptyDescStatus = status.copy(account = status.account!!.copy(username = ""))
|
val emptyDescStatus = status.copy(account = status.account!!.copy(username = ""))
|
||||||
|
|
Loading…
Reference in New Issue