Check if contact picker

pull/146/head
M66B 7 years ago
parent 5dc342eed4
commit 3326088820

@ -201,29 +201,35 @@ public class FragmentCompose extends FragmentEx {
} }
}); });
ivToAdd.setOnClickListener(new View.OnClickListener() { View.OnClickListener onPick = new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI); int request;
startActivityForResult(intent, ActivityCompose.REQUEST_CONTACT_TO); switch (view.getId()) {
case R.id.ivToAdd:
request = ActivityCompose.REQUEST_CONTACT_TO;
break;
case R.id.ivCcAdd:
request = ActivityCompose.REQUEST_CONTACT_CC;
break;
case R.id.ivBccAdd:
request = ActivityCompose.REQUEST_CONTACT_BCC;
break;
default:
return;
} }
});
ivCcAdd.setOnClickListener(new View.OnClickListener() { Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
@Override if (pick.resolveActivity(getContext().getPackageManager()) == null)
public void onClick(View view) { Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI); else
startActivityForResult(intent, ActivityCompose.REQUEST_CONTACT_CC); startActivityForResult(pick, request);
} }
}); };
ivBccAdd.setOnClickListener(new View.OnClickListener() { ivToAdd.setOnClickListener(onPick);
@Override ivCcAdd.setOnClickListener(onPick);
public void onClick(View view) { ivBccAdd.setOnClickListener(onPick);
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
startActivityForResult(intent, ActivityCompose.REQUEST_CONTACT_BCC);
}
});
edit_bar.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { edit_bar.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override @Override

@ -219,6 +219,7 @@
<string name="title_no_answers">No reply templates defined</string> <string name="title_no_answers">No reply templates defined</string>
<string name="title_no_viewer">No viewer app available for %1$s</string> <string name="title_no_viewer">No viewer app available for %1$s</string>
<string name="title_no_saf">Storage access framework not available</string> <string name="title_no_saf">Storage access framework not available</string>
<string name="title_no_contacts">Contact picker not available</string>
<string name="title_attachment_saved">Attachment saved</string> <string name="title_attachment_saved">Attachment saved</string>
<string name="title_attachment_unavailable">Some attachments are not downloaded and will not be forwarded, continue?</string> <string name="title_attachment_unavailable">Some attachments are not downloaded and will not be forwarded, continue?</string>
<string name="title_ask_delete">Delete message permanently?</string> <string name="title_ask_delete">Delete message permanently?</string>

Loading…
Cancel
Save