本文整理匯總了Java中org.linphone.core.LinphoneAddress類的典型用法代碼示例。如果您正苦於以下問題:Java LinphoneAddress類的具體用法?Java LinphoneAddress怎麽用?Java LinphoneAddress使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LinphoneAddress類屬於org.linphone.core包,在下文中一共展示了LinphoneAddress類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findContactFromAddress
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
public LinphoneContact findContactFromAddress(LinphoneAddress address) {
String sipUri = address.asStringUriOnly();
String username = address.getUserName();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
LinphoneProxyConfig lpc = null;
if (lc != null) {
lpc = lc.getDefaultProxyConfig();
}
for (LinphoneContact c: getContacts()) {
for (LinphoneNumberOrAddress noa: c.getNumbersOrAddresses()) {
String normalized = null;
if (lpc != null) {
normalized = lpc.normalizePhoneNumber(noa.getValue());
}
String alias = c.getPresenceModelForUri(noa.getValue());
if ((noa.isSIPAddress() && noa.getValue().equals(sipUri)) || (alias != null && alias.equals(sipUri)) || (normalized != null && !noa.isSIPAddress() && normalized.equals(username)) || (!noa.isSIPAddress() && noa.getValue().equals(username))) {
return c;
}
}
}
return null;
}
示例2: messageReceived
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
if (mServiceContext.getResources().getBoolean(R.bool.disable_chat)) {
return;
}
LinphoneAddress from = message.getFrom();
String textMessage = message.getText();
try {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) {
if (contact != null) {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName(), textMessage);
} else {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName(), textMessage);
}
}
} catch (Exception e) {
Log.e(e);
}
}
示例3: extractADisplayName
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
public static String extractADisplayName(Resources r, LinphoneAddress address) {
if (address == null) return r.getString(R.string.unknown_incoming_call_name);
final String displayName = address.getDisplayName();
if (displayName!=null) {
return displayName;
} else if (address.getUserName() != null){
return address.getUserName();
} else {
String rms = address.toString();
if (rms != null && rms.length() > 1)
return rms;
return r.getString(R.string.unknown_incoming_call_name);
}
}
示例4: configuringStatus
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
@Override
public void configuringStatus(LinphoneCore lc,
RemoteProvisioningState state, String message) {
Log.d("Remote provisioning status = " + state.toString() + " (" + message + ")");
if (state == RemoteProvisioningState.ConfiguringSuccessful) {
if (LinphonePreferences.instance().isProvisioningLoginViewEnabled()) {
LinphoneProxyConfig proxyConfig = lc.createProxyConfig();
try {
LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getIdentity());
wizardLoginViewDomain = addr.getDomain();
} catch (LinphoneCoreException e) {
wizardLoginViewDomain = null;
}
}
}
}
示例5: inviteAddress
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException {
LinphoneCore lc = LinphoneManager.getLc();
LinphoneCallParams params = lc.createCallParams(null);
bm().updateWithProfileSettings(lc, params);
if (videoEnabled && params.getVideoEnabled()) {
params.setVideoEnabled(true);
} else {
params.setVideoEnabled(false);
}
if (lowBandwidth) {
params.enableLowBandwidth(true);
Log.d("Low bandwidth enabled in call params");
}
lc.inviteAddressWithParams(lAddress, params);
}
示例6: onClick
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.back) {
getFragmentManager().popBackStackImmediate();
} if (id == R.id.call) {
LinphoneActivity.instance().setAddresGoToDialerAndCall(sipUri, displayName, pictureUri == null ? null : Uri.parse(pictureUri));
} else if (id == R.id.chat) {
LinphoneActivity.instance().displayChat(sipUri);
} else if (id == R.id.add_contact) {
String uri = sipUri;
try {
LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
uri = addr.asStringUriOnly();
} catch (LinphoneCoreException e) {
Log.e(e);
}
LinphoneActivity.instance().displayContactsForEdition(uri);
} else if (id == R.id.goto_contact) {
LinphoneActivity.instance().displayContact(contact, false);
}
}
示例7: getAccountTransport
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
public TransportType getAccountTransport(int n) {
TransportType transport = null;
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
if (proxyConfig != null) {
LinphoneAddress proxyAddr;
try {
proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
transport = proxyAddr.getTransport();
} catch (LinphoneCoreException e) {
Log.e(e);
}
}
return transport;
}
示例8: updateAccountLed
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
private void updateAccountLed(final LedPreference me, final String username, final String domain, boolean enabled) {
if (!enabled) {
me.setLed(R.drawable.led_disconnected);
return;
}
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
LinphoneAddress addr = lpc.getAddress();
if (addr.getUserName().equals(username) && addr.getDomain().equals(domain)) {
if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk) {
me.setLed(R.drawable.led_connected);
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationFailed) {
me.setLed(R.drawable.led_error);
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationProgress) {
me.setLed(R.drawable.led_inprogress);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
updateAccountLed(me, username, domain, true);
}
}, 500);
} else {
me.setLed(R.drawable.led_disconnected);
}
break;
}
}
}
}
示例9: initChatRoom
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
public void initChatRoom(String sipUri) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
LinphoneAddress lAddress = null;
if (sipUri == null) {
contact = null; // Tablet rotation issue
initNewChatConversation();
} else {
try {
lAddress = lc.interpretUrl(sipUri);
} catch (Exception e) {
//TODO Error popup and quit chat
}
if (lAddress != null) {
chatRoom = lc.getChatRoom(lAddress);
chatRoom.markAsRead();
LinphoneActivity.instance().updateMissedChatCount();
contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
if (chatRoom != null) {
searchContactField.setVisibility(View.GONE);
resultContactsSearch.setVisibility(View.GONE);
displayChatHeader(lAddress);
displayMessageList();
}
}
}
}
示例10: displayChatHeader
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
private void displayChatHeader(LinphoneAddress address) {
if (contact != null || address != null) {
if (contact != null) {
contactName.setText(contact.getFullName());
} else {
contactName.setText(LinphoneUtils.getAddressDisplayName(address));
}
topBar.setVisibility(View.VISIBLE);
edit.setVisibility(View.VISIBLE);
contactName.setVisibility(View.VISIBLE);
}
}
示例11: sendTextMessage
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
private void sendTextMessage(String messageToSend) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
LinphoneAddress lAddress = null;
//Start new conversation in fast chat
if(newChatConversation && chatRoom == null) {
String address = searchContactField.getText().toString().toLowerCase(Locale.getDefault());
if (address != null && !address.equals("")) {
initChatRoom(address);
}
}
if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) {
LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend);
chatRoom.sendChatMessage(message);
lAddress = chatRoom.getPeerAddress();
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().onMessageSent(sipUri, messageToSend);
}
message.setListener(LinphoneManager.getInstance());
if (newChatConversation) {
exitNewConversationMode(lAddress.asStringUriOnly());
} else {
adapter.addMessage(message);
}
Log.i("Sent message current status: " + message.getStatus());
} else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG);
}
}
示例12: onResume
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
@Override
protected void onResume() {
super.onResume();
instance = this;
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
alreadyAcceptedOrDeniedCall = false;
mCall = null;
// Only one call ringing at a time is allowed
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
List<LinphoneCall> calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc());
for (LinphoneCall call : calls) {
if (State.IncomingReceived == call.getState()) {
mCall = call;
break;
}
}
}
if (mCall == null) {
//The incoming call no longer exists.
Log.d("Couldn't find incoming call");
finish();
return;
}
LinphoneAddress address = mCall.getRemoteAddress();
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
if (contact != null) {
LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
name.setText(contact.getFullName());
} else {
name.setText(LinphoneUtils.getAddressDisplayName(address));
}
number.setText(address.asStringUriOnly());
}
示例13: displayHistory
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
private void displayHistory(String status, String callTime, String callDate) {
if (status.equals(getResources().getString(R.string.missed))) {
callDirection.setImageResource(R.drawable.call_missed);
} else if (status.equals(getResources().getString(R.string.incoming))) {
callDirection.setImageResource(R.drawable.call_incoming);
} else if (status.equals(getResources().getString(R.string.outgoing))) {
callDirection.setImageResource(R.drawable.call_outgoing);
}
time.setText(callTime == null ? "" : callTime);
Long longDate = Long.parseLong(callDate);
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format)));
LinphoneAddress lAddress = null;
try {
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
} catch (LinphoneCoreException e) {
Log.e(e);
}
if (lAddress != null) {
contactAddress.setText(lAddress.asStringUriOnly());
contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
if (contact != null) {
contactName.setText(contact.getFullName());
LinphoneUtils.setImagePictureFromUri(view.getContext(),contactPicture,contact.getPhotoUri(),contact.getThumbnailUri());
addToContacts.setVisibility(View.GONE);
goToContact.setVisibility(View.VISIBLE);
} else {
contactName.setText(displayName == null ? LinphoneUtils.getAddressDisplayName(sipUri) : displayName);
contactPicture.setImageResource(R.drawable.avatar);
addToContacts.setVisibility(View.VISIBLE);
goToContact.setVisibility(View.GONE);
}
} else {
contactAddress.setText(sipUri);
contactName.setText(displayName == null ? LinphoneUtils.getAddressDisplayName(sipUri) : displayName);
}
}
示例14: setContactInformation
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
private void setContactInformation(TextView contactName, ImageView contactPicture, LinphoneAddress lAddress) {
LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(lAddress);
if (lContact == null) {
contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
contactPicture.setImageResource(R.drawable.avatar);
} else {
contactName.setText(lContact.getFullName());
LinphoneUtils.setImagePictureFromUri(contactPicture.getContext(), contactPicture, lContact.getPhotoUri(), lContact.getThumbnailUri());
}
}
示例15: getAuthInfo
import org.linphone.core.LinphoneAddress; //導入依賴的package包/類
private LinphoneAuthInfo getAuthInfo(int n) {
LinphoneProxyConfig prxCfg = getProxyConfig(n);
try {
LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(prxCfg.getIdentity());
LinphoneAuthInfo authInfo = getLc().findAuthInfo(addr.getUserName(), null, addr.getDomain());
return authInfo;
} catch (LinphoneCoreException e) {
Log.e(e);
}
return null;
}