当前位置: 首页>>代码示例>>Java>>正文


Java PhoneNumberUtils.compare方法代码示例

本文整理汇总了Java中android.telephony.PhoneNumberUtils.compare方法的典型用法代码示例。如果您正苦于以下问题:Java PhoneNumberUtils.compare方法的具体用法?Java PhoneNumberUtils.compare怎么用?Java PhoneNumberUtils.compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.telephony.PhoneNumberUtils的用法示例。


在下文中一共展示了PhoneNumberUtils.compare方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadRecipients

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
/**
 * For a given address type, extract the recipients from the headers.
 *
 * @param addressType can be PduHeaders.FROM or PduHeaders.TO
 * @param recipients a HashSet that is loaded with the recipients from the FROM or TO headers
 * @param addressMap a HashMap of the addresses from the ADDRESS_FIELDS header
 * @param excludeMyNumber if true, the number of this phone will be excluded from recipients
 */
private void loadRecipients(int addressType, HashSet<String> recipients,
        HashMap<Integer, EncodedStringValue[]> addressMap, boolean excludeMyNumber) {
    EncodedStringValue[] array = addressMap.get(addressType);
    if (array == null) {
        return;
    }
    // If the TO recipients is only a single address, then we can skip loadRecipients when
    // we're excluding our own number because we know that address is our own.
    if (excludeMyNumber && array.length == 1) {
        return;
    }
    String myNumber = excludeMyNumber ? mTelephonyManager.getLine1Number() : null;
    for (EncodedStringValue v : array) {
        if (v != null) {
            String number = v.getString();
            if ((myNumber == null || !PhoneNumberUtils.compare(number, myNumber)) &&
                    !recipients.contains(number)) {
                // Only add numbers which aren't my own number.
                recipients.add(number);
            }
        }
    }
}
 
开发者ID:ivanovpv,项目名称:darksms,代码行数:32,代码来源:PduPersister.java

示例2: getUserPosition

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@Nullable
private static ListIterator<User> getUserPosition(Context context, User user) {
    ArrayList<User> users = getUsers(context);

    if (users != null) {
        ListIterator<User> iterator;
        iterator = users.listIterator();
        while (iterator.hasNext()) {
            if (PhoneNumberUtils.compare(iterator.next().number, user.number)) {
                return iterator;
            }
        }
    }

    return null;
}
 
开发者ID:ArcticLabs,项目名称:Opendoor,代码行数:17,代码来源:Database.java

示例3: equalNumbers

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
private boolean equalNumbers(String number1, String number2) {
//        if (PhoneNumberUtils.isUriNumber(number1) || PhoneNumberUtils.isUriNumber(number2)) {
//            return compareSipAddresses(number1, number2);
//        } else {
        // Optim -- first try to compare very simply
        if(number1 != null && number2 != null && number1.equals(number2)) {
            return true;
        }
        return PhoneNumberUtils.compare(number1, number2);
//        }
    }
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:12,代码来源:CallLogGroupBuilder.java

示例4: isContactFilter

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
public int isContactFilter(Context context, String number)
  {
  	try
{
  		contentResolver = context.getContentResolver();
	contentUri = DatabaseProvider.CONTACT_FILTER_CONTENT_URI;

  		Cursor cursor = contentResolver.query(contentUri, null, null, null, CONTACT_FILTER.DEFAULT_SORT_ORDER);
  		
  		for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext())
      	{
  			String contactFilterNumber = cursor.getString(cursor.getColumnIndex(CONTACT_FILTER.NUMBER));
  			int contactFilterRecordable = cursor.getInt(cursor.getColumnIndex(CONTACT_FILTER.RECORDABLE));
  			
  			boolean isIdenticalNumber = PhoneNumberUtils.compare(number, contactFilterNumber);
  			
  			if (isIdenticalNumber == true)
  			{
  				return contactFilterRecordable;
  			}
      	}
  		
  		return -1;
}
catch (Exception e)
{
	Log.w("FiltersManager", "isContactFilter : " + context.getString(R.string.log_preferences_filters_manager_error_is_contact_filter) + " : " + number + " : " + e);
	databaseManager.insertLog(context, "" + context.getString(R.string.log_preferences_filters_manager_error_is_contact_filter) + " : " + number, new Date().getTime(), 2, false);
	return -1;
}
  }
 
