Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DataRowHandler.kt « contactrow « vcard4android « bitfire « at « java « main « src - github.com/bitfireAT/vcard4android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: be91709152e30dba785f762a269a0b4a7639c433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package at.bitfire.vcard4android.contactrow

import android.content.ContentValues
import androidx.annotation.CallSuper
import at.bitfire.vcard4android.Contact

/**
 * Handler for a raw contact's data row.
 */
abstract class DataRowHandler {

    abstract fun forMimeType(): String

    /**
     * Processes the given data.
     *
     * @param values   values to process
     * @param contact  contact that is modified according to the values
     */
    @CallSuper
    open fun handle(values: ContentValues, contact: Contact) {
        // remove empty strings
        val it = values.keySet().iterator()
        while (it.hasNext()) {
            val obj = values[it.next()]
            if (obj is String && obj.isEmpty())
                it.remove()
        }
    }

}