Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PixelDroid
PixelDroid
Commits
53f5a151
Commit
53f5a151
authored
Oct 07, 2021
by
Matthieu
Browse files
More consistent, remove useless method
parent
f6e4804c
Pipeline
#833
failed with stages
in 13 minutes and 32 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/pixeldroid/app/posts/PostActivity.kt
View file @
53f5a151
...
...
@@ -46,7 +46,7 @@ class PostActivity : BaseActivity() {
domain
=
user
?.
instance_uri
.
orEmpty
()
supportActionBar
?.
title
=
getString
(
R
.
string
.
post_title
).
format
(
status
.
account
?.
get
username
()
)
supportActionBar
?.
title
=
getString
(
R
.
string
.
post_title
).
format
(
status
.
account
?.
username
)
val
holder
=
StatusViewHolder
(
binding
.
postFragmentSingle
)
...
...
app/src/main/java/org/pixeldroid/app/posts/StatusViewHolder.kt
View file @
53f5a151
...
...
@@ -89,13 +89,13 @@ class StatusViewHolder(val binding: PostFragmentBinding) : RecyclerView.ViewHold
)
{
//Setup username as a button that opens the profile
binding
.
username
.
apply
{
text
=
status
?.
account
?.
get
username
()
?:
""
text
=
status
?.
account
?.
username
?:
""
setTypeface
(
null
,
Typeface
.
BOLD
)
setOnClickListener
{
status
?.
account
?.
openProfile
(
binding
.
root
.
context
)
}
}
binding
.
usernameDesc
.
apply
{
text
=
status
?.
account
?.
get
username
()
?:
""
text
=
status
?.
account
?.
username
?:
""
setTypeface
(
null
,
Typeface
.
BOLD
)
}
...
...
app/src/main/java/org/pixeldroid/app/profile/FollowsActivity.kt
View file @
53f5a151
...
...
@@ -27,7 +27,7 @@ class FollowsActivity : BaseActivity() {
val
user
=
db
.
userDao
().
getActiveUser
()
!!
startFragment
(
user
.
user_id
,
user
.
username
,
followers
)
}
else
{
startFragment
(
account
.
id
!!
,
account
.
get
username
(),
followers
)
startFragment
(
account
.
id
!!
,
account
.
username
.
orEmpty
(),
followers
)
}
}
...
...
app/src/main/java/org/pixeldroid/app/profile/ProfileActivity.kt
View file @
53f5a151
...
...
@@ -157,9 +157,10 @@ class ProfileActivity : BaseActivity() {
val
displayName
=
account
.
getDisplayName
()
supportActionBar
?.
title
=
displayName
supportActionBar
?.
title
=
"@${account.acct}"
if
(
displayName
!=
"@${account.acct}"
)
{
supportActionBar
?.
subtitle
=
"@${account.acct}"
supportActionBar
?.
subtitle
=
displayName
}
binding
.
nbPostsTextView
.
text
=
resources
.
getQuantityString
(
...
...
app/src/main/java/org/pixeldroid/app/utils/api/objects/Account.kt
View file @
53f5a151
...
...
@@ -74,12 +74,6 @@ data class Account(
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
/**
...
...
app/src/main/res/values/strings.xml
View file @
53f5a151
...
...
@@ -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=
"about"
>
About
</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=
"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=
"status_more_options"
>
More options
</string>
<string
name=
"report"
>
Report
</string>
...
...
app/src/test/java/org/pixeldroid/app/PostUnitTest.kt
View file @
53f5a151
...
...
@@ -33,9 +33,6 @@ class PostUnitTest {
@Test
fun
getProfilePicUrlReturnsAValidURL
()
=
Assert
.
assertNotNull
(
status
.
getProfilePicUrl
())
@Test
fun
getUsernameReturnsACorrectName
()
=
Assert
.
assertEquals
(
status
.
account
!!
.
username
,
status
.
account
!!
.
getusername
())
/*@Test
fun getUsernameReturnsOtherNameIfUsernameIsNull() {
val emptyDescStatus = status.copy(account = status.account!!.copy(username = ""))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment