Fixed missing action in native contact app
This commit is contained in:
parent
ce6e5fd714
commit
5b20ee25b2
3 changed files with 71 additions and 59 deletions
|
@ -131,6 +131,18 @@ if (firebaseEnabled()) {
|
|||
apply plugin: 'com.google.gms.google-services'
|
||||
}
|
||||
|
||||
task generateContactsXml(type: Copy) {
|
||||
from 'contacts.xml'
|
||||
into "src/main/res/xml/"
|
||||
filter {
|
||||
line -> line
|
||||
.replaceAll('%%AUTO_GENERATED%%', 'This file has been automatically generated, do not edit or commit !')
|
||||
.replaceAll('%%PACKAGE_NAME%%', getPackageName())
|
||||
|
||||
}
|
||||
}
|
||||
project.tasks['preBuild'].dependsOn 'generateContactsXml'
|
||||
|
||||
apply plugin: "com.diffplug.gradle.spotless"
|
||||
spotless {
|
||||
java {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- %%AUTO_GENERATED%% -->
|
||||
<ContactsDataKind
|
||||
android:detailColumn="data3"
|
||||
android:detailSocialSummary="true"
|
||||
android:icon="@drawable/linphone_logo"
|
||||
android:mimeType="@string/linphone_address_mime_type"
|
||||
android:mimeType="vnd.android.cursor.item/vnd.%%PACKAGE_NAME%%.provider.sip_address"
|
||||
android:summaryColumn="data2" />
|
||||
|
||||
<!-- You can use @string/linphone_address_mime_type above ! You have to hardcode it... -->
|
||||
</ContactsSource>
|
|
@ -200,62 +200,6 @@ class AndroidContact implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
protected void setOrganization(String org) {
|
||||
if (org == null || org.isEmpty()) {
|
||||
if (mAndroidId == null) {
|
||||
Log.e("[Contact] Can't set organization to null or empty for new contact");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mAndroidId == null) {
|
||||
Log.i("[Contact] Setting organization " + org + " to new contact.");
|
||||
addChangesToCommit(
|
||||
ContentProviderOperation.newInsert(Data.CONTENT_URI)
|
||||
.withValueBackReference(Data.RAW_CONTACT_ID, 0)
|
||||
.withValue(
|
||||
Data.MIMETYPE, CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
|
||||
.withValue(CommonDataKinds.Organization.COMPANY, org)
|
||||
.build());
|
||||
} else {
|
||||
Log.i("[Contact] Setting organization " + org + " to existing contact " + mAndroidId);
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected void setPhoto(byte[] photo) {
|
||||
if (photo == null) {
|
||||
Log.e("[Contact] Can't set null picture.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAndroidId == null) {
|
||||
Log.i("[Contact] Setting picture to new contact.");
|
||||
// TODO
|
||||
} else {
|
||||
Log.i("[Contact] Setting picture to existing contact " + mAndroidId);
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected void removeNumberOrAddress(String noa) {
|
||||
if (noa == null || noa.isEmpty()) {
|
||||
Log.e("[Contact] Can't remove null or empty number or address.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAndroidId == null) {
|
||||
Log.i("[Contact] Removing number or address " + noa + " from new contact.");
|
||||
// TODO
|
||||
} else {
|
||||
Log.i(
|
||||
"[Contact] Removing number or address "
|
||||
+ noa
|
||||
+ " from existing contact "
|
||||
+ mAndroidId);
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected void addNumberOrAddress(String value, String oldValueToReplace, boolean isSIP) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
Log.e("[Contact] Can't add null or empty number or address");
|
||||
|
@ -317,6 +261,62 @@ class AndroidContact implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
protected void removeNumberOrAddress(String noa) {
|
||||
if (noa == null || noa.isEmpty()) {
|
||||
Log.e("[Contact] Can't remove null or empty number or address.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAndroidId == null) {
|
||||
Log.i("[Contact] Removing number or address " + noa + " from new contact.");
|
||||
// TODO
|
||||
} else {
|
||||
Log.i(
|
||||
"[Contact] Removing number or address "
|
||||
+ noa
|
||||
+ " from existing contact "
|
||||
+ mAndroidId);
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected void setOrganization(String org) {
|
||||
if (org == null || org.isEmpty()) {
|
||||
if (mAndroidId == null) {
|
||||
Log.e("[Contact] Can't set organization to null or empty for new contact");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mAndroidId == null) {
|
||||
Log.i("[Contact] Setting organization " + org + " to new contact.");
|
||||
addChangesToCommit(
|
||||
ContentProviderOperation.newInsert(Data.CONTENT_URI)
|
||||
.withValueBackReference(Data.RAW_CONTACT_ID, 0)
|
||||
.withValue(
|
||||
Data.MIMETYPE, CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
|
||||
.withValue(CommonDataKinds.Organization.COMPANY, org)
|
||||
.build());
|
||||
} else {
|
||||
Log.i("[Contact] Setting organization " + org + " to existing contact " + mAndroidId);
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected void setPhoto(byte[] photo) {
|
||||
if (photo == null) {
|
||||
Log.e("[Contact] Can't set null picture.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAndroidId == null) {
|
||||
Log.i("[Contact] Setting picture to new contact.");
|
||||
// TODO
|
||||
} else {
|
||||
Log.i("[Contact] Setting picture to existing contact " + mAndroidId);
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected void getAndroidIds() {
|
||||
mAndroidRawId = findRawContactID();
|
||||
if (LinphoneManager.getInstance()
|
||||
|
|
Loading…
Reference in a new issue