Started the contacts app from scratch today. Two commits in.
Data layer
The bulk of today was designing how contact data reads and writes. Android’s ContactsContract API is cursor-based, untyped, and imperative (i.e. a pain), so I built an abstraction on top of it.
Contacts are structured by being completely unstructured. In essence, the Android contact directory are a list of fields. Each field includes a unique identifier, a MIME type, the contact it aims to be assigned to, and a bunch of data fields (data0..data15). The shape of the data fields are determined by the MIME type. For example, a phone number field could assign data0 to the number itself, and a name field could assign data0 to the given (first) name.
Android has the shape of commonly-used fields stored as a bunch of constants. I used that information to build wrappers for all of the common fields. Each field class knows how to parse a cursor and how to write itself to a WriteBuffer.
UI Basics
I’m using still-experimental Material 3 Expressive APIs. So far, I drew a nice search bar which will animate on open and on close, and currently does nothing else.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.