Search in sources :

Example 16 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class HistoryService method incomingMessage.

public void incomingMessage(String accountId, String callId, String from, StringMap messages) {
    String msg = null;
    final String textPlainMime = "text/plain";
    if (null != messages && messages.has_key(textPlainMime)) {
        msg = messages.getRaw(textPlainMime).toJavaString();
    }
    if (msg == null) {
        return;
    }
    if (!from.contains(CallContact.PREFIX_RING)) {
        from = CallContact.PREFIX_RING + from;
    }
    TextMessage txt = new TextMessage(true, msg, new Uri(from), callId, accountId);
    Log.w(TAG, "New text messsage " + txt.getAccount() + " " + txt.getCallId() + " " + txt.getMessage());
    insertNewTextMessage(txt);
    ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.INCOMING_MESSAGE);
    event.addEventInput(ServiceEvent.EventInput.MESSAGE, txt);
    setChanged();
    notifyObservers(event);
}
Also used : ServiceEvent(cx.ring.model.ServiceEvent) Uri(cx.ring.model.Uri) TextMessage(cx.ring.model.TextMessage)

Example 17 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class CallService method addCall.

private SipCall addCall(String accountId, String callId, String from, int direction) {
    SipCall call = currentCalls.get(callId);
    if (call == null) {
        call = new SipCall(callId, accountId, new Uri(from), direction);
        currentCalls.put(callId, call);
    } else {
        Log.w(TAG, "Call already existed ! " + callId + " " + from);
    }
    return call;
}
Also used : SipCall(cx.ring.model.SipCall) Uri(cx.ring.model.Uri)

Example 18 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class SmartListPresenter method parseEventState.

private void parseEventState(String name, String address, int state) {
    switch(state) {
        case 0:
            // on found
            if (mLastBlockchainQuery != null && mLastBlockchainQuery.equals(name)) {
                mCallContact = CallContact.buildRingContact(new Uri(address), name);
                getView().displayContact(mCallContact);
                mLastBlockchainQuery = null;
            } else {
                if (("").equals(name) || ("").equals(address)) {
                    return;
                }
                getView().hideSearchRow();
                updateContactName(name, address);
            }
            break;
        case 1:
            // invalid name
            Uri uriName = new Uri(name);
            if (uriName.isRingId() && mLastBlockchainQuery != null && mLastBlockchainQuery.equals(name)) {
                mCallContact = CallContact.buildUnknown(name, address);
                getView().displayContact(mCallContact);
            } else {
                getView().hideSearchRow();
            }
            break;
        default:
            // on error
            Uri uriAddress = new Uri(address);
            if (uriAddress.isRingId() && mLastBlockchainQuery != null && mLastBlockchainQuery.equals(name)) {
                mCallContact = CallContact.buildUnknown(name, address);
                getView().displayContact(mCallContact);
            } else {
                getView().hideSearchRow();
            }
            break;
    }
    getView().setLoading(false);
}
Also used : Uri(cx.ring.model.Uri)

Example 19 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class SmartListPresenter method deleteConversation.

public void deleteConversation(SmartListViewModel smartListViewModel) {
    CallContact callContact = mContactService.getContact(new Uri(smartListViewModel.getUuid()));
    getView().displayDeleteDialog(callContact);
}
Also used : Uri(cx.ring.model.Uri) CallContact(cx.ring.model.CallContact)

Example 20 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class SmartListPresenter method copyNumber.

public void copyNumber(SmartListViewModel smartListViewModel) {
    CallContact callContact = mContactService.getContact(new Uri(smartListViewModel.getUuid()));
    getView().copyNumber(callContact);
}
Also used : Uri(cx.ring.model.Uri) CallContact(cx.ring.model.CallContact)

Aggregations

Uri (cx.ring.model.Uri)24 CallContact (cx.ring.model.CallContact)7 Account (cx.ring.model.Account)6 Conversation (cx.ring.model.Conversation)5 Intent (android.content.Intent)3 ServiceEvent (cx.ring.model.ServiceEvent)3 TextMessage (cx.ring.model.TextMessage)3 ContentResolver (android.content.ContentResolver)2 Cursor (android.database.Cursor)2 HistoryCall (cx.ring.model.HistoryCall)2 HistoryText (cx.ring.model.HistoryText)2 SipCall (cx.ring.model.SipCall)2 NameLookupInputHandler (cx.ring.utils.NameLookupInputHandler)2 ArrayList (java.util.ArrayList)2 PendingIntent (android.app.PendingIntent)1 ContentValues (android.content.ContentValues)1 SharedPreferences (android.content.SharedPreferences)1 Bitmap (android.graphics.Bitmap)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 NotificationCompat (android.support.v4.app.NotificationCompat)1