Issue 2477: Show account's creation date in Profile. (#2480)
* Show account's creation date in Profile. * Fix broken test. * Store account creation date in the Database. * Reformat and reposition Joined Date according to PR Feedback. * Revert "Store account creation date in the Database." This reverts commit d9761f53 as it's not needed. * Change Account's Creation Date to a java.util.Date. Update Test. * Fix wildcard import. * Show full month instead of an abbreviation. * Remove `lazy` usage in favor of local instantiation. Co-authored-by: Martin Marconcini <martin.marconcini.rodriguez@nl.abnamro.com> Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
This commit is contained in:
parent
df49851042
commit
d97493d312
5 changed files with 56 additions and 17 deletions
|
@ -84,6 +84,9 @@ import com.keylesspalace.tusky.view.showMuteAccountDialog
|
|||
import dagger.android.DispatchingAndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import java.text.NumberFormat
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.abs
|
||||
|
||||
|
@ -413,6 +416,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
|
|||
updateToolbar()
|
||||
updateMovedAccount()
|
||||
updateRemoteAccount()
|
||||
updateAccountJoinedDate()
|
||||
updateAccountStats()
|
||||
invalidateOptionsMenu()
|
||||
|
||||
|
@ -422,6 +426,20 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateAccountJoinedDate() {
|
||||
loadedAccount?.let { account ->
|
||||
try {
|
||||
binding.accountDateJoined.text = resources.getString(
|
||||
R.string.account_date_joined,
|
||||
SimpleDateFormat("MMMM, yyyy", Locale.getDefault()).format(account.createdAt)
|
||||
)
|
||||
binding.accountDateJoined.visibility = View.VISIBLE
|
||||
} catch (e: ParseException) {
|
||||
binding.accountDateJoined.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load account's avatar and header image
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,7 @@ data class Account(
|
|||
@SerializedName("username") val localUsername: String,
|
||||
@SerializedName("acct") val username: String,
|
||||
@SerializedName("display_name") val displayName: String?, // should never be null per Api definition, but some servers break the contract
|
||||
@SerializedName("created_at") val createdAt: Date,
|
||||
val note: String,
|
||||
val url: String,
|
||||
val avatar: String,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue