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


Java Phone.TYPE_CUSTOM属性代码示例

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


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

示例1: onItemSelected

public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
    if (position >= 0) {
        //Get current cursor
        Cursor c = (Cursor) parent.getItemAtPosition(position);
        int type = c.getInt(COLUMN_PHONE_TYPE);
        String phone = c.getString(COLUMN_PHONE_NUMBER);
        String label = null;
        //Custom type? Then get the custom label
        if (type == Phone.TYPE_CUSTOM) {
            label = c.getString(COLUMN_PHONE_LABEL);
        }
        //Get the readable string
        String numberType = (String) Phone.getTypeLabel(getResources(), type, label);
        String text = numberType + ": " + phone;
        mPhone.setText(text);
    }
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:17,代码来源:List7.java

示例2: getPhoneType

/**
 * Converts a string from the W3C Contact API to it's Android int value.
 * @param string
 * @return Android int value
 */
private int getPhoneType(String string) {

    int type = Phone.TYPE_OTHER;

    if (string != null) {
        String lowerType = string.toLowerCase(Locale.getDefault());

        if ("home".equals(lowerType)) {
            return Phone.TYPE_HOME;
        }
        else if ("mobile".equals(lowerType)) {
            return Phone.TYPE_MOBILE;
        }
        else if ("work".equals(lowerType)) {
            return Phone.TYPE_WORK;
        }
        else if ("work fax".equals(lowerType)) {
            return Phone.TYPE_FAX_WORK;
        }
        else if ("home fax".equals(lowerType)) {
            return Phone.TYPE_FAX_HOME;
        }
        else if ("fax".equals(lowerType)) {
            return Phone.TYPE_FAX_WORK;
        }
        else if ("pager".equals(lowerType)) {
            return Phone.TYPE_PAGER;
        }
        else if ("other".equals(lowerType)) {
            return Phone.TYPE_OTHER;
        }
        else if ("car".equals(lowerType)) {
            return Phone.TYPE_CAR;
        }
        else if ("company main".equals(lowerType)) {
            return Phone.TYPE_COMPANY_MAIN;
        }
        else if ("isdn".equals(lowerType)) {
            return Phone.TYPE_ISDN;
        }
        else if ("main".equals(lowerType)) {
            return Phone.TYPE_MAIN;
        }
        else if ("other fax".equals(lowerType)) {
            return Phone.TYPE_OTHER_FAX;
        }
        else if ("radio".equals(lowerType)) {
            return Phone.TYPE_RADIO;
        }
        else if ("telex".equals(lowerType)) {
            return Phone.TYPE_TELEX;
        }
        else if ("work mobile".equals(lowerType)) {
            return Phone.TYPE_WORK_MOBILE;
        }
        else if ("work pager".equals(lowerType)) {
            return Phone.TYPE_WORK_PAGER;
        }
        else if ("assistant".equals(lowerType)) {
            return Phone.TYPE_ASSISTANT;
        }
        else if ("mms".equals(lowerType)) {
            return Phone.TYPE_MMS;
        }
        else if ("callback".equals(lowerType)) {
            return Phone.TYPE_CALLBACK;
        }
        else if ("tty ttd".equals(lowerType)) {
            return Phone.TYPE_TTY_TDD;
        }
        return Phone.TYPE_CUSTOM;
    }
    return type;
}
 
开发者ID:rodrigonsh,项目名称:alerta-fraude,代码行数:79,代码来源:ContactAccessorSdk5.java

示例3: getPhoneType

/**
 * Converts a string from the W3C Contact API to it's Android int value.
 * @param string
 * @return Android int value
 */
