An open API service indexing awesome lists of open source software.

https://github.com/random-guys/pica.chu

Contacts Picker
https://github.com/random-guys/pica.chu

library

Last synced: 9 months ago
JSON representation

Contacts Picker

Awesome Lists containing this project

README

          

# pica.chu
This is tiny contacts picker as a BottomSheetDialog picker for Android.
We built it because we wanted to combine phone contacts on a device with contacts loaded from a server.
Also some contact pickers were just misbehaving and we needed the experience to be consistent across devices.

This lib will be useful to anyone that's frustrated using the default contact pickers that ship with android devices.
This is due to the fact that each device rolls out their contact picker.

## Demo

![Picachu](https://media.giphy.com/media/WodomZmSBBMQQYSnxs/giphy.gif)

## Installation
Add the dependency :

```gradle
dependencies {
implementation 'com.random-guys:pica:0.1.1'
}
```

## Usage

Add these permissions to `AndroidManifest.xml`
```xml


```

Usage in View (`Activity` or `Fragment`)
```kt
import com.random_guys.pica.Chu
import com.random_guys.pica.Contact
import com.random_guys.pica.Pica

class MainActivity : AppCompatActivity(), Chu.ContactClickListener {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

button.setOnClickListener {
val mMainContacts = ArrayList()

// load contacts from phonebook into an array
val pica = Pica(this)
pica.load { contacts -> mMainContacts.addAll(contacts) }

// open contacts picker using contacts loaded from phonebook
val chooser = Chu(mMainContacts, this)
chooser.show(supportFragmentManager, "")
}
}

override fun onContactClickListener(contact: Contact) {
Toast.makeText(this, contact.name, Toast.LENGTH_LONG).show()
}
}
```