mirror of https://github.com/M66B/FairEmail.git
Added selection of contact types/groups
This commit is contained in:
parent
76626cf19f
commit
1ec503080a
|
@ -3822,6 +3822,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
int target = args.getInt("target");
|
int target = args.getInt("target");
|
||||||
long group = args.getLong("group");
|
long group = args.getLong("group");
|
||||||
String gname = args.getString("name");
|
String gname = args.getString("name");
|
||||||
|
int type = args.getInt("type");
|
||||||
String to = args.getString("to");
|
String to = args.getString("to");
|
||||||
String cc = args.getString("cc");
|
String cc = args.getString("cc");
|
||||||
String bcc = args.getString("bcc");
|
String bcc = args.getString("bcc");
|
||||||
|
@ -3847,11 +3848,13 @@ public class FragmentCompose extends FragmentBase {
|
||||||
+ ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE + "'",
|
+ ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE + "'",
|
||||||
new String[]{String.valueOf(group)}, null)) {
|
new String[]{String.valueOf(group)}, null)) {
|
||||||
while (cursor != null && cursor.moveToNext()) {
|
while (cursor != null && cursor.moveToNext()) {
|
||||||
|
// https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Email
|
||||||
try (Cursor contact = getContext().getContentResolver().query(
|
try (Cursor contact = getContext().getContentResolver().query(
|
||||||
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
|
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
|
||||||
new String[]{
|
new String[]{
|
||||||
ContactsContract.Contacts.DISPLAY_NAME,
|
ContactsContract.Contacts.DISPLAY_NAME,
|
||||||
ContactsContract.CommonDataKinds.Email.DATA
|
ContactsContract.CommonDataKinds.Email.DATA,
|
||||||
|
ContactsContract.CommonDataKinds.Email.TYPE,
|
||||||
},
|
},
|
||||||
ContactsContract.Data.CONTACT_ID + " = ?",
|
ContactsContract.Data.CONTACT_ID + " = ?",
|
||||||
new String[]{cursor.getString(0)},
|
new String[]{cursor.getString(0)},
|
||||||
|
@ -3859,9 +3862,11 @@ public class FragmentCompose extends FragmentBase {
|
||||||
if (contact != null && contact.moveToNext()) {
|
if (contact != null && contact.moveToNext()) {
|
||||||
String name = contact.getString(0);
|
String name = contact.getString(0);
|
||||||
String email = contact.getString(1);
|
String email = contact.getString(1);
|
||||||
|
int etype = contact.getInt(2);
|
||||||
Address address = new InternetAddress(email, name, StandardCharsets.UTF_8.name());
|
Address address = new InternetAddress(email, name, StandardCharsets.UTF_8.name());
|
||||||
EntityLog.log(context, "Selected group=" + group +
|
EntityLog.log(context, "Selected group=" + group + ":" + type +
|
||||||
" address=" + MessageHelper.formatAddresses(new Address[]{address}));
|
" address=" + MessageHelper.formatAddresses(new Address[]{address}) + ":" + etype);
|
||||||
|
if (type == 0 || etype == type)
|
||||||
selected.add(address);
|
selected.add(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6786,6 +6791,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
final ImageButton ibInfo = dview.findViewById(R.id.ibInfo);
|
final ImageButton ibInfo = dview.findViewById(R.id.ibInfo);
|
||||||
final Spinner spGroup = dview.findViewById(R.id.spGroup);
|
final Spinner spGroup = dview.findViewById(R.id.spGroup);
|
||||||
final Spinner spTarget = dview.findViewById(R.id.spTarget);
|
final Spinner spTarget = dview.findViewById(R.id.spTarget);
|
||||||
|
final Spinner spType = dview.findViewById(R.id.spType);
|
||||||
|
|
||||||
ibInfo.setOnClickListener(new View.OnClickListener() {
|
ibInfo.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -6890,6 +6896,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
args.putInt("target", target);
|
args.putInt("target", target);
|
||||||
args.putLong("group", group);
|
args.putLong("group", group);
|
||||||
args.putString("name", name);
|
args.putString("name", name);
|
||||||
|
args.putInt("type", spType.getSelectedItemPosition());
|
||||||
|
|
||||||
sendResult(RESULT_OK);
|
sendResult(RESULT_OK);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -54,5 +54,15 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/spTarget" />
|
app:layout_constraintTop_toBottomOf="@id/spTarget" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/spType"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:entries="@array/contactGroupTypes"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/spGroup" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</eu.faircode.email.ScrollViewEx>
|
</eu.faircode.email.ScrollViewEx>
|
||||||
|
|
|
@ -2311,6 +2311,15 @@
|
||||||
<item>Not blocked</item>
|
<item>Not blocked</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="contactGroupTypes">
|
||||||
|
<item>Any</item>
|
||||||
|
<item>Home</item>
|
||||||
|
<item>Work</item>
|
||||||
|
<item>Other</item>
|
||||||
|
<item>Mobile</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
<string name="fingerprint" translatable="false">17BA15C1AF55D925F98B99CEA4375D4CDF4C174B</string>
|
<string name="fingerprint" translatable="false">17BA15C1AF55D925F98B99CEA4375D4CDF4C174B</string>
|
||||||
<string name="fingerprint_fdroid" translatable="false">77CD40058858DC3A38523E01C227A39AA019F88B</string>
|
<string name="fingerprint_fdroid" translatable="false">77CD40058858DC3A38523E01C227A39AA019F88B</string>
|
||||||
<string name="fingerprint_amazon" translatable="false">200D0AA43A8ADBC7BB8237023C1553F4753CA7D2</string>
|
<string name="fingerprint_amazon" translatable="false">200D0AA43A8ADBC7BB8237023C1553F4753CA7D2</string>
|
||||||
|
|
Loading…
Reference in New Issue