private int getPhoneType(String string) {

    int type = Phone.TYPE_OTHER;

    if (string != null) {
        String lowerType = string.toLowerCase(Locale.getDefault());

        if ("home".equals(lowerType)) {
            return Phone.TYPE_HOME;
        }
        else if ("mobile".equals(lowerType)) {
            return Phone.TYPE_MOBILE;
        }
        else if ("work".equals(lowerType)) {
            return Phone.TYPE_WORK;
        }
        else if ("work fax".equals(lowerType)) {
            return Phone.TYPE_FAX_WORK;
        }
        else if ("home fax".equals(lowerType)) {
            return Phone.TYPE_FAX_HOME;
        }
        else if ("fax".equals(lowerType)) {
            return Phone.TYPE_FAX_WORK;
        }
        else if ("pager".equals(lowerType)) {
            return Phone.TYPE_PAGER;
        }
        else if ("other".equals(lowerType)) {
            return Phone.TYPE_OTHER;
        }
        else if ("car".equals(lowerType)) {
            return Phone.TYPE_CAR;
        }
        else if ("company main".equals(lowerType)) {
            return Phone.TYPE_COMPANY_MAIN;
        }
        else if ("isdn".equals(lowerType)) {
            return Phone.TYPE_ISDN;
        }
        else if ("main".equals(lowerType)) {
            return Phone.TYPE_MAIN;
        }
        else if ("other fax".equals(lowerType)) {
            return Phone.TYPE_OTHER_FAX;
        }
        else if ("radio".equals(lowerType)) {
            return Phone.TYPE_RADIO;
        }
        else if ("telex".equals(lowerType)) {
            return Phone.TYPE_TELEX;
        }
        else if ("work mobile".equals(lowerType)) {
            return Phone.TYPE_WORK_MOBILE;
        }
        else if ("work pager".equals(lowerType)) {
            return Phone.TYPE_WORK_PAGER;
        }
        else if ("assistant".equals(lowerType)) {
            return Phone.TYPE_ASSISTANT;
        }
        else if ("mms".equals(lowerType)) {
            return Phone.TYPE_MMS;
        }
        else if ("callback".equals(lowerType)) {
            return Phone.TYPE_CALLBACK;
        }
        else if ("tty ttd".equals(lowerType)) {
            return Phone.TYPE_TTY_TDD;
        }
        else if ("custom".equals(lowerType)) {
            return Phone.TYPE_CUSTOM;
        }
    }
    return type;
}
 
开发者ID:chrisuehlinger,项目名称:smart-mirror-app,代码行数:81,代码来源:ContactAccessorSdk5.java

示例4: getPhoneType

