Skip to content

Commit

Permalink
Ordered methods
Browse files Browse the repository at this point in the history
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
  • Loading branch information
ArnyminerZ committed Jul 8, 2024
1 parent e132ff0 commit 714824d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/src/main/java/at/bitfire/vcard4android/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ object Utils {
return values
}

fun StructuredName.isEmpty() =
prefixes.isEmpty() && given == null && additionalNames.isEmpty() && family == null && suffixes.isEmpty()

fun Uri.asSyncAdapter(account: Account): Uri = buildUpon()
.appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_NAME, account.name)
.appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_TYPE, account.type)
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
.build()

fun Long.byteCountToDisplaySize(): String {
val gb = this / 1_073_741_824 // 2^30
if (gb > 0) {
Expand Down Expand Up @@ -58,4 +49,13 @@ object Utils {
*/
fun String?.trimToNull(): String? = this?.trim()?.takeIf { it.isNotBlank() }

fun StructuredName.isEmpty() =
prefixes.isEmpty() && given == null && additionalNames.isEmpty() && family == null && suffixes.isEmpty()

fun Uri.asSyncAdapter(account: Account): Uri = buildUpon()
.appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_NAME, account.name)
.appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_TYPE, account.type)
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
.build()

}

0 comments on commit 714824d

Please sign in to comment.