Remove unnecessary constructor

This commit is contained in:
Moez Bhatti
2017-12-14 15:21:14 -05:00
parent 19c5fac2f2
commit 653f7e9c45
2 changed files with 4 additions and 6 deletions
@@ -12,9 +12,4 @@ open class Contact() : RealmObject() {
var inContactsTable: Boolean = false
constructor(id: Long, address: String) : this() {
this.recipientId = id
this.address = address
}
}
@@ -62,7 +62,10 @@ class ContactRepository @Inject constructor(val context: Context) {
private fun getContactFromDb(recipientId: Long): Contact? {
context.contentResolver.query(Uri.withAppendedPath(URI, recipientId.toString()), null, null, null, null)?.use { recipientCursor ->
if (recipientCursor.moveToFirst()) {
val contact = Contact(recipientId, recipientCursor.getString(0))
val contact = Contact().apply {
this.recipientId = recipientId
this.address = recipientCursor.getString(0)
}
val contactUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(contact.address))
val projection = arrayOf(BaseColumns._ID, ContactsContract.PhoneLookup.DISPLAY_NAME, ContactsContract.PhoneLookup.LOOKUP_KEY)