private int getPhoneType(String phoneType) {
    initPhoneTypesMap();
    Integer type = mPhoneTypesMap.get(phoneType.toLowerCase());
    return type != null ? type : Phone.TYPE_CUSTOM;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:5,代码来源:ContactService.java

示例5: getAndroidPhoneType

public static int getAndroidPhoneType(PhoneType phoneType) {
	switch (phoneType) {
	case TYPE_ASSISTANT:
		return Phone.TYPE_ASSISTANT;
	case TYPE_CALLBACK:
		return Phone.TYPE_CALLBACK;
	case TYPE_CAR:
		return Phone.TYPE_CAR;
	case TYPE_COMPANY_MAIN:
		return Phone.TYPE_COMPANY_MAIN;
	case TYPE_CUSTOM:
		return Phone.TYPE_CUSTOM;
	case TYPE_FAX_HOME:
		return Phone.TYPE_FAX_HOME;
	case TYPE_FAX_WORK:
		return Phone.TYPE_FAX_WORK;
	case TYPE_HOME:
		return Phone.TYPE_HOME;
	case TYPE_ISDN:
		return Phone.TYPE_ISDN;
	case TYPE_MAIN:
		return Phone.TYPE_MAIN;
	case TYPE_MMS:
		return Phone.TYPE_MMS;
	case TYPE_MOBILE:
		return Phone.TYPE_MOBILE;
	case TYPE_OTHER:
		return Phone.TYPE_OTHER;
	case TYPE_OTHER_FAX:
		return Phone.TYPE_OTHER_FAX;
	case TYPE_PAGER:
		return Phone.TYPE_PAGER;
	case TYPE_RADIO:
		return Phone.TYPE_RADIO;
	case TYPE_TELEX:
		return Phone.TYPE_TELEX;
	case TYPE_TTY_TDD:
		return Phone.TYPE_TTY_TDD;
	case TYPE_WORK:
		return Phone.TYPE_WORK;
	case TYPE_WORK_MOBILE:
		return Phone.TYPE_WORK_MOBILE;
	case TYPE_WORK_PAGER:
		return Phone.TYPE_WORK_PAGER;
	default:
		return Phone.TYPE_HOME;
	}
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:48,代码来源:ContactManager.java

示例6: getPhoneType

public static PhoneType getPhoneType(int androidPhoneType) {
	switch (androidPhoneType) {
	case Phone.TYPE_ASSISTANT:
		return PhoneType.TYPE_ASSISTANT;
	case Phone.TYPE_CALLBACK:
		return PhoneType.TYPE_CALLBACK;
	case Phone.TYPE_CAR:
		return PhoneType.TYPE_CAR;
	case Phone.TYPE_COMPANY_MAIN:
		return PhoneType.TYPE_COMPANY_MAIN;
	case Phone.TYPE_CUSTOM:
		return PhoneType.TYPE_CUSTOM;
	case Phone.TYPE_FAX_HOME:
		return PhoneType.TYPE_FAX_HOME;
	case Phone.TYPE_FAX_WORK:
		return PhoneType.TYPE_FAX_WORK;
	case Phone.TYPE_HOME:
		return PhoneType.TYPE_HOME;
	case Phone.TYPE_ISDN:
		return PhoneType.TYPE_ISDN;
	case Phone.TYPE_MAIN:
		return PhoneType.TYPE_MAIN;
	case Phone.TYPE_MMS:
		return PhoneType.TYPE_MMS;
	case Phone.TYPE_MOBILE:
		return PhoneType.TYPE_MOBILE;
	case Phone.TYPE_OTHER:
		return PhoneType.TYPE_OTHER;
	case Phone.TYPE_OTHER_FAX:
		return PhoneType.TYPE_OTHER_FAX;
	case Phone.TYPE_PAGER:
		return PhoneType.TYPE_PAGER;
	case Phone.TYPE_RADIO:
		return PhoneType.TYPE_RADIO;
	case Phone.TYPE_TELEX:
		return PhoneType.TYPE_TELEX;
	case Phone.TYPE_TTY_TDD:
		return PhoneType.TYPE_TTY_TDD;
	case Phone.TYPE_WORK:
		return PhoneType.TYPE_WORK;
	case Phone.TYPE_WORK_MOBILE:
		return PhoneType.TYPE_WORK_MOBILE;
	case Phone.TYPE_WORK_PAGER:
		return PhoneType.TYPE_WORK_PAGER;
	default:
		return PhoneType.TYPE_HOME;
	}
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:48,代码来源:ContactManager.java

示例7: populatePhoneNumbers

protected void populatePhoneNumbers(Contact c) throws RemoteException {
	@Cleanup Cursor cursor = providerClient.query(dataURI(), new String[] { Phone.TYPE, Phone.LABEL, Phone.NUMBER, Phone.IS_SUPER_PRIMARY },
			Phone.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=?",
			new String[] { String.valueOf(c.getLocalID()), Phone.CONTENT_ITEM_TYPE }, null);
	while (cursor != null && cursor.moveToNext()) {
		ezvcard.property.Telephone number = new ezvcard.property.Telephone(cursor.getString(2));
		switch (cursor.getInt(0)) {
		case Phone.TYPE_HOME:
			number.addType(TelephoneType.HOME);
			break;
		case Phone.TYPE_MOBILE:
			number.addType(TelephoneType.CELL);
			break;
		case Phone.TYPE_WORK:
			number.addType(TelephoneType.WORK);
			break;
		case Phone.TYPE_FAX_WORK:
			number.addType(TelephoneType.FAX);
			number.addType(TelephoneType.WORK);
			break;
		case Phone.TYPE_FAX_HOME:
			number.addType(TelephoneType.FAX);
			number.addType(TelephoneType.HOME);
			break;
		case Phone.TYPE_PAGER:
			number.addType(TelephoneType.PAGER);
			break;
		case Phone.TYPE_CALLBACK:
			number.addType(Contact.PHONE_TYPE_CALLBACK);
			break;
		case Phone.TYPE_CAR:
			number.addType(TelephoneType.CAR);
			break;
		case Phone.TYPE_COMPANY_MAIN:
			number.addType(Contact.PHONE_TYPE_COMPANY_MAIN);
			break;
		case Phone.TYPE_ISDN:
			number.addType(TelephoneType.ISDN);
			break;
		case Phone.TYPE_MAIN:
			number.addType(TelephoneType.PREF);
			break;
		case Phone.TYPE_OTHER_FAX:
			number.addType(TelephoneType.FAX);
			break;
		case Phone.TYPE_RADIO:
			number.addType(Contact.PHONE_TYPE_RADIO);
			break;
		case Phone.TYPE_TELEX:
			number.addType(TelephoneType.TEXTPHONE);
			break;
		case Phone.TYPE_TTY_TDD:
			number.addType(TelephoneType.TEXT);
			break;
		case Phone.TYPE_WORK_MOBILE:
			number.addType(TelephoneType.CELL);
			number.addType(TelephoneType.WORK);
			break;
		case Phone.TYPE_WORK_PAGER:
			number.addType(TelephoneType.PAGER);
			number.addType(TelephoneType.WORK);
			break;
		case Phone.TYPE_ASSISTANT:
			number.addType(Contact.PHONE_TYPE_ASSISTANT);
			break;
		case Phone.TYPE_MMS:
			number.addType(Contact.PHONE_TYPE_MMS);
			break;
		case Phone.TYPE_CUSTOM:
			String customType = cursor.getString(1);
			if (!StringUtils.isEmpty(customType))
				number.addType(TelephoneType.get(labelToXName(customType)));
		}
		if (cursor.getInt(3) != 0)	// IS_PRIMARY
			number.addType(TelephoneType.PREF);
		c.getPhoneNumbers().add(number);
	}
}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:78,代码来源:LocalAddressBook.java

示例8: buildPhoneNumber

protected Builder buildPhoneNumber(Builder builder, Telephone number) {
	int typeCode = Phone.TYPE_OTHER;
	String typeLabel = null;
	boolean is_primary = false;
	
	Set<TelephoneType> types = number.getTypes();
	// preferred number?
	if (types.contains(TelephoneType.PREF))
		is_primary = true;
	
	// 1 Android type <-> 2 VCard types: fax, cell, pager
	if (types.contains(TelephoneType.FAX)) {
		if (types.contains(TelephoneType.HOME))
			typeCode = Phone.TYPE_FAX_HOME;
		else if (types.contains(TelephoneType.WORK))
			typeCode = Phone.TYPE_FAX_WORK;
		else
			typeCode = Phone.TYPE_OTHER_FAX;
	} else if (types.contains(TelephoneType.CELL)) {
		if (types.contains(TelephoneType.WORK))
			typeCode = Phone.TYPE_WORK_MOBILE;
		else
			typeCode = Phone.TYPE_MOBILE;
	} else if (types.contains(TelephoneType.PAGER)) {
		if (types.contains(TelephoneType.WORK))
			typeCode = Phone.TYPE_WORK_PAGER;
		else
			typeCode = Phone.TYPE_PAGER;
	// types with 1:1 translation
	} else if (types.contains(TelephoneType.HOME)) {
		typeCode = Phone.TYPE_HOME;
	} else if (types.contains(TelephoneType.WORK)) {
		typeCode = Phone.TYPE_WORK;
	} else if (types.contains(Contact.PHONE_TYPE_CALLBACK)) {
		typeCode = Phone.TYPE_CALLBACK;
	} else if (types.contains(TelephoneType.CAR)) {
		typeCode = Phone.TYPE_CAR;
	} else if (types.contains(Contact.PHONE_TYPE_COMPANY_MAIN)) {
		typeCode = Phone.TYPE_COMPANY_MAIN;
	} else if (types.contains(TelephoneType.ISDN)) {
		typeCode = Phone.TYPE_ISDN;
	} else if (types.contains(TelephoneType.PREF)) {
		typeCode = Phone.TYPE_MAIN;
	} else if (types.contains(Contact.PHONE_TYPE_RADIO)) {
		typeCode = Phone.TYPE_RADIO;
	} else if (types.contains(TelephoneType.TEXTPHONE)) {
		typeCode = Phone.TYPE_TELEX;
	} else if (types.contains(TelephoneType.TEXT)) {
		typeCode = Phone.TYPE_TTY_TDD;
	} else if (types.contains(Contact.PHONE_TYPE_ASSISTANT)) {
		typeCode = Phone.TYPE_ASSISTANT;
	} else if (types.contains(Contact.PHONE_TYPE_MMS)) {
		typeCode = Phone.TYPE_MMS;
	} else if (!types.isEmpty()) {
		TelephoneType type = types.iterator().next();
		typeCode = Phone.TYPE_CUSTOM;
		typeLabel = xNameToLabel(type.getValue());
	}
	
	builder = builder
		.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
		.withValue(Phone.NUMBER, number.getText())
		.withValue(Phone.TYPE, typeCode)
		.withValue(Phone.IS_PRIMARY, is_primary ? 1 : 0)
		.withValue(Phone.IS_SUPER_PRIMARY, is_primary ? 1 : 0);
	if (typeLabel != null)
		builder = builder.withValue(Phone.LABEL, typeLabel);
	return builder;
}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:69,代码来源:LocalAddressBook.java


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