mEnabledFields = new ArrayList<>(8);
23 |
24 | public ContactsGetterBuilder(Context ctx) {
25 | mCtx = ctx;
26 | }
27 |
28 | /**
29 | *
30 | * Sets sort order for all contacts
31 | *
32 | *
33 | * Sort types could be found here {@link Sorting}
34 | *
35 | *
36 | * By default is ascending by display name
37 | *
38 | *
39 | * @param sortOrder order to sort
40 | */
41 | public ContactsGetterBuilder setSortOrder(Sorting sortOrder) {
42 | this.mSortOrder = sortOrder.getSorting();
43 | return this;
44 | }
45 |
46 | /**
47 | *
48 | * Sets sort order for all contacts
49 | *
50 | *
51 | * Sort types could be found here {@link Sorting}
52 | *
53 | *
54 | * By default is ascending by display name
55 | *
56 | *
57 | * @param sortOrder order to sort
58 | */
59 | public ContactsGetterBuilder setSortOrder(String sortOrder) {
60 | this.mSortOrder = sortOrder;
61 | return this;
62 | }
63 |
64 | /**
65 | *
66 | * Should get all contacts or contacts only with phones
67 | *
68 | *
69 | * Note : Will automatically query for phone numbers.
70 | *
71 | *
72 | * No need to explicitly add Phone numbers to field list
73 | *
74 | * By default returns all contacts
75 | */
76 | public ContactsGetterBuilder onlyWithPhones() {
77 | if (mSelectionBuilder.length() != 0)
78 | mSelectionBuilder.append(" AND ");
79 | mSelectionBuilder.append(ContactsContract.CommonDataKinds.Phone.HAS_PHONE_NUMBER)
80 | .append(" = 1");
81 | addField(FieldType.PHONE_NUMBERS);
82 | return this;
83 | }
84 |
85 | /**
86 | *
87 | * Should get contacts only with photos or not
88 | *
89 | * By default returns all contacts
90 | */
91 | public ContactsGetterBuilder onlyWithPhotos() {
92 | if (mSelectionBuilder.length() != 0)
93 | mSelectionBuilder.append(" AND ");
94 | mSelectionBuilder.append(ContactsContract.CommonDataKinds.Phone.PHOTO_URI)
95 | .append(" IS NOT NULL");
96 | return this;
97 | }
98 |
99 | /**
100 | * Searches for contacts with name that contains sequence
101 | *
102 | * @param nameLike sequence to search for
103 | */
104 | public ContactsGetterBuilder withNameLike(String nameLike) {
105 | if (mSelectionBuilder.length() != 0)
106 | mSelectionBuilder.append(" AND ");
107 | mSelectionBuilder.append(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)
108 | .append(" LIKE ?");
109 | mParamsList.add("%" + nameLike + "%");
110 | return this;
111 | }
112 |
113 | /**
114 | * Searches for contacts with this name
115 | *
116 | * @param name name to search for
117 | */
118 | public ContactsGetterBuilder withName(String name) {
119 | if (mSelectionBuilder.length() != 0)
120 | mSelectionBuilder.append(" AND ");
121 | mSelectionBuilder.append(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)
122 | .append(" = ?");
123 | mParamsList.add(name);
124 | return this;
125 | }
126 |
127 | /**
128 | * Searches for contacts that contains this number sequence
129 | *
130 | * @param number number sequence to search for
131 | */
132 | public ContactsGetterBuilder withPhoneLike(final String number) {
133 | mFilterList.add(FilterUtils.withPhoneLikeFilter(number));
134 | return onlyWithPhones();
135 | }
136 |
137 | /**
138 | * Searches for contacts with this number
139 | *
140 | * @param number number to search for
141 | */
142 | public ContactsGetterBuilder withPhone(final String number) {
143 | mFilterList.add(FilterUtils.withPhoneFilter(number));
144 | return onlyWithPhones();
145 | }
146 |
147 | /**
148 | * Searches for contacts with this email
149 | * Implicitly adds Email field
150 | *
151 | * @param email email to search for
152 | */
153 | public ContactsGetterBuilder withEmail(final String email) {
154 | addField(FieldType.EMAILS);
155 | mFilterList.add(FilterUtils.withEmailFilter(email));
156 | return this;
157 | }
158 |
159 | /**
160 | * Searches for contacts that contains sequence
161 | * Implicitly adds Email field
162 | *
163 | * @param sequence sequence to search for
164 | */
165 | public ContactsGetterBuilder withEmailLike(final String sequence) {
166 | addField(FieldType.EMAILS);
167 | mFilterList.add(FilterUtils.withEmailLikeFilter(sequence));
168 | return this;
169 | }
170 |
171 | /**
172 | * Searches for contacts with this number
173 | * Implicitly adds Address field
174 | *
175 | * @param number number to search for
176 | */
177 | public ContactsGetterBuilder withAddress(final String number) {
178 | addField(FieldType.ADDRESS);
179 | mFilterList.add(FilterUtils.withAddressFilter(number));
180 | return this;
181 | }
182 |
183 | /**
184 | * Searches for addresses that contains this sequence
185 | * Implicitly adds Address field
186 | *
187 | * @param sequence sequence to search for
188 | */
189 | public ContactsGetterBuilder withAddressLike(final String sequence) {
190 | addField(FieldType.ADDRESS);
191 | mFilterList.add(FilterUtils.withAddressLikeFilter(sequence));
192 | return this;
193 | }
194 |
195 |
196 | private List applyFilters(List contactList) {
197 | for (BaseFilter filter : mFilterList) {
198 | for (Iterator iterator = contactList.iterator(); iterator.hasNext(); ) {
199 | ContactData contact = iterator.next();
200 | if (!filter.passedFilter(contact))
201 | iterator.remove();
202 | }
203 | }
204 | return contactList;
205 | }
206 |
207 | /**
208 | *
209 | * Applies custom filter to query on contacts list
210 | *
211 | *
212 | * Additional filters and example implementations could be found here {@link FilterUtils}
213 | *
214 | *
215 | * @param filter filter to apply
216 | */
217 | public ContactsGetterBuilder applyCustomFilter(BaseFilter filter) {
218 | mFilterList.add(filter);
219 | return this;
220 | }
221 |
222 | /**
223 | *
224 | * Enables all fields for query
225 | *
226 | *
227 | * Note : Consider to enable fields you need with {@link #addField(FieldType...)} to increase performance
228 | *
229 | */
230 | public ContactsGetterBuilder allFields() {
231 | addField(FieldType.values());
232 | return this;
233 | }
234 |
235 | /**
236 | *
237 | * Enables fields that should be queried
238 | *
239 | *
240 | * Number of fields influence on performance
241 | *
242 | *
243 | * @param fieldType field type you want to add
244 | */
245 | public ContactsGetterBuilder addField(FieldType... fieldType) {
246 | mEnabledFields.addAll(Arrays.asList(fieldType));
247 | return this;
248 | }
249 |
250 | private ContactsGetter initGetter() {
251 | ContactsGetter getter;
252 | if (mSelectionBuilder.length() == 0)
253 | getter = new ContactsGetter(mCtx, mEnabledFields, mSortOrder, null, null);
254 | else
255 | getter = new ContactsGetter(mCtx, mEnabledFields, mSortOrder, generateSelectionArgs(), generateSelection());
256 | return getter;
257 | }
258 |
259 |
260 | /**
261 | * Builds list of contacts
262 | *
263 | * @param T class of object you want to get data
264 | */
265 | public List buildList(Class extends ContactData> T) {
266 | return applyFilters((List) initGetter()
267 | .setContactDataClass(T)
268 | .getContacts());
269 | }
270 |
271 | /**
272 | * Builds list of contacts
273 | */
274 | public List buildList() {
275 | return applyFilters(initGetter().getContacts());
276 | }
277 |
278 | /**
279 | * Gets contact by local id
280 | *
281 | * @param id id to search for
282 | * @return contact with data specified by options or null if no contact with this id
283 | */
284 | public ContactData getById(int id) {
285 | if (mSelectionBuilder.length() != 0)
286 | mSelectionBuilder.append(" AND ");
287 | mSelectionBuilder.append(ContactsContract.CommonDataKinds.Phone._ID)
288 | .append(" = ?");
289 | mParamsList.add(String.valueOf(id));
290 | return firstOrNull();
291 | }
292 |
293 | /**
294 | * Gets contact by local id
295 | *
296 | * @param id id to search for
297 | * @param T class of object you want to get data
298 | * @return contact with data specified by options or null if no contact with this id
299 | */
300 | public T getById(int id, Class T) {
301 | if (mSelectionBuilder.length() != 0)
302 | mSelectionBuilder.append(" AND ");
303 | mSelectionBuilder.append(ContactsContract.CommonDataKinds.Phone._ID)
304 | .append(" = ?");
305 | mParamsList.add(String.valueOf(id));
306 | return firstOrNull(T);
307 | }
308 |
309 | /**
310 | * Get first contact of null if no contacts with these params
311 | */
312 | public ContactData firstOrNull() {
313 | List contacts = buildList();
314 | if (contacts.isEmpty())
315 | return null;
316 | else
317 | return contacts.get(0);
318 | }
319 |
320 | /**
321 | * Get first contact of null if no contacts with these params
322 | *
323 | * @param T class of object you want to get data
324 | */
325 | public T firstOrNull(Class T) {
326 | List contacts = buildList(T);
327 | if (contacts.isEmpty())
328 | return null;
329 | else
330 | return contacts.get(0);
331 | }
332 |
333 | private String generateSelection() {
334 | return mSelectionBuilder.toString();
335 | }
336 |
337 | private String[] generateSelectionArgs() {
338 | return mParamsList.toArray(new String[mParamsList.size()]);
339 | }
340 | }
341 |
--------------------------------------------------------------------------------
/androidcontacts/src/main/java/com/tomash/androidcontacts/contactgetter/main/contactsSaver/ContactsSaver.java:
--------------------------------------------------------------------------------
1 | package com.tomash.androidcontacts.contactgetter.main.contactsSaver;
2 |
3 | import android.content.*;
4 | import android.graphics.Bitmap;
5 | import android.net.Uri;
6 | import android.provider.ContactsContract;
7 | import com.tomash.androidcontacts.contactgetter.entity.*;
8 | import com.tomash.androidcontacts.contactgetter.interfaces.WithLabel;
9 |
10 | import java.io.ByteArrayInputStream;
11 | import java.io.ByteArrayOutputStream;
12 | import java.io.FileOutputStream;
13 | import java.io.InputStream;
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | class ContactsSaver {
18 | private ContentResolver mResolver;
19 |
20 | public ContactsSaver(ContentResolver resolver) {
21 | mResolver = resolver;
22 | }
23 |
24 | public int[] insertContacts(List contactDataList) {
25 | ArrayList cvList = new ArrayList<>(100);
26 |
27 | ContentProviderResult[] results = createContacts(contactDataList);
28 | int[] ids = new int[results.length];
29 | for (int i = 0; i < results.length; i++) {
30 | int id = Integer.parseInt(results[i].uri.getLastPathSegment());
31 | generateInsertOperations(cvList, contactDataList.get(i), id);
32 | ids[i] = id;
33 | }
34 | mResolver.bulkInsert(ContactsContract.Data.CONTENT_URI, cvList.toArray(new ContentValues[cvList.size()]));
35 | return ids;
36 | }
37 |
38 | private void generateInsertOperations(List contentValuesList, ContactData contactData, int id) {
39 | for (PhoneNumber number : contactData.getPhoneList()) {
40 | contentValuesList.add(getPhonesCV(number, id));
41 | }
42 | for (Address address : contactData.getAddressesList()) {
43 | contentValuesList.add(getWithLabelCV(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE, address, id));
44 | }
45 | for (Email email : contactData.getEmailList()) {
46 | contentValuesList.add(getWithLabelCV(ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE, email, id));
47 | }
48 | for (SpecialDate specialDate : contactData.getSpecialDatesList()) {
49 | contentValuesList.add(getWithLabelCV(ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE, specialDate, id));
50 | }
51 | for (Relation relation : contactData.getRelationsList()) {
52 | contentValuesList.add(getWithLabelCV(ContactsContract.CommonDataKinds.Relation.CONTENT_ITEM_TYPE, relation, id));
53 | }
54 | for (String webSite : contactData.getWebsitesList()) {
55 | contentValuesList.add(getStringTypeCV(ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE, webSite, id));
56 | }
57 | for (IMAddress imAddress : contactData.getImAddressesList()) {
58 | contentValuesList.add(getImAddressCV(imAddress, id));
59 | }
60 | if (!contactData.getNote().isEmpty())
61 | contentValuesList.add(getStringTypeCV(ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE, contactData.getNote(), id));
62 | if (!contactData.getNickName().isEmpty())
63 | contentValuesList.add(getStringTypeCV(ContactsContract.CommonDataKinds.Nickname.CONTENT_ITEM_TYPE, contactData.getNickName(), id));
64 | if (!contactData.getSipAddress().isEmpty())
65 | contentValuesList.add(getStringTypeCV(ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE, contactData.getSipAddress(), id));
66 | contentValuesList.add(getNameDataCV(contactData, id));
67 | Organization currentOrganization = contactData.getOrganization();
68 | if (!currentOrganization.getName().isEmpty() || !currentOrganization.getTitle().isEmpty())
69 | contentValuesList.add(getOrganizationTypeCV(currentOrganization, id));
70 | saveUpdatedPhoto(id, contactData);
71 | }
72 |
73 | /**
74 | * Save updated photo for the specified raw-contact.
75 | */
76 | private void saveUpdatedPhoto(long rawContactId, ContactData contactData) {
77 | try {
78 | InputStream inputStream;
79 | if (contactData.getUpdatedPhotoUri() != null) {
80 | inputStream = mResolver.openInputStream(contactData.getUpdatedPhotoUri());
81 | contactData.setUpdatedPhotoUri(null);
82 | } else if (contactData.getUpdatedBitmap() != null) {
83 | ByteArrayOutputStream bos = new ByteArrayOutputStream();
84 | contactData.getUpdatedBitmap().compress(Bitmap.CompressFormat.PNG, 0 /*ignored for PNG*/, bos);
85 | byte[] bitmapdata = bos.toByteArray();
86 | inputStream = new ByteArrayInputStream(bitmapdata);
87 | contactData.setUpdatedBitmap(null);
88 | } else {
89 | return;
90 | }
91 |
92 | final Uri outputUri = Uri.withAppendedPath(
93 | ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI, rawContactId),
94 | ContactsContract.RawContacts.DisplayPhoto.CONTENT_DIRECTORY);
95 |
96 | FileOutputStream outputStream;
97 | outputStream = mResolver
98 | .openAssetFileDescriptor(outputUri, "rw").createOutputStream();
99 | final byte[] buffer = new byte[16 * 1024];
100 | int length;
101 | while ((length = inputStream.read(buffer)) > 0)
102 | outputStream.write(buffer, 0, length);
103 | outputStream.close();
104 | inputStream.close();
105 | } catch (Exception ignored) {
106 | }
107 | }
108 |
109 | private ContentValues getWithLabelCV(String contentType, WithLabel withLabel, int id) {
110 | ContentValues contentValues = new ContentValues();
111 | contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, id);
112 | contentValues.put(ContactsContract.Data.MIMETYPE, contentType);
113 | contentValues.put(ContactsContract.Data.DATA1, withLabel.getMainData());
114 | contentValues.put(ContactsContract.Data.DATA2, withLabel.getLabelId());
115 | if (withLabel.getLabelId() == withLabel.getCustomLabelId())
116 | contentValues.put(ContactsContract.Data.DATA3, withLabel.getLabelName());
117 | return contentValues;
118 | }
119 |
120 | private ContentValues getNameDataCV(ContactData contactData, int id) {
121 | NameData current = contactData.getNameData();
122 | ContentValues contentValues = new ContentValues();
123 | contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, id);
124 | contentValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE);
125 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, current.getFullName().isEmpty() ? contactData.getCompositeName() : current.getFullName());
126 | if (!current.getFirstName().isEmpty())
127 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, current.getFirstName());
128 | if (!current.getSurname().isEmpty())
129 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, current.getSurname());
130 | if (!current.getNamePrefix().isEmpty())
131 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.PREFIX, current.getNamePrefix());
132 | if (!current.getNameSuffix().isEmpty())
133 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.SUFFIX, current.getNameSuffix());
134 | if (!current.getMiddleName().isEmpty())
135 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME, current.getMiddleName());
136 | if (!current.getPhoneticFirst().isEmpty())
137 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_GIVEN_NAME, current.getPhoneticFirst());
138 | if (!current.getPhoneticMiddle().isEmpty())
139 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_MIDDLE_NAME, current.getPhoneticMiddle());
140 | if (!current.getPhoneticLast().isEmpty())
141 | contentValues.put(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_FAMILY_NAME, current.getPhoneticLast());
142 | return contentValues;
143 | }
144 |
145 | private ContentValues getImAddressCV(IMAddress imAddress, int id) {
146 | ContentValues contentValues = new ContentValues();
147 | contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, id);
148 | contentValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE);
149 | contentValues.put(ContactsContract.Data.DATA1, imAddress.getMainData());
150 | contentValues.put(ContactsContract.Data.DATA2, ContactsContract.CommonDataKinds.Im.TYPE_HOME);
151 | contentValues.put(ContactsContract.Data.DATA5, imAddress.getLabelId());
152 | if (imAddress.getLabelId() == imAddress.getCustomLabelId())
153 | contentValues.put(ContactsContract.Data.DATA6, imAddress.getLabelName());
154 | return contentValues;
155 | }
156 |
157 | private ContentValues getPhonesCV(PhoneNumber phoneNumber, int id) {
158 | ContentValues contentValues = new ContentValues();
159 | contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, id);
160 | contentValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
161 | contentValues.put(ContactsContract.Data.DATA1, phoneNumber.getMainData());
162 | contentValues.put(ContactsContract.Data.DATA2, phoneNumber.getLabelId());
163 | contentValues.put(ContactsContract.Data.IS_PRIMARY, phoneNumber.isPrimary());
164 | if (phoneNumber.getLabelId() == phoneNumber.getCustomLabelId())
165 | contentValues.put(ContactsContract.Data.DATA3, phoneNumber.getLabelName());
166 | return contentValues;
167 | }
168 |
169 | private ContentValues getStringTypeCV(String contentType, String data, int id) {
170 | ContentValues contentValues = new ContentValues();
171 | contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, id);
172 | contentValues.put(ContactsContract.Data.MIMETYPE, contentType);
173 | contentValues.put(ContactsContract.Data.DATA1, data);
174 | return contentValues;
175 | }
176 |
177 | private ContentValues getOrganizationTypeCV(Organization organization, int id) {
178 | ContentValues contentValues = new ContentValues();
179 | contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, id);
180 | contentValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE);
181 | contentValues.put(ContactsContract.Data.DATA1, organization.getName());
182 | contentValues.put(ContactsContract.Data.DATA4, organization.getTitle());
183 | return contentValues;
184 | }
185 |
186 | private ContentProviderResult[] createContacts(List contacts) {
187 | ContentProviderResult[] results = null;
188 | ArrayList op_list = new ArrayList<>();
189 | for (int i = 0; i < contacts.size(); i++) {
190 | ContactData contactData = contacts.get(i);
191 | op_list.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
192 | .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, contactData.getAccountType())
193 | .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, contactData.getAccountName())
194 | .withValue(ContactsContract.RawContacts.STARRED, contactData.isFavorite() ? 1 : 0)
195 | .build());
196 | }
197 | try {
198 | results = mResolver.applyBatch(ContactsContract.AUTHORITY, op_list);
199 | } catch (Exception ignored) {
200 | }
201 | return results;
202 | }
203 |
204 | }
205 |
--------------------------------------------------------------------------------
/androidcontacts/src/main/java/com/tomash/androidcontacts/contactgetter/main/contactsSaver/ContactsSaverBuilder.java:
--------------------------------------------------------------------------------
1 | package com.tomash.androidcontacts.contactgetter.main.contactsSaver;
2 |
3 | import android.content.Context;
4 | import com.tomash.androidcontacts.contactgetter.entity.ContactData;
5 |
6 | import java.util.Collections;
7 | import java.util.List;
8 |
9 | public class ContactsSaverBuilder {
10 | private Context mCtx;
11 |
12 | public ContactsSaverBuilder(Context mCtx) {
13 | this.mCtx = mCtx;
14 | }
15 |
16 | /**
17 | * Saves to phone database list of contacts
18 | *
19 | * @param contactDataList list of contacts you want to save
20 | * @return array with newly created contacts ids
21 | */
22 | public int[] saveContactsList(List contactDataList) {
23 | return new ContactsSaver(mCtx.getContentResolver())
24 | .insertContacts(contactDataList);
25 | }
26 |
27 | /**
28 | * Saves contacts with all data to phone database
29 | *
30 | * @param contactData contact you want to save
31 | * @return newly created contacts id
32 | */
33 | public int saveContact(ContactData contactData) {
34 | List contactDatas = Collections.singletonList(contactData);
35 | int[] ids = new ContactsSaver(mCtx.getContentResolver())
36 | .insertContacts(contactDatas);
37 | return ids[0];
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/androidcontacts/src/main/java/com/tomash/androidcontacts/contactgetter/main/contactsUpdater/ContactsUpdater.java:
--------------------------------------------------------------------------------
1 | package com.tomash.androidcontacts.contactgetter.main.contactsUpdater;
2 |
3 | class ContactsUpdater {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/androidcontacts/src/main/java/com/tomash/androidcontacts/contactgetter/utils/FilterUtils.java:
--------------------------------------------------------------------------------
1 | package com.tomash.androidcontacts.contactgetter.utils;
2 |
3 | import com.tomash.androidcontacts.contactgetter.entity.Address;
4 | import com.tomash.androidcontacts.contactgetter.entity.ContactData;
5 | import com.tomash.androidcontacts.contactgetter.entity.Email;
6 | import com.tomash.androidcontacts.contactgetter.entity.PhoneNumber;
7 | import com.tomash.androidcontacts.contactgetter.interfaces.BaseFilter;
8 | import com.tomash.androidcontacts.contactgetter.interfaces.FieldFilter;
9 | import com.tomash.androidcontacts.contactgetter.interfaces.ListFilter;
10 |
11 | import java.util.List;
12 |
13 | public class FilterUtils {
14 | public static BaseFilter withPhoneLikeFilter(final String number) {
15 | return new ListFilter() {
16 | @Override
17 | protected String getFilterPattern() {
18 | return number;
19 | }
20 |
21 | @Override
22 | protected String getFilterData(PhoneNumber data) {
23 | return data.getMainData();
24 | }
25 |
26 | @Override
27 | protected List getFilterContainer(ContactData contact) {
28 | return contact.getPhoneList();
29 | }
30 |
31 | @Override
32 | protected boolean getFilterCondition(String data, String pattern) {
33 | return formatNumber(data).contains(pattern);
34 | }
35 |
36 | private String formatNumber(String number) {
37 | return number.replaceAll("[^0-9+]", "");
38 | }
39 | };
40 | }
41 |
42 | public static BaseFilter withPhoneFilter(final String number) {
43 | return new ListFilter() {
44 | @Override
45 | protected String getFilterPattern() {
46 | return number;
47 | }
48 |
49 | @Override
50 | protected String getFilterData(PhoneNumber data) {
51 | return data.getMainData();
52 | }
53 |
54 | @Override
55 | protected List getFilterContainer(ContactData contact) {
56 | return contact.getPhoneList();
57 | }
58 |
59 | @Override
60 | protected boolean getFilterCondition(String data, String pattern) {
61 | return data.equalsIgnoreCase(pattern);
62 | }
63 | };
64 | }
65 |
66 | public static BaseFilter withEmailFilter(final String email) {
67 | return new ListFilter() {
68 | @Override
69 | protected String getFilterPattern() {
70 | return email;
71 | }
72 |
73 | @Override
74 | protected String getFilterData(Email data) {
75 | return data.getMainData();
76 | }
77 |
78 | @Override
79 | protected List getFilterContainer(ContactData contact) {
80 | return contact.getEmailList();
81 | }
82 |
83 | @Override
84 | protected boolean getFilterCondition(String data, String pattern) {
85 | return data.equalsIgnoreCase(pattern);
86 | }
87 | };
88 | }
89 |
90 | public static BaseFilter withEmailLikeFilter(final String email) {
91 | return new ListFilter() {
92 | @Override
93 | protected String getFilterPattern() {
94 | return email;
95 | }
96 |
97 | @Override
98 | protected String getFilterData(Email data) {
99 | return data.getMainData();
100 | }
101 |
102 | @Override
103 | protected List getFilterContainer(ContactData contact) {
104 | return contact.getEmailList();
105 | }
106 |
107 | @Override
108 | protected boolean getFilterCondition(String data, String pattern) {
109 | return data.toLowerCase().contains(pattern.toLowerCase());
110 | }
111 | };
112 | }
113 |
114 | public static BaseFilter withAddressLikeFilter(final String address) {
115 | return new ListFilter() {
116 | @Override
117 | protected String getFilterPattern() {
118 | return address;
119 | }
120 |
121 | @Override
122 | protected String getFilterData(Address data) {
123 | return data.getMainData();
124 | }
125 |
126 | @Override
127 | protected List getFilterContainer(ContactData contact) {
128 | return contact.getAddressesList();
129 | }
130 |
131 | @Override
132 | protected boolean getFilterCondition(String data, String pattern) {
133 | return data.toLowerCase().contains(pattern.toLowerCase());
134 | }
135 | };
136 | }
137 |
138 | public static BaseFilter withAddressFilter(final String address) {
139 | return new ListFilter() {
140 | @Override
141 | protected String getFilterPattern() {
142 | return address;
143 | }
144 |
145 | @Override
146 | protected String getFilterData(Address data) {
147 | return data.getMainData();
148 | }
149 |
150 | @Override
151 | protected List getFilterContainer(ContactData contact) {
152 | return contact.getAddressesList();
153 | }
154 |
155 | @Override
156 | protected boolean getFilterCondition(String data, String pattern) {
157 | return data.equalsIgnoreCase(pattern);
158 | }
159 | };
160 | }
161 |
162 | public static BaseFilter withNoteLike(final String noteLike) {
163 | return new FieldFilter() {
164 | @Override
165 | protected String getFilterPattern() {
166 | return noteLike;
167 | }
168 |
169 | @Override
170 | protected String getFilterData(ContactData data) {
171 | return data.getNote();
172 | }
173 |
174 | @Override
175 | protected boolean getFilterCondition(String data, String pattern) {
176 | return data.toLowerCase().contains(pattern.toLowerCase());
177 | }
178 | };
179 | }
180 |
181 | public static BaseFilter withNote(final String note) {
182 | return new FieldFilter() {
183 | @Override
184 | protected String getFilterPattern() {
185 | return note;
186 | }
187 |
188 | @Override
189 | protected String getFilterData(ContactData data) {
190 | return data.getNote();
191 | }
192 |
193 | @Override
194 | protected boolean getFilterCondition(String data, String pattern) {
195 | return data.equalsIgnoreCase(pattern);
196 | }
197 | };
198 | }
199 |
200 | }
201 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | apply from: 'deps.gradle'
5 | repositories {
6 | jcenter()
7 | google()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:4.1.0'
11 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin_version"
13 |
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 | plugins {
19 | id "com.jfrog.bintray" version "1.7.3"
20 | }
21 |
22 | allprojects {
23 | repositories {
24 | jcenter()
25 | google()
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/deps.gradle:
--------------------------------------------------------------------------------
1 | ext.versions = [
2 | publishVersion : '1.14.2',
3 | buildCode : 16,
4 | artifact : 'androidcontacts',
5 | compileSdkVersion: 30,
6 | 'kotlin_version' : '1.4.10'
7 | ]
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | android.useAndroidX=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blainepwnz/AndroidContacts/0dc22ca4db9130e06a6f13a879b65929b5d739fb/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Oct 18 22:09:43 EEST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':androidcontacts'
2 | include ':testapp'
3 |
--------------------------------------------------------------------------------
/testapp/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/testapp/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "com.tomash.testapp"
11 | minSdkVersion 16
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 |
31 | }
32 |
33 | dependencies {
34 | implementation fileTree(dir: 'libs', include: ['*.jar'])
35 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$versions.kotlin_version"
36 | implementation 'androidx.appcompat:appcompat:1.1.0'
37 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
38 | implementation project(":androidcontacts")
39 | }
40 |
--------------------------------------------------------------------------------
/testapp/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/testapp/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
--------------------------------------------------------------------------------
/testapp/src/main/java/com/tomash/testapp/DeleteExample.kt:
--------------------------------------------------------------------------------
1 | package com.tomash.testapp
2 |
3 | import android.content.Context
4 | import com.tomash.androidcontacts.contactgetter.entity.ContactData
5 | import com.tomash.androidcontacts.contactgetter.main.contactsDeleter.ContactsDeleter
6 |
7 | class DeleteExample(
8 | val deleter: ContactsDeleter
9 | ) {
10 |
11 | fun create(context: Context) {
12 | val contactsDeleter = ContactsDeleter(context)
13 | }
14 |
15 | fun deleteOneContact(contactData: ContactData) {
16 | //usual delete with no need of callbacks
17 | deleter.deleteContact(contactData)
18 | //full range of callbacks, implement any you need
19 | deleter.deleteContact(contactData) {
20 | onCompleted { }
21 | onFailure { }
22 | onResult { }
23 | doFinally { }
24 | }
25 | }
26 |
27 | fun deleteMultipleContacts(contactDatas: List) {
28 | //usual delete with no need of callbacks
29 | deleter.deleteContacts(contactDatas)
30 | //full range of callbacks, implement any you need
31 | deleter.deleteContacts(contactDatas) {
32 | onCompleted { }
33 | onFailure { }
34 | onResult { }
35 | doFinally { }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/testapp/src/main/java/com/tomash/testapp/JavaDeleteExample.java:
--------------------------------------------------------------------------------
1 | package com.tomash.testapp;
2 |
3 | import android.content.Context;
4 | import com.tomash.androidcontacts.contactgetter.entity.ContactData;
5 | import com.tomash.androidcontacts.contactgetter.main.contactsDeleter.ContactsDeleter;
6 | import kotlin.Unit;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Examples how delete contacts
12 | */
13 | public class JavaDeleteExample {
14 | private ContactsDeleter contactsDeleter;
15 |
16 | /**
17 | * Example of creation of ContactsDeleter object
18 | */
19 | private ContactsDeleter createContactsDeleter(Context context) {
20 | return ContactsDeleter.Companion.invoke(context);
21 | }
22 |
23 | /**
24 | * Example of deleting one ContactData
25 | */
26 | private void deleteOneContact(ContactData contactData) {
27 | contactsDeleter.deleteContact(contactData, contactDataExceptionACResult -> {
28 | contactDataExceptionACResult.onResult(deletedContactData -> {
29 | // do something with successfully deleted contact
30 | return Unit.INSTANCE;
31 | });
32 | contactDataExceptionACResult.onCompleted(() -> {
33 | // do something when successfully deleted contact
34 | return Unit.INSTANCE;
35 | });
36 | contactDataExceptionACResult.doFinally(() -> {
37 | // do something in case of success or error
38 | return Unit.INSTANCE;
39 | });
40 | contactDataExceptionACResult.onFailure(error -> {
41 | // do something in case of error
42 | return Unit.INSTANCE;
43 | });
44 | return Unit.INSTANCE;
45 | });
46 | }
47 |
48 | /**
49 | * Example of deleting list of ContactData
50 | */
51 | private void deleteMultipleContacts(List contactData) {
52 | contactsDeleter.deleteContacts(contactData, contactDataExceptionACResult -> {
53 | contactDataExceptionACResult.onResult(contactDataList -> {
54 | // do something with successfully deleted contacts
55 | return Unit.INSTANCE;
56 | });
57 | return Unit.INSTANCE;
58 | });
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/testapp/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/testapp/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/testapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blainepwnz/AndroidContacts/0dc22ca4db9130e06a6f13a879b65929b5d739fb/testapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/testapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blainepwnz/AndroidContacts/0dc22ca4db9130e06a6f13a879b65929b5d739fb/testapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/testapp/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/testapp/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Test App
3 |
4 |
--------------------------------------------------------------------------------
/testapp/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------