开发者ID:vassela,项目名称:AC2RD,代码行数:32,代码来源:FiltersManager.java

示例5: equals

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@Override
public boolean equals(Object o) {
    if(!(o instanceof Contact)) {
        return false;
    }
    return PhoneNumberUtils.compare(number, ((Contact) o).number);
}
 
开发者ID:yeriomin,项目名称:DumbphoneAssistant,代码行数:8,代码来源:Contact.java

示例6: removeMessagesFromNumber

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
/**
 * Call this after a read command to clear the unread messages for that conversation.
 * @param number Number for which to remove unread messages.
 */
public void removeMessagesFromNumber(String number) {
    for(Iterator<SmsMessage> it = messages.iterator(); it.hasNext();) {
        SmsMessage sms = it.next();
        if(PhoneNumberUtils.compare(sms.getOriginatingAddress(), number)) {
            it.remove();
        }
    }
}
 
开发者ID:tetchel,项目名称:shexter,代码行数:13,代码来源:SmsReceiver.java

示例7: getUserFromNumber

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@Nullable
static User getUserFromNumber(Context context, String number) {
    ArrayList<User> users = getUsers(context);

    if (users != null) {
        for (User user : users) {
            if (PhoneNumberUtils.compare(user.number, number)) {
                return user;
            }
        }
    }

    return null;
}
 
开发者ID:ArcticLabs,项目名称:Opendoor,代码行数:15,代码来源:Database.java

示例8: onReceive

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    TelephonyManager tm = (TelephonyManager)context.getSystemService(Service.TELEPHONY_SERVICE);
    String phoneNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);

    if (tm.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK &&
            PhoneNumberUtils.compare(Database.getDialNumber(context), phoneNumber)) {
        Log.d(TAG, "Door dial number found: " + phoneNumber + ", sleeping..."); //NON-NLS NON-NLS
        endCallSleeperThread(context);
    }
}
 
开发者ID:ArcticLabs,项目名称:Opendoor,代码行数:12,代码来源:PhoneReceiver.java

示例9: onReceive

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(Telephony.Sms.Intents.SMS_RECEIVED_ACTION)) {
        try {
            Bundle bundle = intent.getExtras();
            Object[] pdus = (Object[]) bundle.get("pdus");
            SmsMessage[] msgs = new SmsMessage[pdus.length];
            for (int i = 0; i < msgs.length; i++) {
                msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
                String msg_from = msgs[i].getOriginatingAddress();
                String msgBody = msgs[i].getMessageBody();
                if (!Utils.isBlank(smsInnerData.sender)) {
                    if (!PhoneNumberUtils.compare(context, msg_from, smsInnerData.sender)) {
                        continue;
                    }
                }
                if (!Utils.isBlank(smsInnerData.content)) {
                    if (!msgBody.contains(smsInnerData.content)) {
                        continue;
                    }
                }
                changeSatisfiedState(true);
                return;
            }
            changeSatisfiedState(false);
        } catch (Exception e) {
            Logger.d("Exception caught",e.getMessage());
        }
    }
}
 
开发者ID:renyuneyun,项目名称:Easer,代码行数:31,代码来源:SmsConnSlot.java

示例10: isPhoneGranted

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
public boolean isPhoneGranted(String phone) {
    for (String grantedPhone : grantedPhones) {
        if (PhoneNumberUtils.compare(phone, grantedPhone))
            return true;
    }
    return false;
}
 
开发者ID:tranquvis,项目名称:SimpleSmsRemote,代码行数:8,代码来源:ControlModuleUserData.java

示例11: isSupportNumber

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
public boolean isSupportNumber(String contactNumber) {
    return PhoneNumberUtils.compare(getSupportNumber(), contactNumber);
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:4,代码来源:Support.java


注:本文中的android.telephony.PhoneNumberUtils.compare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。