use of cx.ring.adapters.NumberAdapter in project ring-client-android by savoirfairelinux.
the class ConversationFragment method displayNumberSpinner.
@Override
public void displayNumberSpinner(final Conversation conversation, final Uri number) {
getActivity().runOnUiThread(() -> {
mNumberSpinner.setVisibility(View.VISIBLE);
mNumberAdapter = new NumberAdapter(getActivity(), conversation.getContact(), false);
mNumberSpinner.setAdapter(mNumberAdapter);
mNumberSpinner.setSelection(getIndex(mNumberSpinner, number));
});
}
use of cx.ring.adapters.NumberAdapter in project ring-client-android by savoirfairelinux.
the class ActionHelper method launchCopyNumberToClipboardFromContact.
public static void launchCopyNumberToClipboardFromContact(final Context context, final CallContact callContact, final Conversation.ConversationActionCallback callback) {
if (callContact == null) {
Log.d(TAG, "launchCopyNumberToClipboardFromContact: callContact is null");
return;
}
if (context == null) {
Log.d(TAG, "launchCopyNumberToClipboardFromContact: activity is null");
return;
}
if (callContact.getPhones().isEmpty()) {
Log.d(TAG, "launchCopyNumberToClipboardFromContact: no number to copy");
return;
}
if (callContact.getPhones().size() == 1 && callback != null) {
String number = callContact.getPhones().get(0).getNumber().toString();
callback.copyContactNumberToClipboard(number);
} else {
final NumberAdapter adapter = new NumberAdapter(context, callContact, true);
AlertDialog alertDialog = new AlertDialog.Builder(context).setTitle(R.string.conversation_action_select_peer_number).setAdapter(adapter, (dialog, which) -> {
if (callback != null) {
Phone selectedPhone = (Phone) adapter.getItem(which);
callback.copyContactNumberToClipboard(selectedPhone.getNumber().toString());
}
}).create();
final int listViewSidePadding = (int) context.getResources().getDimension(R.dimen.alert_dialog_side_padding_list_view);
alertDialog.getListView().setPadding(listViewSidePadding, 0, listViewSidePadding, 0);
alertDialog.show();
}
}
Aggregations